// File: /workspace/github_c_makefile_star2_O0/s3lase[P]v6shell/sh6.c
// Function: syn3
static struct tnode *
syn3(char **p1, char **p2)
{
	struct tnode *t;
	enum tnflags flags;
	int ac, c, n, subcnt;
	char **p, **lp, **rp;
	char *fin, *fout;

	flags = 0;
	if (**p2 == RPARENTHESIS)
		flags |= FNOFORK;

	fin    = NULL;
	fout   = NULL;
	lp     = NULL;
	rp     = NULL;
	n      = 0;
	subcnt = 0;
	for (p = p1; p < p2; p++)
		switch (c = **p) {
		case LPARENTHESIS:
			if (subcnt == 0) {
				if (lp != NULL)
					goto synerr;
				lp = p + 1;
			}
			subcnt++;
			continue;

		case RPARENTHESIS:
			subcnt--;
			if (subcnt == 0)
				rp = p;
			continue;

		case GREATERTHAN:
			p++;
			if (p < p2 && **p == GREATERTHAN)
				flags |= FCAT;
			else
				p--;
			/*FALLTHROUGH*/

		case LESSTHAN:
			if (subcnt == 0) {
				p++;
				if (p == p2 || any(**p, REDIRERR))
					goto synerr;
				if (c == LESSTHAN) {
					if (fin != NULL)
						goto synerr;
					fin = *p;
				} else {
					if (fout != NULL)
						goto synerr;
					fout = *p;
				}
			}
			continue;

		default:
			if (subcnt == 0)
				p1[n++] = *p;
		}

	if (lp == NULL) {
		if (n == 0)
			goto synerr;
		t = talloc();
		t->ntype = TCOMMAND;
		t->nav   = xmalloc((n + 1) * sizeof(char *));
		for (ac = 0; ac < n; ac++)
			t->nav[ac] = p1[ac];
		t->nav[ac] = NULL;
	} else {
		if (n != 0)
			goto synerr;
		t = talloc();
		t->ntype = TSUBSHELL;
		t->nsub  = syn1(lp, rp);
	}
	t->nfin   = fin;
	t->nfout  = fout;
	t->nflags = flags;
	return t;

synerr:
	error = true;
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
jne 0x3eef
movl -0x24(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x24(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x409b
movq -0x40(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
addl $-0x28, %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x16, %eax
ja 0x4063
movq -0x68(%rbp), %rax
leaq 0x2453(%rip), %rcx      # 0x63b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x34(%rbp)
jne 0x3f84
cmpq $0x0, -0x48(%rbp)
je 0x3f78
jmp 0x418e
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x408a
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x3fa9
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x408a
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x3fde
movq -0x40(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0x3fde
movl -0x24(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x3fea
movq -0x40(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x40(%rbp)
jmp 0x3fec
cmpl $0x0, -0x34(%rbp)
jne 0x4061
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x4024
movq -0x40(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %edi
leaq 0x247b(%rip), %rsi      # 0x6494
callq 0x3a30
testb $0x1, %al
jne 0x4024
jmp 0x4029
jmp 0x418e
cmpl $0x3c, -0x2c(%rbp)
jne 0x4048
cmpq $0x0, -0x58(%rbp)
je 0x403b
jmp 0x418e
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x405f
cmpq $0x0, -0x60(%rbp)
je 0x4054
jmp 0x418e
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x4061
jmp 0x408a
cmpl $0x0, -0x34(%rbp)
jne 0x4086
movq -0x40(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x4088
jmp 0x408a
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
jmp 0x3f25
cmpq $0x0, -0x48(%rbp)
jne 0x412e
cmpl $0x0, -0x30(%rbp)
jne 0x40b1
jmp 0x418e
callq 0x3cd0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x3, 0x34(%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x3e60
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x4118
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x40e9
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x28(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x4162
cmpl $0x0, -0x30(%rbp)
je 0x4136
jmp 0x418e
callq 0x3cd0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x4, 0x34(%rax)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x3b60
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x60(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x419d
movb $0x1, 0x6843(%rip)      # 0xa9d8
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)