// File: /workspace/github_c_makefile_star2_O2/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 0x1593(%rip), %rdi      # 0x3960
callq 0x3c1a
movq %r15, %rdi
callq 0x3c27
callq 0x20e0
movl %eax, %edi
callq 0x3c79
callq 0x2170
movl %eax, %ebp
callq 0x2110
cmpl %eax, %ebp
jne 0x2406
callq 0x2220
movl %eax, %ebp
callq 0x2200
cmpl %eax, %ebp
je 0x241e
leaq 0x3003(%rip), %rsi      # 0x5410
leaq 0x2f26(%rip), %rdx      # 0x533a
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x39b8
callq 0x3c0b
leaq 0x85d6(%rip), %rdi      # 0xaa00
leaq 0x2f21(%rip), %rdx      # 0x5352
pushq $0x21
popq %rsi
movl %eax, %ecx
xorl %eax, %eax
callq 0x2130
cmpl $0x21, %eax
jb 0x2449
movb $0x0, 0x85b7(%rip)      # 0xaa00
leaq 0x8(%rsp), %r15
leaq 0x2f02(%rip), %r12      # 0x5357
pushq $0x2
popq %rbp
xorl %r13d, %r13d
cmpl $0x3, %r13d
je 0x2494
movl %r13d, %edi
movq %r15, %rsi
callq 0x2270
cmpl $-0x1, %eax
jne 0x248f
callq 0x2070
movl (%rax), %edi
callq 0x2260
movl %ebp, %edi
movq %r12, %rsi
movl %r13d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x39b8
incl %r13d
jmp 0x245b
pushq $0x11
popq %rdi
xorl %esi, %esi
callq 0x4188
movq (%rbx), %rax
testq %rax, %rax
je 0x24ab
cmpb $0x0, (%rax)
jne 0x24c3
leaq 0x2f5e(%rip), %rsi      # 0x5410
leaq 0x2c5f(%rip), %rdx      # 0x5118
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x39b8
callq 0x29b0
testb %al, %al
je 0x24e4
movl 0x5ce2(%rip), %eax      # 0x81b4
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %r14d
jl 0x254c
leaq 0x8(%rbx), %r15
movq 0x8(%rbx), %rax
movq %rax, 0x5c87(%rip)      # 0x8180
movq %r15, 0x5c88(%rip)      # 0x8188
leal -0x1(%r14), %ecx
movl %ecx, 0x5c86(%rip)      # 0x8190
cmpb $0x2d, (%rax)
jne 0x2585
movb 0x1(%rax), %al
cmpb $0x63, %al
setne %cl
cmpl $0x2, %r14d
sete %dl
orb %cl, %dl
jne 0x25c6
leaq 0x10(%rbx), %rax
movq %rax, 0x5c57(%rip)      # 0x8188
addl $-0x2, %r14d
movl %r14d, 0x5c54(%rip)     # 0x8190
movq 0x10(%rbx), %rax
movq %rax, 0x5c51(%rip)      # 0x8198
jmp 0x25d4
xorl %edi, %edi
callq 0x20a0
testl %eax, %eax
je 0x25d4
pushq $0x2
popq %rdi
callq 0x20a0
testl %eax, %eax
je 0x25d4
callq 0x2170
testl %eax, %eax
leaq 0x2bcc(%rip), %rax      # 0x513d
leaq 0x2bc2(%rip), %rcx      # 0x513a
cmoveq %rax, %rcx
movq %rcx, 0x5c25(%rip)      # 0x81a8
jmp 0x25d4
xorl %edi, %edi
callq 0x2180
movq (%r15), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
je 0x25b7
movq (%r15), %rdx
leaq 0x2e66(%rip), %rsi      # 0x540c
leaq 0x2b81(%rip), %rcx      # 0x512e
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x39b8
callq 0x29b0
testb %al, %al
jne 0x24cc
jmp 0x2623
cmpb $0x74, %al
jne 0x25d4
movl $0x2, 0x5bcc(%rip)      # 0x81a0
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
callq 0x4188
testq %rax, %rax
jne 0x25eb
orb $0x1, 0x5bc5(%rip)      # 0x81b0
pushq $0x3
popq %rdi
pushq $0x1
popq %rsi
callq 0x4188
testq %rax, %rax
jne 0x2602
orb $0x2, 0x5bae(%rip)      # 0x81b0
cmpq $0x0, 0x5b9e(%rip)      # 0x81a8
je 0x2623
pushq $0xf
popq %rdi
pushq $0x1
popq %rsi
callq 0x4188
testq %rax, %rax
jne 0x2623
orb $0x4, 0x5b8d(%rip)      # 0x81b0
pushq $0x4
popq %rdi
callq 0x2240
leaq -0x1001(%rax), %rcx
decl %eax
cmpq $-0xfed, %rcx           # imm = 0xF013
pushq $0x13
popq %rbx
cmovael %eax, %ebx
cmpl $0x3, %ebx
jl 0x2651
movl %ebx, %edi
callq 0x2180
decl %ebx
jmp 0x2641
leaq 0x8(%rsp), %rsi
xorl %edi, %edi
callq 0x2270
cmpl $-0x1, %eax
je 0x26cd
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x26cd
pushq $0x1
popq %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2150
testq %rax, %rax
jne 0x26cd
callq 0x335b
cmpb $0x23, %al
jne 0x26c2
callq 0x335b
cmpb $0x21, %al
jne 0x26c2
movl $0x7ff, %ebx            # imm = 0x7FF
decq %rbx
je 0x26aa
callq 0x335b
cmpb $0xa, %al
jne 0x269a
jmp 0x26cd
leaq 0x2d5f(%rip), %rsi      # 0x5410
leaq 0x2ab7(%rip), %rdx      # 0x516f
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x39b8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2150
pushq $0x1
popq %rbp
pushq $0x20
popq %r12
leaq 0x2a75(%rip), %r14      # 0x5150
pushq $0x2
popq %r15
movq 0x5ac2(%rip), %rdx      # 0x81a8
testq %rdx, %rdx
je 0x26fc
movl %r15d, %edi
leaq 0x2a4b(%rip), %rsi      # 0x5140
xorl %eax, %eax
callq 0x3b68
leaq 0x5abd(%rip), %r15      # 0x81c0
movq %r15, 0x62b6(%rip)      # 0x89c0
leaq 0x62bf(%rip), %rax      # 0x89d0
movq %rax, 0x82b8(%rip)      # 0xa9d0
movb $0x0, 0x82b9(%rip)      # 0xa9d8
andl $0x0, 0x82b6(%rip)      # 0xa9dc
movq 0x82a3(%rip), %rax      # 0xa9d0
leaq 0x8(%rax), %rcx
movq %rcx, 0x8298(%rip)      # 0xa9d0
movq %r15, (%rax)
movl %ebp, %edi
callq 0x31b4
movl %eax, %ebx
movzbl %al, %eax
cmpb $0x3e, %al
ja 0x27d3
movabsq $0x100000200, %rcx      # imm = 0x100000200
btq %rax, %rcx
jb 0x273b
movabsq $0x8400000000, %rcx     # imm = 0x8400000000
btq %rax, %rcx
jae 0x27bf
xorl %edi, %edi
callq 0x31b4
cmpb %bl, %al
je 0x281b
cmpb $0x5c, %al
je 0x278f
movzbl %al, %ecx
cmpl $0xa, %ecx
jne 0x27a7
jmp 0x2884
xorl %edi, %edi
callq 0x31b4
movl %eax, %ecx
movb $0x20, %al
cmpb $0xa, %cl
je 0x27a7
movb %cl, 0x8243(%rip)       # 0xa9e8
movb $0x5c, %al
orb $-0x80, %al
movq 0x6210(%rip), %rcx      # 0x89c0
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6205(%rip)      # 0x89c0
movb %al, (%rcx)
jmp 0x276f
movabsq $0x5800034000000400, %rcx # imm = 0x5800034000000400
btq %rax, %rcx
jb 0x28c0
cmpl $0x5c, %eax
je 0x27eb
cmpl $0x5e, %eax
je 0x28c0
cmpl $0x7c, %eax
jne 0x27ff
jmp 0x28c0
xorl %edi, %edi
callq 0x31b4
cmpb $0xa, %al
je 0x273b
movl %eax, %ebx
orb $-0x80, %bl
movb %bl, 0x81e3(%rip)       # 0xa9e8
jmp 0x281b
movq 0x61b2(%rip), %rax      # 0x89c0
leaq 0x1(%rax), %rcx
movq %rcx, 0x61a7(%rip)      # 0x89c0
movb %bl, (%rax)
movl %ebp, %edi
callq 0x31b4
movl %eax, %ebx
cmpb $0x5c, %al
jne 0x283d
xorl %edi, %edi
callq 0x31b4
movl %eax, %ecx
orb $-0x80, %cl
cmpb $0xa, %al
movzbl %cl, %ebx
cmovel %r12d, %ebx
movsbl %bl, %r13d
movl %r13d, %edi
movq %r14, %rsi
callq 0x3347
testb %al, %al
je 0x2807
movb %bl, 0x8192(%rip)       # 0xa9e8
movl %r13d, %edi
leaq 0x28fe(%rip), %rsi      # 0x515e
callq 0x3347
testb %al, %al
jne 0x273b
movq 0x614c(%rip), %rcx      # 0x89c0
leaq 0x1(%rcx), %rax
movq %rax, 0x6141(%rip)      # 0x89c0
movb $0x0, (%rcx)
jmp 0x28d8
cmpb $0x0, 0x814d(%rip)      # 0xa9d8
jne 0x289b
leaq 0x28af(%rip), %rax      # 0x5143
movq %rax, 0x8145(%rip)      # 0xa9e0
movb $0xa, 0x8146(%rip)      # 0xa9e8
movq 0x6117(%rip), %rcx      # 0x89c0
leaq 0x1(%rcx), %rax
movq %rax, 0x610c(%rip)      # 0x89c0
movb $0x0, (%rcx)
movb $0x1, 0x811a(%rip)      # 0xa9d8
jmp 0x28d8
movq 0x60f9(%rip), %rcx      # 0x89c0
movb %bl, (%rcx)
leaq 0x2(%rcx), %rax
movq %rax, 0x60ec(%rip)      # 0x89c0
movb $0x0, 0x1(%rcx)
cmpb $0xa, (%r15)
movq %rax, %r15
jne 0x2726
cmpb $0x1, 0x80ec(%rip)      # 0xa9d8
jne 0x290f
movq 0x80eb(%rip), %rdx      # 0xa9e0
pushq $0x2
popq %r15
movl %r15d, %edi
leaq 0x2b0d(%rip), %rsi      # 0x5410
xorl %eax, %eax
callq 0x39b8
jmp 0x26df
movq 0x80ba(%rip), %rax      # 0xa9d0
leaq 0x60b3(%rip), %rcx      # 0x89d0
subq %rcx, %rax
cmpq $0x9, %rax
pushq $0x2
popq %r15
jl 0x26df
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21e0
movl %r15d, %edi
movq %rbx, %rsi
leaq 0x98(%rsp), %r13
movq %r13, %rdx
callq 0x2040
movq 0x8078(%rip), %rsi      # 0xa9d0
leaq 0x6071(%rip), %rdi      # 0x89d0
callq 0x29e2
movq %rax, %rbx
movl %r15d, %edi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2040
cmpb $0x1, 0x805d(%rip)      # 0xa9d8
jne 0x2997
movl %r15d, %edi
leaq 0x2a89(%rip), %rsi      # 0x5410
leaq 0x27b5(%rip), %rdx      # 0x5143
xorl %eax, %eax
callq 0x39b8
jmp 0x29a3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2a29
movq %rbx, %rdi
callq 0x316a
jmp 0x26df