// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_wordwrap
static int jx9Builtin_wordwrap(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zIn, *zEnd, *zBreak;
	int iLen, iBreaklen, iChunk;
	if( nArg < 1 ){
		/* Missing arguments, return the empty string */
		jx9_result_string(pCtx, "", 0);
		return JX9_OK;
	}
	/* Extract the input string */
	zIn = jx9_value_to_string(apArg[0], &iLen);
	if( iLen < 1 ){
		/* Nothing to process, return the empty string */
		jx9_result_string(pCtx, "", 0);
		return JX9_OK;
	}
	/* Chunk length */
	iChunk = 75;
	iBreaklen = 0;
	zBreak = ""; /* cc warning */
	if( nArg > 1 ){
		iChunk = jx9_value_to_int(apArg[1]);
		if( iChunk < 1 ){
			iChunk = 75;
		}
		if( nArg > 2 ){
			zBreak = jx9_value_to_string(apArg[2], &iBreaklen);
		}
	}
	if( iBreaklen < 1 ){
		/* Set a default column break */
#ifdef __WINNT__
		zBreak = "\r\n";
		iBreaklen = (int)sizeof("\r\n")-1;
#else
		zBreak = "\n";
		iBreaklen = (int)sizeof(char);
#endif
	}
	/* Perform the requested operation */
	zEnd = &zIn[iLen];
	for(;;){
		int nMax;
		if( zIn >= zEnd ){
			/* No more input to process */
			break;
		}
		nMax = (int)(zEnd-zIn);
		if( iChunk > nMax ){
			iChunk = nMax;
		}
		/* Append the column first */
		jx9_result_string(pCtx, zIn, iChunk); /* Will make it's own copy */
		/* Advance the cursor */
		zIn += iChunk;
		if( zIn < zEnd ){
			/* Append the line break */
			jx9_result_string(pCtx, zBreak, iBreaklen);
		}
	}
	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 0x95dc7
movq -0x10(%rbp), %rdi
leaq 0x2fd97(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
jmp 0x95eeb
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x3c(%rbp)
jge 0x95dff
movq -0x10(%rbp), %rdi
leaq 0x2fd5f(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
jmp 0x95eeb
movl $0x4b, -0x44(%rbp)
movl $0x0, -0x40(%rbp)
leaq 0x2fd37(%rip), %rax     # 0xc5b4b
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x95e58
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x44(%rbp)
cmpl $0x1, -0x44(%rbp)
jge 0x95e3b
movl $0x4b, -0x44(%rbp)
cmpl $0x2, -0x14(%rbp)
jle 0x95e56
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x56e20
movq %rax, -0x38(%rbp)
jmp 0x95e58
cmpl $0x1, -0x40(%rbp)
jge 0x95e70
leaq 0x30d74(%rip), %rax     # 0xc6bd9
movq %rax, -0x38(%rbp)
movl $0x1, -0x40(%rbp)
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0x95e8b
jmp 0x95ee4
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x95ea7
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x57180
movl -0x44(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x95ee2
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x57180
jmp 0x95e7f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)