static LoadSpec getLoadSpec(ByteProvider provider, Program program) {
		LoaderMap loaderMap = LoaderService.getSupportedLoadSpecs(provider,
			loader -> loader.getName().equalsIgnoreCase(program.getExecutableFormat()));

		if (loaderMap.isEmpty()) {
			return null;
		}

		Loader loader = loaderMap.firstKey();
		if (loader == null) {
			return null;
		}

		LanguageCompilerSpecPair programLcs = program.getLanguageCompilerSpecPair();
		return loaderMap.get(loader)
				.stream()
				.filter(e -> programLcs.equals(e.getLanguageCompilerSpec()))
				.findFirst()
				.orElse(null);
	}
Get's the {@link LoadSpec} that was used to import the given {@link Program}

@param provider The original bytes of the {@link Program}
@param program The {@link Program}
@return The {@link LoadSpec} that was used to import the given {@link Program}, or null if
  it could not be determined
Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterUtilities.java