// File: /workspace/github_c_makefile_star2_O0/ccxvii[P]mujs/./jsregexp.c
// Function: js_RegExp_prototype_exec
void js_RegExp_prototype_exec(js_State *J, js_Regexp *re, const char *text)
{
	const char *haystack;
	int result;
	int i;
	int opts;
	Resub m;

	haystack = text;
	opts = 0;
	if (re->flags & JS_REGEXP_G) {
		if (re->last > strlen(haystack)) {
			re->last = 0;
			js_pushnull(J);
			return;
		}
		if (re->last > 0) {
			haystack = text + re->last;
			opts |= REG_NOTBOL;
		}
	}

	result = js_regexec(re->prog, haystack, &m, opts);
	if (result < 0)
		js_error(J, "regexec failed");
	if (result == 0) {
		js_newarray(J);
		js_pushstring(J, text);
		js_setproperty(J, -2, "input");
		js_pushnumber(J, js_utfptrtoidx(text, m.sub[0].sp));
		js_setproperty(J, -2, "index");
		for (i = 0; i < m.nsub; ++i) {
			js_pushlstring(J, m.sub[i].sp, m.sub[i].ep - m.sub[i].sp);
			js_setindex(J, -2, i);
		}
		if (re->flags & JS_REGEXP_G)
			re->last = m.sub[0].ep - text;
		return;
	}

	if (re->flags & JS_REGEXP_G)
		re->last = 0;

	js_pushnull(J);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x13563
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %eax
movq %rax, -0x140(%rbp)
movq -0x20(%rbp), %rdi
callq 0x31e0
movq %rax, %rcx
movq -0x140(%rbp), %rax
cmpq %rcx, %rax
jbe 0x13535
movq -0x10(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x8(%rbp), %rdi
callq 0x136f0
jmp 0x136e6
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %eax
cmpl $0x0, %eax
jle 0x13561
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x2c(%rbp)
jmp 0x13563
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movl -0x2c(%rbp), %ecx
leaq -0x138(%rbp), %rdx
callq 0x13760
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x13598
movq -0x8(%rbp), %rdi
leaq 0x287f4(%rip), %rsi     # 0x3bd85
movb $0x0, %al
callq 0xbb10
cmpl $0x0, -0x24(%rbp)
jne 0x136c3
movq -0x8(%rbp), %rdi
callq 0x13830
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x13880
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
leaq 0x287cc(%rip), %rdx     # 0x3bd94
callq 0x4560
movq -0x8(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x18(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x139e0
movq -0x148(%rbp), %rdi
cvtsi2sd %eax, %xmm0
callq 0x44d0
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
leaq 0x28792(%rip), %rdx     # 0x3bd9a
callq 0x4560
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x138(%rbp), %eax
jge 0x13698
movq -0x8(%rbp), %rdi
leaq -0x138(%rbp), %rax
addq $0x8, %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq -0x138(%rbp), %rax
addq $0x8, %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq -0x138(%rbp), %rcx
addq $0x8, %rcx
movslq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x13a70
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x13614
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x136c1
movq -0x128(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x12(%rax)
jmp 0x136e6
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x136dd
movq -0x10(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x8(%rbp), %rdi
callq 0x136f0
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nop