private void mergeOriginal(ExternalLocation[] externalLocations, TaskMonitor monitor)
			throws DuplicateNameException, InvalidInputException, CancelledException {

		if (externalLocations[ORIGINAL] == null) {
			Program fromProgram = programs[LATEST];
			ExternalLocation fromLocation = externalLocations[LATEST];
			if (fromLocation == null) {
				fromProgram = programs[MY];
				fromLocation = externalLocations[MY];
			}
			if (fromLocation == null) {
				return; // Shouldn't get here. LATEST or MY should have a value.
			}
			removeExternal(fromProgram, fromLocation);
			externalLocations[RESULT] = null;
			adjustIDMapsForRemove(externalLocations, ORIGINAL);
		}
		else if (externalLocations[RESULT] == null) {
			// Don't have it in result so add ORIGINAL.
			ExternalLocation resultExternalLocation =
				addExternal(externalLocations[ORIGINAL], mergeOriginal, monitor);
			externalLocations[RESULT] = resultExternalLocation;
			adjustIDMapsForAdd(externalLocations, resultExternalLocation, ORIGINAL);
		}
		else {
			originalAddressTranslator.setPair(externalLocations[RESULT].getExternalSpaceAddress(),
				externalLocations[ORIGINAL].getExternalSpaceAddress());
			ExternalLocation resultExternalLocation =
				replaceExternalLocation(externalLocations[RESULT], externalLocations[ORIGINAL],
					getMergeOriginal(), monitor);
			externalLocations[RESULT] = resultExternalLocation;
			adjustIDMapsForReplace(externalLocations, ORIGINAL);
		}
	}
Merges the entire external so that it will match the external as it is in the program
indicated by the chosen option.
@param externalLocations the external locations for the external in Latest, My, and Original.
(Any of these locations can be null if the external is not in that program.)
@param chosenConflictOption ListingMergeConstant (KEEP_LATEST, KEEP_MY, KEEP_ORIGINAL)
indicating which program the resulting external should become.
@param monitor the task monitor for feedback and cancelling the merge.
@throws CancelledException if the user cancels the merge.
@throws InvalidInputException
@throws DuplicateNameException
Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ExternalFunctionMerger.java