private static int getFunctionPurge(Program functionProgram, Function func) {

		if (func == null) {
			return getDefaultStackDepthChange(functionProgram, Function.UNKNOWN_STACK_DEPTH_CHANGE);
		}

		int depth = func.getStackPurgeSize();
		if (func.isStackPurgeSizeValid()) {
			return depth;
		}

		PrototypeModel proto = func.getCallingConvention();
		if (proto == null) {
			return getDefaultStackDepthChange(functionProgram, depth);
		}

		int callStackMod = proto.getExtrapop();
		int callStackShift = proto.getStackshift();
		if (callStackMod != PrototypeModel.UNKNOWN_EXTRAPOP && callStackShift >= 0) {
			return callStackShift - callStackMod;
		}
		return depth;
	}
Get/Compute the Purge size from the stack for the function
@param func function or null
@return size in bytes that is removed from the stack after the function
        is called.
Ghidra/Features/Base/src/main/java/ghidra/util/state/ResultsState.java