public static int getFirstVarArg(Program program, Address addr) {
		for (Reference ref : program.getReferenceManager().getReferencesFrom(addr)) {
			if (ref.isPrimary() && ref.getReferenceType().isCall()) {
				Address callDestAddr = ref.getToAddress();
				Function func = program.getFunctionManager().getFunctionAt(callDestAddr);
				if (func != null && func.hasVarArgs()) {
					return func.getParameterCount();
				}
				break;
			}
		}
		return -1;
	}
If there is a call to a function at the given address, and the function takes variable arguments,
return the index of the first variable argument. Return -1 otherwise.
@param program is the Program
@param addr is the given address of the call
@return the index of the first variable argument or -1
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunctionDBUtil.java