private void getProgramContextDifferences(ProgramContext pc1, Register reg1, ProgramContext pc2,
			Register reg2, AddressSetView addressSet, AddressSet differences, TaskMonitor monitor)
			throws CancelledException {
		AddressRangeIterator iter = addressSet.getAddressRanges();
		while (iter.hasNext()) {
			monitor.checkCancelled();
			AddressRange range = iter.next();
			Address min = range.getMinAddress();
			Address max = range.getMaxAddress();
			monitor.setMessage("Checking Program Context Differences: " + reg1.getName() + " @ " +
				min.toString(true));
			Address min2 = SimpleDiffUtility.getCompatibleAddress(program1, min, program2);
			Address max2 = SimpleDiffUtility.getCompatibleAddress(program1, max, program2);

			AddressRangeIterator it1 = pc1.getRegisterValueAddressRanges(reg1, min, max);
			AddressRangeIterator it2 = pc2.getRegisterValueAddressRanges(reg2, min2, max2);
			AddressRangeIteratorConverter convertedIt2 =
				new AddressRangeIteratorConverter(it2, program1);
			AddressRangeIterator p1CombinedIterator =
				new CombinedAddressRangeIterator(it1, convertedIt2);

			while (p1CombinedIterator.hasNext()) {
				monitor.checkCancelled();
				AddressRange addrRange = p1CombinedIterator.next();
				Address rangeMin1 = addrRange.getMinAddress();
				Address rangeMin2 =
					SimpleDiffUtility.getCompatibleAddress(program1, rangeMin1, program2);
				RegisterValue value1 = pc1.getRegisterValue(reg1, rangeMin1);
				RegisterValue value2 = pc2.getRegisterValue(reg2, rangeMin2);
				boolean sameValue;
				if (value1 == null || value2 == null) {
					sameValue = (value1 == value2);
				}
				else {
					sameValue = Arrays.equals(value1.toBytes(), value2.toBytes());
				}
				if (!sameValue) {
					differences.addRange(addrRange.getMinAddress(), addrRange.getMaxAddress());
				}
			}
		}
	}
Gets the addresses where the Program Context (register bits) differ
between two programs for the specified registers (which should generally match).

@param pc1 program context for 1st program
@param reg1 register corresponding to pc1 (should generally be the same as reg2)
@param pc2 program context for 2nd program
@param reg2 register corresponding to pc2 (should generally be the same as reg1)
@param addressSet the addresses (in common to both programs) to check for differences.
The addresses in this address set should be derived from program1.
@param differences the addresses of code units where the register value differs will be
added to this set. The addresses in this address set are derived from the 1st program.
@param monitor the task monitor for indicating the progress of
determining differences. This monitor reports the progress to the user.
@throws CancelledException if the user cancelled the Diff.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramDiff.java