private void addStackLocalVariables(Function func, List<Variable> sortedVariables,
			VariableStorageConflicts conflicts, TaskMonitor monitor) {

		if (func.isThunk()) {
			return;
		}

		Variable[] unprotectedLocals =
			func.getVariables(variable -> (variable instanceof LocalVariable) &&
				variable.isStackVariable() && !isProtectedVariable(variable));

		for (Variable var : sortedVariables) {
			if ((var instanceof Parameter) || conflicts.isConflicted(var, null)) {
				continue;
			}
			for (Variable old : unprotectedLocals) {
				if (old.getVariableStorage().intersects(var.getVariableStorage())) {
					func.removeVariable(old);
				}
			}
			try {
				// skip variable if conflict with non-default variable occurs
				VariableUtilities.checkVariableConflict(func, null, var.getVariableStorage(),
					false);
				func.addLocalVariable(var, SourceType.DEFAULT);
			}
			catch (DuplicateNameException | InvalidInputException e) {
				// ignore - unexpected
			}
		}
	}
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