@Test
	public void testSimpleRefOverride() throws AddressFormatException {
		//verify the instructions needed for the test
		Address callFunc1Addr = defaultSpace.getAddress(CALL_FUNC1_10001e);
		Instruction callFunc1 = program.getListing().getInstructionAt(callFunc1Addr);
		assertNotNull(callFunc1);
		assertEquals("call 0x" + func1Addr.toString(), callFunc1.toString());

		PcodeOp[] unmodified = callFunc1.getPcode(false);
		assertEquals(unmodified.length, 2);
		assertTrue(unmodified[0].getOpcode() == PcodeOp.COPY); //save return address in lr
		assertTrue(unmodified[1].getOpcode() == PcodeOp.CALL); //call op

		//verify that requesting overrides when there aren't any is the same as
		//not requesting overrides
		assertTrue(equalPcodeOpArrays(callFunc1.getPcode(true), callFunc1.getPcode(false)));

		int id = program.startTransaction("test");
		Reference simpleCallRef = refManager.addMemoryReference(callFunc1Addr, func2Addr,
			RefType.UNCONDITIONAL_CALL, SourceType.USER_DEFINED, 0);
		//default reference is primary, so need to set simpleCallRef to primary to unseat it
		refManager.setPrimary(simpleCallRef, true);
		program.endTransaction(id, true);

		//verify that nothing changes with no overrides requested
		assertTrue(equalPcodeOpArrays(unmodified, callFunc1.getPcode(false)));
		assertTrue(equalPcodeOpArrays(unmodified, callFunc1.getPcode()));

		//simple call ref override
		PcodeOp[] simpleRefOverride = callFunc1.getPcode(true);

		//verify same number of ops		
		assertEquals(simpleRefOverride.length, unmodified.length);

		//verify COPY op not changed
		assertTrue(equalPcodeOps(unmodified[0], simpleRefOverride[0]));

		//verify the call target changed
		assertNull(unmodified[1].getOutput());
		assertNull(simpleRefOverride[1].getOutput());
		assertTrue(unmodified[1].getOpcode() == simpleRefOverride[1].getOpcode());
		assertTrue(unmodified[1].getNumInputs() == simpleRefOverride[1].getNumInputs());
		assertTrue(unmodified[1].getInput(0).getOffset() == func1Addr.getOffset());
		assertTrue(simpleRefOverride[1].getInput(0).getOffset() == func2Addr.getOffset());

		//verify that a simple reference override has precedence over a CALL_OVERRIDE_UNCONDITIONAL
		Address main = defaultSpace.getAddress(INDIRECT_CALL_100000);
		assertTrue(main.getOffset() == 0x100000);
		id = program.startTransaction("test");
		//use a different opIndex than simpleCallRef so we can verify what happens
		//when both refs are primary
		Reference overrideRef = refManager.addMemoryReference(callFunc1Addr, main,
			RefType.CALL_OVERRIDE_UNCONDITIONAL, SourceType.USER_DEFINED, -1);
		refManager.setPrimary(overrideRef, true);
		program.endTransaction(id, true);

		//verify nothing changes with no overrides requested
		assertTrue(equalPcodeOpArrays(unmodified, callFunc1.getPcode(false)));
		assertTrue(equalPcodeOpArrays(unmodified, callFunc1.getPcode()));

		//verify that with overrides what you get is simpleRef
		PcodeOp[] bothOverrides = callFunc1.getPcode(true);
		assertTrue(equalPcodeOpArrays(simpleRefOverride, bothOverrides));

		//set simpleRef to non-primary
		id = program.startTransaction("test");
		refManager.setPrimary(simpleCallRef, false);
		program.endTransaction(id, true);

		//verify that overrideRef then applies
		PcodeOp[] callOverrideOps = callFunc1.getPcode(true);
		assertTrue(equalPcodeOps(unmodified[0], callOverrideOps[0]));
		assertTrue(callOverrideOps[1].getInput(0).getOffset() == main.getOffset());

		Address callFixmeAddr = defaultSpace.getAddress(CALL_FIXME_10001c);
		Instruction callFixme = program.getListing().getInstructionAt(callFixmeAddr);
		assertNotNull(callFixme);
		assertEquals("call 0x" + fixMeAddr.toString(), callFixme.toString());

		unmodified = callFixme.getPcode(false);

		//add a simple ref override on a call to a function with a call fixup
		id = program.startTransaction("test");
		simpleCallRef = refManager.addMemoryReference(callFixmeAddr, func2Addr,
			RefType.UNCONDITIONAL_CALL, SourceType.USER_DEFINED, 0);
		//default reference is primary; set simpleCallRef to primary to unseat it
		refManager.setPrimary(simpleCallRef, true);
		program.endTransaction(id, true);

		//verify that nothing changes with no overrides requested
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode(false)));
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode()));

		//verify that nothing changes WITH overrides requested since "fixme" has a 
		//call fixup
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode(true)));

		//add a CALL_OVERRIDE_UNCONDITIONAL reference on a call to a function with
		//a call fixup
		id = program.startTransaction("test");
		overrideRef = refManager.addMemoryReference(callFixmeAddr, main,
			RefType.CALL_OVERRIDE_UNCONDITIONAL, SourceType.USER_DEFINED, -1);
		refManager.setPrimary(overrideRef, false);
		program.endTransaction(id, true);

		//verify that nothing changes with no overrides requested
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode(false)));
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode()));

		//verify that nothing changes WITH overrides requested since "fixme" has a 
		//call fixup
		assertTrue(equalPcodeOpArrays(unmodified, callFixme.getPcode(true)));
	}
Test that simple call reference overrides (retained for backward compatibility) have
precedence over CALL_OVERRIDE_UNCONDITIONAL reference overrides, and that neither
override applies if the call target has a call fixup.

@throws AddressFormatException if {@code AddressSpace.getAddress} throws it
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/program/model/pcode/PcodeEmitContextTest.java