// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./jsstring.c
// Function: Sp_match
static void Sp_match(js_State *J)
{
	js_Regexp *re;
	const char *text;
	int len;
	const char *a, *b, *c, *e;
	Resub m;

	text = checkstring(J, 0);

	if (js_isregexp(J, 1))
		js_copy(J, 1);
	else if (js_isundefined(J, 1))
		js_newregexp(J, "", 0);
	else
		js_newregexp(J, js_tostring(J, 1), 0);

	re = js_toregexp(J, -1);
	if (!(re->flags & JS_REGEXP_G)) {
		js_RegExp_prototype_exec(J, re, text);
		return;
	}

	re->last = 0;

	js_newarray(J);

	len = 0;
	a = text;
	e = text + strlen(text);
	while (a <= e) {
		if (js_doregexec(J, re->prog, a, &m, a > text ? REG_NOTBOL : 0))
			break;

		b = m.sub[0].sp;
		c = m.sub[0].ep;

		js_pushlstring(J, b, c - b);
		js_setindex(J, -2, len++);

		a = c;
		if (c - b == 0)
			++a;
	}

	if (len == 0) {
		js_pop(J, 1);
		js_pushnull(J);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r12
callq 0x2925f
movq %rax, %r14
movl 0x144(%r12), %ecx
leal 0x1(%rcx), %eax
leaq 0x27617(%rip), %rdx     # 0x403f8
cmpl $-0x1, %ecx
jl 0x18dfe
cmpl 0x140(%r12), %eax
jge 0x18dfe
movl %eax, %edx
shlq $0x4, %rdx
addq 0x148(%r12), %rdx
cmpb $0x7, 0xf(%rdx)
jne 0x18e1b
movq (%rdx), %rdx
cmpl $0x9, (%rdx)
jne 0x18e1b
movq %r12, %rdi
movl $0x1, %esi
callq 0x14073
jmp 0x18e8c
leaq 0x275d6(%rip), %rdx     # 0x403f8
cmpl $-0x1, %ecx
jl 0x18e3f
cmpl 0x140(%r12), %eax
jge 0x18e3f
movl %eax, %edx
shlq $0x4, %rdx
addq 0x148(%r12), %rdx
cmpb $0x1, 0xf(%rdx)
jne 0x18e51
leaq 0x1b53a(%rip), %rsi     # 0x34386
movq %r12, %rdi
jmp 0x18e83
leaq 0x275a0(%rip), %rsi     # 0x403f8
cmpl $-0x1, %ecx
jl 0x18e75
cmpl 0x140(%r12), %eax
jge 0x18e75
movl %eax, %esi
shlq $0x4, %rsi
addq 0x148(%r12), %rsi
movq %r12, %rdi
callq 0x1533b
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x13250
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15720
movq %rax, %r15
testb $0x1, 0x10(%rax)
jne 0x18ec1
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x133b4
movw $0x0, 0x12(%r15)
movq %r12, %rdi
callq 0x135de
movq %r14, %rdi
callq 0x3200
testq %rax, %rax
js 0x18f6e
movq %rax, %rbx
addq %r14, %rbx
xorl %ebp, %ebp
movq %r14, %rdx
movq %r15, 0x8(%rsp)
movq %rbx, (%rsp)
movq (%r15), %rsi
xorl %r8d, %r8d
cmpq %r14, %rdx
seta %r8b
shll $0x2, %r8d
movq %r12, %rdi
leaq 0x10(%rsp), %rcx
callq 0x292cf
testl %eax, %eax
jne 0x18f6a
movq 0x18(%rsp), %r13
movq %r14, %r15
movq 0x20(%rsp), %r14
movl %r14d, %edx
subl %r13d, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x13802
leal 0x1(%rbp), %ebx
movq %r12, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl %ebp, %edx
callq 0x1393c
xorl %edx, %edx
cmpq %r13, %r14
sete %dl
addq %r14, %rdx
movq %r15, %r14
movq 0x8(%rsp), %r15
movl %ebx, %ebp
movq (%rsp), %rbx
cmpq %rbx, %rdx
jbe 0x18ef5
movl $0x1, %ebp
testl %ebp, %ebp
jne 0x18f95
movl 0x140(%r12), %ecx
movl 0x144(%r12), %eax
leal -0x1(%rcx), %edx
movl %edx, 0x140(%r12)
cmpl %eax, %ecx
jle 0x18fa7
movq %r12, %rdi
callq 0x13525
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, 0x140(%r12)
leaq 0x1a7b8(%rip), %rsi     # 0x3376e
movq %r12, %rdi
xorl %eax, %eax
callq 0xc939