// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, (%rsp)
cmpl $0x0, 0x18(%rdi)
je 0x271ae
leaq 0x3a07d(%rip), %rax     # 0x611d0
movq (%rax), %rcx
testq %rcx, %rcx
je 0x272d1
leaq 0x3a10a(%rip), %rax     # 0x61270
movq (%rax), %r8
movq (%rsp), %rax
movq 0x20(%rax), %r9
leaq 0x10f46(%rip), %rdx     # 0x380be
leaq 0x20(%rsp), %r14
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
xorl %eax, %eax
callq 0x4150
movq %r14, %rdi
callq 0x4340
movq %rax, %r15
leaq 0xfb05(%rip), %rsi      # 0x36ca3
movq %rax, %rdi
callq 0x42e0
movq %rax, %r14
jmp 0x272d7
leaq 0x3a0b3(%rip), %rax     # 0x61268
cmpq $0x0, (%rax)
je 0x27335
movq %rbx, 0x10(%rsp)
movl %r12d, 0xc(%rsp)
leaq 0x3a090(%rip), %r12     # 0x61260
leaq 0xa963(%rip), %rbx      # 0x31b3a
leaq 0xfac5(%rip), %rbp      # 0x36ca3
xorl %r14d, %r14d
movq (%rsp), %rax
movq 0x20(%rax), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0x10ee9(%rip), %rdx     # 0x380e6
xorl %eax, %eax
callq 0x4150
movq (%r12), %rax
movq %r14, 0x18(%rsp)
movq (%rax,%r14,8), %rdi
movq %rbx, %rsi
callq 0x2e548
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x2e548
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rsi
callq 0x42e0
testq %rax, %rax
jne 0x2733d
movq %r15, %rdi
callq 0x4040
movq (%rsp), %r14
movq (%r12), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq %rbx, %rsi
callq 0x2e548
movq %rax, %r13
movq 0x20(%r14), %rsi
movq %rax, %rdi
callq 0x2e548
movq %rax, %rbx
movq %rax, %rdi
movq %rbp, %r15
movq %rbp, %rsi
callq 0x42e0
testq %rax, %rax
jne 0x27342
movq %rbx, %r13
movq %rbx, %rdi
callq 0x4040
movq 0x18(%rsp), %r14
incq %r14
leaq 0x39fc6(%rip), %rax     # 0x61268
cmpq (%rax), %r14
leaq 0x39fb4(%rip), %r12     # 0x61260
leaq 0xa887(%rip), %rbx      # 0x31b3a
movq %r15, %rbp
jb 0x271e1
xorl %r14d, %r14d
movl 0xc(%rsp), %r12d
movq 0x10(%rsp), %rbx
movq %r13, %r15
jmp 0x2735a
xorl %r14d, %r14d
xorl %r15d, %r15d
testq %r14, %r14
jne 0x27326
leaq 0x39f8d(%rip), %rax     # 0x61270
movq (%rax), %rcx
movq (%rsp), %rax
movq 0x20(%rax), %r8
leaq 0x10dcc(%rip), %rdx     # 0x380c1
leaq 0x20(%rsp), %r14
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
xorl %eax, %eax
callq 0x4150
movq %r14, %rdi
callq 0x4340
movq %rax, %r15
leaq 0xf988(%rip), %rsi      # 0x36ca3
movq %rax, %rdi
callq 0x42e0
movq %rax, %r14
testq %r14, %r14
jne 0x2735f
leaq 0x20(%rsp), %rdi
callq 0x481b
xorl %r14d, %r14d
xorl %r15d, %r15d
jmp 0x2735a
movq %rax, %r14
jmp 0x27348
movq %rax, %r14
movq %rbx, %r15
movq %r13, %rdi
callq 0x4040
movl 0xc(%rsp), %r12d
movq 0x10(%rsp), %rbx
testq %r14, %r14
je 0x273a7
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x264e5
testl %eax, %eax
je 0x2738e
movq %r15, %rdi
callq 0x4040
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdi
movq 0x20(%rdi), %rdx
leaq 0x10d83(%rip), %rsi     # 0x38120
movq %r15, %rcx
xorl %eax, %eax
callq 0x13aa3
movq (%rsp), %rdi
callq 0x483f