public Map<Address, Function> getFunctionCallMap(Function function, boolean getThunkedFunction,
			Set<Address> visited)
			throws CancelledException {

		visited.add(function.getEntryPoint());
		Map<Address, Function> functionCallMap = new HashMap<Address, Function>();

		InstructionIterator instructions =
			function.getProgram().getListing().getInstructions(function.getBody(), true);

		while (instructions.hasNext()) {
			monitor.checkCancelled();
			Instruction instruction = instructions.next();
			if (instruction.getFlowType().isCall()) {

				Function calledFunction = extendedFlatAPI
						.getReferencedFunction(instruction.getMinAddress(), getThunkedFunction);

				if (calledFunction == null) {
					continue;
				}

				// include the null functions in map so things using map can get accurate count
				// of number of CALL instructions even if the call reg type
				functionCallMap.put(instruction.getMinAddress(), calledFunction);
			}
			if (instruction.getFlowOverride().equals(FlowOverride.CALL_RETURN)) {
				Reference reference = instruction.getPrimaryReference(0);
				if (reference == null) {
					continue;
				}
				Address functionAddress = reference.getFromAddress();
				Function secondHalfOfFunction =
					extendedFlatAPI.getReferencedFunction(functionAddress);
				if (secondHalfOfFunction != null &&
					!visited.contains(secondHalfOfFunction.getEntryPoint())) {
					Map<Address, Function> functionCallMap2 =
						getFunctionCallMap(secondHalfOfFunction, false, visited);
					for (Address addr : functionCallMap2.keySet()) {
						monitor.checkCancelled();
						functionCallMap.put(addr, functionCallMap2.get(addr));
					}
				}

			}
		}
		return functionCallMap;
	}
Method to create a map of calling address to called function for the given function.
@param function the given function
@param getThunkedFunction if true, use the thunked function in the map, if false use the 
directly called function from the calling function even if it is a thunk
@param visited the set of function entry point addresses already processed
@return a map of the given functions calling addresses to the called functions 
@throws CancelledException if cancelled
Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java