// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/driver.c
// Function: buildexe
static void
buildexe(struct input *inputs, size_t ninputs, char *output)
{
	struct stageinfo *s = &stages[LINK];
	size_t i;
	int ret, status;
	pid_t pid;

	arrayaddptr(&s->cmd, "-o");
	arrayaddptr(&s->cmd, output);
	if (!flags.nostdlib && startfiles[0])
		arrayaddbuf(&s->cmd, startfiles, sizeof(startfiles));
	for (i = 0; i < ninputs; ++i) {
		if (inputs[i].lib)
			arrayaddptr(&s->cmd, "-l");
		arrayaddptr(&s->cmd, inputs[i].name);
	}
	if (!flags.nostdlib && endfiles[0])
		arrayaddbuf(&s->cmd, endfiles, sizeof(endfiles));
	arrayaddptr(&s->cmd, NULL);

	ret = spawn(&pid, &s->cmd, NULL);
	if (ret)
		fatal("%s: spawn \"%s\": %s", s->name, *(char **)s->cmd.val, strerror(errno));
	if (waitpid(pid, &status, 0) < 0)
		fatal("waitpid %ju:", (uintmax_t)pid);
	for (i = 0; i < ninputs; ++i) {
		if (inputs[i].filetype != OBJ)
			unlink(inputs[i].name);
	}
	exit(!succeeded(s->name, pid, status));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x3985(%rip), %rax      # 0x7140
addq $0xc0, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq 0x1d16(%rip), %rsi      # 0x54ea
callq 0x4260
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x4260
testb $0x1, 0x3a40(%rip)      # 0x7231
jne 0x3816
cmpq $0x0, 0x3585(%rip)      # 0x6d80
je 0x3816
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq 0x3574(%rip), %rsi      # 0x6d80
movl $0x30, %edx
callq 0x42a0
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x3878
movq -0x8(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
testb $0x1, 0x10(%rax)
je 0x384e
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq 0x19d6(%rip), %rsi      # 0x521f
callq 0x4260
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movq -0x8(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x4260
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x381e
testb $0x1, 0x39b2(%rip)      # 0x7231
jne 0x38a4
cmpq $0x0, 0x3527(%rip)      # 0x6db0
je 0x38a4
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq 0x3516(%rip), %rsi      # 0x6db0
movl $0x30, %edx
callq 0x42a0
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4260
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
leaq -0x34(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x3d40
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x3912
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x2040
movl (%rax), %edi
callq 0x2240
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rax, %rcx
leaq 0x1bc3(%rip), %rdi      # 0x54ce
movb $0x0, %al
callq 0x3f60
movl -0x34(%rbp), %edi
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0x21e0
cmpl $0x0, %eax
jge 0x3937
movslq -0x34(%rbp), %rsi
leaq 0x1c1c(%rip), %rdi      # 0x554c
movb $0x0, %al
callq 0x3f60
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x397f
movq -0x8(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
cmpl $0x6, 0xc(%rax)
je 0x396f
movq -0x8(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x2050
jmp 0x3971
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x393f
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x3c80
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %edi
callq 0x2210
nopl (%rax)