// File: /workspace/github_c_makefile_star2_O0/darwin-on-arm[P]darwin-sdk/xcode_tools/xcrun/xcrun.c
// Function: get_developer_path
static int get_developer_path(char *path)
{
	FILE *fp;
	int len = 0;
	char *home_path, *dev_path;
	char cfg_path[PATH_MAX] = { 0 };

	verbose_printf(stdout, "xcrun: info: attempting to retrieve developer path from DEVELOPER_DIR...\n");

	if ((dev_path = getenv("DEVELOPER_DIR")) != NULL) {
		verbose_printf(stdout, "xcrun: info: using developer path \'%s\' from DEVELOPER_DIR.\n", dev_path);
		len = strlen(dev_path);
		strncpy(path, dev_path, len);
		return len;
	}

	verbose_printf(stdout, "xcrun: info: attempting to retrieve developer path from configuration cache...\n");
	if ((home_path = getenv("HOME")) == NULL) {
		fprintf(stderr, "xcrun: error: failed to read HOME variable.\n");
		return len;
	}

	strcat(cfg_path, home_path);
	strcat(cfg_path, "/");
	strcat(cfg_path, SDK_CFG);

	if ((fp = fopen(cfg_path, "r")) != NULL) {
		fseek(fp, 0, SEEK_END);
		int fsize = ftell(fp);
		fseek(fp, SEEK_SET, 0);
		len = fread(path, fsize, 1, fp);
		fclose(fp);
	} else {
		fprintf(stderr, "xcrun: error: unable to read configuration cache. (%s)\n", strerror(errno));
		return len;
	}

	verbose_printf(stdout, "xcrun: info: using developer path \'%s\' from configuration cache.\n", path);

	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1040, %rsp           # imm = 0x1040
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x1030(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x20c0
movq 0x5538(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
leaq 0x2623(%rip), %rsi      # 0x50bd
movb $0x0, %al
callq 0x3c00
leaq 0x265f(%rip), %rdi      # 0x5107
callq 0x2030
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x2afb
movq 0x550a(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
leaq 0x2649(%rip), %rsi      # 0x5115
movb $0x0, %al
callq 0x3c00
movq -0x30(%rbp), %rdi
callq 0x2090
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x2060
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2c55
movq 0x54c6(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
leaq 0x2645(%rip), %rsi      # 0x5151
movb $0x0, %al
callq 0x3c00
leaq 0x2687(%rip), %rdi      # 0x51a1
callq 0x2030
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x2b4c
movq 0x54c8(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x266c(%rip), %rsi      # 0x51a6
movb $0x0, %al
callq 0x2120
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2c55
leaq -0x1030(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x21b0
leaq -0x1030(%rbp), %rdi
leaq 0x2669(%rip), %rsi      # 0x51d3
callq 0x21b0
leaq -0x1030(%rbp), %rdi
leaq 0x2658(%rip), %rsi      # 0x51d5
callq 0x21b0
leaq -0x1030(%rbp), %rdi
leaq 0x2474(%rip), %rsi      # 0x5004
callq 0x2180
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x2bf6
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x2160
movq -0x18(%rbp), %rdi
callq 0x2130
movl %eax, -0x1034(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x2160
movq -0x10(%rbp), %rdi
movslq -0x1034(%rbp), %rsi
movq -0x18(%rbp), %rcx
movl $0x1, %edx
callq 0x2070
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2080
jmp 0x2c33
movq 0x53fb(%rip), %rax      # 0x7ff8
movq (%rax), %rax
movq %rax, -0x1040(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x21f0
movq -0x1040(%rbp), %rdi
movq %rax, %rdx
leaq 0x25bc(%rip), %rsi      # 0x51e0
movb $0x0, %al
callq 0x2120
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2c55
movq 0x538e(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x25d0(%rip), %rsi      # 0x5218
movb $0x0, %al
callq 0x3c00
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1040, %rsp           # imm = 0x1040
popq %rbp
retq
nopw %cs:(%rax,%rax)