// File: /workspace/github_c_makefile_star2_O3/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, %rbp
movq %rdi, %r13
cmpl $0x0, 0x18(%rdi)
je 0x26d83
leaq 0x3a4f1(%rip), %rax     # 0x611d0
movq (%rax), %rcx
testq %rcx, %rcx
je 0x26d2f
leaq 0x3a582(%rip), %rax     # 0x61270
movq (%rax), %r8
movq 0x20(%r13), %r9
leaq 0x11392(%rip), %rdx     # 0x3808e
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 0xff91(%rip), %rsi      # 0x36cb3
movq %rax, %rdi
callq 0x42e0
testq %rax, %rax
jne 0x26d7b
leaq 0x3a53a(%rip), %rax     # 0x61270
movq (%rax), %rcx
movq 0x20(%r13), %r8
leaq 0x1134d(%rip), %rdx     # 0x38091
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 0xff49(%rip), %rsi      # 0x36cb3
movq %rax, %rdi
callq 0x42e0
testq %rax, %rax
je 0x26ef4
movq %rax, %r14
jmp 0x26ead
movq %rbp, 0x10(%rsp)
movl %r12d, 0x4(%rsp)
leaq 0x3a4d4(%rip), %rax     # 0x61268
cmpq $0x0, (%rax)
je 0x26e7e
leaq 0x3a4bb(%rip), %r15     # 0x61260
leaq 0xad9e(%rip), %r12      # 0x31b4a
xorl %ebx, %ebx
movq %r13, 0x8(%rsp)
movq 0x20(%r13), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0x112eb(%rip), %rdx     # 0x380b6
xorl %eax, %eax
callq 0x4150
movq (%r15), %rax
movq %rbx, 0x18(%rsp)
movq (%rax,%rbx,8), %rdi
movq %r12, %rsi
callq 0x2e0c8
movq %r13, %rbp
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x2e0c8
movq %rax, %rbx
movq %rax, %rdi
leaq 0xfeaf(%rip), %rsi      # 0x36cb3
callq 0x42e0
testq %rax, %rax
jne 0x26e86
movq %rbx, %rdi
callq 0x4040
movq (%r15), %rax
movq 0x18(%rsp), %rbx
movq (%rax,%rbx,8), %rdi
movq %r12, %rsi
callq 0x2e0c8
movq %rax, %r13
movq 0x20(%rbp), %rsi
movq %rax, %rdi
callq 0x2e0c8
movq %rax, %r15
movq %rax, %rdi
leaq 0xfe6d(%rip), %rsi      # 0x36cb3
callq 0x42e0
testq %rax, %rax
jne 0x26e93
movq %r15, %rdi
callq 0x4040
incq %rbx
leaq 0x3a406(%rip), %rax     # 0x61268
cmpq (%rax), %rbx
movq 0x8(%rsp), %r13
leaq 0x3a3ef(%rip), %r15     # 0x61260
leaq 0xacd2(%rip), %r12      # 0x31b4a
jb 0x26db3
movq %r13, %rdi
callq 0x47a3
movq %rax, %r14
movl 0x4(%rsp), %r12d
movq %rbx, %r15
jmp 0x26e9b
movq %rax, %r14
movl 0x4(%rsp), %r12d
movq %r13, %rdi
callq 0x4040
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl %r12d, %ecx
callq 0x26068
testl %eax, %eax
je 0x26edc
movq %r15, %rdi
callq 0x4040
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r13), %rdx
leaq 0x11209(%rip), %rsi     # 0x380f0
movq %r13, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x138e7
leaq 0x20(%rsp), %rdi
callq 0x477f