// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_chunk_split
static int jx9Builtin_chunk_split(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zIn, *zEnd, *zSep = "\r\n";
	int nSepLen, nChunkLen, nLen;
	if( nArg < 1 || !jx9_value_is_string(apArg[0]) ){
		/* Nothing to split, return null */
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	/* initialize/Extract arguments */
	nSepLen = (int)sizeof("\r\n") - 1;
	nChunkLen = 76;
	zIn = jx9_value_to_string(apArg[0], &nLen);
	zEnd = &zIn[nLen];
	if( nArg > 1 ){
		/* Chunk length */
		nChunkLen = jx9_value_to_int(apArg[1]);
		if( nChunkLen < 1 ){
			/* Switch back to the default length */
			nChunkLen = 76;
		}
		if( nArg > 2 ){
			/* Separator */
			zSep = jx9_value_to_string(apArg[2], &nSepLen);
			if( nSepLen < 1 ){
				/* Switch back to the default separator */
				zSep = "\r\n";
				nSepLen = (int)sizeof("\r\n") - 1;
			}
		}
	}
	/* Perform the requested operation */
	if( nChunkLen > nLen ){
		/* Nothing to split, return the string and the separator */
		jx9_result_string_format(pCtx, "%.*s%.*s", nLen, zIn, nSepLen, zSep);
		return JX9_OK;
	}
	while( zIn < zEnd ){
		if( nChunkLen > (int)(zEnd-zIn) ){
			nChunkLen = (int)(zEnd - zIn);
		}
		/* Append the chunk and the separator */
		jx9_result_string_format(pCtx, "%.*s%.*s", nChunkLen, zIn, nSepLen, zSep);
		/* Point beyond the chunk */
		zIn += nChunkLen;
	}
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x34c17(%rip), %rax     # 0xc6c71
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0x92075
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x57480
cmpl $0x0, %eax
jne 0x9208a
movq -0x10(%rbp), %rdi
callq 0x57120
movl $0x0, -0x4(%rbp)
jmp 0x921ae
movl $0x2, -0x3c(%rbp)
movl $0x4c, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x44(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x92115
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jge 0x920de
movl $0x4c, -0x40(%rbp)
cmpl $0x2, -0x14(%rbp)
jle 0x92113
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x56e20
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x3c(%rbp)
jge 0x92111
leaq 0x34b6b(%rip), %rax     # 0xc6c71
movq %rax, -0x38(%rbp)
movl $0x2, -0x3c(%rbp)
jmp 0x92113
jmp 0x92115
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x92147
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movq -0x28(%rbp), %rcx
movl -0x3c(%rbp), %r8d
movq -0x38(%rbp), %r9
leaq 0x33291(%rip), %rsi     # 0xc53c8
movb $0x0, %al
callq 0x794a0
movl $0x0, -0x4(%rbp)
jmp 0x921ae
jmp 0x92149
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x921a7
movl -0x40(%rbp), %eax
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rdx, %rcx
cmpl %ecx, %eax
jle 0x92173
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %edx
movq -0x28(%rbp), %rcx
movl -0x3c(%rbp), %r8d
movq -0x38(%rbp), %r9
leaq 0x3323b(%rip), %rsi     # 0xc53c8
movb $0x0, %al
callq 0x794a0
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x92149
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)