// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/parse/use.c
// Function: readuse
void
readuse(Node *use, Stab *st, Vis vis)
{
	size_t i;
	FILE *fd;
	char *t, *p;
	char buf[512];

	/* local (quoted) uses are always relative to the output */
	fd = NULL;
	p = NULL;
	if (use->use.islocal) {
		fd = NULL;
		if (objdir) {
			snprintf(buf,sizeof buf, "%s/%s/%s.use", objdir, localincpath, use->use.name);
			p = strdup(buf);
			fd = fopen(p, "r");
		}
		if (!fd) {
			snprintf(buf,sizeof buf, "%s/%s.use", localincpath, use->use.name);
			p = strdup(buf);
			fd = fopen(p, "r");
		}
		if (!fd) {
			fprintf(stderr, "could not open usefile %s\n", buf);
			exit(1);
		}
	/* nonlocal (barename) uses are always searched on the include path */
	} else {
		for (i = 0; i < nincpaths; i++) {
			snprintf(buf, sizeof buf, "lib%s.use", use->use.name);
			t = strjoin(incpaths[i], "/");
			p = strjoin(t, buf);
			fd = fopen(p, "r");
			if (fd) {
				free(t);
				break;
			}
			free(p);

			t = strjoin(incpaths[i], "/");
			p = strjoin(t, use->use.name);
			fd = fopen(p, "r");
			if (fd) {
				free(t);
				break;
			}
			free(p);
		}
		if (!fd) {
			fprintf(stderr, "could not open usefile %s in search path:\n", use->use.name);
			for (i = 0; i < nincpaths; i++)
				fprintf(stderr, "\t%s\n", incpaths[i]);
			exit(1);
		}
	}

	if (!loaduse(p, fd, st, vis))
		fatal(use, "unable to load %s (full path: %s)", use->use.name, p);
	free(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x3e2ff
movq $0x0, -0x28(%rbp)
leaq 0x3eadd(%rip), %rax     # 0x7ccf0
cmpq $0x0, (%rax)
je 0x3e273
leaq -0x240(%rbp), %rdi
leaq 0x3eac9(%rip), %rax     # 0x7ccf0
movq (%rax), %rcx
leaq 0x3eb5f(%rip), %rax     # 0x7cd90
movq (%rax), %r8
movq -0x8(%rbp), %rax
movq 0x20(%rax), %r9
movl $0x200, %esi            # imm = 0x200
leaq 0x16262(%rip), %rdx     # 0x544aa
movb $0x0, %al
callq 0x6130
leaq -0x240(%rbp), %rdi
callq 0x6330
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x14a17(%rip), %rsi     # 0x52c81
callq 0x62d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3e2ca
leaq -0x240(%rbp), %rdi
leaq 0x3eb08(%rip), %rax     # 0x7cd90
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %r8
movl $0x200, %esi            # imm = 0x200
leaq 0x1620e(%rip), %rdx     # 0x544ad
movb $0x0, %al
callq 0x6130
leaq -0x240(%rbp), %rdi
callq 0x6330
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x149c0(%rip), %rsi     # 0x52c81
callq 0x62d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3e2fa
movq 0x20d18(%rip), %rax     # 0x5eff0
movq (%rax), %rdi
leaq -0x240(%rbp), %rdx
leaq 0x161ce(%rip), %rsi     # 0x544b7
movb $0x0, %al
callq 0x6230
movl $0x1, %edi
callq 0x6310
jmp 0x3e49f
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x3ea76(%rip), %rcx     # 0x7cd88
cmpq (%rcx), %rax
jae 0x3e41c
leaq -0x240(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x1619c(%rip), %rdx     # 0x544d2
movb $0x0, %al
callq 0x6130
leaq 0x3ea3c(%rip), %rax     # 0x7cd80
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xf791(%rip), %rsi      # 0x4dae7
callq 0x4a3d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x4a3d0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x14903(%rip), %rsi     # 0x52c81
callq 0x62d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3e39c
movq -0x30(%rbp), %rdi
callq 0x6040
jmp 0x3e41c
movq -0x38(%rbp), %rdi
callq 0x6040
leaq 0x3e9d4(%rip), %rax     # 0x7cd80
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xf729(%rip), %rsi      # 0x4dae7
callq 0x4a3d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x4a3d0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x1489a(%rip), %rsi     # 0x52c81
callq 0x62d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3e402
movq -0x30(%rbp), %rdi
callq 0x6040
jmp 0x3e41c
movq -0x38(%rbp), %rdi
callq 0x6040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3e307
cmpq $0x0, -0x28(%rbp)
jne 0x3e49d
movq 0x20bc6(%rip), %rax     # 0x5eff0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x160a0(%rip), %rsi     # 0x544dc
movb $0x0, %al
callq 0x6230
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x3e932(%rip), %rcx     # 0x7cd88
cmpq (%rcx), %rax
jae 0x3e493
movq 0x20b8e(%rip), %rax     # 0x5eff0
movq (%rax), %rdi
leaq 0x3e914(%rip), %rax     # 0x7cd80
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x16089(%rip), %rsi     # 0x54507
movb $0x0, %al
callq 0x6230
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3e44b
movl $0x1, %edi
callq 0x6310
jmp 0x3e49f
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
callq 0x3d130
cmpl $0x0, %eax
jne 0x3e4d6
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x38(%rbp), %rcx
leaq 0x1603d(%rip), %rsi     # 0x5450c
movb $0x0, %al
callq 0x1dfe0
movq -0x38(%rbp), %rdi
callq 0x6040
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopl (%rax,%rax)