private boolean hasEnoughPushes(CodeUnitIterator iterator, int numParams) {

		if (iterator == null) {
			return false;
		}

		int numPushes = 0;
		int numSkips = 0;
		while ((iterator.hasNext()) && (numPushes < numParams)) {
			CodeUnit cu = iterator.next();
			if (numSkips > 0) {
				numSkips--;
			}
			else if (cu.getMnemonicString().equals("CALL")) {
				numParams += numParams(cu);
			}
			else if (cu.getMnemonicString().equals("PUSH")) {
				numPushes++;
			}
		}

		// Have enough params between ref and top of function?
		return numPushes >= numParams;
	}
This will return true if enough pushes before top of function.
This will return false if not enough pushes or if not a function.
Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PropagateExternalParametersAnalyzer.java