// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x85e0, %rsp           # imm = 0x85E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x85b8(%rbp)
movq $0x0, -0x85c0(%rbp)
leaq -0x85c0(%rbp), %rdi
addq $0xc8, %rdi
callq 0x30e0
cmpl $0x0, %eax
je 0x6d3b
cmpq $0x0, -0x30(%rbp)
je 0x6cd1
movq -0x8500(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x85b8(%rbp), %rsi
xorl %edx, %edx
callq *%rax
cmpq $0x0, -0x85c0(%rbp)
je 0x6d2e
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x85c0(%rbp), %rcx
movq 0x10(%rcx), %rsi
xorl %edx, %edx
callq *%rax
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x85c0(%rbp), %rcx
movq (%rcx), %rsi
xorl %edx, %edx
callq *%rax
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x85c0(%rbp), %rsi
xorl %edx, %edx
callq *%rax
movq $0x0, -0x8(%rbp)
jmp 0x71af
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl $0x20, %edx
callq *%rax
movq %rax, -0x85c0(%rbp)
cmpq $0x0, -0x85c0(%rbp)
jne 0x6d72
leaq -0x85c0(%rbp), %rdi
leaq 0x3547d(%rip), %rsi     # 0x3c1ea
callq 0x1c7b0
movq -0x85c0(%rbp), %rax
movq $0x0, (%rax)
movq -0x85c0(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rdi
callq 0x31e0
shlq %rax
movl %eax, -0x85e0(%rbp)
cmpl $0x8000, -0x85e0(%rbp)  # imm = 0x8000
jle 0x6dc0
leaq -0x85c0(%rbp), %rdi
leaq 0x35452(%rip), %rsi     # 0x3c20d
callq 0x1c7b0
cmpl $0x0, -0x85e0(%rbp)
jle 0x6e11
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movslq -0x85e0(%rbp), %rcx
shlq $0x5, %rcx
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq %rax, -0x85b0(%rbp)
movq %rax, -0x85b8(%rbp)
cmpq $0x0, -0x85b8(%rbp)
jne 0x6e0f
leaq -0x85c0(%rbp), %rdi
leaq 0x35415(%rip), %rsi     # 0x3c21f
callq 0x1c7b0
jmp 0x6e11
movq -0x20(%rbp), %rax
movq %rax, -0x85a8(%rbp)
movl $0x0, -0x85a0(%rbp)
movl $0x1, -0x859c(%rbp)
movl $0x0, -0x85dc(%rbp)
cmpl $0x10, -0x85dc(%rbp)
jge 0x6e67
movslq -0x85dc(%rbp), %rax
movq $0x0, -0x8598(%rbp,%rax,8)
movl -0x85dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x85dc(%rbp)
jmp 0x6e3a
movl -0x24(%rbp), %ecx
movq -0x85c0(%rbp), %rax
movl %ecx, 0x18(%rax)
leaq -0x85c0(%rbp), %rdi
callq 0x1c7f0
leaq -0x85c0(%rbp), %rdi
callq 0x1c820
movq %rax, -0x85c8(%rbp)
cmpl $0x29, -0x8518(%rbp)
jne 0x6eaf
leaq -0x85c0(%rbp), %rdi
leaq 0x353a3(%rip), %rsi     # 0x3c24d
callq 0x1c7b0
cmpl $-0x1, -0x8518(%rbp)
je 0x6ecb
leaq -0x85c0(%rbp), %rdi
leaq 0x35395(%rip), %rsi     # 0x3c25b
callq 0x1c7b0
movq -0x85c8(%rbp), %rsi
leaq -0x85c0(%rbp), %rdi
xorl %edx, %edx
callq 0x1c8a0
addl $0x6, %eax
movl %eax, -0x85e0(%rbp)
cmpl $0x0, -0x85e0(%rbp)
jl 0x6efe
cmpl $0x8000, -0x85e0(%rbp)  # imm = 0x8000
jle 0x6f11
leaq -0x85c0(%rbp), %rdi
leaq 0x35301(%rip), %rsi     # 0x3c20d
callq 0x1c7b0
movl -0x859c(%rbp), %ecx
movq -0x85c0(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movslq -0x85e0(%rbp), %rcx
shlq $0x5, %rcx
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq %rax, %rcx
movq -0x85c0(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x85c0(%rbp), %rax
movq %rcx, (%rax)
movq -0x85c0(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x6f74
leaq -0x85c0(%rbp), %rdi
leaq 0x352f9(%rip), %rsi     # 0x3c268
callq 0x1c7b0
cmpl $0x0, -0x85a0(%rbp)
jle 0x70bd
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movslq -0x85a0(%rbp), %rcx
imulq $0x108, %rcx, %rcx      # imm = 0x108
movl %ecx, %edx
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq %rax, %rcx
movq -0x85c0(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x85c0(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x6fce
leaq -0x85c0(%rbp), %rdi
leaq 0x352d3(%rip), %rsi     # 0x3c29c
callq 0x1c7b0
movq -0x85c0(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x85c0(%rbp), %rsi
addq $0x190, %rsi            # imm = 0x190
movslq -0x85a0(%rbp), %rax
imulq $0x108, %rax, %rdx      # imm = 0x108
callq 0x33a0
movl $0x0, -0x85dc(%rbp)
movl -0x85dc(%rbp), %eax
cmpl -0x85a0(%rbp), %eax
jge 0x70bb
movq -0x85c0(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x85dc(%rbp), %rax
imulq $0x108, %rax, %rax      # imm = 0x108
addq %rax, %rcx
addq $0x8, %rcx
leaq -0x85c0(%rbp), %rax
addq $0x190, %rax            # imm = 0x190
movslq -0x85dc(%rbp), %rdx
imulq $0x108, %rdx, %rdx      # imm = 0x108
addq %rdx, %rax
movq (%rax), %rax
leaq -0x85c0(%rbp), %rdx
addq $0x190, %rdx            # imm = 0x190
movslq -0x85dc(%rbp), %rsi
imulq $0x108, %rsi, %rsi      # imm = 0x108
addq %rsi, %rdx
addq $0x8, %rdx
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x85c0(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x85dc(%rbp), %rdx
imulq $0x108, %rdx, %rdx      # imm = 0x108
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x85dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x85dc(%rbp)
jmp 0x7004
jmp 0x70bd
movq -0x85c0(%rbp), %rdi
movl $0x2, %esi
callq 0x1caa0
movq %rax, -0x85d0(%rbp)
movq -0x85d0(%rbp), %rcx
addq $0x60, %rcx
movq -0x85d0(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x85d0(%rbp), %rcx
addq $0x20, %rcx
movq -0x85d0(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x85c0(%rbp), %rdi
movl $0x5, %esi
callq 0x1caa0
movq -0x85c0(%rbp), %rdi
movl $0x1, %esi
callq 0x1caa0
movq %rax, -0x85d8(%rbp)
movq -0x85d0(%rbp), %rcx
movq -0x85d8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x85c0(%rbp), %rdi
movl $0xf, %esi
callq 0x1caa0
movq -0x85c0(%rbp), %rdi
movq -0x85c8(%rbp), %rsi
callq 0x1cb10
movq -0x85c0(%rbp), %rdi
movl $0x10, %esi
callq 0x1caa0
movq -0x85c0(%rbp), %rdi
xorl %esi, %esi
callq 0x1caa0
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x85b8(%rbp), %rsi
xorl %edx, %edx
callq *%rax
cmpq $0x0, -0x30(%rbp)
je 0x71a4
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x85c0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x85e0, %rsp           # imm = 0x85E0
popq %rbp
retq
nopl (%rax)