private InstructionMetadata searchBackward(ProgramPlugin plugin, AddressRange searchBounds,
			TaskMonitor taskMonitor, MaskContainer maskContainer) {

		Address startAddress = searchBounds.getMaxAddress();
		Address endAddress = searchBounds.getMinAddress();
		Address currentPosition = plugin.getProgramLocation().getByteAddress().previous();

		taskMonitor.setShowProgressValue(false);
		taskMonitor.setProgress(0);

		// The maximum value for the monitor is the number of bytes to be checked - this will 
		// NOT always be the size of the range passed-in. If the cursor is in the middle of
		// the range already, then only the number of bytes in the range BEFORE the cursor will 
		// will be checked.
		long max = searchBounds.getLength();
		if (currentPosition.compareTo(searchBounds.getMaxAddress()) < 0) {
			max = currentPosition.subtract(searchBounds.getMinAddress());
		}
		taskMonitor.setMaximum(max);

		// Move the cursor to the end of the range if it is currently past it. We don't
		// want to search for any addresses that aren't in the search bounds.
		if (currentPosition.compareTo(startAddress) > 0) {
			currentPosition = startAddress;
		}

		while (currentPosition.compareTo(endAddress) > 0) {

			// Search program memory for the given mask and val.
			currentPosition = plugin.getCurrentProgram()
					.getMemory()
					.findBytes(currentPosition,
						endAddress, maskContainer.getValue(), maskContainer.getMask(), false,
						taskMonitor);

			// If no match was found, currentPosition will be null.
			if (currentPosition == null) {
				break;
			}

			// Otherwise construct a new entry to put in our results table.
			MaskContainer masks =
				new MaskContainer(maskContainer.getMask(), maskContainer.getValue());
			InstructionMetadata temp = new InstructionMetadata(masks);
			temp.setAddr(currentPosition);

			return temp;
		}

		return null;
	}
Searches for a specific byte pattern in the reverse direction.

@param plugin the instruction pattern search plugin
@param searchBounds the addresses to search
@param taskMonitor the task monitor
@param maskContainer the bytes to search for
@return the instruction, or null if not found
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/model/InstructionSearchData.java