// File: /workspace/github_c_makefile_star2_O1/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 0x16f5(%rip), %rdi      # 0x3ac2
callq 0x3d88
movq %r15, %rdi
callq 0x3d95
callq 0x20e0
movl %eax, %edi
callq 0x3de9
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 0x3005(%rip), %rsi      # 0x5412
leaq 0x2f28(%rip), %rdx      # 0x533c
movl $0x2, %edi
xorl %eax, %eax
callq 0x3b1c
callq 0x3d79
leaq 0x75d4(%rip), %rdi      # 0x9a00
leaq 0x2f21(%rip), %rdx      # 0x5354
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 0x2f00(%rip), %r12      # 0x5359
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 0x3b1c
incl %ebp
cmpl $0x3, %ebp
jne 0x245b
movl $0x11, %edi
xorl %esi, %esi
callq 0x42ec
movq (%rbx), %rax
testq %rax, %rax
je 0x24aa
cmpb $0x0, (%rax)
jne 0x24c4
leaq 0x2f61(%rip), %rsi      # 0x5412
leaq 0x2c60(%rip), %rdx      # 0x5118
movl $0x2, %edi
xorl %eax, %eax
callq 0x3b1c
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 0x2e42(%rip), %rsi      # 0x540e
leaq 0x2b5b(%rip), %rcx      # 0x512e
movl $0x2, %edi
xorl %eax, %eax
callq 0x3b1c
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 0x42ec
testq %rax, %rax
jne 0x262e
orb $0x1, 0x4b82(%rip)      # 0x71b0
movl $0x1, %esi
movl $0x3, %edi
callq 0x42ec
testq %rax, %rax
jne 0x2649
orb $0x2, 0x4b67(%rip)      # 0x71b0
cmpq $0x0, 0x4b57(%rip)      # 0x71a8
je 0x266e
movl $0x1, %esi
movl $0xf, %edi
callq 0x42ec
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
jg 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 0x348c
cmpb $0x23, %al
jne 0x2719
callq 0x348c
cmpb $0x21, %al
jne 0x2719
movl $0x7fe, %ebx            # imm = 0x7FE
callq 0x348c
cmpb $0xa, %al
je 0x2724
decq %rbx
jne 0x26f1
leaq 0x2d0c(%rip), %rsi      # 0x5412
leaq 0x2a62(%rip), %rdx      # 0x516f
movl $0x2, %edi
xorl %eax, %eax
callq 0x3b1c
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2150
movabsq $0x100000200, %r15      # imm = 0x100000200
movl $0x20, %ebx
leaq 0x2a16(%rip), %r14      # 0x5150
leaq 0x2a1d(%rip), %r13      # 0x515e
movq 0x4a60(%rip), %rdx      # 0x71a8
testq %rdx, %rdx
je 0x2760
movl $0x2, %edi
leaq 0x29e7(%rip), %rsi      # 0x5140
xorl %eax, %eax
callq 0x3cd6
leaq 0x4a59(%rip), %rax      # 0x71c0
movq %rax, 0x5252(%rip)      # 0x79c0
leaq 0x525b(%rip), %rax      # 0x79d0
movq %rax, 0x7254(%rip)      # 0x99d0
movb $0x0, 0x7255(%rip)      # 0x99d8
movl $0x0, 0x724f(%rip)      # 0x99dc
movq 0x522c(%rip), %rbp      # 0x79c0
movq 0x7235(%rip), %rax      # 0x99d0
leaq 0x8(%rax), %rcx
movq %rcx, 0x722a(%rip)      # 0x99d0
movq %rbp, (%rax)
movl $0x1, %edi
callq 0x32ff
movl %eax, %r12d
movzbl %al, %eax
cmpl $0x5b, %eax
jg 0x2834
cmpl $0x3e, %eax
ja 0x2878
movl %eax, %eax
btq %rax, %r15
jb 0x27a9
movabsq $0x8400000000, %rcx     # imm = 0x8400000000
btq %rax, %rcx
jae 0x2864
xorl %edi, %edi
callq 0x32ff
cmpb %r12b, %al
je 0x2895
cmpb $0x5c, %al
je 0x2804
movzbl %al, %ecx
cmpl $0xa, %ecx
jne 0x281c
jmp 0x2900
xorl %edi, %edi
callq 0x32ff
movl %eax, %ecx
movb $0x20, %al
cmpb $0xa, %cl
je 0x281c
movb %cl, 0x71ce(%rip)       # 0x99e8
movb $0x5c, %al
orb $-0x80, %al
movq 0x519b(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rdx
movq %rdx, 0x5190(%rip)      # 0x79c0
movb %al, (%rcx)
jmp 0x27e3
cmpl $0x5c, %eax
jne 0x2851
xorl %edi, %edi
callq 0x32ff
cmpb $0xa, %al
je 0x27a9
movl %eax, %r12d
orb $-0x80, %r12b
jmp 0x2878
cmpl $0x5e, %eax
je 0x293b
cmpl $0x7c, %eax
jne 0x2878
jmp 0x293b
movabsq $0x5800034000000400, %rcx # imm = 0x5800034000000400
btq %rax, %rcx
jb 0x293b
movb %r12b, 0x7169(%rip)     # 0x99e8
jmp 0x2895
movq 0x5138(%rip), %rcx      # 0x79c0
leaq 0x1(%rcx), %rdx
movq %rdx, 0x512d(%rip)      # 0x79c0
movb %al, (%rcx)
movl $0x1, %edi
callq 0x32ff
cmpb $0x5c, %al
jne 0x28b7
xorl %edi, %edi
callq 0x32ff
movl %eax, %ecx
orb $-0x80, %cl
cmpb $0xa, %al
movzbl %cl, %eax
cmovel %ebx, %eax
movq %r14, %rcx
movb (%rcx), %dl
testb %dl, %dl
je 0x28c7
incq %rcx
cmpb %al, %dl
jne 0x28ba
testb %dl, %dl
je 0x2881
movb %al, 0x7117(%rip)       # 0x99e8
movq %r13, %rcx
movb (%rcx), %dl
testb %dl, %dl
je 0x28e1
incq %rcx
cmpb %al, %dl
jne 0x28d4
testb %dl, %dl
jne 0x27a9
movq 0x50d0(%rip), %rax      # 0x79c0
leaq 0x1(%rax), %rcx
movq %rcx, 0x50c5(%rip)      # 0x79c0
movb $0x0, (%rax)
jmp 0x295f
cmpb $0x0, 0x70d1(%rip)      # 0x99d8
jne 0x2917
leaq 0x2833(%rip), %rcx      # 0x5143
movq %rcx, 0x70c9(%rip)      # 0x99e0
movb %al, 0x70cb(%rip)       # 0x99e8
movq 0x509c(%rip), %rax      # 0x79c0
leaq 0x1(%rax), %rcx
movq %rcx, 0x5091(%rip)      # 0x79c0
movb $0x0, (%rax)
movb $0x1, 0x709f(%rip)      # 0x99d8
jmp 0x295f
movq 0x507e(%rip), %rax      # 0x79c0
leaq 0x1(%rax), %rcx
movq %rcx, 0x5073(%rip)      # 0x79c0
movb %r12b, (%rax)
leaq 0x2(%rax), %rcx
movq %rcx, 0x5065(%rip)      # 0x79c0
movb $0x0, 0x1(%rax)
cmpb $0xa, (%rbp)
jne 0x278d
cmpb $0x1, 0x7068(%rip)      # 0x99d8
jne 0x2991
movq 0x7067(%rip), %rdx      # 0x99e0
movl $0x2, %edi
leaq 0x2a8d(%rip), %rsi      # 0x5412
xorl %eax, %eax
callq 0x3b1c
jmp 0x2741
movq 0x7038(%rip), %rax      # 0x99d0
leaq 0x5031(%rip), %rcx      # 0x79d0
subq %rcx, %rax
cmpq $0x9, %rax
jl 0x2741
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x21e0
movl $0x2, %edi
movq %r12, %rsi
leaq 0x98(%rsp), %rbp
movq %rbp, %rdx
callq 0x2040
movq 0x6ff8(%rip), %rsi      # 0x99d0
leaq 0x4ff1(%rip), %rdi      # 0x79d0
callq 0x2a34
movq %rax, %r12
movl $0x2, %edi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x2040
cmpb $0x1, 0x6fdb(%rip)      # 0x99d8
jne 0x2a1b
movl $0x2, %edi
leaq 0x2a07(%rip), %rsi      # 0x5412
leaq 0x2731(%rip), %rdx      # 0x5143
xorl %eax, %eax
callq 0x3b1c
jmp 0x2a27
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2a6d
movq %r12, %rdi
callq 0x32b5
jmp 0x2741