// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_str_split
static int jx9Builtin_str_split(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zString, *zEnd;
	jx9_value *pArray, *pValue;
	int split_len;
	int nLen;
	if( nArg < 1 ){
		/* Missing arguments, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Point to the target string */
	zString = jx9_value_to_string(apArg[0], &nLen);
	if( nLen < 1 ){
		/* Nothing to process, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	split_len = (int)sizeof(char);
	if( nArg > 1 ){
		/* Split length */
		split_len = jx9_value_to_int(apArg[1]);
		if( split_len < 1 ){
			/* Invalid length, return FALSE */
			jx9_result_bool(pCtx, 0);
			return JX9_OK;
		}
		if( split_len > nLen ){
			split_len = nLen;
		}
	}
	/* Create the array and the scalar value */
	pArray = jx9_context_new_array(pCtx);
	/*Chunk value */
	pValue = jx9_context_new_scalar(pCtx);
	if( pValue == 0 || pArray == 0 ){
		/* Return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Point to the end of the string */
	zEnd = &zString[nLen];
	/* Perform the requested operation */
	for(;;){
		int nMax;
		if( zString >= zEnd ){
			/* No more input to process */
			break;
		}
		nMax = (int)(zEnd-zString);
		if( nMax < split_len ){
			split_len = nMax;
		}
		/* Copy the current chunk */
		jx9_value_string(pValue, zString, split_len);
		/* Insert it */
		jx9_array_add_elem(pArray, 0, pValue); /* Will make it's own copy */
		/* reset the string cursor */
		jx9_value_reset_string_cursor(pValue);
		/* Update position */
		zString += split_len;
	}
	/* 
	 * Return the array.
	 * Don't worry about freeing memory, everything will be automatically released
	 * upon we return from this function.
	 */
	jx9_result_value(pCtx, pArray);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x95550
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x95692
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x48(%rbp)
jge 0x95581
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x95692
movl $0x1, -0x44(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x955cb
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x44(%rbp)
cmpl $0x1, -0x44(%rbp)
jge 0x955bb
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x95692
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x955c9
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x955cb
movq -0x10(%rbp), %rdi
callq 0x58570
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x58510
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x955f3
cmpq $0x0, -0x38(%rbp)
jne 0x9560a
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x95692
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0x95625
jmp 0x9567e
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x95641
movl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x56950
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x57920
movq -0x40(%rbp), %rdi
callq 0x56b80
movl -0x44(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x95619
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x572c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)