private void mergeProgramContext(ProgramContext resultContext, ProgramContext originContext,
			Register originReg, AddressRange originRange, AddressRange resultRange,
			TaskMonitor monitor) throws CancelledException, ContextChangeException {
		Register resultReg = resultContext.getRegister(originReg.getName());
		if (resultReg == null) {
			return;
		}
		AddressRangeIterator origValueIter = originContext.getRegisterValueAddressRanges(originReg,
			originRange.getMinAddress(), originRange.getMaxAddress());
		resultContext.remove(resultRange.getMinAddress(), resultRange.getMaxAddress(), resultReg);
		while (origValueIter.hasNext()) {
			monitor.checkCancelled();
			AddressRange origValueRange = origValueIter.next();
			AddressRange resultValueRange =
				originToResultTranslator.getAddressRange(origValueRange);
			RegisterValue originValue =
				originContext.getRegisterValue(originReg, origValueRange.getMinAddress());
			if (originValue != null && originValue.hasAnyValue()) {
				RegisterValue resultValue = new RegisterValue(resultReg, originValue.toBytes());
				resultContext.setRegisterValue(resultValueRange.getMinAddress(),
					resultValueRange.getMaxAddress(), resultValue);
			}
		}
	}
Merge context register values over a specified address range.  It is very important that all
instructions be cleared over this range in the result program prior to invoking this
method.
@param resultContext
@param originContext
@param originReg
@param originRange
@param resultRange
@param monitor
@throws CancelledException
@throws ContextChangeException if an instruction was encountered where a context register
value change was attempted
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMerge.java