// File: /workspace/github_c_makefile_star2_O3/s3lase[P]v6shell/util.c
// Function: sbi_fd2
static int
sbi_fd2(int argc, char **argv)
{
	bool eopt;
	enum sbikey key;
	int efd, nfd, ofd, opt;
	char *file;

	setmyname(argv[0]);

	ofd = FD1, efd = FD2;
	eopt = false, file = NULL;
	while ((opt = getopt(argc, argv, ":ef:")) != -1)
		switch (opt) {
		case 'e':
			eopt = true;
			break;
		case 'f':
			file = optarg;
			break;
		default:
			fd2_usage();
		}
	argc -= optind;
	argv += optind;
	if (argc < 1)
		fd2_usage();

	if (file != NULL) {
		if ((nfd = open(file, O_WRONLY|O_APPEND|O_CREAT, 0666)) == -1)
			err(FC_ERR, FMT3S, getmyname(), file, ERR_CREATE);
		if (dup2(nfd, efd) == -1)
			err(FC_ERR, FMT2S, getmyname(), strerror(errno));
		if (eopt && dup2(efd, ofd) == -1)
			err(FC_ERR, FMT2S, getmyname(), strerror(errno));
		(void)close(nfd);
	} else {
		if (eopt)
			ofd = FD2, efd = FD1;
		if (dup2(ofd, efd) == -1)
			err(FC_ERR, FMT2S, getmyname(), strerror(errno));
	}

	/*
	 * Try to execute the specified command.
	 */
	key = cmd_lookup(argv[0]);
	if (IS_SBI(key))
		return uexec(key, argc, argv);

	(void)err_pexec(argv[0], argv);
	/*NOTREACHED*/
	return FC_ERR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rdi
callq 0x6ab9
movq $0x0, (%rsp)
leaq 0x2a06(%rip), %r12      # 0x96db
movq 0x52fc(%rip), %rbp      # 0xbfd8
leaq 0x29fd(%rip), %r13      # 0x96e0
xorl %r15d, %r15d
movl %ebx, %edi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2350
cmpl $-0x1, %eax
je 0x6d29
cmpl $0x65, %eax
je 0x6d21
cmpl $0x66, %eax
je 0x6d1b
callq 0x6a87
movl $0x7c, %edi
movq %r13, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6840
jmp 0x6ce6
movq (%rbp), %r15
jmp 0x6ce6
movb $0x1, %al
movq %rax, (%rsp)
jmp 0x6ce6
movq 0x52a0(%rip), %rax      # 0xbfd0
movslq (%rax), %r12
subl %r12d, %ebx
jg 0x6d53
callq 0x6a87
leaq 0x299c(%rip), %rsi      # 0x96e0
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6840
leaq (%r14,%r12,8), %r14
testq %r15, %r15
je 0x6e2e
movq %r15, %rdi
movl $0x441, %esi            # imm = 0x441
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x2320
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x6da0
callq 0x6a87
leaq 0x25ac(%rip), %rsi      # 0x9333
leaq 0x27c1(%rip), %r8       # 0x954f
movl $0x7c, %edi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x6840
movl %ebp, %edi
movl $0x2, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x6dde
callq 0x6a87
movq %rax, %r15
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x256b(%rip), %rsi      # 0x9337
movl $0x7c, %edi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x6840
testb $0x1, (%rsp)
je 0x6e25
movl $0x2, %edi
movl $0x1, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x6e25
callq 0x6a87
movq %rax, %r15
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x2524(%rip), %rsi      # 0x9337
movl $0x7c, %edi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x6840
movl %ebp, %edi
callq 0x21d0
jmp 0x6e75
movzbl (%rsp), %edi
andl $0x1, %edi
movl $0x2, %esi
subl %edi, %esi
incl %edi
callq 0x2160
cmpl $-0x1, %eax
jne 0x6e75
callq 0x6a87
movq %rax, %r15
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x24d4(%rip), %rsi      # 0x9337
movl $0x7c, %edi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x6840
movq (%r14), %rdi
callq 0x326a
cmpl $0x9, %eax
ja 0x6ea6
movl $0x390, %ecx            # imm = 0x390
btl %eax, %ecx
jae 0x6ea6
movl %eax, %edi
movl %ebx, %esi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6b44
movq (%r14), %rdi
movq %r14, %rsi
callq 0x7e21
movl $0x7c, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq