// File: /workspace/github_c_makefile_star2_O3/s3lase[P]v6shell/sh6.c
// Function: main
int
main(int argc, char **argv)
{
	bool dosigs = false;

	sh_init(argv[0]);
	if (argv[0] == NULL || *argv[0] == EOS)
		err(SH_ERR, FMT1S, ERR_ALINVAL);
	if (fd_isdir(FD0))
		goto done;

	if (argc > 1) {
		name = argv[1];
		dolv = &argv[1];
		dolc = argc - 1;
		if (*argv[1] == HYPHEN) {
			dosigs = true;
			if (argv[1][1] == 'c' && argc > 2) {
				dolv  += 1;
				dolc  -= 1;
				argv2p = argv[2];
			} else if (argv[1][1] == 't')
				one_line_flag = 2;
		} else {
			(void)close(FD0);
			if (open(argv[1], O_RDONLY) != FD0)
				err(SH_ERR, FMT2S, argv[1], ERR_OPEN);
			if (fd_isdir(FD0))
				goto done;
		}
	} else {
		dosigs = true;
		if (isatty(FD0) != 0 && isatty(FD2) != 0)
			prompt = (geteuid() != 0) ? "% " : "# ";
	}
	if (dosigs) {
		if (sasignal(SIGINT, SIG_IGN) == SIG_DFL)
			sig_child |= S_SIGINT;
		if (sasignal(SIGQUIT, SIG_IGN) == SIG_DFL)
			sig_child |= S_SIGQUIT;
		if (prompt != NULL)
			if (sasignal(SIGTERM, SIG_IGN) == SIG_DFL)
				sig_child |= S_SIGTERM;
	}
	fd_free();
	sh_magic();

loop:
	if (prompt != NULL)
		fd_print(FD2, "%s", prompt);
	rpx_line();
	goto loop;

done:
	return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movl %edi, %r14d
movq (%rsi), %r15
leaq 0x16a2(%rip), %rdi      # 0x3a6f
callq 0x3d34
movq %r15, %rdi
callq 0x3d41
callq 0x20e0
movl %eax, %edi
callq 0x3d95
callq 0x2170
movl %eax, %ebp
callq 0x2110
cmpl %eax, %ebp
jne 0x2406
callq 0x2220
movl %eax, %ebp
callq 0x2200
cmpl %eax, %ebp
je 0x2420
leaq 0x3000(%rip), %rsi      # 0x540d
leaq 0x2f23(%rip), %rdx      # 0x5337
movl $0x2, %edi
xorl %eax, %eax
callq 0x3ac8
callq 0x3d25
leaq 0x75d4(%rip), %rdi      # 0x9a00
leaq 0x2f1c(%rip), %rdx      # 0x534f
movl $0x21, %esi
movl %eax, %ecx
xorl %eax, %eax
callq 0x2130
cmpl $0x21, %eax
jb 0x244d
movb $0x0, 0x75b3(%rip)      # 0x9a00
leaq 0x8(%rsp), %r15
leaq 0x2efb(%rip), %r12      # 0x5354
xorl %ebp, %ebp
movl %ebp, %edi
movq %r15, %rsi
callq 0x2270
cmpl $-0x1, %eax
jne 0x248a
callq 0x2070
movl (%rax), %edi
callq 0x2260
movl $0x2, %edi
movq %r12, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3ac8
incl %ebp
cmpl $0x3, %ebp
jne 0x245b
movl $0x11, %edi
xorl %esi, %esi
callq 0x42d8
movq (%rbx), %rax
testq %rax, %rax
je 0x24aa
cmpb $0x0, (%rax)
jne 0x24c4
leaq 0x2f5c(%rip), %rsi      # 0x540d
leaq 0x2c60(%rip), %rdx      # 0x5118
movl $0x2, %edi
xorl %eax, %eax
callq 0x3ac8
leaq 0x8(%rsp), %rsi
xorl %edi, %edi
callq 0x2270
testl %eax, %eax
jne 0x24fc
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x24fc
movl 0x4cca(%rip), %eax      # 0x71b4
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %r14d
jl 0x2568
leaq 0x8(%rbx), %r15
movq 0x8(%rbx), %rax
movq %rax, 0x4c6f(%rip)      # 0x7180
movq %r15, 0x4c70(%rip)      # 0x7188
leal -0x1(%r14), %ecx
movl %ecx, 0x4c6e(%rip)      # 0x7190
cmpb $0x2d, (%rax)
jne 0x25ab
movb 0x1(%rax), %al
cmpb $0x63, %al
setne %cl
cmpl $0x2, %r14d
sete %dl
orb %cl, %dl
jne 0x2605
leaq 0x10(%rbx), %rax
movq %rax, 0x4c3b(%rip)      # 0x7188
addl $-0x2, %r14d
movl %r14d, 0x4c38(%rip)     # 0x7190
movq 0x10(%rbx), %rax
movq %rax, 0x4c35(%rip)      # 0x7198
jmp 0x2613
xorl %edi, %edi
callq 0x20a0
testl %eax, %eax
je 0x2613
movl $0x2, %edi
callq 0x20a0
testl %eax, %eax
je 0x2613
callq 0x2170
testl %eax, %eax
leaq 0x2ba6(%rip), %rax      # 0x513d
leaq 0x2b9c(%rip), %rcx      # 0x513a
cmoveq %rax, %rcx
movq %rcx, 0x4bff(%rip)      # 0x71a8
jmp 0x2613
xorl %edi, %edi
callq 0x2180
movq (%r15), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
je 0x25df
movq (%r15), %rdx
leaq 0x2e3d(%rip), %rsi      # 0x5409
leaq 0x2b5b(%rip), %rcx      # 0x512e
movl $0x2, %edi
xorl %eax, %eax
callq 0x3ac8
leaq 0x8(%rsp), %rsi
xorl %edi, %edi
callq 0x2270
testl %eax, %eax
jne 0x266e
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x24e4
jmp 0x266e
cmpb $0x74, %al
jne 0x2613
movl $0x2, 0x4b8d(%rip)      # 0x71a0
movl $0x1, %esi
movl $0x2, %edi
callq 0x42d8
testq %rax, %rax
jne 0x262e
orb $0x1, 0x4b82(%rip)      # 0x71b0
movl $0x1, %esi
movl $0x3, %edi
callq 0x42d8
testq %rax, %rax
jne 0x2649
orb $0x2, 0x4b67(%rip)      # 0x71b0
cmpq $0x0, 0x4b57(%rip)      # 0x71a8
je 0x266e
movl $0x1, %esi
movl $0xf, %edi
callq 0x42d8
testq %rax, %rax
jne 0x266e
orb $0x4, 0x4b42(%rip)      # 0x71b0
movl $0x4, %edi
callq 0x2240
leaq -0x1001(%rax), %rcx
decl %eax
cmpq $-0xfed, %rcx           # imm = 0xF013
movl $0x13, %ebx
cmovael %eax, %ebx
cmpl $0x3, %ebx
jl 0x26a6
movl %ebx, %edi
callq 0x2180
leal -0x1(%rbx), %eax
cmpl $0x3, %ebx
movl %eax, %ebx
ja 0x2695
leaq 0x8(%rsp), %rsi
xorl %edi, %edi
callq 0x2270
cmpl $-0x1, %eax
je 0x2724
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x2724
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0x2150
testq %rax, %rax
jne 0x2724
callq 0x346d
cmpb $0x23, %al
jne 0x2719
callq 0x346d
cmpb $0x21, %al
jne 0x2719
movl $0x7fe, %ebx            # imm = 0x7FE
callq 0x346d
cmpb $0xa, %al
je 0x2724
decq %rbx
jne 0x26f1
leaq 0x2d07(%rip), %rsi      # 0x540d
leaq 0x2a5f(%rip), %rdx      # 0x516c
movl $0x2, %edi
xorl %eax, %eax
callq 0x3ac8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2150
movabsq $0x100000200, %r15      # imm = 0x100000200
movabsq $0x8400000000, %rbp     # imm = 0x8400000000
movl $0x20, %r13d
leaq 0x2a0b(%rip), %r14      # 0x5150
movq 0x4a5c(%rip), %rdx      # 0x71a8
testq %rdx, %rdx
je 0x2764
movl $0x2, %edi
leaq 0x29e3(%rip), %rsi      # 0x5140
xorl %eax, %eax
callq 0x3c82
leaq 0x4a55(%rip), %rbx      # 0x71c0
movq %rbx, 0x524e(%rip)      # 0x79c0
leaq 0x5257(%rip), %rax      # 0x79d0
movq %rax, 0x7250(%rip)      # 0x99d0
movb $0x0, 0x7251(%rip)      # 0x99d8
movl $0x0, 0x724b(%rip)      # 0x99dc
movq 0x7238(%rip), %rax      # 0x99d0
leaq 0x8(%rax), %rcx
movq %rcx, 0x722d(%rip)      # 0x99d0
movq %rbx, (%rax)
movl $0x1, %edi
callq 0x32d5
movl %eax, %r12d
movzbl %al, %eax
cmpl $0x5b, %eax
jg 0x2827
cmpl $0x3e, %eax
ja 0x286b
movl %eax, %eax
btq %rax, %r15
jb 0x27a6
btq %rax, %rbp
jae 0x2857
xorl %edi, %edi
callq 0x32d5
cmpb %r12b, %al
je 0x2888
cmpb $0x5c, %al
je 0x27f7
movzbl %al, %ecx
cmpl $0xa, %ecx
jne 0x280f
jmp 0x28f0
xorl %edi, %edi
callq 0x32d5
movl %eax, %ecx
movb $0x20, %al
cmpb $0xa, %cl
je 0x280f
movb %cl, 0x71db(%rip)       # 0x99e8
movb $0x5c, %al
orb $-0x80, %al
movq 0x51a8(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rdx
movq %rdx, 0x519d(%rip)      # 0x79c0
movb %al, (%rcx)
jmp 0x27d6
cmpl $0x5c, %eax
jne 0x2844
xorl %edi, %edi
callq 0x32d5
cmpb $0xa, %al
je 0x27a6
movl %eax, %r12d
orb $-0x80, %r12b
jmp 0x286b
cmpl $0x5e, %eax
je 0x292c
cmpl $0x7c, %eax
jne 0x286b
jmp 0x292c
movabsq $0x5800034000000400, %rcx # imm = 0x5800034000000400
btq %rax, %rcx
jb 0x292c
movb %r12b, 0x7176(%rip)     # 0x99e8
jmp 0x2888
movq 0x5145(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rdx
movq %rdx, 0x513a(%rip)      # 0x79c0
movb %al, (%rcx)
movl $0x1, %edi
callq 0x32d5
cmpb $0x5c, %al
jne 0x28ab
xorl %edi, %edi
callq 0x32d5
movl %eax, %ecx
orb $-0x80, %cl
cmpb $0xa, %al
movzbl %cl, %eax
cmovel %r13d, %eax
movq %r14, %rcx
movb (%rcx), %dl
testb %dl, %dl
je 0x28bb
incq %rcx
cmpb %al, %dl
jne 0x28ae
testb %dl, %dl
je 0x2874
movb %al, 0x7123(%rip)       # 0x99e8
cmpb $0x22, %al
je 0x27a6
movzbl %al, %eax
cmpl $0x27, %eax
je 0x27a6
movq 0x50e0(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rax
movq %rax, 0x50d5(%rip)      # 0x79c0
movb $0x0, (%rcx)
jmp 0x2945
cmpb $0x0, 0x70e1(%rip)      # 0x99d8
jne 0x2907
leaq 0x2843(%rip), %rax      # 0x5143
movq %rax, 0x70d9(%rip)      # 0x99e0
movb $0xa, 0x70da(%rip)      # 0x99e8
movq 0x50ab(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rax
movq %rax, 0x50a0(%rip)      # 0x79c0
movb $0x0, (%rcx)
movb $0x1, 0x70ae(%rip)      # 0x99d8
jmp 0x2945
movq 0x508d(%rip), %rcx      # 0x79c0
movb %r12b, (%rcx)
leaq 0x2(%rcx), %rax
movq %rax, 0x507f(%rip)      # 0x79c0
movb $0x0, 0x1(%rcx)
cmpb $0xa, (%rbx)
movq %rax, %rbx
jne 0x2791
cmpb $0x1, 0x7080(%rip)      # 0x99d8
jne 0x2979
movq 0x707f(%rip), %rdx      # 0x99e0
movl $0x2, %edi
leaq 0x2aa0(%rip), %rsi      # 0x540d
xorl %eax, %eax
callq 0x3ac8
jmp 0x2745
movq 0x7050(%rip), %rax      # 0x99d0
leaq 0x5049(%rip), %rcx      # 0x79d0
subq %rcx, %rax
cmpq $0x9, %rax
jl 0x2745
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21e0
movl $0x2, %edi
movq %rbx, %rsi
leaq 0x98(%rsp), %rbx
movq %rbx, %rdx
callq 0x2040
movq 0x7010(%rip), %rsi      # 0x99d0
leaq 0x5009(%rip), %rdi      # 0x79d0
callq 0x2a1c
movq %rax, %r12
movl $0x2, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2040
cmpb $0x1, 0x6ff3(%rip)      # 0x99d8
jne 0x2a03
movl $0x2, %edi
leaq 0x2a1a(%rip), %rsi      # 0x540d
leaq 0x2749(%rip), %rdx      # 0x5143
xorl %eax, %eax
callq 0x3ac8
jmp 0x2a0f
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2a55
movq %r12, %rdi
callq 0x328b
jmp 0x2745