// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0xc8(%rdi)
callq 0x3100
testl %eax, %eax
je 0x5e62
testq %r15, %r15
je 0x5e1e
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 0x5e5b
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 0x6100
xorl %eax, %eax
movl %eax, %esi
pushq $0x20
popq %rdx
movq %r14, %rdi
callq *%rbx
movq %rax, (%rsp)
testq %rax, %rax
je 0x6129
andq $0x0, (%rax)
andq $0x0, 0x10(%rax)
movq %r12, %rdi
callq 0x3200
movl %eax, %edx
addl %eax, %eax
cmpl $0x8001, %eax           # imm = 0x8001
jge 0x6120
testl %eax, %eax
jle 0x5ebe
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 0x6144
movq %r12, 0x18(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x20(%rsp)
pushq $0x5
popq %rax
cmpq $0x15, %rax
je 0x5ee5
andq $0x0, (%rsp,%rax,8)
incq %rax
jmp 0x5ed5
movq %rsp, %r12
movq (%r12), %rax
movl %ebp, 0x18(%rax)
movq %r12, %rdi
callq 0x14140
movq %r12, %rdi
callq 0x1470b
movl 0xa8(%r12), %ecx
cmpl $-0x1, %ecx
jne 0x6112
movq %rax, %r12
movq %rsp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1477f
movl %eax, %ecx
addl $0xffff8005, %ecx       # imm = 0xFFFF8005
cmpl $0xffff7ffe, %ecx       # imm = 0xFFFF7FFE
jbe 0x6120
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 0x613b
movl 0x20(%rsp), %edx
testl %edx, %edx
jle 0x6019
imull $0x108, %edx, %edx      # imm = 0x108
xorl %r13d, %r13d
movl %r13d, %esi
movq %r14, %rdi
callq *%rbx
movq (%rsp), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0x614d
movq %rax, %rdi
leaq 0x190(%rsp), %rbp
movslq -0x170(%rbp), %rax
imulq $0x108, %rax, %rdx      # imm = 0x108
movq %rbp, %rsi
callq 0x33d0
movl -0x170(%rbp), %ecx
movq -0x190(%rbp), %rax
testl %ecx, %ecx
cmovlel %r13d, %ecx
imulq $0x108, %rcx, %rcx      # imm = 0x108
movq $-0x198, %rdx           # imm = 0xFE68
movq %rsp, %rsi
subq %rsi, %rdx
movl %r13d, %esi
cmpq %rsi, %rcx
je 0x6013
movq 0x10(%rax), %rdi
leaq (%rdi,%rsi), %r8
movq 0x190(%rsp,%rsi), %r9
addq %rdx, %r9
addq %r9, %r8
addq $0x8, %r8
movq %r8, (%rdi,%rsi)
addq $0x108, %rsi            # imm = 0x108
addq $-0x108, %rdx           # imm = 0xFEF8
jmp 0x5fe0
movq 0x8(%rax), %rdx
jmp 0x601f
movq %rax, %rdx
movq %rcx, %rax
leaq 0x20(%rdx), %rcx
movq %rcx, 0x8(%rax)
movw $0x2, (%rdx)
andq $0x0, 0x4(%rdx)
andl $0x0, 0xc(%rdx)
leaq 0x60(%rdx), %rax
movq %rax, 0x10(%rdx)
movq %rcx, 0x18(%rdx)
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rsi
movq %rsi, 0x8(%rax)
movw $0x5, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rsi
movq %rsi, 0x8(%rax)
movw $0x1, (%rcx)
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
movq %rdx, 0x10(%rcx)
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 %r12, %rsi
callq 0x148c6
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)
andw $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 0x60fc
andq $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 0x6132
leaq 0x22a84(%rip), %rsi     # 0x28ba2
jmp 0x6154
leaq 0x22a3b(%rip), %rsi     # 0x28b62
jmp 0x6154
leaq 0x22a0f(%rip), %rsi     # 0x28b3f
jmp 0x6154
leaq 0x22a77(%rip), %rsi     # 0x28bb0
jmp 0x6154
leaq 0x22a7b(%rip), %rsi     # 0x28bbd
jmp 0x6154
leaq 0x22a29(%rip), %rsi     # 0x28b74
jmp 0x6154
leaq 0x22a9d(%rip), %rsi     # 0x28bf1
movq %rsp, %rdi
callq 0x14129