public MachHeader parse(SplitDyldCache splitDyldCache) throws IOException, MachException {
		if (_parsed) {
			return this;
		}

		// We must parse segment load commands first, so find and store their indexes separately
		long currentIndex = _commandIndex;
		List<Long> segmentIndexes = new ArrayList<>();
		List<Long> nonSegmentIndexes = new ArrayList<>();
		for (int i = 0; i < nCmds; ++i) {
			_reader.setPointerIndex(currentIndex);
			int type = _reader.readNextInt();
			long size = _reader.readNextUnsignedInt();
			if (type == LoadCommandTypes.LC_SEGMENT || type == LoadCommandTypes.LC_SEGMENT_64) {
				segmentIndexes.add(currentIndex);
			}
			else {
				nonSegmentIndexes.add(currentIndex);
			}
			currentIndex += size;
		}
		List<Long> combinedIndexes = new ArrayList<>();
		combinedIndexes.addAll(segmentIndexes);    // Parse segments first
		combinedIndexes.addAll(nonSegmentIndexes); // Parse everything else second
		for (Long index : combinedIndexes) {
			_reader.setPointerIndex(index);
			LoadCommand lc = LoadCommandFactory.getLoadCommand(_reader, this, splitDyldCache);
			_commands.add(lc);
		}
		sanitizeSegmentSectionNames(getAllSegments());
		_parsed = true;
		return this;
	}
Parses this {@link MachHeader}'s {@link LoadCommand load commands}

@param splitDyldCache The {@link SplitDyldCache} that this header resides in.  Could be null
  if a split DYLD cache is not being used.
@return This {@link MachHeader}, for convenience
@throws IOException If there was an IO-related error
@throws MachException if the load command is invalid
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/MachHeader.java