private void fixDummyFunctionBodies(Program program, TaskMonitor monitor,
			Set<Address> redoFunctionSet) throws CancelledException {
		Set<Address> recreateFunctionSet = new HashSet<>();
		for (Address entry : redoFunctionSet) {
			Function function = program.getFunctionManager().getFunctionAt(entry);
			if (function == null) {
				continue;
			}
			Instruction instr = program.getListing().getInstructionAt(entry);
			if (instr == null) {
				continue;
			}

			// go through the references, and see if there are any non-jumps to them
			ReferenceIterator referencesTo = program.getReferenceManager().getReferencesTo(entry);
			boolean foundNonJumpRef = false;
			while (referencesTo.hasNext()) {
				Reference reference = referencesTo.next();
				if (!reference.getReferenceType().isJump()) {
					foundNonJumpRef = true;
					break;
				}
			}
			if (!foundNonJumpRef) {
				// check if we have been thunked
				Address[] functionThunkAddresses = function.getFunctionThunkAddresses();
				foundNonJumpRef =
					functionThunkAddresses != null && functionThunkAddresses.length != 0;
			}

			// if found non-jump ref, or is external
			if (function.getSymbol().isExternalEntryPoint() || foundNonJumpRef) {
				recreateFunctionSet.add(entry);
			}
			else {
				referencesTo = program.getReferenceManager().getReferencesTo(entry);
				// find all functions that jumped to this one, and re-create them
				while (referencesTo.hasNext()) {
					Reference reference = referencesTo.next();
					Function func = program.getFunctionManager()
							.getFunctionContaining(reference.getFromAddress());
					if (func != null) {
						recreateFunctionSet.add(func.getEntryPoint());
					}
				}
				// does this function have a fallThru?
				Address fallFrom = instr.getFallFrom();
				if (fallFrom != null) {
					Function func = program.getFunctionManager().getFunctionContaining(fallFrom);
					if (func != null) {
						recreateFunctionSet.add(func.getEntryPoint());
					}
				}

				recreateFunctionSet.add(entry);
				// Never clear functions that are already created
				//    program.getFunctionManager().removeFunction(entry);
			}
		}

		// now re-create the function bodies for those left
		for (Address entry : recreateFunctionSet) {
			Function function = program.getFunctionManager().getFunctionAt(entry);
			CreateFunctionCmd.fixupFunctionBody(program, function, monitor);
		}
	}
Check for a single external entry point.

@param program - program to check
@param externalCount - count of external entry points found
@param doNowSet - set of functions that are to be done now

@return true if this program has only one external entry point
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/EntryPointAnalyzer.java