private ScalarMatch findScalarMatch(Program program, Address startAddress, Varnode constVn,
			TaskMonitor monitor) throws CancelledException {
		long value = constVn.getOffset();
		long mask = -1;
		if (constVn.getSize() < 8) {
			mask = mask >>> (8 - constVn.getSize()) * 8;
		}
		long values[] = new long[4];
		values[0] = value;
		values[1] = (value - 1) & mask;
		values[2] = (value + 1) & mask;
		values[3] = (-value) & mask;
		int count = 0;
		ScalarMatch scalarMatch = null;
		Instruction curInst = program.getListing().getInstructionAt(startAddress);
		if (curInst == null) {
			return null;
		}
		SimpleBlockModel model = new SimpleBlockModel(program);
		CodeBlock basicBlock = model.getFirstCodeBlockContaining(startAddress, monitor);
		if (basicBlock == null) {
			return null;
		}
		while (count < MAX_INSTRUCTION_WINDOW) {
			count += 1;
			ScalarMatch newMatch = findScalarInInstruction(curInst, values);
			if (newMatch != null) {
				if (scalarMatch != null) {
					return null;		// Matches at more than one address
				}
				if (newMatch.opIndex < 0) {
					return null;		// Matches at more than one operand
				}
				scalarMatch = newMatch;
			}
			curInst = curInst.getPrevious();
			if (curInst == null) {
				break;
			}
			if (!basicBlock.contains(curInst.getAddress())) {
				break;
			}
		}
		return scalarMatch;
	}
Find a scalar (instruction operand) that matches the given constant Varnode.
We walk backward from the starting address inspecting operands until a match is found.
The search is terminated if either a match is found, the beginning of the basic block
is reached, or if 20 instructions are traversed.  The scalar can be a "near" match, meaning
off by 1 or the negated value.
@param program is the Program
@param startAddress is the starting address to search backward from
@param constVn is the given constant Varnode
@param monitor is the TaskMonitor
@return a description of the scalar match, or null if there is no match
@throws CancelledException if the user cancels
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ConvertConstantAction.java