private void propogateParams(Parameter[] params, CodeUnitIterator iterator,
			String externalFunctionName) {

		int index = 0;
		int numSkips = 0;
		while (iterator.hasNext() && index < params.length) {

			// Need to take into account calls between the pushes and skip the
			// pushes for those calls skip pushes that are used for another call.

			// If label, then probably a branch, allow current push to be commented and
			// next time through stop.  Can also be a branch if not label there but
			// this case should still have parameters set
			// before it as long as not an unconditional jump - this wouldn't make
			// sense so it shouldn't happen

			CodeUnit cu = iterator.next();
			boolean isBranch = cu.getLabel() != null;

			if (cu.getMnemonicString().equals("CALL")) {
				numSkips += numParams(cu);
			}
			else if (cu.getMnemonicString().equals("PUSH")) {
				if (numSkips > 0) {
					numSkips--;
				}
				else {
					Parameter param = params[index];
					DataType dt = param.getDataType();
					String name = param.getName();
					SetCommentCmd cmd = new SetCommentCmd(cu.getAddress(), CommentType.EOL,
						dt.getDisplayName() + " " + name + " for " + externalFunctionName);
					cmd.applyTo(currentProgram);

					// add the following to the EOL comment to see the value of the optype
					addResult(name, dt, cu.getMinAddress(), externalFunctionName);
					index++;
				}
			}

			if (isBranch) {
				break;
			}
		}
	}
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