private void redoAllPairs(Program program, AddressSet pairSet, TaskMonitor monitor)
			throws CancelledException {

		final int locationCount = pairSet.getNumAddressRanges();
		int count = 0;
		if (locationCount > NOTIFICATION_INTERVAL) {
			monitor.initialize(locationCount);
		}

		Disassembler dis = Disassembler.getDisassembler(program, monitor, null);
		for (AddressRange addressRange : pairSet) {
			monitor.checkCancelled();
			if (locationCount > NOTIFICATION_INTERVAL) {

				if ((count % NOTIFICATION_INTERVAL) == 0) {
					//monitor.setMaximum(locationCount);
					monitor.setProgress(count);
				}
				count++;
			}

			program.getListing().clearCodeUnits(addressRange.getMinAddress(),
				addressRange.getMaxAddress(), false);

			// Set bits
			try {
				program.getProgramContext().setValue(pairBitRegister, addressRange.getMinAddress(),
					addressRange.getMaxAddress(), BigInteger.valueOf(1));

				// Disassemble all again
				AddressSet rangeSet = new AddressSet(addressRange);
				dis.disassemble(rangeSet, rangeSet, false);
				// don't notify anyone of new code, since this analyzer should run very early on all new code
			}
			catch (ContextChangeException e) {
				Msg.error(this, "Unexpected Exception", e);
			}
		}

	}
Given one instruction, finds a corresponding paired instruction.
Ghidra/Processors/MIPS/src/main/java/ghidra/app/plugin/core/analysis/MipsPreAnalyzer.java