// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2fae0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15360
cmpl $0x0, %eax
je 0x1a4d1
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x14410
jmp 0x1a524
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15100
cmpl $0x0, %eax
je 0x1a4f8
movq -0x8(%rbp), %rdi
leaq 0x2254d(%rip), %rsi     # 0x3ca3c
xorl %edx, %edx
callq 0x13380
jmp 0x1a522
movq -0x8(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x14b80
movq -0x150(%rbp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x13380
jmp 0x1a524
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15f20
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1a55c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x134c0
jmp 0x1a67a
movq -0x10(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x8(%rbp), %rdi
callq 0x13830
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x18(%rbp), %rdi
callq 0x31e0
movq %rax, %rcx
movq -0x158(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x40(%rbp), %rax
ja 0x1a65d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %r9
xorl %r8d, %r8d
movl $0x4, %eax
cmpq %r9, %rcx
cmoval %eax, %r8d
leaq -0x148(%rbp), %rcx
callq 0x2fb30
cmpl $0x0, %eax
je 0x1a5ea
jmp 0x1a65d
movq -0x140(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x13a70
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
cmpq $0x0, %rax
jne 0x1a658
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1a5a3
cmpl $0x0, -0x1c(%rbp)
jne 0x1a67a
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movq -0x8(%rbp), %rdi
callq 0x136f0
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)