protected boolean checkPreRequisites(Program program, Address addr) {
			/**
			 * If the match's mark point occurs in undefined data, schedule disassembly
			 * and a function start at that address. If the match's mark point occurs at an instruction, but that
			 * instruction isn't in a function body, schedule a function start at that address
			 */
			if (validFunction) {
				Function func = program.getFunctionManager().getFunctionAt(addr);
				if (func == null) {
					postreqFailedResult.add(addr);
					// Drop a property breadcrumb to make sure only those functions that could match are checked.
					potentialMatchAddressSetPropertyMap.add(addr, addr);
					return false;
				}
			}

			if (!checkAfterName(program, addr)) {
				postreqFailedResult.add(addr);
				return false;
			}

			// do we require some number of valid instructions
			if (validCodeMin != 0) {
				PseudoDisassembler pseudoDisassembler = new PseudoDisassembler(program);
				PseudoDisassemblerContext pcont =
					new PseudoDisassemblerContext(program.getProgramContext());
				
				setDisassemblerContext(program, pcont, addr);
				boolean isvalid = false;
				if (validCodeMin == -1) {
					if (validCodeMax > 0) {  // check at most N instructions
						pseudoDisassembler.setMaxInstructions(validCodeMax);
					}
					isvalid = pseudoDisassembler.checkValidSubroutine(addr, pcont, true, true, contiguous);
				}
				else {
					if (validCodeMax > 0) { // check at most N instructions
						pseudoDisassembler.setMaxInstructions(validCodeMax);
					}
					// disassemble only fallthru, must have validcode number of instructions
					isvalid = pseudoDisassembler.checkValidSubroutine(addr, pcont, true, false, contiguous);
					int instrCount = pseudoDisassembler.getLastCheckValidInstructionCount();
					if (instrCount < validCodeMin) {
						isvalid = false;
					}
				}
				return isvalid;
			}

			return true;
		}
apply any latent context at the location

@param program
@param addr
Ghidra/Features/BytePatterns/src/main/java/ghidra/app/analyzers/FunctionStartAnalyzer.java