// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/osh.c
// Function: execute
static void
execute(struct tnode *t, int *pin, int *pout)
{
	struct tnode *t1;
	enum tnflags f;
	pid_t cpid;
	int pfd[2];

	if (t == NULL)
		return;
	switch (t->ntype) {
	case TLIST:
		f = t->nflags & (FFIN | FPIN | FINTR);
		if ((t1 = t->nleft) != NULL)
			t1->nflags |= f;
		execute(t1, NULL, NULL);
		if ((t1 = t->nright) != NULL)
			t1->nflags |= f;
		execute(t1, NULL, NULL);
		return;

	case TPIPE:
		if (pipe(pfd) == -1) {
			err(-1, FMT2S, getmyname(), ERR_PIPE);
			if (pin != NULL) {
				(void)close(pin[0]);
				(void)close(pin[1]);
			}
			return;
		}
		f = t->nflags;
		if ((t1 = t->nleft) != NULL)
			t1->nflags |= FPOUT | (f & (FFIN|FPIN|FINTR|FPRS));
		execute(t1, pin, pfd);
		if ((t1 = t->nright) != NULL)
			t1->nflags |= FPIN | (f & (FAND|FPOUT|FINTR|FPRS));
		execute(t1, pfd, pout);
		(void)close(pfd[0]);
		(void)close(pfd[1]);
		return;

	case TCOMMAND:
		if (t->nav == NULL || t->nav[0] == NULL) {
			/* should never (but can) be true */
			err(-1, FMT2S, getmyname(), "execute: Invalid command");
			return;
		}
		if (vtglob(t->nav)) {
			if ((t->nav = (char **)glob(t->nkey, t->nav)) == NULL)
				return;
		} else if (DO_TRIM(t->nkey))
			vtrim(t->nav);
		switch (t->nkey) {
		case SBI_ECHO:
			break;
		case SBI_EXEC:
			/*
			 * Replace the current shell w/ an instance of
			 * the specified external command.
			 *
			 * usage: exec command [arg ...]
			 */
			if (t->nav[1] == NULL) {
				err(-1, FMT3S, getmyname(),
				    t->nav[0], ERR_ARGCOUNT);
				return;
			}
			if ((t->nkey = cmd_lookup(t->nav[1])) != SBI_UNKNOWN) {
				err(-1, FMT4S, getmyname(),
				    t->nav[0], t->nav[1], ERR_EXEC);
				return;
			}
			t->nav++;
			t->nflags |= FNOFORK;
			(void)sasignal(SIGCHLD, SIG_IGN);
			break;
		case SBI_FD2: case SBI_GOTO: case SBI_IF: case SBI_UNKNOWN:
			break;
		default:
			execute1(t);
			return;
		}
		/*FALLTHROUGH*/

	case TSUBSHELL:
		f = t->nflags;
		if ((cpid = ((f & FNOFORK) != 0) ? 0 : fork()) == -1) {
			err(-1, FMT2S, getmyname(), ERR_FORK);
			return;
		}
		/**** Parent! ****/
		if (cpid != 0) {
			if (pin != NULL && (f & FPIN) != 0) {
				(void)close(pin[0]);
				(void)close(pin[1]);
			}
			if ((f & FPRS) != 0)
				fd_print(FD2, "%u\n", (unsigned)cpid);
			if ((f & FAND) != 0)
				return;
			if ((f & FPOUT) == 0)
				pwait(cpid);
			return;
		}
		/**** Child! ****/
		execute2(t, pin, pout);
		/*NOTREACHED*/
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x3b29
movq %rdi, %rbx
movl 0x38(%rdi), %eax
decl %eax
cmpl $0x3, %eax
ja 0x3b29
movq %rdx, %r14
movq %rsi, %r15
leaq 0x5ac2(%rip), %rcx      # 0x911c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x34(%rbx), %ebp
andl $0x4c, %ebp
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3674
orl %ebp, 0x34(%rdi)
xorl %esi, %esi
xorl %edx, %edx
callq 0x3625
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3689
orl %ebp, 0x34(%rdi)
xorl %esi, %esi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3625
movq 0x28(%rbx), %r12
testq %r12, %r12
je 0x375a
movq (%r12), %r13
testq %r13, %r13
je 0x375a
movq %r14, 0x8(%rsp)
movq %r13, %rdi
callq 0x5c7c
testq %rax, %rax
je 0x37b3
movl 0x30(%rbx), %edi
movq %r12, %rsi
callq 0x4ae0
movq %rax, 0x28(%rbx)
testq %rax, %rax
movq 0x8(%rsp), %r14
jne 0x3803
jmp 0x3b29
leaq 0x10(%rsp), %rdi
callq 0x21e0
cmpl $-0x1, %eax
je 0x3772
movl 0x34(%rbx), %ebp
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3719
movl %ebp, %eax
andl $0xcc, %eax
orl 0x34(%rdi), %eax
orl $0x10, %eax
movl %eax, 0x34(%rdi)
leaq 0x10(%rsp), %rdx
movq %r15, %rsi
callq 0x3625
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x373e
andl $0xd1, %ebp
orl 0x34(%rdi), %ebp
orl $0x8, %ebp
movl %ebp, 0x34(%rdi)
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3625
movl (%rbx), %edi
callq 0x21d0
movl 0x4(%rbx), %edi
jmp 0x37a9
callq 0x6b0f
leaq 0x5bd7(%rip), %rsi      # 0x933d
leaq 0x5ba5(%rip), %rcx      # 0x9312
jmp 0x3850
callq 0x6b0f
leaq 0x5bbf(%rip), %rsi      # 0x933d
leaq 0x5b75(%rip), %rcx      # 0x92fa
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
testq %r15, %r15
je 0x3b29
movl (%r15), %edi
callq 0x21d0
movl 0x4(%r15), %edi
callq 0x21d0
jmp 0x3b29
leaq 0x8(%r12), %r14
movq (%r14), %rbp
testq %rbp, %rbp
je 0x37da
movq %rbp, %rdi
callq 0x5c7c
addq $0x8, %r14
testq %rax, %rax
je 0x37b8
testq %rbp, %rbp
jne 0x36cd
movl 0x30(%rbx), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
movq 0x8(%rsp), %r14
je 0x3803
addq $0x8, %r12
movq %r13, %rdi
callq 0x5d89
movq (%r12), %r13
addq $0x8, %r12
testq %r13, %r13
jne 0x37ee
movl 0x30(%rbx), %eax
cmpl $0x14, %eax
ja 0x3c8f
movl $0x100390, %ecx         # imm = 0x100390
btl %eax, %ecx
jae 0x3c47
movl 0x34(%rbx), %r12d
xorl %ebp, %ebp
testb $0x20, %r12b
jne 0x3830
callq 0x23c0
movl %eax, %ebp
testl %ebp, %ebp
je 0x386d
cmpl $-0x1, %ebp
jne 0x3ae3
callq 0x6b0f
leaq 0x5af4(%rip), %rsi      # 0x933d
leaq 0x5b04(%rip), %rcx      # 0x9354
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68c8
movl 0x34(%rbx), %r13d
testq %r15, %r15
sete %al
testb $0x8, %r13b
sete %cl
orb %al, %cl
jne 0x38cf
movl (%r15), %edi
xorl %esi, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x38be
callq 0x6b0f
movq %rax, %r12
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x5a91(%rip), %rsi      # 0x933d
movl $0x7c, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x68c8
movl (%r15), %edi
callq 0x21d0
movl 0x4(%r15), %edi
callq 0x21d0
testq %r14, %r14
sete %al
testb $0x10, %r13b
sete %cl
orb %al, %cl
jne 0x3931
movl 0x4(%r14), %edi
movl $0x1, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x3920
callq 0x6b0f
movq %rax, %r15
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x5a2f(%rip), %rsi      # 0x933d
movl $0x7c, %edi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x68c8
movl (%r14), %edi
callq 0x21d0
movl 0x4(%r14), %edi
callq 0x21d0
testb $0x8, %r13b
sete %al
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x39e0
cmpb $0x2d, (%rdi)
jne 0x395c
cmpb $0x0, 0x1(%rdi)
je 0x3ca5
callq 0x5d89
movq %rax, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2320
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x399a
callq 0x6b0f
movq 0x18(%rbx), %rcx
leaq 0x59b5(%rip), %rsi      # 0x9339
leaq 0x5860(%rip), %r8       # 0x91eb
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
movl %ebp, %edi
xorl %esi, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x39d5
callq 0x6b0f
movq %rax, %r14
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x597a(%rip), %rsi      # 0x933d
movl $0x7c, %edi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x68c8
orl $0x4, %r13d
movl %ebp, %edi
callq 0x21d0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x3a90
movl %r13d, %eax
andl $0x10, %eax
jne 0x3a90
movl %r13d, %ebp
andl $0x2, %ebp
shll $0x8, %ebp
addl $0x241, %ebp            # imm = 0x241
callq 0x5d89
movq %rax, %rdi
movl %ebp, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x2320
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x3a4b
callq 0x6b0f
movq 0x20(%rbx), %rcx
leaq 0x5904(%rip), %rsi      # 0x9339
leaq 0x5b1d(%rip), %r8       # 0x9559
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
movl %ebp, %edi
movl $0x1, %esi
callq 0x2160
cmpl $-0x1, %eax
jne 0x3a89
callq 0x6b0f
movq %rax, %r14
callq 0x2070
movl (%rax), %edi
callq 0x2380
leaq 0x58c6(%rip), %rsi      # 0x933d
movl $0x7c, %edi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x68c8
movl %ebp, %edi
callq 0x21d0
testb $0x40, %r13b
jne 0x3b38
testb $0x1, 0xd8d3(%rip)      # 0x11374
jne 0x3ab8
testb $0x1, 0x87a2(%rip)      # 0xc24c
je 0x3ab8
movl $0x2, %edi
xorl %esi, %esi
callq 0x81f0
testb $0x2, 0xd8b5(%rip)      # 0x11374
jne 0x3bb0
testb $0x2, 0x8780(%rip)      # 0xc24c
je 0x3bb0
movl $0x3, %edi
xorl %esi, %esi
callq 0x81f0
jmp 0x3bb0
testq %r15, %r15
sete %al
testb $0x8, %r12b
sete %cl
orb %al, %cl
jne 0x3b05
movl (%r15), %edi
callq 0x21d0
movl 0x4(%r15), %edi
callq 0x21d0
testb %r12b, %r12b
jns 0x3b1f
leaq 0x585b(%rip), %rsi      # 0x936c
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x6a82
testb $0x11, %r12b
je 0x3c32
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %esi
movl $0x2, %edi
callq 0x81f0
movl $0x1, %esi
movl $0x3, %edi
callq 0x81f0
cmpq $0x0, 0x18(%rbx)
jne 0x3bb0
movl %r13d, %eax
andl $0x8c, %eax
cmpl $0x80, %eax
jne 0x3bb0
xorl %edi, %edi
callq 0x21d0
leaq 0x59ed(%rip), %rdi      # 0x9567
xorl %esi, %esi
xorl %eax, %eax
callq 0x2320
testl %eax, %eax
je 0x3bb0
callq 0x6b0f
leaq 0x57a6(%rip), %rsi      # 0x9339
leaq 0x59cd(%rip), %rcx      # 0x9567
leaq 0x564a(%rip), %r8       # 0x91eb
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
testb $0x4, 0xd7bd(%rip)      # 0x11374
jne 0x3bce
testb $0x4, 0x868c(%rip)      # 0xc24c
je 0x3bce
movl $0xf, %edi
xorl %esi, %esi
callq 0x81f0
cmpl $0x4, 0x38(%rbx)
je 0x3d27
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x3be7
cmpq $0x0, (%rax)
jne 0x3c09
callq 0x6b0f
leaq 0x574a(%rip), %rsi      # 0x933d
leaq 0x5977(%rip), %rcx      # 0x9571
movl $0x7c, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
movl 0x30(%rbx), %edi
movq 0x28(%rbx), %rdx
cmpl $0x14, %edi
jne 0x3d4c
movq (%rdx), %rdi
movq %rdx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7fd9
movl %ebp, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5b1a
cmpl $0x5, %eax
jne 0x3c8f
movq 0x28(%rbx), %r14
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3cb5
callq 0x3226
movl %eax, 0x30(%rbx)
cmpl $0x14, %eax
jne 0x3cec
addq $0x8, %r14
movq %r14, 0x28(%rbx)
orb $0x20, 0x34(%rbx)
movl $0x1, %esi
movl $0x11, %edi
callq 0x81f0
movq 0x8(%rsp), %r14
jmp 0x381d
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4fca
movl 0xd6d1(%rip), %edi      # 0x1137c
callq 0x2190
jmp 0x396d
callq 0x6b0f
movq 0x28(%rbx), %rcx
movq (%rcx), %rcx
leaq 0x5671(%rip), %rsi      # 0x9339
leaq 0x565c(%rip), %r8       # 0x932b
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68c8
callq 0x6b0f
movq 0x28(%rbx), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %r8
leaq 0x5632(%rip), %rsi      # 0x9335
leaq 0x563b(%rip), %r9       # 0x9345
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68c8
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x3d38
andl $0x4c, %r13d
orl %r13d, 0x34(%rdi)
xorl %esi, %esi
xorl %edx, %edx
callq 0x3625
movl 0x8521(%rip), %edi      # 0xc268
callq 0x2080
xorl %esi, %esi
cmpq $0x0, (%rdx,%rsi,8)
leaq 0x1(%rsi), %rsi
jne 0x3d4e
decl %esi
callq 0x6bcc
movl %eax, %edi
callq 0x2080