// File: /workspace/github_c_makefile_star2_O3/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, 0x4(%rsp)
movl %r15d, 0x670b(%rip)     # 0x9390
movl %r15d, 0x6700(%rip)     # 0x938c
movl %r15d, 0x66f5(%rip)     # 0x9388
movl %r15d, 0x66ea(%rip)     # 0x9384
movl %r15d, 0x66df(%rip)     # 0x9380
movl %r15d, 0x66d4(%rip)     # 0x937c
movl %r15d, 0x66c9(%rip)     # 0x9378
movl %r15d, 0x66be(%rip)     # 0x9374
movb %r15b, 0x66b3(%rip)     # 0x9370
movb %r15b, 0x66a8(%rip)     # 0x936c
movb %r15b, 0x669d(%rip)     # 0x9368
movb %r15b, 0x6692(%rip)     # 0x9364
movb %r15b, 0x6687(%rip)     # 0x9360
movb %r15b, 0x667c(%rip)     # 0x935c
movb %r15b, 0x6671(%rip)     # 0x9358
cmpl $0x1, %edi
jle 0x2e7c
movq %rsi, %r14
movl %edi, %ebx
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0x2e6a
cmpb $0x0, 0x1(%rdi)
je 0x2e86
cmpb $0x2d, 0x1(%rdi)
jne 0x2d1c
cmpb $0x0, 0x2(%rdi)
je 0x2e86
xorl %r12d, %r12d
leaq 0x4(%rsp), %rbp
leaq 0x22ed(%rip), %r13      # 0x5018
movq %r14, 0x8(%rsp)
movl %ebx, %edi
movq %r14, %rsi
leaq 0x25cf(%rip), %rdx      # 0x530b
leaq 0x53ed(%rip), %rcx      # 0x8130
movq %rbp, %r8
callq 0x20f0
movl %eax, %r15d
leal -0x66(%r15), %eax
cmpl $0x10, %eax
ja 0x2d6d
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movb $0x1, 0x6608(%rip)      # 0x9370
jmp 0x2e55
testl %r15d, %r15d
je 0x2dac
cmpl $-0x1, %r15d
je 0x2e7a
movb $0x1, 0x65d5(%rip)      # 0x9358
jmp 0x2e55
movb $0x1, 0x65dd(%rip)      # 0x936c
jmp 0x2e55
movb $0x1, 0x65c1(%rip)      # 0x935c
jmp 0x2e55
movb $0x1, 0x65b9(%rip)      # 0x9360
jmp 0x2e55
movl 0x4(%rsp), %eax
cmpl $0x4, %eax
je 0x2df4
cmpl $0x3, %eax
jne 0x2e55
movq 0x520b(%rip), %rax      # 0x7fd0
movq (%rax), %r14
movb (%r14), %al
cmpb $0x2d, %al
je 0x31f2
incl %r12d
cmpb $0x2f, %al
jne 0x2e2a
movq %r14, %rdi
callq 0x3a12
cmpl $-0x1, %eax
je 0x2f80
movq %r14, 0x65a6(%rip)      # 0x9398
jmp 0x2e50
movq 0x51d5(%rip), %rax      # 0x7fd0
movq (%rax), %r14
movb (%r14), %al
cmpb $0x2d, %al
je 0x31e8
incl %r12d
cmpb $0x2f, %al
jne 0x2e3a
movq %r14, %rdi
callq 0x3a12
cmpl $-0x1, %eax
je 0x2f80
movq %r14, 0x7588(%rip)      # 0xa3b0
jmp 0x2e50
movb $0x1, 0x656f(%rip)      # 0x93a0
leaq 0x6578(%rip), %rdi      # 0x93b0
jmp 0x2e48
movb $0x1, 0x7577(%rip)      # 0xa3b8
leaq 0x7578(%rip), %rdi      # 0xa3c0
movq %r14, %rsi
callq 0x3a71
movq 0x8(%rsp), %r14
incl %r12d
cmpl $0x66, %r15d
je 0x2e7a
cmpl $0x72, %r15d
jne 0x2d30
jmp 0x2eb9
callq 0x2160
movq %rax, %rdi
movl $0x1, %r12d
jmp 0x2eb9
jmp 0x2eb9
callq 0x23fa
jmp 0x303a
callq 0x23db
jmp 0x3037
leaq 0x64cd(%rip), %rax      # 0x9364
jmp 0x2ea0
leaq 0x64c8(%rip), %rax      # 0x9368
movb $0x1, (%rax)
movq 0x5126(%rip), %rax      # 0x7fd0
movq (%rax), %rdi
callq 0x2160
movq %rax, %rdi
addl $0x2, %r12d
movq 0x5108(%rip), %rax      # 0x7fc8
movslq (%rax), %rcx
cmpl %ebx, %ecx
jge 0x2ef7
movb 0x6497(%rip), %dl       # 0x9364
andb 0x6495(%rip), %dl       # 0x9368
testq %rdi, %rdi
setne %sil
orb %dl, %sil
testb $0x1, %sil
jne 0x2ef7
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movq (%r14,%rcx,8), %rdi
callq 0x2160
movq %rax, %rdi
incl %r12d
movb 0x6463(%rip), %al       # 0x9360
orb 0x6459(%rip), %al       # 0x935c
testb $0x1, %al
je 0x2f0c
testq %rdi, %rdi
je 0x2f7b
cmpb $0x1, 0x6445(%rip)      # 0x9358
je 0x2f8b
cmpl $0x0, 0x6458(%rip)      # 0x9374
je 0x2f45
movq 0x509b(%rip), %rax      # 0x7fc0
movq (%rax), %rdi
leaq 0x2a31(%rip), %rsi      # 0x5960
leaq 0x2a3c(%rip), %rdx      # 0x5972
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2130
jmp 0x303a
cmpb $0x0, 0x6464(%rip)      # 0x93b0
jne 0x2fc0
movq %rdi, %r13
leaq 0x245f(%rip), %rdi      # 0x53b7
callq 0x2030
testq %rax, %rax
je 0x2f95
movq %rax, %rdi
callq 0x2160
leaq 0x643f(%rip), %rdi      # 0x93b0
movq %rax, %rsi
callq 0x3a71
jmp 0x2fbd
callq 0x23b9
movl $0x1, %r15d
jmp 0x303a
callq 0x2394
jmp 0x3037
callq 0x3aaf
movq %r14, %r15
movq %rax, %r14
movq %rax, %rdi
callq 0x20a0
leaq 0x6401(%rip), %rdi      # 0x93b0
movq %r14, %rsi
movq %r15, %r14
movq %rax, %rdx
callq 0x2060
movq %r13, %rdi
cmpb $0x0, 0x73f9(%rip)      # 0xa3c0
jne 0x3021
movq %rdi, %r13
leaq 0x23fb(%rip), %rdi      # 0x53ce
callq 0x2030
testq %rax, %rax
je 0x2ff6
movq %rax, %rdi
callq 0x2160
leaq 0x73d4(%rip), %rdi      # 0xa3c0
movq %rax, %rsi
callq 0x3a71
jmp 0x301e
callq 0x3aaf
movq %r14, %r15
movq %rdx, %r14
movq %rdx, %rdi
callq 0x20a0
leaq 0x73b0(%rip), %rdi      # 0xa3c0
movq %r14, %rsi
movq %r15, %r14
movq %rax, %rdx
callq 0x2060
movq %r13, %rdi
cmpl $0x0, 0x6358(%rip)      # 0x9380
je 0x304f
callq 0x3ae4
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, 0x632e(%rip)      # 0x9384
je 0x309f
callq 0x3ae4
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b30
movq (%rbx), %rbx
callq 0x3ae4
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b30
movq 0x8(%r14), %rdx
leaq 0x2349(%rip), %rdi      # 0x53d9
xorl %r15d, %r15d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20c0
jmp 0x303a
cmpl $0x0, 0x62e2(%rip)      # 0x9388
je 0x30b9
leaq 0x7311(%rip), %rdi      # 0xa3c0
callq 0x3b94
jmp 0x302f
cmpl $0x0, 0x62d0(%rip)      # 0x9390
je 0x3123
callq 0x3ae4
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b30
movq (%rbx), %rbx
leaq 0x72df(%rip), %r14      # 0xa3c0
movq %r14, %rdi
callq 0x3b94
movq %rax, %rdi
callq 0x3be8
movq %rdx, %r12
movq %r14, %rdi
callq 0x3b94
movq %rax, %rdi
callq 0x3be8
leaq 0x22e1(%rip), %rdi      # 0x53ec
xorl %r15d, %r15d
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x20c0
jmp 0x303a
cmpl $0x0, 0x6262(%rip)      # 0x938c
je 0x3136
callq 0x3c52
jmp 0x302f
cmpb $0x1, 0x6233(%rip)      # 0x9370
je 0x31fc
cmpb $0x1, 0x6222(%rip)      # 0x936c
je 0x320c
cmpb $0x1, 0x6205(%rip)      # 0x935c
jne 0x3160
movb $0x1, 0x61f4(%rip)      # 0x9354
cmpb $0x1, 0x61f9(%rip)      # 0x9360
jne 0x3170
movb $0x1, 0x61e0(%rip)      # 0x9350
testq %rdi, %rdi
je 0x321c
cmpb $0x1, 0x61e4(%rip)      # 0x9364
jne 0x31ad
movb $0x1, 0x8237(%rip)      # 0xb3c0
xorl %r15d, %r15d
xorl %esi, %esi
xorl %edx, %edx
movq %rdi, %rbx
callq 0x3226
testl %eax, %eax
je 0x303a
movq %rbx, %rdi
callq 0x2336
jmp 0x2f80
subl %r12d, %ebx
movslq %r12d, %rax
leaq (%r14,%rax,8), %rdx
movl %ebx, %esi
movq %rdi, %rbx
callq 0x3226
movl $0x1, %r15d
testl %eax, %eax
je 0x303a
movq 0x4e1a(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x1ea4(%rip), %rsi      # 0x5084
movq %rbx, %rdx
jmp 0x2f39
callq 0x22d0
jmp 0x2f80
callq 0x22ae
jmp 0x2f80
movq %rdi, %r15
callq 0x22f2
movq %r15, %rdi
jmp 0x3143
movq %rdi, %r15
callq 0x2314
movq %r15, %rdi
jmp 0x3150
callq 0x2372
jmp 0x2f80