// File: /workspace/github_c_makefile_star2_O3/s3lase[P]v6shell/osh.c
// Function: syn3
static struct tnode *
syn3(char **p1, char **p2)
{
	struct tnode *t;
	enum tnflags flags;
	static int alcnt;
	int ac, ac1, c, n, subcnt;
	char **p, **pv, **lp, **rp;
	char **tav, **tavp;
	const char **av;
	char *fin, *fout;
	const char *as;

	pv    = xmalloc(((p2 - p1) + 1) * sizeof(char *));
	pv[0] = NULL;
	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 = xstrdup(*p);
				} else {
					if (fout != NULL)
						goto synerr;
					fout = xstrdup(*p);
				}
			}
			continue;

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

	if (lp == NULL) {
		if (n == 0)
			goto synerr;
		if ((as = asget(pv[0])) != NULL && asp == NULL) {
			/*
			 * Substitute alias string pointed to by as
			 * for alias name pointed to by pv[0].
			 */

			/* Check for errors. */
			if (error)
				goto synerr;
			if (alcnt > 2) {
				error_message = ERR_ALIASLOOP;
				goto synerr;
			}
			/* Read and parse as into av. */
			if ((av = rp_alias(as)) == NULL)
				goto synerr;

			/* Create alias vector. */
			ac   = vacount(av);
			tav  = xmalloc((ac + n + 1) * sizeof(char *));
			tavp = tav;
			for (ac = 0; *av[ac] != EOL; ac++)
				*tavp++ = xstrdup(av[ac]);
			for (ac1 = 1; ac1 < n; ac1++)
				*tavp++ = xstrdup(pv[ac1]);
			*tavp++ = xstrdup("\n");
			*tavp   = NULL;

			/* Execute as TSUBSHELL w/o ( ) . */
			alcnt++;
			t = talloc();
			t->ntype = TSUBSHELL;
			t->nsub  = syn1(tav, tavp);
			vfree(tav);
			alcnt--;
		} else {
			/*
			 * Execute as TCOMMAND.
			 */
			t = talloc();
			t->ntype = TCOMMAND;
			t->nav   = xmalloc((n + 1) * sizeof(char *));
			for (ac = 0; ac < n; ac++)
				t->nav[ac] = xstrdup(pv[ac]);
			t->nav[ac] = NULL;
			t->nkey    = cmd_lookup(t->nav[0]);
		}
	} else {
		/*
		 * Execute as TSUBSHELL w/ ( ) .
		 */
		if (n != 0)
			goto synerr;
		t = talloc();
		t->ntype = TSUBSHELL;
		t->nsub  = syn1(lp, rp);
	}
	t->nfin   = fin;
	t->nfout  = fout;
	t->nflags = flags;
	pv[n] = NULL;
	vfree(pv);
	return t;

synerr:
	xfree(fin);
	xfree(fout);
	pv[n] = NULL;
	vfree(pv);
	error = true;
	if (error_message == NULL)
		error_message = ERR_SYNTAX;
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, %r13
movq %rsi, %rax
subq %rdi, %rax
leaq 0x8(%rax), %rdi
callq 0x42b3
movq %rax, %rdi
xorl %eax, %eax
movq $0x0, (%rdi)
cmpq %r13, %r12
jbe 0x4602
movq %rdi, 0x10(%rsp)
movq (%r12), %rax
xorl %ecx, %ecx
cmpb $0x29, (%rax)
sete %cl
shll $0x5, %ecx
movl %ecx, 0x24(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
xorl %r9d, %r9d
movq $0x0, 0x18(%rsp)
xorl %eax, %eax
movl $0x0, (%rsp)
movq (%r13), %r15
movb (%r15), %cl
movzbl %cl, %edx
cmpl $0x3b, %edx
jg 0x43a3
cmpl $0x28, %edx
je 0x44bb
cmpl $0x29, %edx
jne 0x4464
decl %eax
cmoveq %r13, %r9
jmp 0x450e
cmpl $0x3c, %edx
je 0x43d9
cmpl $0x3e, %edx
jne 0x4464
leaq 0x8(%r13), %rdx
cmpq %r12, %rdx
jae 0x43d9
movq 0x8(%r13), %rsi
movl 0x24(%rsp), %r8d
movl %r8d, %edi
orl $0x2, %edi
cmpb $0x3e, (%rsi)
cmoveq %rdx, %r13
cmovel %edi, %r8d
movl %r8d, 0x24(%rsp)
testl %eax, %eax
jne 0x450e
addq $0x8, %r13
cmpq %r12, %r13
je 0x4579
movq (%r13), %r15
movb (%r15), %al
leaq 0x4ee3(%rip), %rdx      # 0x92df
movb (%rdx), %sil
testb %sil, %sil
je 0x440c
incq %rdx
cmpb %al, %sil
jne 0x43fc
testb %sil, %sil
jne 0x4579
cmpb $0x3c, %cl
jne 0x44d8
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
jne 0x45e5
movq %r15, %rdi
movq %rbp, %r14
movq %r9, %rbp
callq 0x2130
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
callq 0x42b3
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x22a0
movq %rbp, %r9
movq %r14, %rbp
jmp 0x450c
testl %eax, %eax
jne 0x450e
movq %r15, %rdi
movq %r9, 0x30(%rsp)
callq 0x2130
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
callq 0x42b3
movq %rbp, 0x28(%rsp)
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x22a0
movq 0x30(%rsp), %r9
movl (%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, (%rsp)
movq 0x10(%rsp), %rcx
movq %r14, (%rcx,%rax,8)
movq 0x28(%rsp), %rbp
jmp 0x450c
testl %eax, %eax
jne 0x44d4
cmpq $0x0, 0x18(%rsp)
jne 0x4579
leaq 0x8(%r13), %rcx
movq %rcx, 0x18(%rsp)
incl %eax
jmp 0x450e
testq %rbp, %rbp
jne 0x4579
movq %r15, %rdi
movq %r9, %r14
callq 0x2130
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
callq 0x42b3
movq %rax, %rbp
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x22a0
movq %r14, %r9
xorl %eax, %eax
addq $0x8, %r13
cmpq %r12, %r13
jb 0x4377
movq 0x18(%rsp), %r14
testq %r14, %r14
je 0x4580
cmpl $0x0, (%rsp)
movq 0x8(%rsp), %rbx
jne 0x45e0
movl $0x40, %edi
movq %r9, %r15
callq 0x42b3
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x4, 0x38(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x40fc
movq %rax, 0x10(%r12)
xorl %r13d, %r13d
jmp 0x4708
movq 0x8(%rsp), %rbx
jmp 0x45e0
movl (%rsp), %eax
testl %eax, %eax
movq 0x8(%rsp), %rbx
je 0x45d9
movl %eax, %r13d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x48cd
testq %rax, %rax
je 0x4645
cmpq $0x0, 0x7ccb(%rip)      # 0xc278
jne 0x4645
cmpb $0x0, 0xa4e6(%rip)      # 0xeaa0
jne 0x45e0
cmpl $0x3, 0xa541(%rip)      # 0xeb04
jl 0x4735
leaq 0x4d13(%rip), %rax      # 0x92e3
movq %rax, 0xa4d1(%rip)      # 0xeaa8
jmp 0x45e0
movl $0x0, (%rsp)
testq %rbx, %rbx
je 0x45ed
movq %rbx, %rdi
callq 0x2050
testq %rbp, %rbp
je 0x45fa
movq %rbp, %rdi
callq 0x2050
movl (%rsp), %eax
movq 0x10(%rsp), %rdi
cltq
movq $0x0, (%rdi,%rax,8)
callq 0x4a67
movb $0x1, 0xa488(%rip)      # 0xeaa0
cmpq $0x0, 0xa488(%rip)      # 0xeaa8
jne 0x4630
leaq 0x4c3c(%rip), %rax      # 0x9265
movq %rax, 0xa478(%rip)      # 0xeaa8
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x40, %edi
callq 0x42b3
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x3, 0x38(%rax)
movl (%rsp), %r14d
movslq %r14d, %rax
leaq 0x8(,%rax,8), %rdi
callq 0x42b3
movq %rax, 0x28(%r12)
testl %r14d, %r14d
jle 0x46f1
movq %r12, (%rsp)
movq %rbp, 0x28(%rsp)
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
movq (%rcx,%rbp,8), %rbx
movq %rbx, %rdi
movq %rax, %r12
callq 0x2130
leaq 0x1(%rax), %r15
movq %r15, %rdi
callq 0x42b3
movq %r13, %r14
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x22a0
movq %r12, %rax
movq %r13, (%r12,%rbp,8)
movq %r14, %r13
incq %rbp
cmpq %rbp, %r14
jne 0x4698
movq %r13, %rcx
movq 0x28(%rsp), %rbp
movq 0x8(%rsp), %rbx
movq (%rsp), %r12
jmp 0x46f3
xorl %ecx, %ecx
movq $0x0, (%rax,%rcx,8)
movq (%rax), %rdi
callq 0x326a
movl %eax, 0x30(%r12)
movq 0x10(%rsp), %rdi
movq %rbx, 0x18(%r12)
movq %rbp, 0x20(%r12)
movl 0x24(%rsp), %eax
movl %eax, 0x34(%r12)
movslq %r13d, %rax
movq $0x0, (%rdi,%rax,8)
callq 0x4a67
jmp 0x4633
movq %rax, %rdi
callq 0x491d
testq %rax, %rax
je 0x45e0
movq %rax, %r12
movq %r13, 0x18(%rsp)
xorl %eax, %eax
cmpq $0x0, (%r12,%rax,8)
leaq 0x1(%rax), %rax
jne 0x4750
addl (%rsp), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x42b3
movq %rax, %r14
movq (%r12), %r15
cmpb $0xa, (%r15)
movq %rax, 0x30(%rsp)
je 0x47bf
addq $0x8, %r12
movq 0x30(%rsp), %r14
movq %r15, %rdi
callq 0x2130
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
callq 0x42b3
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x22a0
movq %r13, (%r14)
addq $0x8, %r14
movq (%r12), %r15
addq $0x8, %r12
cmpb $0xa, (%r15)
jne 0x4785
cmpl $0x2, (%rsp)
jl 0x4823
movq %rbp, 0x28(%rsp)
movq 0x18(%rsp), %rax
leaq -0x8(,%rax,8), %rax
movq %rax, (%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %rbp
movq 0x8(%rbp,%r13), %rbx
movq %rbx, %rdi
callq 0x2130
leaq 0x1(%rax), %r15
movq %r15, %rdi
callq 0x42b3
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x22a0
movq %r12, (%r14,%r13)
addq $0x8, %r13
cmpq %r13, (%rsp)
jne 0x47e3
addq %r13, %r14
movq 0x28(%rsp), %rbp
movq 0x18(%rsp), %r13
leaq 0x4aa0(%rip), %rdi      # 0x92cf
callq 0x48a0
leaq 0x8(%r14), %rbx
movq %rax, (%r14)
xorl %r15d, %r15d
movq %r15, 0x8(%r14)
incl 0xa2bc(%rip)            # 0xeb04
movl $0x40, %edi
callq 0x42b3
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq %r15, 0x30(%rax)
movl $0x4, 0x38(%rax)
movq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40fc
movq %rax, 0x10(%r12)
movq %r14, %rdi
callq 0x4a67
decl 0xa273(%rip)            # 0xeb04
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rbx
jmp 0x470d