private void performMergeInstruction(Instruction originInstruction,
			AddressSetView originByteDiffs) throws MemoryAccessException {

		Address originMin = originInstruction.getMinAddress();
		Address resultMin = originToResultTranslator.getAddress(originMin);

		if (originInstruction.isInDelaySlot()) {
			// delay slots must be created as part of its delay-slotted predecessor
			Instruction resultInst = resultListing.getInstructionAt(resultMin);
			if (resultInst != null && resultInst.isInDelaySlot()) {
				copyInstructionAttributes(originInstruction, resultInst);
			}
			return;
		}

		int bytesLength;
		Address originMax;
		if (originInstruction.getDelaySlotDepth() != 0) {
			// must include delay slots for byte copy
			originMax = SimpleDiffUtility.getEndOfDelaySlots(originInstruction);
			bytesLength = (int) originMax.subtract(originMin);
		}
		else {
			bytesLength = originInstruction.getParsedLength();
			originMax = originMin.add(bytesLength - 1);
		}

		Address resultMax = originToResultTranslator.getAddress(originMax);

		MemoryBlock resultBlock = resultProgram.getMemory().getBlock(resultMin);
		boolean initializedBytes = (resultBlock != null) ? resultBlock.isInitialized() : false;

		if (!initializedBytes) {
			infoMsg.append("Diff/Merge can't apply instruction from " + originMin + " to " +
				resultMin + " since it needs initialized memory");
			return;
		}

		// If there are byte differences for this instruction then the
		// bytes need to get copied even though the user did not indicate to.
		if (bytesMayDiffer(originByteDiffs, originMin, resultMin, bytesLength)) {
			// Copy all the bytes for the instruction if any bytes differ.
			ProgramMemoryUtil.copyBytesInRanges(resultProgram, originProgram, resultMin, resultMax);
		}

		Instruction newInst;
		if (originInstruction.getDelaySlotDepth() != 0) {
			newInst = disassembleDelaySlottedInstruction(resultProgram, resultMin);
		}
		else {
			newInst = disassembleNonDelaySlotInstruction(resultProgram, resultMin,
				originInstruction.isLengthOverridden() ? originInstruction.getLength() : 0);
		}
		if (newInst == null) {
			return;
		}

		copyInstructionAttributes(originInstruction, newInst);
	}
<CODE>performMergeInstruction</CODE> merges the indicated instruction
into the merge program. Before the instruction is created the bytes for
the instruction are copied from program2 to program1.
Corresponding code unit(s) must already be cleared in result program,
as well as having copied context-register value.
@param originInstruction the instruction to be merged
This instruction should be from the origin program.
@param originByteDiffs address set indicating addresses where the bytes differ
between program1 and program2.
The addresses in this set should be from program1.
@throws CodeUnitInsertionException if the instruction can't be created
in the merge program.
@throws MemoryAccessException if bytes can't be copied.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMerge.java