// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxRegexp.c
// Function: Reg
static char *
Reg(
Hax_Interp *interp,
int paren,			/* Parenthesized? */
int *flagp)
{
	Interp *iPtr = (Interp *) interp;
	char *ret;
	char *br;
	char *ender;
	int parno = 0;
	int flags;

	*flagp = HASWIDTH;	/* Tentatively. */

	/* Make an OPEN node, if parenthesized. */
	if (paren) {
		if (iPtr->regnpar >= NSUBEXP)
			FAIL((char *) "too many ()");
		parno = iPtr->regnpar;
		iPtr->regnpar++;
		ret = RegNode(interp, OPEN+parno);
	} else
		ret = NULL;

	/* Pick up the branches, linking them together. */
	br = RegBranch(interp, &flags);
	if (br == NULL)
		return(NULL);
	if (ret != NULL)
		RegTail(interp, ret, br);	/* OPEN -> first. */
	else
		ret = br;
	if (!(flags&HASWIDTH))
		*flagp &= ~HASWIDTH;
	*flagp |= flags&SPSTART;
	while (*iPtr->regparse == '|') {
		iPtr->regparse++;
		br = RegBranch(interp, &flags);
		if (br == NULL)
			return(NULL);
		RegTail(interp, ret, br);	/* BRANCH -> BRANCH. */
		if (!(flags&HASWIDTH))
			*flagp &= ~HASWIDTH;
		*flagp |= flags&SPSTART;
	}

	/* Make a closing node, and hook it on the end. */
	ender = RegNode(interp, (paren) ? CLOSE+parno : END);
	RegTail(interp, ret, ender);

	/* Hook the tails of the branches to the closing node. */
	for (br = ret; br != NULL; br = RegNext(interp, br))
		RegOpTail(interp, br, ender);

	/* Check for proper termination. */
	if (paren && *iPtr->regparse++ != ')') {
		FAIL((char *) "unmatched ()");
	} else if (!paren && *iPtr->regparse != '\0') {
		if (*iPtr->regparse == ')') {
			FAIL((char *) "unmatched ()");
		} else
			FAIL((char *) "junk on end");	/* "Can't happen". */
		/* NOTREACHED */
	}

	return(ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
movl $0x1, (%rdx)
testl %esi, %esi
je 0x4975
movl 0x2a0(%rbx), %r13d
cmpl $0x9, %r13d
jle 0x497d
leaq 0xe7cb(%rip), %rsi      # 0x1313b
jmp 0x4ab5
xorl %r13d, %r13d
xorl %r14d, %r14d
jmp 0x499d
leal 0x1(%r13), %eax
movl %eax, 0x2a0(%rbx)
leal 0x14(%r13), %eax
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4c9b
movq %rax, %r14
addb $0x1e, %r13b
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ccb
testq %rax, %rax
je 0x4abd
testq %r14, %r14
je 0x49c8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5327
jmp 0x49cb
movq %rax, %r14
leaq 0x4(%rsp), %r12
movl (%r12), %eax
movl (%r15), %ecx
movl %ecx, %edx
andl $-0x2, %edx
testb $0x1, %al
cmovnel %ecx, %edx
andl $0x4, %eax
orl %edx, %eax
movl %eax, (%r15)
movq 0x298(%rbx), %rax
cmpb $0x7c, (%rax)
jne 0x4a39
incq %rax
movq %rax, 0x298(%rbx)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4ccb
testq %rax, %rax
je 0x4abd
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5327
movl 0x4(%rsp), %eax
movl (%r15), %ecx
testb $0x1, %al
jne 0x4a32
andl $-0x2, %ecx
movl %ecx, (%r15)
andl $0x4, %eax
orl %ecx, %eax
jmp 0x49e6
movsbl %r13b, %esi
movq %rbx, %rdi
callq 0x4c9b
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5327
movq %r14, %r12
testq %r12, %r12
je 0x4a7c
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x5372
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4ad2
movq %rax, %r12
jmp 0x4a59
movq 0x298(%rbx), %rax
testl %ebp, %ebp
je 0x4a99
leaq 0x1(%rax), %rcx
movq %rcx, 0x298(%rbx)
cmpb $0x29, (%rax)
jne 0x4aa5
jmp 0x4ac0
movzbl (%rax), %eax
testl %eax, %eax
je 0x4ac0
cmpl $0x29, %eax
jne 0x4aae
leaq 0xe69b(%rip), %rsi      # 0x13147
jmp 0x4ab5
leaq 0xe69f(%rip), %rsi      # 0x13154
movq %rbx, %rdi
callq 0x4220
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq