// File: /workspace/github_c_makefile_star2_O2/darwin-on-arm[P]darwin-sdk/xcode_tools/xcrun/xcrun.c
// Function: request_command
static int request_command(const char *name, int argc, char *argv[])
{
	char cmd[PATH_MAX] = { 0 };
	char search_string[PATH_MAX * 256] = { 0 };
	char *sdk_env, *toolch_name, *toolchain_env;

	/*
	 * If xcrun was called in a multicall state, we still want to specify current_sdk for SDKROOT and
	 * current_toolchain for PATH.
	 */
	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));
		}
	}

	/* No matter the circumstance, search the developer dir. */
	sprintf(search_string, "%s/usr/bin:", developer_dir);

	/* If we explicitly specified an sdk, search the sdk and it's associated toolchain. */
	if (explicit_sdk_mode == 1) {
		toolch_name = strdup(get_sdk_info(get_sdk_path(current_sdk)).toolchain);
		sprintf((search_string + strlen(search_string)), "%s/usr/bin:%s/usr/bin", get_sdk_path(current_sdk), get_toolchain_path(toolch_name));
		goto do_search;
	}

	/* If we explicitly specified a toolchain, only search the toolchain. */
	if (explicit_toolchain_mode == 1) {
		sprintf((search_string + strlen(search_string)), "%s/usr/bin", get_toolchain_path(current_toolchain));
		goto do_search;
	}

	/* If we explicitly specified an SDK, append it to the search string. */
	if (alternate_sdk_path != NULL) {
		sprintf((search_string + strlen(search_string)), "%s/usr/bin:", alternate_sdk_path);
		/* We also want to append an associated toolchain if this is really an SDK folder. */
		if (test_sdk_authenticity(alternate_sdk_path) == 1) {
			toolch_name = strdup(get_sdk_info(alternate_sdk_path).toolchain);
			sprintf((search_string + strlen(search_string)), "%s/usr/bin", get_toolchain_path(toolch_name));
			/* We now have a toolchain, so skip to search. */
			goto do_search;
		}
	}

	/* If we explicitly specified a toolchain, append it to the search string. */
	if (alternate_toolchain_path != NULL)
		sprintf((search_string + strlen(search_string)), "%s/usr/bin", alternate_toolchain_path);

	/* By default, we search our developer dir, our default sdk, and our default toolchain only. */
	if (explicit_sdk_mode == 0 && explicit_toolchain_mode == 0 && alternate_toolchain_path == NULL && alternate_sdk_path == NULL)
		sprintf((search_string + strlen(search_string)), "%s/usr/bin:%s/usr/bin", get_sdk_path(current_sdk), get_toolchain_path(current_toolchain));

	/* Search each path entry in search_string until we find our program. */
do_search:
	if (search_command(cmd, name, search_string) == 0) {
		if (finding_mode == 1) {
			if (access(cmd, (F_OK | X_OK)) == 0) {
				fprintf(stdout, "%s\n", cmd);
				return 0;
			} else {
				return -1;
			}
		} else {
			if (call_command(cmd, argc, argv) != 0) {
				fprintf(stderr, "xcrun: error: can't exec \'%s\' (%s)\n", cmd, strerror(errno));
				return -1;
			}
		}
	}

	/* We have searched everywhere, but we haven't found our program. State why. */
	fprintf(stderr, "xcrun: error: can't stat \'%s\' (%s)\n", name, strerror(errno));

	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1020b8, %rsp         # imm = 0x1020B8
