// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpq %rsi, %rdi
jae 0x38de
movq %rdi, %rbx
movq (%rsi), %rax
xorl %ebp, %ebp
cmpb $0x29, (%rax)
sete %bpl
shll $0x5, %ebp
xorl %r11d, %r11d
leaq 0x1a7c(%rip), %rax      # 0x519d
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rdi, %rcx
xorl %edx, %edx
xorl %r13d, %r13d
movq (%rcx), %r8
movb (%r8), %dil
movzbl %dil, %r9d
cmpl $0x3b, %r9d
jg 0x3761
cmpl $0x28, %r9d
je 0x37e8
cmpl $0x29, %r9d
jne 0x37d6
decl %edx
cmoveq %rcx, %r14
jmp 0x380b
cmpl $0x3c, %r9d
je 0x378d
cmpl $0x3e, %r9d
jne 0x37d6
leaq 0x8(%rcx), %r8
cmpq %rsi, %r8
jae 0x378d
movq 0x8(%rcx), %r9
movl %ebp, %r10d
orl $0x2, %r10d
cmpb $0x3e, (%r9)
cmovel %r10d, %ebp
cmoveq %r8, %rcx
testl %edx, %edx
jne 0x380b
addq $0x8, %rcx
cmpq %rsi, %rcx
je 0x38de
movq (%rcx), %r8
movb (%r8), %dl
movq %rax, %r9
movb (%r9), %r10b
testb %r10b, %r10b
je 0x37b7
incq %r9
cmpb %dl, %r10b
jne 0x37a7
testb %r10b, %r10b
jne 0x38de
cmpb $0x3c, %dil
jne 0x37fd
testq %r12, %r12
jne 0x38de
xorl %edx, %edx
movq %r8, %r12
jmp 0x380b
testl %edx, %edx
jne 0x380b
movslq %r13d, %rdx
incl %r13d
movq %r8, (%rbx,%rdx,8)
xorl %edx, %edx
jmp 0x380b
testl %edx, %edx
jne 0x37f9
testq %r15, %r15
jne 0x38de
leaq 0x8(%rcx), %r15
incl %edx
jmp 0x380b
testq %r11, %r11
jne 0x38de
xorl %edx, %edx
movq %r8, %r11
addq $0x8, %rcx
cmpq %rsi, %rcx
jb 0x3732
testq %r15, %r15
je 0x3870
testl %r13d, %r13d
jne 0x38de
movq %r12, 0x10(%rsp)
movl $0x38, %edi
movq %r11, %rbx
callq 0x36a4
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x4, 0x34(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x34fb
movq %rbx, %rcx
movq %rax, 0x10(%r12)
jmp 0x390a
testl %r13d, %r13d
je 0x38de
movq %r12, 0x10(%rsp)
movq %r11, 0x8(%rsp)
movl $0x38, %edi
callq 0x36a4
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x3, 0x34(%rax)
movslq %r13d, %rax
leaq 0x8(,%rax,8), %rdi
callq 0x36a4
movq %rax, %r14
movq %rax, 0x28(%r12)
testl %r13d, %r13d
jle 0x38fa
movl %r13d, %r15d
leaq (,%r15,8), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21f0
jmp 0x38fd
movb $0x1, 0x60f3(%rip)      # 0x99d8
xorl %r12d, %r12d
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
movq 0x8(%rsp), %rcx
movq $0x0, (%r14,%r15,8)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%r12)
movq %rcx, 0x20(%r12)
movl %ebp, 0x30(%r12)
jmp 0x38e8