// File: /workspace/github_c_makefile_star2_O1/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
movq (%rsi), %rax
xorl %ebp, %ebp
cmpb $0x29, (%rax)
movq %rdi, %rbx
sete %bpl
shll $0x5, %ebp
cmpq %rsi, %rdi
jae 0x3845
xorl %r11d, %r11d
leaq 0x1a54(%rip), %rax      # 0x51a0
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbx, %rcx
xorl %edx, %edx
xorl %r13d, %r13d
movq (%rcx), %r8
movb (%r8), %dil
movzbl %dil, %r9d
cmpl $0x3b, %r9d
jg 0x378c
cmpl $0x28, %r9d
je 0x3813
cmpl $0x29, %r9d
jne 0x3801
decl %edx
cmoveq %rcx, %r14
jmp 0x3836
cmpl $0x3c, %r9d
je 0x37b8
cmpl $0x3e, %r9d
jne 0x3801
leaq 0x8(%rcx), %r8
cmpq %rsi, %r8
jae 0x37b8
movq 0x8(%rcx), %r9
movl %ebp, %r10d
orl $0x2, %r10d
cmpb $0x3e, (%r9)
cmovel %r10d, %ebp
cmoveq %r8, %rcx
testl %edx, %edx
jne 0x3836
addq $0x8, %rcx
cmpq %rsi, %rcx
je 0x391a
movq (%rcx), %r8
movb (%r8), %dl
movq %rax, %r9
movb (%r9), %r10b
testb %r10b, %r10b
je 0x37e2
incq %r9
cmpb %dl, %r10b
jne 0x37d2
testb %r10b, %r10b
jne 0x391a
cmpb $0x3c, %dil
jne 0x3828
testq %r12, %r12
jne 0x391a
xorl %edx, %edx
movq %r8, %r12
jmp 0x3836
testl %edx, %edx
jne 0x3836
movslq %r13d, %rdx
incl %r13d
movq %r8, (%rbx,%rdx,8)
xorl %edx, %edx
jmp 0x3836
testl %edx, %edx
jne 0x3824
testq %r15, %r15
jne 0x391a
leaq 0x8(%rcx), %r15
incl %edx
jmp 0x3836
testq %r11, %r11
jne 0x391a
xorl %edx, %edx
movq %r8, %r11
addq $0x8, %rcx
cmpq %rsi, %rcx
jb 0x375d
jmp 0x3854
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r11d, %r11d
testq %r15, %r15
je 0x38ac
testl %r13d, %r13d
jne 0x391a
movq %r12, 0x10(%rsp)
movl $0x38, %edi
movq %r11, %rbx
callq 0x36cf
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 0x3518
movq %rbx, %rcx
movq %rax, 0x10(%r12)
jmp 0x3936
testl %r13d, %r13d
je 0x391a
movq %r12, 0x10(%rsp)
movq %r11, 0x8(%rsp)
movl $0x38, %edi
callq 0x36cf
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 0x36cf
movq %rax, %r14
movq %rax, 0x28(%r12)
testl %r13d, %r13d
jle 0x3926
movl %r13d, %r15d
leaq (,%r15,8), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21f0
jmp 0x3929
movb $0x1, 0x60b7(%rip)      # 0x99d8
xorl %r12d, %r12d
jmp 0x394a
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)
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq