private AddressSet getRegisterDifferences(String regName, ProgramContext context1,
				ProgramContext context2, AddressSetView addressSet, TaskMonitor monitor) {
			AddressSet differences = new AddressSet();
			ProgramContext pc1 = context1;
			ProgramContext pc2 = context2;
			Register rb1 = pc1.getRegister(regName);
			Register rb2 = pc2.getRegister(regName);

			AddressRangeIterator iter = addressSet.getAddressRanges();
			while (iter.hasNext()) {
				AddressRange range = iter.next();
				Address rangeMin = range.getMinAddress();
				Address rangeMax = range.getMaxAddress();

				AddressRangeIterator it1 =
					pc1.getRegisterValueAddressRanges(rb1, rangeMin, rangeMax);
				AddressRangeIterator it2 =
					pc2.getRegisterValueAddressRanges(rb2, rangeMin, rangeMax);

				AddressRangeIterator it = new CombinedAddressRangeIterator(it1, it2);

				while (it.hasNext()) {
					AddressRange addrRange = it.next();
					BigInteger value1 = pc1.getValue(rb1, addrRange.getMinAddress(), false);
					BigInteger value2 = pc2.getValue(rb2, addrRange.getMinAddress(), false);
					boolean sameValue = (value1 == null) ? (value2 == null) : value1.equals(value2);
					if (!sameValue) {
						differences.addRange(addrRange.getMinAddress(), addrRange.getMaxAddress());
					}
				}

				if (monitor.isCancelled()) {
					return null;
				}
			}
			return differences;
		}
Gets the addresses where the named register differs 
between two programs.

@param regName
@param addressSet
@param monitor the task monitor for indicating the progress of
determining differences. This monitor reports the progress to the user.

@return the addresses of code units where the register values differ.
Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/RegisterMergeManager.java