private void defineFuncVariable(Function func, Instruction instr, int opIndex,
			int stackOffset) {

		ReferenceManager refMgr = program.getReferenceManager();

		int refSize = getRefSize(instr, opIndex);

		try {
			// check if operand already has a stack reference created
			Reference ref = instr.getPrimaryReference(opIndex);
			if (ref instanceof StackReference) {
				Variable var = refMgr.getReferencedVariable(ref);
				if (var == null) {
					stackOffset = ((StackReference) ref).getStackOffset(); // TODO: is this necessary?
					createVar(func, 0, stackOffset, refSize);
				}
				return;
			}

			RefType refType = RefTypeFactory.getDefaultStackRefType(instr, opIndex);

			int unitSize = program.getAddressFactory().getStackSpace().getAddressableUnitSize();
			stackOffset *= unitSize; // factor in stack unit size
			refMgr.addStackReference(instr.getMinAddress(), opIndex, stackOffset, refType,
				SourceType.ANALYSIS);
			createVar(func, 0, stackOffset, refSize);
		}
		catch (InvalidInputException e) {
			Msg.debug(this, "Failed to create variable (instruction at " + instr.getMinAddress() +
				", stack-offset=" + stackOffset + ", size=" + refSize + "): " + e.getMessage());
		}
	}
//	 * Checks the indicated function in the program to determine if it is a jump thunk
//	 * through a function pointer.
//	 * @param func the function to check
//	 * @param monitor status monitor for indicating progress and allowing cancel.
//	 * @returntrue if check if this is a jump thunk through a function pointer
//
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionStackAnalysisCmd.java