// File: /workspace/github_c_makefile_star2_O1/darwin-on-arm[P]darwin-sdk/xcode_tools/xcrun/xcrun.c
// Function: xcrun_main
static int xcrun_main(int argc, char *argv[])
{
	int ch;
	int optindex = 0;
	int argc_offset = 0;
	char *sdk_env, *toolchain_env;
	char *sdk, *toolchain, *tool_called;

	static int help_f, verbose_f, log_f, find_f, run_f, nocache_f, killcache_f, version_f, sdk_f, toolchain_f, ssdkp_f, ssdkv_f, ssdkpp_f, ssdktt_f, ssdkpv_f;
	help_f = verbose_f = log_f = find_f = run_f = nocache_f = killcache_f = version_f = sdk_f = toolchain_f = ssdkp_f = ssdkv_f = ssdkpp_f = ssdktt_f = ssdkpv_f = 0;

	/* Supported options */
	static struct option options[] = {
		{ "help", no_argument, 0, 'h' },
		{ "version", no_argument, &version_f, 1 },
		{ "verbose", no_argument, 0, 'v' },
		{ "sdk", required_argument, &sdk_f, 1 },
		{ "toolchain", required_argument, &toolchain_f, 1 },
		{ "log", no_argument, 0, 'l' },
		{ "find", required_argument, 0, 'f' },
		{ "run", required_argument, 0, 'r' },
		{ "no-cache", no_argument, 0, 'n' },
		{ "kill-cache", no_argument, 0, 'k' },
		{ "show-sdk-path", no_argument, &ssdkp_f, 1 },
		{ "show-sdk-version", no_argument, &ssdkv_f, 1 },
		{ "show-sdk-target-triple", no_argument, &ssdktt_f, 1},
		{ "show-sdk-toolchain-path", no_argument, &ssdkpp_f, 1 },
		{ "show-sdk-toolchain-version", no_argument, &ssdkpv_f, 1 },
		{ NULL, 0, 0, 0 }
	};

	/* Print help if nothing is specified */
	if (argc < 2)
		return usage();

	/* Only parse arguments if they are given */
	if (*(*(argv + 1)) == '-') {
		if (strcmp(argv[1], "-") == 0 || strcmp(argv[1], "--") == 0)
			return usage();
		while ((ch = getopt_long_only(argc, argv, "+hvlr:f:nk", options, &optindex)) != (-1)) {
			switch (ch) {
				case 'h':
					help_f = 1;
					break;
				case 'v':
					verbose_f = 1;
					break;
				case 'l':
					log_f = 1;
					break;
				case 'r':
					run_f = 1;
					tool_called = basename(optarg);
					++argc_offset;
					break;
				case 'f':
					find_f = 1;
					tool_called = basename(optarg);
					++argc_offset;
					break;
				case 'n':
					nocache_f = 1;
					break;
				case 'k':
					killcache_f = 1;
					break;
				case 0: /* long-only options */
					switch (optindex) {
						case 1: /* --version */
							break;
						case 3: /* --sdk */
							if (*optarg != '-') {
								++argc_offset;
								sdk = optarg;
								/* we support absolute paths and short names */
								if (*sdk == '/') {
									if (validate_directory_path(sdk) != (-1))
										alternate_sdk_path = sdk;
									else
										return 1;
								} else {
									explicit_sdk_mode = 1;
									stripext(current_sdk, sdk);
								}
							} else {
								fprintf(stderr, "xcrun: error: sdk flag requires an argument.\n");
								return 1;
							}
							break;
						case 4: /* --toolchain */
							if (*optarg != '-') {
								++argc_offset;
								toolchain = optarg;
								/* we support absolute paths and short names */
								if (*toolchain == '/') {
									if (validate_directory_path(toolchain) != (-1))
										alternate_toolchain_path = toolchain;
									else
										return 1;
								} else {
									explicit_toolchain_mode = 1;
									stripext(current_toolchain, toolchain);
								}
							} else {
								fprintf(stderr, "xcrun: error: toolchain flag requires an argument.\n");
								return 1;
							}
							break;
						case 10: /* --show-sdk-path */
							break;
						case 11: /* --show-sdk-version */
							break;
						case 12: /* --snow-sdk-target-triple */
							break;
						case 13: /* --show-sdk-toolchain-path */
							break;
						case 14: /* --show-sdk-toolchain-version */
							break;
					}
					break;
				case '?':
				default:
					help_f = 1;
					break;
			}

			++argc_offset;

			/* We don't want to parse any more arguments after these are set. */
			if (ch == 'f' || ch == 'r')
				break;
		}
	} else { /* We are just executing a program. */
		tool_called = basename(argv[1]);
		++argc_offset;
	}

	/* The last non-option argument may be the command called. */
	if (optind < argc && ((!run_f || !find_f) && tool_called == NULL)) {
		tool_called = basename(argv[optind++]);
		++argc_offset;
	}

	/* Don't continue if we are missing arguments. */
	if ((verbose_f || log_f) && tool_called == NULL) {
		fprintf(stderr, "xcrun: error: specified arguments require -r or -f arguments.\n");
		return 1;
	}

	/* Print help? */
	if (help_f || argc < 2)
		return usage();

	/* Print version? */
	if (version_f)
		return version();

	/* If our SDK and/or Toolchain hasn't been specified, fall back to environment or defaults. */
	if (strlen(current_sdk) == 0) {
		if ((sdk_env = getenv("SDKROOT")) != NULL) {
			stripext(current_sdk, basename(sdk_env));
		} else {
			const char *sdk_info = get_default_info(XCRUN_DEFAULT_CFG).sdk;
			strncpy(current_sdk, sdk_info, strlen(sdk_info));
		}
	}

	if (strlen(current_toolchain) == 0) {
		if ((toolchain_env = getenv("TOOLCHAINS")) != NULL) {
			stripext(current_toolchain, basename(toolchain_env));
		} else {
			const char *toolch_info = get_default_info(XCRUN_DEFAULT_CFG).toolchain;
			strncpy(current_toolchain, toolch_info, strlen(toolch_info));
		}
	}

	/* Show SDK path? */
	if (ssdkp_f) {
		printf("%s\n", get_sdk_path(current_sdk));
		return 0;
	}

	/* Show SDK version? */
	if (ssdkv_f) {
		printf("%s SDK version %s\n", get_sdk_info(get_sdk_path(current_sdk)).name, get_sdk_info(get_sdk_path(current_sdk)).version);
		return 0;
	}

	/* Show SDK toolchain path? */
	if (ssdkpp_f) {
		printf("%s\n", get_toolchain_path(current_toolchain));
		return 0;
	}

	/* Show SDK toolchain version? */
	if (ssdkpv_f) {
		printf("%s SDK Toolchain version %s (%s)\n", get_sdk_info(get_sdk_path(current_sdk)).name, get_toolchain_info(get_toolchain_path(current_toolchain)).version, get_toolchain_info(get_toolchain_path(current_toolchain)).name);
		return 0;
	}

	/* Show SDK target triple ? */
	if (ssdktt_f) {
		printf("%s\n", get_target_triple(current_sdk));
		return 0;
	}

	/* Clear the lookup cache? */
	if (killcache_f)
		fprintf(stderr, "xcrun: warning: --kill-cache not supported.\n");

	/* Don't use the lookup cache? */
	if (nocache_f)
		fprintf(stderr, "xcrun: warning: --no-cache not supported.\n");

	/* Turn on verbose mode? */
	if (verbose_f)
		verbose_mode = 1;

	/* Turn on logging mode? */
	if (log_f)
		logging_mode = 1;

	/* Before we continue, double check if we have a tool to call. */
	if (tool_called == NULL) {
		fprintf(stderr, "xcrun: error: no tool specified.\n");
		return 1;
	}

	/* Search for program? */
	if (find_f) {
		finding_mode = 1;
		if (request_command(tool_called, 0, NULL) == 0) {
			return 0;
		} else {
			fprintf(stderr, "xcrun: error: unable to locate command \'%s\' (%s)\n", tool_called, strerror(errno));
			return 1;
		}
	}

	/* Search and execute program. (default behavior) */
	if (request_command(tool_called, (argc - argc_offset),  (argv += ((argc - argc_offset) - (argc - argc_offset) + (argc_offset)))) != 0) {
		fprintf(stderr, "xcrun: error: failed to execute command \'%s\'. aborting.\n", tool_called);
		return 1;
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
xorl %r15d, %r15d
movl %r15d, 0xc(%rsp)
movl %r15d, 0x66f5(%rip)     # 0x9390
movl %r15d, 0x66ea(%rip)     # 0x938c
movl %r15d, 0x66df(%rip)     # 0x9388
movl %r15d, 0x66d4(%rip)     # 0x9384
movl %r15d, 0x66c9(%rip)     # 0x9380
movl %r15d, 0x66be(%rip)     # 0x937c
movl %r15d, 0x66b3(%rip)     # 0x9378
movl %r15d, 0x66a8(%rip)     # 0x9374
movb %r15b, 0x669d(%rip)     # 0x9370
movb %r15b, 0x6692(%rip)     # 0x936c
movb %r15b, 0x6687(%rip)     # 0x9368
movb %r15b, 0x667c(%rip)     # 0x9364
movb %r15b, 0x6671(%rip)     # 0x9360
movb %r15b, 0x6666(%rip)     # 0x935c
movb %r15b, 0x665b(%rip)     # 0x9358
cmpl $0x1, %edi
jle 0x2f92
movq %rsi, %r14
movl %edi, %ebx
movq 0x8(%rsi), %r15
cmpb $0x2d, (%r15)
jne 0x2ec0
leaq 0x25ec(%rip), %rsi      # 0x530c
movq %r15, %rdi
callq 0x2120
testl %eax, %eax
je 0x2f9c
leaq 0x25d4(%rip), %rsi      # 0x530b
movq %r15, %rdi
callq 0x2120
testl %eax, %eax
je 0x2f9c
xorl %r13d, %r13d
leaq 0x22c7(%rip), %rbp      # 0x5018
movl %ebx, %edi
movq %r14, %rsi
leaq 0x25b1(%rip), %rdx      # 0x530e
leaq 0x53cc(%rip), %rcx      # 0x8130
leaq 0xc(%rsp), %r8
callq 0x20f0
movl %eax, %r15d
leal -0x66(%r15), %eax
cmpl $0x10, %eax
ja 0x2d8d
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movb $0x1, 0x65d9(%rip)      # 0x9364
jmp 0x2dbb
testl %r15d, %r15d
je 0x2df9
cmpl $-0x1, %r15d
je 0x2ed1
movb $0x1, 0x65b5(%rip)      # 0x9358
jmp 0x2eab
movb $0x1, 0x65ad(%rip)      # 0x935c
jmp 0x2eab
movb $0x1, 0x65ad(%rip)      # 0x9368
movq 0x520e(%rip), %rax      # 0x7fd0
movq (%rax), %rdi
callq 0x2160
movq %rax, %r12
incl %r13d
jmp 0x2eab
movb $0x1, 0x6584(%rip)      # 0x9360
jmp 0x2eab
movb $0x1, 0x6588(%rip)      # 0x9370
jmp 0x2eab
movb $0x1, 0x6578(%rip)      # 0x936c
jmp 0x2eab
movl 0xc(%rsp), %eax
cmpl $0x4, %eax
je 0x2e46
cmpl $0x3, %eax
jne 0x2eab
movq %r12, (%rsp)
movq 0x51ba(%rip), %rax      # 0x7fd0
movq (%rax), %r12
movb (%r12), %al
cmpb $0x2d, %al
je 0x31fe
incl %r13d
cmpb $0x2f, %al
jne 0x2e81
movq %r12, %rdi
callq 0x3a3a
cmpl $-0x1, %eax
je 0x2fab
movq %r12, 0x6554(%rip)      # 0x9398
jmp 0x2ea7
movq %r12, (%rsp)
movq 0x517f(%rip), %rax      # 0x7fd0
movq (%rax), %r12
movb (%r12), %al
cmpb $0x2d, %al
je 0x3208
incl %r13d
cmpb $0x2f, %al
jne 0x2e91
movq %r12, %rdi
callq 0x3a3a
cmpl $-0x1, %eax
je 0x2fab
movq %r12, 0x7531(%rip)      # 0xa3b0
jmp 0x2ea7
movb $0x1, 0x6518(%rip)      # 0x93a0
leaq 0x6521(%rip), %rdi      # 0x93b0
jmp 0x2e9f
movb $0x1, 0x7520(%rip)      # 0xa3b8
leaq 0x7521(%rip), %rdi      # 0xa3c0
movq %r12, %rsi
callq 0x3a99
movq (%rsp), %r12
incl %r13d
cmpl $0x66, %r15d
je 0x2ed1
cmpl $0x72, %r15d
jne 0x2d51
jmp 0x2ed1
movq %r15, %rdi
callq 0x2160
movq %rax, %r12
movl $0x1, %r13d
movq 0x50f0(%rip), %rax      # 0x7fc8
movslq (%rax), %rcx
cmpl %ebx, %ecx
jge 0x2f09
movb 0x647f(%rip), %dl       # 0x9364
andb 0x647d(%rip), %dl       # 0x9368
testb $0x1, %dl
jne 0x2f09
testq %r12, %r12
jne 0x2f09
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movq (%r14,%rcx,8), %rdi
callq 0x2160
movq %rax, %r12
incl %r13d
movb 0x6451(%rip), %al       # 0x9360
orb 0x6447(%rip), %al       # 0x935c
testb $0x1, %al
je 0x2f22
testq %r12, %r12
je 0x2fa6
cmpb $0x1, 0x642f(%rip)      # 0x9358
je 0x2fb6
cmpl $0x0, 0x643e(%rip)      # 0x9374
je 0x2f5f
movq 0x5081(%rip), %rax      # 0x7fc0
movq (%rax), %rdi
leaq 0x2a1a(%rip), %rsi      # 0x5963
leaq 0x2a25(%rip), %rdx      # 0x5975
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2130
jmp 0x3050
cmpb $0x0, 0x644a(%rip)      # 0x93b0
jne 0x2fe2
leaq 0x244b(%rip), %rdi      # 0x53ba
callq 0x2030
testq %rax, %rax
je 0x2fc0
movq %rax, %rdi
callq 0x2160
leaq 0x6428(%rip), %rdi      # 0x93b0
movq %rax, %rsi
callq 0x3a99
jmp 0x2fe2
callq 0x23fa
jmp 0x3050
callq 0x23db
jmp 0x304d
callq 0x23b9
movl $0x1, %r15d
jmp 0x3050
callq 0x2394
jmp 0x304d
callq 0x3ad7
movq %rax, %r15
movq %rax, %rdi
callq 0x20a0
leaq 0x63d9(%rip), %rdi      # 0x93b0
movq %r15, %rsi
movq %rax, %rdx
callq 0x2060
cmpb $0x0, 0x73d7(%rip)      # 0xa3c0
jne 0x3037
leaq 0x23df(%rip), %rdi      # 0x53d1
callq 0x2030
testq %rax, %rax
je 0x3015
movq %rax, %rdi
callq 0x2160
leaq 0x73b5(%rip), %rdi      # 0xa3c0
movq %rax, %rsi
callq 0x3a99
jmp 0x3037
callq 0x3ad7
movq %rdx, %r15
movq %rdx, %rdi
callq 0x20a0
leaq 0x7394(%rip), %rdi      # 0xa3c0
movq %r15, %rsi
movq %rax, %rdx
callq 0x2060
cmpl $0x0, 0x6342(%rip)      # 0x9380
je 0x3065
callq 0x3b0c
movq %rax, %rdi
callq 0x2070
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x6318(%rip)      # 0x9384
je 0x30b5
callq 0x3b0c
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b58
movq (%rbx), %rbx
callq 0x3b0c
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b58
movq 0x8(%r14), %rdx
leaq 0x2336(%rip), %rdi      # 0x53dc
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20c0
jmp 0x3050
cmpl $0x0, 0x62cc(%rip)      # 0x9388
je 0x30cf
leaq 0x72fb(%rip), %rdi      # 0xa3c0
callq 0x3bbf
jmp 0x3045
cmpl $0x0, 0x62ba(%rip)      # 0x9390
je 0x3139
callq 0x3b0c
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b58
movq (%rbx), %rbx
leaq 0x72c9(%rip), %r14      # 0xa3c0
movq %r14, %rdi
callq 0x3bbf
movq %rax, %rdi
callq 0x3c13
movq %rdx, %r12
movq %r14, %rdi
callq 0x3bbf
movq %rax, %rdi
callq 0x3c13
leaq 0x22ce(%rip), %rdi      # 0x53ef
xorl %r15d, %r15d
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x20c0
jmp 0x3050
cmpl $0x0, 0x624c(%rip)      # 0x938c
je 0x314c
callq 0x3c7d
jmp 0x3045
cmpb $0x1, 0x621d(%rip)      # 0x9370
je 0x3212
cmpb $0x1, 0x620c(%rip)      # 0x936c
je 0x321c
cmpb $0x1, 0x61ef(%rip)      # 0x935c
jne 0x3176
movb $0x1, 0x61de(%rip)      # 0x9354
cmpb $0x1, 0x61e3(%rip)      # 0x9360
jne 0x3186
movb $0x1, 0x61ca(%rip)      # 0x9350
testq %r12, %r12
je 0x3226
cmpb $0x1, 0x61ce(%rip)      # 0x9364
jne 0x31c3
movb $0x1, 0x8221(%rip)      # 0xb3c0
xorl %r15d, %r15d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3230
testl %eax, %eax
je 0x3050
movq %r12, %rdi
callq 0x2336
jmp 0x2fab
subl %r13d, %ebx
movslq %r13d, %rax
leaq (%r14,%rax,8), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq 0x3230
movl $0x1, %r15d
testl %eax, %eax
je 0x3050
movq 0x4e04(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x1e8e(%rip), %rsi      # 0x5084
movq %r12, %rdx
jmp 0x2f53
callq 0x22ae
jmp 0x2fab
callq 0x22d0
jmp 0x2fab
callq 0x22f2
jmp 0x3159
callq 0x2314
jmp 0x3166
callq 0x2372
jmp 0x2fab