// File: /workspace/github_c_makefile_star2_O1/ccxvii[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), %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0xc8(%r12)
movq %r12, %rdi
callq 0x3100
testl %eax, %eax
je 0x71a3
testq %r15, %r15
je 0x715f
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 0x719c
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 0x7471
xorl %eax, %eax
movl %eax, %esi
movq %r14, %rdi
movl $0x20, %edx
callq *%rbx
movq %rax, (%rsp)
testq %rax, %rax
je 0x7491
xorl %ecx, %ecx
movq %rcx, (%rax)
movq %rcx, 0x10(%rax)
movq %r13, %rdi
callq 0x3200
movl %eax, %edx
addl %eax, %eax
cmpl $0x8001, %eax           # imm = 0x8001
jge 0x749a
testl %eax, %eax
jle 0x7201
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 0x74c9
movq %rsp, %r12
movq %r13, 0x18(%r12)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 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)
movq (%r12), %rax
movl %ebp, 0x18(%rax)
movq %r12, %rdi
callq 0x1b447
movq %r12, %rdi
callq 0x1bb0e
movl 0xa8(%r12), %ecx
cmpl $-0x1, %ecx
jne 0x7483
movq %rax, %r13
movq %rsp, %rbp
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1bb90
movl %eax, %ecx
addl $0xffff8005, %ecx       # imm = 0xFFFF8005
cmpl $0xffff7ffe, %ecx       # imm = 0xFFFF7FFE
jbe 0x74b7
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 0x74c0
movl 0x20(%rsp), %eax
testl %eax, %eax
jle 0x7385
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 0x74d2
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), %rdx
testq %rdx, %rdx
jle 0x7385
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq $-0x198, %rdi           # imm = 0xFE68
subq %rbp, %rdi
leaq 0x8(%rax), %rcx
movq %rdx, %rsi
shlq $0x8, %rsi
leaq (%rsi,%rdx,8), %rdx
xorl %esi, %esi
movq 0x190(%rsp,%rsi), %r9
addq %rdi, %r9
addq %rcx, %r9
addq %rsi, %r9
movq %r9, (%rax,%rsi)
addq $-0x108, %rdi           # imm = 0xFEF8
movq %rsi, %r8
addq $0x108, %r8             # imm = 0x108
movq %r8, %rsi
cmpq %r8, %rdx
jne 0x7357
movq (%rsp), %rax
movq 0x8(%rax), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x8(%rax)
movw $0x2, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rcx)
movups %xmm0, 0x10(%rcx)
leaq 0x60(%rcx), %rax
movq %rax, 0x10(%rcx)
movq %rdx, 0x18(%rcx)
movq (%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x20(%rdx), %rsi
movq %rsi, 0x8(%rax)
movw $0x5, (%rdx)
movups %xmm0, 0x4(%rdx)
movups %xmm0, 0x10(%rdx)
movq (%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x20(%rdx), %rsi
movq %rsi, 0x8(%rax)
movw $0x1, (%rdx)
movups %xmm0, 0x4(%rdx)
movups %xmm0, 0x10(%rdx)
movq %rcx, 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 0x1bce7
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 0x746d
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 0x74ae
leaq 0x2c713(%rip), %rax     # 0x33ba2
jmp 0x74d9
leaq 0x2c6a7(%rip), %rax     # 0x33b3f
jmp 0x74a1
leaq 0x2c6c1(%rip), %rax     # 0x33b62
movq %rax, 0xc0(%rsp)
movq %r12, %rdi
jmp 0x74e9
leaq 0x2c6fb(%rip), %rax     # 0x33bb0
jmp 0x74d9
leaq 0x2c6a4(%rip), %rax     # 0x33b62
jmp 0x74d9
leaq 0x2c6f6(%rip), %rax     # 0x33bbd
jmp 0x74d9
leaq 0x2c6a4(%rip), %rax     # 0x33b74
jmp 0x74d9
leaq 0x2c718(%rip), %rax     # 0x33bf1
movq %rax, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
movl $0x1, %esi
callq 0x3320