// File: /workspace/github_c_makefile_star2_O0/ccxvii[P]mujs/./jsstring.c
// Function: Sp_split_string
static void Sp_split_string(js_State *J)
{
	const char *str = checkstring(J, 0);
	const char *sep = js_tostring(J, 1);
	int limit = js_isdefined(J, 2) ? js_tointeger(J, 2) : 1 << 30;
	int i, n;

	js_newarray(J);

	if (limit == 0)
		return;

	n = strlen(sep);

	/* empty string */
	if (n == 0) {
		Rune rune;
		for (i = 0; *str && i < limit; ++i) {
			n = chartorune(&rune, str);
			js_pushlstring(J, str, n);
			js_setindex(J, -2, i);
			str += n;
		}
		return;
	}

	for (i = 0; str && i < limit; ++i) {
		const char *s = strstr(str, sep);
		if (s) {
			js_pushlstring(J, str, s-str);
			js_setindex(J, -2, i);
			str = s + n;
		} else {
			js_pushstring(J, str);
			js_setindex(J, -2, i);
			str = NULL;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2fae0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x14b80
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x150d0
cmpl $0x0, %eax
je 0x309b3
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x43c0
movl %eax, -0x34(%rbp)
jmp 0x309bd
movl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0x34(%rbp)
jmp 0x309bd
movl -0x34(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x13830
cmpl $0x0, -0x1c(%rbp)
jne 0x309d7
jmp 0x30b1d
movq -0x18(%rbp), %rdi
callq 0x31e0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x30a68
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x35(%rbp)
je 0x30a0d
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setl %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0x30a16
jmp 0x30a63
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x19d20
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x13a70
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x309f0
jmp 0x30b1d
movl $0x0, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x36(%rbp)
je 0x30a87
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setl %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
testb $0x1, %al
jne 0x30a93
jmp 0x30b1d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3240
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x30ae7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x13a70
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x30b0d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13880
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x13bb0
movq $0x0, -0x10(%rbp)
jmp 0x30b0f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x30a6f
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)