private AddressSet adjustCodeUnitAddressSet(AddressSetView initialAddressSet, Listing listing,
			TaskMonitor monitor) throws CancelledException {

		if (initialAddressSet == null) {
			return null;
		}
		monitor.initialize(initialAddressSet.getNumAddressRanges());
		int count = 0;
		AddressSet tmpAddrSet = new AddressSet();
		AddressRangeIterator iter = initialAddressSet.getAddressRanges();
		while (iter.hasNext()) {
			monitor.checkCancelled();
			AddressRange range = iter.next();
			Address minAddr = range.getMinAddress();
			Address maxAddr = range.getMaxAddress();
			monitor.setMessage(
				monitorMsg + ": " + "Adjusting code unit set @ " + minAddr.toString() + ".");
			CodeUnit cu;
			cu = listing.getCodeUnitContaining(minAddr);
			if (cu != null) {
				minAddr = cu.getMinAddress();
			}
			cu = listing.getCodeUnitContaining(maxAddr);
			if (cu != null) {
				maxAddr = cu.getMaxAddress();
			}
			tmpAddrSet.addRange(minAddr, maxAddr);
			monitor.setProgress(++count);
		}
		return tmpAddrSet;
	}
adjustCodeUnitAddressSet creates a new address set from the initial
address set by adjusting the address ranges so that they contain
complete code units as indicated by the program listing.
@param initialAddressSet the initial address set
The addresses in this address set should be derived from the program
passed as a parameter.
@param listing the program listing to get the code units from.
@param monitor the task monitor for indicating the progress of
determining differences. This monitor reports the progress to the user.
@return the new address set
The addresses in this address set are derived from the program
that was passed as a parameter.
@throws CancelledException if the user cancelled the Diff.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramDiff.java