private Varnode replaceInputVarnodes(Varnode exp, Varnode vn, Varnode value, int maxComplexity,
			TaskMonitor monitor) throws CancelledException {
		if (!(exp instanceof VarnodeOperation)) {
			return exp.equals(vn) ? value : exp;
		}
		VarnodeOperation vop = (VarnodeOperation) exp;
		Varnode[] inputValues = vop.getInputValues();
		for (int i = 0; i < inputValues.length; i++) {
			monitor.checkCancelled();
			if (vn.equals(inputValues[i])) {
				inputValues[i] = value;
			}
			else if (maxComplexity == 0) {
				return null; // maxComplexity exceeded
			}
			else {
				inputValues[i] =
					replaceInputVarnodes(inputValues[i], vn, value, maxComplexity - 1, monitor);
				if (inputValues[i] == null) {
					return null; // maxComplexity exceeded
				}
			}
		}
		return new VarnodeOperation(vop.getPCodeOp(), inputValues);
	}
Replace all occurrences of vn within exp with value
@param exp expression within which vn should be replaced with value
@param vn a simple varnode to be replaced (e.g., register), must not be a VarnodeOperation
@param value replacement value (e.g., constant varnode), must not be a VarnodeOperation
@param maxComplexity maximum expression complexity (i.e., depth) allowed for exp
@param monitor
@return updated expression or null if maxComplexity exceeded
@throws CancelledException
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionResultStateStackAnalysisCmd.java