protected void processEntryPoint(String source) throws Exception {
		monitor.setMessage("Processing entry point...");

		final int LC_MAIN_PRIORITY = 1;
		final int LC_UNIX_THREAD_PRIORITY = 2;
		final int LC_THREAD_PRIORITY = 3;
		SortedMap<Integer, List<Address>> priorityMap =
			LazySortedMap.lazySortedMap(new TreeMap<>(), () -> new ArrayList<>());

		for (EntryPointCommand cmd : machoHeader.getLoadCommands(EntryPointCommand.class)) {
			long offset = cmd.getEntryOffset();
			if (offset > 0) {
				SegmentCommand segment = machoHeader.getSegment("__TEXT");
				if (segment != null) {
					priorityMap.get(LC_MAIN_PRIORITY)
							.add(space.getAddress(segment.getVMaddress()).add(offset));
				}
			}
		}

		for (ThreadCommand threadCommand : machoHeader.getLoadCommands(ThreadCommand.class)) {
			int priority = threadCommand.getCommandType() == LoadCommandTypes.LC_UNIXTHREAD
					? LC_UNIX_THREAD_PRIORITY
					: LC_THREAD_PRIORITY;
			long pointer = threadCommand.getInitialInstructionPointer();
			if (pointer != -1) {
				priorityMap.get(priority).add(space.getAddress(pointer));
			}
		}

		if (!priorityMap.isEmpty()) {
			boolean realEntryFound = false;
			for (List<Address> addrs : priorityMap.values()) {
				for (Address addr : addrs) {
					if (!realEntryFound) {
						program.getSymbolTable().createLabel(addr, "entry", SourceType.IMPORTED);
						program.getSymbolTable().addExternalEntryPoint(addr);
						createOneByteFunction(program, "entry", addr);
						realEntryFound = true;
					}
					else {
						log.appendMsg("Ignoring entry point at " + addr + " in " + source);
					}
				}
			}
		}
	}
Attempts to discover and set the entry point.
<p>
A program may declare multiple entry points to, for example, confuse static analysis tools.
We will sort the discovered entry points by priorities assigned to each type of load
command, and only use the one with the highest priority.

@param source A name that represents where the memory blocks came from.
@throws Exception If there was a problem discovering or setting the entry point.
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java