private int addMissingParameters(Variable stackVar, int nextCopyParamIndex,
			Parameter[] oldParamList, List<Variable> newParamList, PrototypeModel callingConvention,
			boolean hasStackParams) {
		if (!(stackVar instanceof Parameter)) {
			throw new IllegalArgumentException();
		}

		if (callingConvention.getStackParameterOffset() == null) {
			return -1; // don't add parameters
		}

		int offset = stackVar.getStackOffset();

		// copy old params which come before stackVar offset
		while (nextCopyParamIndex < oldParamList.length) {
			Parameter p = oldParamList[nextCopyParamIndex];
			if (!p.isStackVariable()) {
				newParamList.add(p);
			}
			else {
				int stackOffset = p.getStackOffset();
				if ((offset > 0 && offset > stackOffset) || (offset < 0 && offset < stackOffset)) {
					newParamList.add(p);
				}
				else {
					if (offset == stackOffset) {
						// assume replacement
						++nextCopyParamIndex;
					}
					break;
				}
			}
			++nextCopyParamIndex;
		}

		return nextCopyParamIndex;
	}
Create locals and parameters based on references involving purely the stack pointer.
Pushes, Pops, and arithmetic manipulation of the stack pointer must be tracked.

@param func - function to analyze stack pointer references
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/NewFunctionStackAnalysisCmd.java