// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./regexp.c
// Function: js_regcompx
Reprog *regcompx(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
	const char *pattern, int cflags, const char **errorp)
{
	struct cstate g;
	Renode *node;
	Reinst *split, *jump;
	int i, n;

	g.pstart = NULL;
	g.prog = NULL;

	if (setjmp(g.kaboom)) {
		if (errorp) *errorp = g.error;
		alloc(ctx, g.pstart, 0);
		if (g.prog) {
			alloc(ctx, g.prog->cclass, 0);
			alloc(ctx, g.prog->start, 0);
			alloc(ctx, g.prog, 0);
		}
		return NULL;
	}

	g.prog = alloc(ctx, NULL, sizeof (Reprog));
	if (!g.prog)
		die(&g, "cannot allocate regular expression");
	g.prog->start = NULL;
	g.prog->cclass = NULL;

	n = strlen(pattern) * 2;
	if (n > REG_MAXPROG)
		die(&g, "program too large");
	if (n > 0) {
		g.pstart = g.pend = alloc(ctx, NULL, sizeof (Renode) * n);
		if (!g.pstart)
			die(&g, "cannot allocate regular expression parse list");
	}

	g.source = pattern;
	g.ncclass = 0;
	g.nsub = 1;
	for (i = 0; i < REG_MAXSUB; ++i)
		g.sub[i] = 0;

	g.prog->flags = cflags;

	next(&g);
	node = parsealt(&g);
	if (g.lookahead == ')')
		die(&g, "unmatched ')'");
	if (g.lookahead != EOF)
		die(&g, "syntax error");

#ifdef TEST
	dumpnode(&g, node);
	putchar('\n');
#endif

	n = 6 + count(&g, node, 0);
	if (n < 0 || n > REG_MAXPROG)
		die(&g, "program too large");

	g.prog->nsub = g.nsub;
	g.prog->start = g.prog->end = alloc(ctx, NULL, n * sizeof (Reinst));
	if (!g.prog->start)
		die(&g, "cannot allocate regular expression instruction list");

	if (g.ncclass > 0) {
		g.prog->cclass = alloc(ctx, NULL, g.ncclass * sizeof (Reclass));
		if (!g.prog->cclass)
			die(&g, "cannot allocate regular expression character class list");
		memcpy(g.prog->cclass, g.cclass, g.ncclass * sizeof (Reclass));
		for (i = 0; i < g.ncclass; ++i)
			g.prog->cclass[i].end = g.prog->cclass[i].spans + (g.cclass[i].end - g.cclass[i].spans);
	}

	split = emit(g.prog, I_SPLIT);
	split->x = split + 3;
	split->y = split + 1;
	emit(g.prog, I_ANYNL);
	jump = emit(g.prog, I_JUMP);
	jump->x = split;
	emit(g.prog, I_LPAR);
	compile(g.prog, node);
	emit(g.prog, I_RPAR);
	emit(g.prog, I_END);

#ifdef TEST
	dumpprog(g.prog);
#endif

	alloc(ctx, g.pstart, 0);

	if (errorp) *errorp = NULL;
	return g.prog;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8598, %rsp           # imm = 0x8598
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0xc8(%rdi)
callq 0x3100
testl %eax, %eax
je 0x70e0
testq %r15, %r15
je 0x709c
movq 0xc0(%rsp), %rax
movq %rax, (%r15)
movq 0x8(%rsp), %rsi
xorl %ebp, %ebp
movq %r14, %rdi
movl %ebp, %edx
callq *%rbx
movq (%rsp), %rax
testq %rax, %rax
je 0x70d9
movq 0x10(%rax), %rsi
xorl %ebp, %ebp
movq %r14, %rdi
movl %ebp, %edx
callq *%rbx
movq (%rsp), %rax
movq (%rax), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq *%rbx
movq (%rsp), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq *%rbx
movl %ebp, %eax
jmp 0x73c0
xorl %eax, %eax
movl %eax, %esi
movq %r14, %rdi
movl $0x20, %edx
callq *%rbx
movq %rax, (%rsp)
testq %rax, %rax
je 0x73e9
movq %rax, %r12
xorl %eax, %eax
movq %rax, (%r12)
movq %rax, 0x10(%r12)
movq %r13, %rdi
callq 0x3200
movl %eax, %edx
addl %eax, %eax
cmpl $0x8001, %eax           # imm = 0x8001
jge 0x73e0
testl %eax, %eax
jle 0x7147
shll $0x6, %edx
xorl %eax, %eax
movl %eax, %esi
movq %r14, %rdi
callq *%rbx
movq %rax, 0x10(%rsp)
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x7404
movq (%rsp), %r12
movq %r12, %rax
movq %rsp, %r12
movq %r13, 0x18(%r12)
movabsq $0x100000000, %rcx      # imm = 0x100000000
movq %rcx, 0x20(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r12)
movups %xmm0, 0x38(%r12)
movups %xmm0, 0x48(%r12)
movups %xmm0, 0x58(%r12)
movups %xmm0, 0x68(%r12)
movups %xmm0, 0x78(%r12)
movups %xmm0, 0x88(%r12)
movups %xmm0, 0x98(%r12)
movl %ebp, 0x18(%rax)
movq %r12, %rdi
callq 0x1af6c
movq %r12, %rdi
callq 0x1b632
movl 0xa8(%r12), %ecx
cmpl $-0x1, %ecx
jne 0x73d2
movq %rax, %r13
movq %rsp, %rbp
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1b6b4
movl %eax, %ecx
addl $0xffff8005, %ecx       # imm = 0xFFFF8005
cmpl $0xffff7ffe, %ecx       # imm = 0xFFFF7FFE
jbe 0x73e0
movl 0x24(%rsp), %ecx
movq (%rsp), %rdx
movl %ecx, 0x1c(%rdx)
shll $0x5, %eax
movl %eax, %edx
addl $0xc0, %edx
xorl %eax, %eax
movl %eax, %esi
movq %r14, %rdi
callq *%rbx
movq (%rsp), %rcx
movq %rax, 0x8(%rcx)
movq %rax, (%rcx)
testq %rax, %rax
je 0x73fb
movl 0x20(%rsp), %eax
testl %eax, %eax
jle 0x72d1
movl %eax, %ecx
shll $0x8, %eax
leal (%rax,%rcx,8), %edx
xorl %eax, %eax
movl %eax, %esi
movq %r14, %rdi
callq *%rbx
movq (%rsp), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0x740d
movq %rax, %rdi
leaq 0x190(%rsp), %r12
movslq -0x170(%r12), %rax
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,8), %rdx
movq %r12, %rsi
callq 0x33d0
movslq -0x170(%r12), %rsi
movq -0x190(%r12), %rax
testq %rsi, %rsi
jle 0x72ce
movq 0x10(%rax), %rcx
movq $-0x198, %r8            # imm = 0xFE68
subq %rbp, %r8
leaq 0x8(%rcx), %rdx
movq %rsi, %rdi
shlq $0x8, %rdi
leaq (%rdi,%rsi,8), %rsi
xorl %edi, %edi
movq 0x190(%rsp,%rdi), %r10
addq %r8, %r10
addq %rdx, %r10
addq %rdi, %r10
movq %r10, (%rcx,%rdi)
addq $-0x108, %r8            # imm = 0xFEF8
movq %rdi, %r9
addq $0x108, %r9             # imm = 0x108
movq %r9, %rdi
cmpq %r9, %rsi
jne 0x72a0
movq %rax, %rcx
movq 0x8(%rcx), %rax
leaq 0x20(%rax), %rdx
movq %rdx, 0x8(%rcx)
movw $0x2, (%rax)
movq $0x0, 0x4(%rax)
movl $0x0, 0xc(%rax)
leaq 0x60(%rax), %rcx
movq %rcx, 0x10(%rax)
movq %rdx, 0x18(%rax)
movq (%rsp), %rcx
movq 0x8(%rcx), %rdx
leaq 0x20(%rdx), %rsi
movq %rsi, 0x8(%rcx)
movw $0x5, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rdx)
movups %xmm0, 0x10(%rdx)
movq (%rsp), %rcx
movq 0x8(%rcx), %rdx
leaq 0x20(%rdx), %rsi
movq %rsi, 0x8(%rcx)
movw $0x1, (%rdx)
movups %xmm0, 0x4(%rdx)
movups %xmm0, 0x10(%rdx)
movq %rax, 0x10(%rdx)
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x8(%rax)
movw $0xf, (%rcx)
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x1b839
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x8(%rax)
movw $0x10, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x8(%rax)
movw $0x0, (%rcx)
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
movq 0x8(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq *%rbx
testq %r15, %r15
je 0x73bc
movq $0x0, (%r15)
movq (%rsp), %rax
addq $0x8598, %rsp           # imm = 0x8598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x29, %ecx
jne 0x73f2
leaq 0x2c7f4(%rip), %rax     # 0x33bd2
jmp 0x7414
leaq 0x2c7ab(%rip), %rax     # 0x33b92
jmp 0x7414
leaq 0x2c77f(%rip), %rax     # 0x33b6f
jmp 0x7414
leaq 0x2c7e7(%rip), %rax     # 0x33be0
jmp 0x7414
leaq 0x2c7eb(%rip), %rax     # 0x33bed
jmp 0x7414
leaq 0x2c799(%rip), %rax     # 0x33ba4
jmp 0x7414
leaq 0x2c80d(%rip), %rax     # 0x33c21
movq %rax, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
movl $0x1, %esi
callq 0x3320