private Object addScalarAdjustment(Object opObj, Address addr, Scalar originalScalar,
			boolean scalarOperand) {

		if (originalScalar == null) {
			return opObj;
		}

		long originalValue = (addr.isStackAddress() &&
			originalScalar.bitLength() == addr.getAddressSpace().getSize())
					? originalScalar.getSignedValue()
					: originalScalar.getUnsignedValue();
		long addrOffset;
		if (addr instanceof SegmentedAddress) {
			addrOffset = ((SegmentedAddress) addr).getSegmentOffset();
		}
		else {
			addrOffset = addr.getAddressableWordOffset();
		}

		if (originalValue == addrOffset || originalValue == addr.getOffset()) {
			return opObj;
		}

		OperandRepresentationList list = new OperandRepresentationList();
		if (addr.isMemoryAddress()) {

			// Include "offset" prefix since addrOffset does not match originalValue
			list.add("offset ");

			// Check for shift cases
			for (int element : SHIFT_CASES) {
				if ((addrOffset >>> element) == originalValue && originalValue != 0x0) {
					list.add(opObj);
					if (options.includeScalarReferenceAdjustment) {
						list.add(" >>");
						list.add(Integer.toString(element));
					}
					return list;
				}
			}

			// Check for mask cases
			for (long element : MASK_CASES) {
				if ((addrOffset & element) == originalValue) {
					list.add(opObj);
					if (options.includeScalarReferenceAdjustment) {
						list.add(" &");
						list.add("0x" + Long.toHexString(element));
					}
					return list;
				}
			}

			// TODO: Check for "reasonable delta value", return null if bad value
			if (!scalarOperand) {
				return null;
			}
		}

		// Handle offset case
		list.add(opObj);
		if (options.includeScalarReferenceAdjustment) {

			long delta = originalValue - addrOffset;
			if (delta < 0) {
				list.add('-');
				delta = -delta;
			}
			else {
				list.add('+');
			}
			list.add(new Scalar(addr.getSize(), delta));
		}
		return list;
	}
Add scalar adjustment markup to the specified opObj. If the specified
addr is a memory address and an adjustment is performed, the "offset "
prefix will also be added to the modified opObj which is returned.

@param opObj original sub-operand object
@param addr reference address which corresponds to opObj
@param originalScalar scalar which was replaced by opObj
@param scalarOperand true if operand consists of single scalar only
@return modified opObj with scalar adjustments reflected or null if
        memory address requires excessive adjustment
Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java