// File: /workspace/github_c_makefile_star2_O3/s3lase[P]v6shell/util.c
// Function: e3
static bool
e3(void)
{
	bool re;
	pid_t cpid, tpid;
	int cstat, d;
	char *a, *b;

	if ((a = nxtarg(RETERR)) == NULL)
		err(FC_ERR, FMT3S, getmyname(), iav[iap - 2], ERR_EXPR);

	/*
	 * Deal w/ parentheses for grouping.
	 */
	if (equal(a, "(")) {
		re = expr();
		if (!equal(nxtarg(RETERR), ")"))
			err(FC_ERR, FMT3S, getmyname(), a, ERR_PAREN);
		return re;
	}

	/*
	 * Execute { command [arg ...] } to obtain its exit status.
	 */
	if (equal(a, "{")) {
		if ((cpid = fork()) == -1)
			err(FC_ERR, FMT2S, getmyname(), ERR_FORK);
		if (cpid == 0)
			/**** Child! ****/
			doex(FORKED);
		else {
			/**** Parent! ****/
			tpid = wait(&cstat);
			while ((a = nxtarg(RETERR)) != NULL && !equal(a, "}"))
				;	/* nothing */
			if (a == NULL)
				iap--;
			return (tpid == cpid && cstat == 0) ? true : false;
		}
	}

	/*
	 * file existence/permission tests
	 */
	if (equal(a, "-e"))
		return ifaccess(nxtarg(!RETERR), F_OK);
	if (equal(a, "-r"))
		return ifaccess(nxtarg(!RETERR), R_OK);
	if (equal(a, "-w"))
		return ifaccess(nxtarg(!RETERR), W_OK);
	if (equal(a, "-x"))
		return ifaccess(nxtarg(!RETERR), X_OK);

	/*
	 * file existence/type tests
	 */
	if (equal(a, "-d"))
		return ifstat1(nxtarg(!RETERR), S_IFDIR);
	if (equal(a, "-f"))
		return ifstat1(nxtarg(!RETERR), S_IFREG);
	if (equal(a, "-h"))
		return ifstat1(nxtarg(!RETERR), S_IFLNK);
	if (equal(a, "-s"))
		return ifstat1(nxtarg(!RETERR), F_GZ);
	if (equal(a, "-t")) {
		/* Does the descriptor refer to a terminal device? */
		b = nxtarg(RETERR);
		if (b == NULL || *b == EOS)
			err(FC_ERR, FMT3S, getmyname(), a, ERR_DIGIT);
		if (*b >= '0' && *b <= '9' && *(b + 1) == EOS) {
			d = *b - '0';
			if (IS_DIGIT(d, *b))
				return isatty(d) != 0;
		}
		err(FC_ERR, FMT3S, getmyname(), b, ERR_NOTDIGIT);
	}

	/*
	 * binary comparisons
	 */
	if ((b = nxtarg(RETERR)) == NULL)
		err(FC_ERR, FMT3S, getmyname(), a, ERR_OPERATOR);
	if (equal(b,  "="))
		return  equal(a, nxtarg(!RETERR));
	if (equal(b, "!="))
		return !equal(a, nxtarg(!RETERR));
	if (equal(b, "-ot"))
		return ifstat2(a, nxtarg(!RETERR), F_OT);
	if (equal(b, "-nt"))
		return ifstat2(a, nxtarg(!RETERR), F_NT);
	if (equal(b, "-ef"))
		return ifstat2(a, nxtarg(!RETERR), F_EF);
	err(FC_ERR, FMT3S, getmyname(), b, ERR_OPUNKNOWN);
	/*NOTREACHED*/
	return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movl $0x1, %edi
callq 0x7415
movq %rax, %rbx
testq %rax, %rax
je 0x754b
movzbl (%rbx), %eax
cmpl $0x7b, %eax
je 0x7585
cmpl $0x28, %eax
jne 0x7603
cmpb $0x0, 0x1(%rbx)
jne 0x77c1
callq 0x715c
movl %eax, %ebp
movl $0x1, %edi
callq 0x7415
testq %rax, %rax
je 0x7528
cmpb $0x29, (%rax)
jne 0x7528
cmpb $0x0, 0x1(%rax)
je 0x7879
callq 0x6a87
leaq 0x1dff(%rip), %rsi      # 0x9333
leaq 0x2215(%rip), %r8       # 0x9750
movl $0x7c, %edi
movq %rax, %rdx
movq %rbx, %rcx
jmp 0x7872
callq 0x6a87
movq 0x9e59(%rip), %rcx      # 0x113b0
movslq 0x9e5a(%rip), %rdx      # 0x113b8
movq -0x10(%rcx,%rdx,8), %rcx
leaq 0x1dc9(%rip), %rsi      # 0x9333
leaq 0x21cb(%rip), %r8       # 0x973c
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6840
jmp 0x77c1
cmpb $0x0, 0x1(%rbx)
jne 0x77c1
callq 0x23c0
testl %eax, %eax
je 0x75f7
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x75c1
callq 0x6a87
leaq 0x1d8c(%rip), %rsi      # 0x9337
leaq 0x1d9c(%rip), %rcx      # 0x934e
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6840
movq %rsp, %rdi
callq 0x23a0
movl %eax, %ebx
movl $0x1, %edi
callq 0x7415
testq %rax, %rax
je 0x75e7
cmpb $0x7d, (%rax)
jne 0x75cb
cmpb $0x0, 0x1(%rax)
jne 0x75cb
jmp 0x75ed
decl 0x9dcb(%rip)            # 0x113b8
xorl %ebp, %ebx
orl (%rsp), %ebx
jmp 0x7827
movl $0x1, %edi
callq 0x71b4
movb (%rbx), %al
cmpb $0x2d, %al
jne 0x77c1
movzbl 0x1(%rbx), %eax
addl $-0x64, %eax
cmpl $0x14, %eax
ja 0x77c1
leaq 0x204e(%rip), %rcx      # 0x9670
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %edi, %edi
callq 0x7415
movq %rax, %rdi
movl $0x4000, %esi           # imm = 0x4000
jmp 0x7777
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %edi, %edi
callq 0x7415
movq %rax, %rdi
movl $0x8000, %esi           # imm = 0x8000
jmp 0x7777
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %edi, %edi
callq 0x7415
movq %rax, %rdi
movl $0x1, %esi
jmp 0x7777
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
je 0x7879
cmpb $0x0, (%rax)
je 0x79d5
movq %rax, %rdi
xorl %esi, %esi
jmp 0x77b0
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
movl $0x1, %edi
callq 0x7415
movq %rax, %r14
testq %rax, %rax
je 0x76d7
movb (%r14), %al
testb %al, %al
jne 0x76ff
callq 0x6a87
leaq 0x1c50(%rip), %rsi      # 0x9333
leaq 0x2071(%rip), %r8       # 0x975b
movl $0x7c, %edi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6840
movb (%r14), %al
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x79dc
cmpb $0x0, 0x1(%r14)
jne 0x79dc
movzbl %cl, %edi
leaq 0x1b73(%rip), %rcx      # 0x9293
cmpb %al, (%rdi,%rcx)
jne 0x79dc
callq 0x20a0
jmp 0x7927
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
je 0x7879
cmpb $0x0, (%rax)
je 0x79d5
movq %rax, %rdi
movl $0x2, %esi
jmp 0x77b0
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %edi, %edi
callq 0x7415
movq %rax, %rdi
movl $0xa000, %esi           # imm = 0xA000
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x79ff
cmpb $0x0, 0x2(%rbx)
jne 0x77c1
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
je 0x7879
cmpb $0x0, (%rax)
je 0x79d5
movq %rax, %rdi
movl $0x4, %esi
callq 0x2330
jmp 0x7825
cmpb $0x0, 0x2(%rbx)
je 0x7968
movl $0x1, %edi
callq 0x7415
movq %rax, %r14
testq %rax, %rax
je 0x782d
movzbl (%r14), %eax
cmpl $0x21, %eax
je 0x78dc
cmpl $0x2d, %eax
je 0x7887
cmpl $0x3d, %eax
jne 0x7852
cmpb $0x0, 0x1(%r14)
jne 0x7852
testq %rbx, %rbx
sete %r14b
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
sete %cl
orb %r14b, %cl
jne 0x7879
movb (%rbx), %cl
cmpb (%rax), %cl
jne 0x79d5
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2230
testl %eax, %eax
sete %bpl
jmp 0x7879
callq 0x6a87
leaq 0x1afa(%rip), %rsi      # 0x9333
leaq 0x1f36(%rip), %r8       # 0x9776
movl $0x7c, %edi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6840
callq 0x6a87
leaq 0x1ad5(%rip), %rsi      # 0x9333
leaq 0x1f2f(%rip), %r8       # 0x9794
xorl %ebp, %ebp
movl $0x7c, %edi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x6840
movl %ebp, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1efa(%rip), %rsi      # 0x9788
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x7932
leaq 0x1ee7(%rip), %rsi      # 0x978c
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x7946
leaq 0x1ed4(%rip), %rsi      # 0x9790
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
jne 0x7852
xorl %edi, %edi
callq 0x7415
movq %rbx, %rdi
movq %rax, %rsi
movl $0x4, %edx
jmp 0x7958
cmpb $0x3d, 0x1(%r14)
jne 0x7852
cmpb $0x0, 0x2(%r14)
jne 0x7852
testq %rbx, %rbx
sete %bpl
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
sete %cl
orb %bpl, %cl
movb $0x1, %bpl
jne 0x7879
movb (%rbx), %cl
cmpb (%rax), %cl
jne 0x7879
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2230
testl %eax, %eax
setne %bpl
jmp 0x7879
xorl %edi, %edi
callq 0x7415
movq %rbx, %rdi
movq %rax, %rsi
movl $0x2, %edx
jmp 0x7958
xorl %edi, %edi
callq 0x7415
movq %rbx, %rdi
movq %rax, %rsi
movl $0x3, %edx
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x7a7e
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x7415
testq %rax, %rax
je 0x7879
movq %rax, %rbx
cmpb $0x0, (%rax)
je 0x79d5
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2330
testl %eax, %eax
sete %bpl
leaq 0x48d0(%rip), %rcx      # 0xc26c
orl (%rcx), %eax
jne 0x7879
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2270
testl %eax, %eax
js 0x79d5
movl 0x18(%rsp), %eax
movl %eax, %ecx
andl $0xf000, %ecx           # imm = 0xF000
movb $0x1, %bpl
cmpl $0x4000, %ecx           # imm = 0x4000
je 0x7879
testb $0x49, %al
jmp 0x7929
xorl %ebp, %ebp
jmp 0x7879
callq 0x6a87
leaq 0x194b(%rip), %rsi      # 0x9333
leaq 0x1d7b(%rip), %r8       # 0x976a
movl $0x7c, %edi
movq %rax, %rdx
movq %r14, %rcx
jmp 0x7579