// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: csv_write_callback
static int csv_write_callback(jx9_value *pKey, jx9_value *pValue, void *pUserData)
{
	struct csv_data *pData = (struct csv_data *)pUserData;
	const char *zData;
	int nLen, c2;
	sxu32 n;
	/* Point to the raw data */
	zData = jx9_value_to_string(pValue, &nLen);
	if( nLen < 1 ){
		/* Nothing to write */
		return JX9_OK;
	}
	if( pData->iCount > 0 ){
		/* Write the delimiter */
		pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)&pData->delimiter, sizeof(char));
	}
	n = 1;
	c2 = 0;
	if( SyByteFind(zData, (sxu32)nLen, pData->delimiter, 0) == SXRET_OK || 
		SyByteFind(zData, (sxu32)nLen, pData->enclosure, &n) == SXRET_OK ){
			c2 = 1;
			if( n == 0 ){
				c2 = 2;
			}
			/* Write the enclosure */
			pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)&pData->enclosure, sizeof(char));
			if( c2 > 1 ){
				pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)&pData->enclosure, sizeof(char));
			}
	}
	/* Write the data */
	if( pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)zData, (jx9_int64)nLen) < 1 ){
		SXUNUSED(pKey); /* cc warning */
		return JX9_ABORT;
	}
	if( c2 > 0 ){
		/* Write the enclosure */
		pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)&pData->enclosure, sizeof(char));
		if( c2 > 1 ){
			pData->pDev->pStream->xWrite(pData->pDev->pHandle, (const void *)&pData->enclosure, sizeof(char));
		}
	}
	pData->iCount++;
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %rdi
leaq -0x24(%rbp), %r15
movq %r15, %rsi
callq 0x297ed
movl (%r15), %esi
testl %esi, %esi
jle 0x56646
movq %rax, %r14
cmpl $0x0, 0x10(%rbx)
jle 0x56577
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq *0x40(%rcx)
movl -0x24(%rbp), %esi
movl $0x1, -0x28(%rbp)
movl (%rbx), %edx
xorl %r12d, %r12d
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x3df83
testl %eax, %eax
je 0x565b4
movl -0x24(%rbp), %esi
movl 0x4(%rbx), %edx
leaq -0x28(%rbp), %rcx
movq %r14, %rdi
callq 0x3df83
testl %eax, %eax
je 0x565ac
movb $0x1, %r12b
jmp 0x565e8
cmpl $0x0, -0x28(%rbp)
sete %r12b
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
leaq 0x4(%rbx), %r15
pushq $0x1
popq %rdx
movq %r15, %rsi
callq *0x40(%rcx)
testb %r12b, %r12b
je 0x565ed
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
pushq $0x1
popq %rdx
movq %r15, %rsi
callq *0x40(%rcx)
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x565f3
movb $0x1, %r15b
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
movslq -0x24(%rbp), %rdx
movq %r14, %rsi
callq *0x40(%rcx)
testq %rax, %rax
jle 0x5664a
testb %r12b, %r12b
jne 0x56643
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
leaq 0x4(%rbx), %r14
pushq $0x1
popq %rdx
movq %r14, %rsi
callq *0x40(%rcx)
testb %r15b, %r15b
jne 0x56643
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdi
pushq $0x1
popq %rdx
movq %r14, %rsi
callq *0x40(%rcx)
incl 0x10(%rbx)
xorl %eax, %eax
jmp 0x5664d
pushq $-0xa
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq