// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x4(%rsp)
andl $0x0, 0x5ace(%rip)      # 0x8390
andl $0x0, 0x5ac3(%rip)      # 0x838c
andl $0x0, 0x5ab8(%rip)      # 0x8388
andl $0x0, 0x5aad(%rip)      # 0x8384
andl $0x0, 0x5aa2(%rip)      # 0x8380
andl $0x0, 0x5a97(%rip)      # 0x837c
andl $0x0, 0x5a8c(%rip)      # 0x8378
andl $0x0, 0x5a81(%rip)      # 0x8374
xorl %r12d, %r12d
movb %r12b, 0x5a73(%rip)     # 0x8370
movb %r12b, 0x5a68(%rip)     # 0x836c
movb %r12b, 0x5a5d(%rip)     # 0x8368
movb %r12b, 0x5a52(%rip)     # 0x8364
movb %r12b, 0x5a47(%rip)     # 0x8360
movb %r12b, 0x5a3c(%rip)     # 0x835c
movb %r12b, 0x5a31(%rip)     # 0x8358
cmpl $0x1, %edi
jg 0x2936
callq 0x36ed
jmp 0x2b4d
movq %rsi, %r14
movl %edi, %ebx
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0x2aac
cmpb $0x0, 0x1(%rdi)
je 0x2b18
cmpb $0x2d, 0x1(%rdi)
jne 0x2962
cmpb $0x0, 0x2(%rdi)
je 0x2b18
xorl %r15d, %r15d
pushq $0x1
popq %r12
leaq 0x16a8(%rip), %rbp      # 0x4018
movl %ebx, %edi
movq %r14, %rsi
leaq 0x198f(%rip), %rdx      # 0x430b
leaq 0x47ad(%rip), %rcx      # 0x7130
leaq 0x4(%rsp), %r8
callq 0x20f0
movl %eax, %r13d
leal -0x66(%r13), %eax
cmpl $0x10, %eax
ja 0x29ac
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movb $0x1, 0x59c6(%rip)      # 0x8370
jmp 0x29dd
testl %r13d, %r13d
je 0x29f5
cmpl $-0x1, %r13d
je 0x2b98
movb $0x1, 0x5996(%rip)      # 0x8358
jmp 0x29dd
movb $0x1, 0x59a1(%rip)      # 0x836c
jmp 0x29dd
movb $0x1, 0x5988(%rip)      # 0x835c
jmp 0x29dd
movb $0x1, 0x5983(%rip)      # 0x8360
incl %r15d
cmpl $0x66, %r13d
je 0x2b98
cmpl $0x72, %r13d
jne 0x2970
jmp 0x2ab8
movl 0x4(%rsp), %eax
cmpl $0x4, %eax
je 0x2a42
cmpl $0x3, %eax
jne 0x29dd
movq 0x45c6(%rip), %rax      # 0x6fd0
movq (%rax), %rsi
movb (%rsi), %al
cmpb $0x2d, %al
je 0x2e59
incl %r15d
cmpb $0x2f, %al
jne 0x2a84
movq %rsi, %rdi
movq %rsi, 0x8(%rsp)
callq 0x370c
cmpl $-0x1, %eax
je 0x2b4d
movq 0x8(%rsp), %rax
movq %rax, 0x5958(%rip)      # 0x8398
jmp 0x29dd
movq 0x4587(%rip), %rax      # 0x6fd0
movq (%rax), %rsi
movb (%rsi), %al
cmpb $0x2d, %al
je 0x2e44
incl %r15d
cmpb $0x2f, %al
jne 0x2a94
movq %rsi, %rdi
movq %rsi, 0x8(%rsp)
callq 0x370c
cmpl $-0x1, %eax
je 0x2b4d
movq 0x8(%rsp), %rax
movq %rax, 0x6931(%rip)      # 0x93b0
jmp 0x29dd
movb $0x1, 0x5915(%rip)      # 0x83a0
leaq 0x591e(%rip), %rdi      # 0x83b0
jmp 0x2aa2
movb $0x1, 0x691d(%rip)      # 0x93b8
leaq 0x691e(%rip), %rdi      # 0x93c0
callq 0x3794
jmp 0x29dd
pushq $0x1
popq %r15
callq 0x2160
movq %rax, %rdi
movq 0x4509(%rip), %rax      # 0x6fc8
movslq (%rax), %rcx
cmpl %ebx, %ecx
jge 0x2af6
movb 0x5898(%rip), %dl       # 0x8364
andb 0x5896(%rip), %dl       # 0x8368
testq %rdi, %rdi
setne %sil
orb %dl, %sil
testb $0x1, %sil
jne 0x2af6
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movq (%r14,%rcx,8), %rdi
callq 0x2160
movq %rax, %rdi
incl %r15d
movb 0x5864(%rip), %al       # 0x8360
orb 0x585a(%rip), %al       # 0x835c
testb $0x1, %al
je 0x2b0f
testq %rdi, %rdi
je 0x2b9d
cmpb $0x1, 0x5842(%rip)      # 0x8358
jne 0x2b22
callq 0x36ed
xorl %r12d, %r12d
jmp 0x2b4d
cmpl $0x0, 0x584b(%rip)      # 0x8374
je 0x2b62
movq 0x448e(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
leaq 0x1e24(%rip), %rsi      # 0x4960
leaq 0x1e2f(%rip), %rdx      # 0x4972
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x2130
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x5847(%rip)      # 0x83b0
jne 0x2be4
movq %rdi, %r13
leaq 0x1842(%rip), %rdi      # 0x43b7
callq 0x2030
testq %rax, %rax
je 0x2bbf
movq %rax, %rdi
callq 0x2160
leaq 0x5822(%rip), %rdi      # 0x83b0
movq %rax, %rsi
callq 0x3794
jmp 0x2be1
jmp 0x2ab8
movq 0x444c(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
leaq 0x17ca(%rip), %rdi      # 0x4378
pushq $0x3e
popq %rsi
pushq $0x1
popq %rdx
callq 0x21f0
pushq $0x1
popq %r12
jmp 0x2b4d
callq 0x37d0
movq %rax, %r12
movq %rax, %rdi
callq 0x20a0
leaq 0x57da(%rip), %rdi      # 0x83b0
movq %r12, %rsi
movq %rax, %rdx
callq 0x2060
movq %r13, %rdi
cmpb $0x0, 0x67d5(%rip)      # 0x93c0
jne 0x2c3f
movq %rdi, %r13
leaq 0x17d7(%rip), %rdi      # 0x43ce
callq 0x2030
testq %rax, %rax
je 0x2c1a
movq %rax, %rdi
callq 0x2160
leaq 0x67b0(%rip), %rdi      # 0x93c0
movq %rax, %rsi
callq 0x3794
jmp 0x2c3c
callq 0x37d0
movq %rdx, %r12
movq %rdx, %rdi
callq 0x20a0
leaq 0x678f(%rip), %rdi      # 0x93c0
movq %r12, %rsi
movq %rax, %rdx
callq 0x2060
movq %r13, %rdi
cmpl $0x0, 0x573a(%rip)      # 0x8380
je 0x2c5a
callq 0x3838
movq %rax, %rdi
callq 0x2070
jmp 0x2b1d
cmpl $0x0, 0x5723(%rip)      # 0x8384
je 0x2cad
callq 0x3838
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x38a5
movq (%rbx), %rbx
callq 0x3838
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x38a5
movq 0x8(%r14), %rdx
leaq 0x173e(%rip), %rdi      # 0x43d9
xorl %r12d, %r12d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20c0
jmp 0x2b4d
cmpl $0x0, 0x56d4(%rip)      # 0x8388
je 0x2cf2
leaq 0x6703(%rip), %rdi      # 0x93c0
callq 0x3939
jmp 0x2c4d
leaq 0x5699(%rip), %rax      # 0x8364
jmp 0x2cd4
leaq 0x5694(%rip), %rax      # 0x8368
movb $0x1, (%rax)
movq 0x42f2(%rip), %rax      # 0x6fd0
movq (%rax), %rdi
callq 0x2160
movq %rax, %rdi
addl $0x2, %r15d
jmp 0x2ab8
cmpl $0x0, 0x5697(%rip)      # 0x8390
je 0x2d5c
callq 0x3838
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x38a5
movq (%rbx), %rbx
leaq 0x66a6(%rip), %r14      # 0x93c0
movq %r14, %rdi
callq 0x3939
movq %rax, %rdi
callq 0x39ae
movq %rdx, %r15
movq %r14, %rdi
callq 0x3939
movq %rax, %rdi
callq 0x39ae
leaq 0x16a8(%rip), %rdi      # 0x43ec
xorl %r12d, %r12d
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x20c0
jmp 0x2b4d
cmpl $0x0, 0x5629(%rip)      # 0x838c
je 0x2d6f
callq 0x3a45
jmp 0x2c4d
cmpb $0x1, 0x55fa(%rip)      # 0x8370
je 0x2e7a
cmpb $0x1, 0x55e9(%rip)      # 0x836c
je 0x2ea1
cmpb $0x1, 0x55cc(%rip)      # 0x835c
jne 0x2d99
movb $0x1, 0x55bb(%rip)      # 0x8354
cmpb $0x1, 0x55c0(%rip)      # 0x8360
jne 0x2da9
movb $0x1, 0x55a7(%rip)      # 0x8350
testq %rdi, %rdi
je 0x2ec8
cmpb $0x1, 0x55ab(%rip)      # 0x8364
jne 0x2e0b
movb $0x1, 0x75fe(%rip)      # 0xa3c0
xorl %r12d, %r12d
xorl %esi, %esi
xorl %edx, %edx
movq %rdi, %r14
callq 0x2ee0
testl %eax, %eax
je 0x2b4d
movq 0x4210(%rip), %rax      # 0x6ff0
movq (%rax), %rbx
callq 0x2050
movl (%rax), %edi
callq 0x2210
leaq 0x1692(%rip), %rsi      # 0x4488
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
jmp 0x2bb9
subl %r15d, %ebx
movslq %r15d, %rax
leaq (%r14,%rax,8), %rdx
movl %ebx, %esi
movq %rdi, %rbx
callq 0x2ee0
pushq $0x1
popq %r12
testl %eax, %eax
je 0x2b4d
movq 0x41be(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x1248(%rip), %rsi      # 0x4084
movq %rbx, %rdx
jmp 0x2b46
movq 0x41a5(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
leaq 0x14ef(%rip), %rdi      # 0x4344
pushq $0x33
jmp 0x2e6c
movq 0x4190(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
leaq 0x14ac(%rip), %rdi      # 0x4316
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x21f0
jmp 0x2b4d
movq 0x416f(%rip), %rax      # 0x6ff0
movq %rdi, %r12
movq (%rax), %rcx
leaq 0x1580(%rip), %rdi      # 0x440e
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x21f0
movq %r12, %rdi
jmp 0x2d7c
movq 0x4148(%rip), %rax      # 0x6ff0
movq %rdi, %r12
movq (%rax), %rcx
leaq 0x1586(%rip), %rdi      # 0x443b
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x21f0
movq %r12, %rdi
jmp 0x2d89
movq 0x4121(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
leaq 0x158d(%rip), %rdi      # 0x4466
pushq $0x21
jmp 0x2bb0