movq %rdx, %r14
movl %esi, 0x14(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x10b0(%rsp), %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %esi, %esi
callq 0x20d0
leaq 0x20b0(%rsp), %rdi
movl $0x100000, %edx         # imm = 0x100000
xorl %esi, %esi
callq 0x20d0
cmpb $0x0, 0x5484(%rip)      # 0x83b0
jne 0x2f7a
leaq 0x1482(%rip), %rdi      # 0x43b7
callq 0x2030
testq %rax, %rax
je 0x2f58
movq %rax, %rdi
callq 0x2160
leaq 0x5462(%rip), %rdi      # 0x83b0
movq %rax, %rsi
callq 0x3794
jmp 0x2f7a
callq 0x37d0
movq %rax, %rbx
movq %rax, %rdi
callq 0x20a0
leaq 0x5441(%rip), %rdi      # 0x83b0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2060
cmpb $0x0, 0x643f(%rip)      # 0x93c0
jne 0x2fcf
leaq 0x1444(%rip), %rdi      # 0x43ce
callq 0x2030
testq %rax, %rax
je 0x2fad
movq %rax, %rdi
callq 0x2160
leaq 0x641d(%rip), %rdi      # 0x93c0
movq %rax, %rsi
callq 0x3794
jmp 0x2fcf
callq 0x37d0
movq %rdx, %rbx
movq %rdx, %rdi
callq 0x20a0
leaq 0x63fc(%rip), %rdi      # 0x93c0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2060
leaq 0x1b73(%rip), %rsi      # 0x4b49
leaq 0x4373(%rip), %rdx      # 0x7350
leaq 0x20b0(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x21d0
cmpb $0x1, 0x53aa(%rip)      # 0x83a0
movq %r14, 0x18(%rsp)
jne 0x3062
callq 0x3838
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x38a5
movq 0x10(%rbx), %rdi
callq 0x2200
movq %rax, %rbx
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %r14
addq $0x20b0, %r14           # imm = 0x20B0
callq 0x3838
movq %rax, %r12
movq %rbx, %rdi
callq 0x3939
leaq 0x1b08(%rip), %rsi      # 0x4b55
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x21d0
jmp 0x315e
cmpb $0x1, 0x634f(%rip)      # 0x93b8
jne 0x309e
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %rbx
addq $0x20b0, %rbx           # imm = 0x20B0
leaq 0x6336(%rip), %rdi      # 0x93c0
callq 0x3939
leaq 0x1aca(%rip), %rsi      # 0x4b60
movq %rbx, %rdi
jmp 0x3154
movq 0x52f3(%rip), %rbx      # 0x8398
testq %rbx, %rbx
je 0x3281
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %rdi
addq $0x20b0, %rdi           # imm = 0x20B0
leaq 0x1a7c(%rip), %rsi      # 0x4b49
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21d0
movq 0x52ba(%rip), %rdx      # 0x8398
leaq 0x1921(%rip), %rsi      # 0x4a06
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2180
cmpl $-0x1, %eax
je 0x3281
movq 0x5287(%rip), %rsi      # 0x8398
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x38a5
movq 0x10(%rbx), %rdi
callq 0x2200
movq %rax, %rbx
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %r14
addq $0x20b0, %r14           # imm = 0x20B0
movq %rbx, %rdi
callq 0x3939
leaq 0x1a0f(%rip), %rsi      # 0x4b60
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
leaq 0xb0(%rsp), %r12
leaq 0x1a46(%rip), %rbp      # 0x4bb3
leaq 0x1a79(%rip), %r14      # 0x4bed
pushq $0x1
popq %rbx
movq 0x20(%rsp), %r13
movl $0x1000, %edx           # imm = 0x1000
movq %r12, %rdi
xorl %esi, %esi
callq 0x20d0
movq %r15, %rdi
leaq 0x19be(%rip), %rsi      # 0x4b53
callq 0x21a0
testq %rax, %rax
je 0x35fe
movq %rax, %r15
movq 0x3e13(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x365c
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x21d0
movq %r12, %rdi
movl %ebx, %esi
callq 0x2180
movl $0x0, %r15d
testl %eax, %eax
jne 0x317c
movq 0x3dd2(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
leaq 0x19fb(%rip), %rsi      # 0x4bf3
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x365c
movq %rbx, %rdi
callq 0x20a0
leaq 0x10b0(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2060
cmpb $0x1, 0x7194(%rip)      # 0xa3c0
jne 0x3333
leaq 0x10b0(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x2180
testl %eax, %eax
je 0x324b
pushq $-0x1
popq %rbx
jmp 0x326d
movq 0x3d6e(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
leaq 0x118c(%rip), %rsi      # 0x43e8
xorl %ebx, %ebx
leaq 0x10b0(%rsp), %rdx
xorl %eax, %eax
callq 0x2130
movl %ebx, %eax
addq $0x1020b8, %rsp         # imm = 0x1020B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6128(%rip), %rbx      # 0x93b0
testq %rbx, %rbx
je 0x32c3
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %rdi
addq $0x20b0, %rdi           # imm = 0x20B0
leaq 0x18b4(%rip), %rsi      # 0x4b60
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21d0
cmpq $0x0, 0x60f2(%rip)      # 0x93b0
sete %al
jmp 0x32c5
movb $0x1, %al
cmpb $0x0, 0x50d4(%rip)      # 0x83a0
jne 0x315e
testb $0x1, 0x60df(%rip)      # 0x93b8
jne 0x315e
testb %al, %al
je 0x315e
cmpq $0x0, 0x50a9(%rip)      # 0x8398
jne 0x315e
leaq 0x20b0(%rsp), %rdi
callq 0x20a0
leaq (%rsp,%rax), %rbx
addq $0x20b0, %rbx           # imm = 0x20B0
callq 0x3838
movq %rax, %r14
leaq 0x60a4(%rip), %rdi      # 0x93c0
callq 0x3939
leaq 0x182d(%rip), %rsi      # 0x4b55
movq %rbx, %rdi
movq %r14, %rdx
jmp 0x3053
xorps %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
pushq $0x1
popq %r15
movl $0x1000, %edi           # imm = 0x1000
movq %r15, %rsi
callq 0x2110
movq %rax, %r14
movq %rax, 0xb0(%rsp)
movl $0x1000, %edi           # imm = 0x1000
movq %r15, %rsi
callq 0x2110
movq %rax, %r12
movq %rax, 0xb8(%rsp)
movl $0x1000, %edi           # imm = 0x1000
movq %r15, %rsi
callq 0x2110
movq %rax, %r13
movq %rax, 0xc0(%rsp)
movl $0x1000, %edi           # imm = 0x1000
movq %r15, %rsi
callq 0x2110
movq %rax, 0x30(%rsp)
movq %rax, 0xc8(%rsp)
movl $0xff, %edi
movq %r15, %rsi
callq 0x2110
movq %rax, 0x28(%rsp)
movq %rax, 0xd0(%rsp)
movl $0xff, %edi
movq %r15, %rsi
callq 0x2110
movq %rax, 0x8(%rsp)
movq %rax, 0xd8(%rsp)
movl $0x1000, %edi           # imm = 0x1000
movq %r15, %rsi
callq 0x2110
movq %rax, %rbp
movq %rax, 0xe0(%rsp)
callq 0x3838
leaq 0x1829(%rip), %rsi      # 0x4c25
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
leaq 0x5fb0(%rip), %r14      # 0x93c0
movq %r14, %rdi
callq 0x3939
movq %rax, %rbx
leaq 0x182c(%rip), %rdi      # 0x4c4e
callq 0x2030
leaq 0x1802(%rip), %rsi      # 0x4c30
leaq 0x3f1b(%rip), %rdx      # 0x7350
movq %r12, %rdi
movq %rdx, %r12
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x21d0
movq %r14, %rdi
callq 0x3939
leaq 0x17fc(%rip), %rsi      # 0x4c53
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
leaq 0xd36(%rip), %rdi       # 0x41a1
callq 0x2030
leaq 0x17f7(%rip), %rsi      # 0x4c6e
movq 0x30(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
leaq 0x17e9(%rip), %rsi      # 0x4c76
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x21d0
callq 0x3a45
testq %rax, %rax
jne 0x34c5
movq 0x3b45(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x17e3(%rip), %rsi      # 0x4c98
leaq 0x4ef4(%rip), %rdx      # 0x83b0
xorl %eax, %eax
callq 0x2130
jmp 0x34db
leaq 0x17bb(%rip), %rsi      # 0x4c87
movq 0x28(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
movq 0x18(%rsp), %r12
leaq 0x17fb(%rip), %rdi      # 0x4ce2
callq 0x2030
testq %rax, %rax
jne 0x3567
leaq 0x1823(%rip), %rdi      # 0x4d1b
callq 0x2030
testq %rax, %rax
jne 0x3555
callq 0x3838
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x38a5
movq 0x20(%rbx), %rdi
callq 0x2200
testq %rax, %rax
jne 0x354c
movq 0x3ac1(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x1817(%rip), %rsi      # 0x4d50
leaq 0x4e70(%rip), %rdx      # 0x83b0
xorl %eax, %eax
callq 0x2130
jmp 0x3625
cmpb $0x1, 0x6e75(%rip)      # 0xa3c8
jne 0x355e
leaq 0x17d8(%rip), %rsi      # 0x4d34
jmp 0x356e
cmpb $0x1, 0x6e5f(%rip)      # 0xa3c4
jne 0x357d
leaq 0x178f(%rip), %rsi      # 0x4cfd
movq 0x8(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21d0
cmpb $0x1, 0x4dcc(%rip)      # 0x8350
jne 0x35e2
movq 0x3a33(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
leaq 0x1805(%rip), %rsi      # 0x4d9c
leaq 0x10b0(%rsp), %rdx
xorl %eax, %eax
callq 0x3dbe
movslq 0x14(%rsp), %r14
leaq 0x180e(%rip), %rbx      # 0x4dc0
movq 0x3a07(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
cmpq %r14, %r15
jge 0x35d4
movq (%r12,%r15,8), %rdx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3dbe
incq %r15
jmp 0x35b2
leaq 0x17e9(%rip), %rsi      # 0x4dc4
xorl %eax, %eax
callq 0x3dbe
leaq 0x10b0(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
movq %r12, %rsi
callq 0x2100
testl %eax, %eax
jne 0x3625
movq 0x39eb(%rip), %rax      # 0x6ff0
movq (%rax), %rbx
callq 0x2050
movl (%rax), %edi
callq 0x2210
leaq 0x1574(%rip), %rsi      # 0x4b8f
movq %rbx, %rdi
movq 0x20(%rsp), %rdx
jmp 0x364d
movq 0x39c4(%rip), %rax      # 0x6ff0
movq (%rax), %rbx
callq 0x2050
movl (%rax), %edi
callq 0x2210
leaq 0x1529(%rip), %rsi      # 0x4b6b
leaq 0x10b0(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
jmp 0x3246