// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: lhCellWriteOvflPayload
static int lhCellWriteOvflPayload(lhcell *pCell,const void *pKey,sxu32 nKeylen,...)
{
	lhpage *pPage = pCell->pPage;
	lhash_kv_engine *pEngine = pPage->pHash;
	unqlite_page *pOvfl,*pFirst,*pNew;
	const unsigned char *zPtr,*zEnd;
	unsigned char *zRaw,*zRawEnd;
	sxu32 nAvail;
	va_list ap;
	int rc;
	/* Acquire a new overflow page */
	rc = lhAcquirePage(pEngine,&pOvfl);
	if( rc != UNQLITE_OK ){
		return rc;
	}
	/* Acquire a writer lock */
	rc = pEngine->pIo->xWrite(pOvfl);
	if( rc != UNQLITE_OK ){
		return rc;
	}
	pFirst = pOvfl;
	/* Link */
	pCell->iOvfl = pOvfl->iPage;
	/* Update the cell header */
	SyBigEndianPack64(&pPage->pRaw->zData[pCell->iStart + 4/*Hash*/ + 4/*Key*/ + 8/*Data*/ + 2 /*Next cell*/],pCell->iOvfl);
	/* Start the write process */
	zPtr = (const unsigned char *)pKey;
	zEnd = &zPtr[nKeylen];
	SyBigEndianPack64(pOvfl->zData,0); /* Next overflow page on the chain */
	zRaw = &pOvfl->zData[8/* Next ovfl page*/ + 8 /* Data page */ + 2 /* Data offset*/];
	zRawEnd = &pOvfl->zData[pEngine->iPageSize];
	pNew = pOvfl;
	/* Write the key */
	for(;;){
		if( zPtr >= zEnd ){
			break;
		}
		if( zRaw >= zRawEnd ){
			/* Acquire a new page */
			rc = lhAcquirePage(pEngine,&pNew);
			if( rc != UNQLITE_OK ){
				return rc;
			}
			rc = pEngine->pIo->xWrite(pNew);
			if( rc != UNQLITE_OK ){
				return rc;
			}
			/* Link */
			SyBigEndianPack64(pOvfl->zData,pNew->iPage);
			pEngine->pIo->xPageUnref(pOvfl);
			SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
			pOvfl = pNew;
			zRaw = &pNew->zData[8];
			zRawEnd = &pNew->zData[pEngine->iPageSize];
		}
		nAvail = (sxu32)(zRawEnd-zRaw);
		nKeylen = (sxu32)(zEnd-zPtr);
		if( nKeylen > nAvail ){
			nKeylen = nAvail;
		}
		SyMemcpy((const void *)zPtr,(void *)zRaw,nKeylen);
		/* Synchronize pointers */
		zPtr += nKeylen;
		zRaw += nKeylen;
	}
	rc = UNQLITE_OK;
	va_start(ap,nKeylen);
	pCell->iDataPage = pNew->iPage;
	pCell->iDataOfft = (sxu16)(zRaw-pNew->zData);
	/* Write the data page and its offset */
	SyBigEndianPack64(&pFirst->zData[8/*Next ovfl*/],pCell->iDataPage);
	SyBigEndianPack16(&pFirst->zData[8/*Next ovfl*/+8/*Data page*/],pCell->iDataOfft);
	/* Write data */
	for(;;){
		const void *pData;
		sxu32 nDatalen;
		sxu64 nData;
		pData = va_arg(ap,const void *);
		nData = va_arg(ap,sxu64);
		if( pData == 0 ){
			/* No more chunks */
			break;
		}
		/* Write this chunk */
		zPtr = (const unsigned char *)pData;
		zEnd = &zPtr[nData];
		for(;;){
			if( zPtr >= zEnd ){
				break;
			}
			if( zRaw >= zRawEnd ){
				/* Acquire a new page */
				rc = lhAcquirePage(pEngine,&pNew);
				if( rc != UNQLITE_OK ){
					va_end(ap);
					return rc;
				}
				rc = pEngine->pIo->xWrite(pNew);
				if( rc != UNQLITE_OK ){
					va_end(ap);
					return rc;
				}
				/* Link */
				SyBigEndianPack64(pOvfl->zData,pNew->iPage);
				pEngine->pIo->xPageUnref(pOvfl);
				SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
				pOvfl = pNew;
				zRaw = &pNew->zData[8];
				zRawEnd = &pNew->zData[pEngine->iPageSize];
			}
			nAvail = (sxu32)(zRawEnd-zRaw);
			nDatalen = (sxu32)(zEnd-zPtr);
			if( nDatalen > nAvail ){
				nDatalen = nAvail;
			}
			SyMemcpy((const void *)zPtr,(void *)zRaw,nDatalen);
			/* Synchronize pointers */
			zPtr += nDatalen;
			zRaw += nDatalen;
		}
	}
	/* Unref the overflow page */
	pEngine->pIo->xPageUnref(pOvfl);
	va_end(ap);
	return UNQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
testb %al, %al
je 0x64407
movaps %xmm0, -0x130(%rbp)
movaps %xmm1, -0x120(%rbp)
movaps %xmm2, -0x110(%rbp)
movaps %xmm3, -0x100(%rbp)
movaps %xmm4, -0xf0(%rbp)
movaps %xmm5, -0xe0(%rbp)
movaps %xmm6, -0xd0(%rbp)
movaps %xmm7, -0xc0(%rbp)
movq %r9, -0x138(%rbp)
movq %r8, -0x140(%rbp)
movq %rcx, -0x148(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x625b0
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x64468
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rdi
callq *%rax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x64496
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movzwl 0x28(%rax), %eax
addl $0x4, %eax
addl $0x4, %eax
addl $0x8, %eax
addl $0x2, %eax
cltq
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x61c60
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl -0x1c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x61c60
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0x12, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x110(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jb 0x64544
jmp 0x6466e
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jb 0x6460f
movq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x625b0
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x6457c
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rdi
callq *%rax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x645aa
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x61c60
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rdi
callq *%rax
movq -0x48(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x61c60
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x110(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jbe 0x64639
movl -0x6c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x5d570
movl -0x1c(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
jmp 0x64535
movl $0x0, -0x94(%rbp)
leaq -0x90(%rbp), %rax
leaq -0x160(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x18, (%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x38(%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x61c60
movq -0x40(%rbp), %rax
movq (%rax), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rax
movzwl 0x38(%rax), %esi
callq 0x63d00
leaq -0x90(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x164(%rbp)
cmpl $0x28, %eax
ja 0x64739
movq -0x170(%rbp), %rcx
movl -0x164(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x178(%rbp)
jmp 0x64756
movq -0x170(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x188(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x17c(%rbp)
cmpl $0x28, %eax
ja 0x647a8
movq -0x188(%rbp), %rcx
movl -0x17c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x190(%rbp)
jmp 0x647c5
movq -0x188(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xa0(%rbp)
jne 0x647e5
jmp 0x6495d
movq -0xa0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
addq -0xb0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jb 0x6480e
jmp 0x64958
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jb 0x648e7
movq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x625b0
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x6484d
leaq -0x90(%rbp), %rax
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rdi
callq *%rax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0x64882
leaq -0x90(%rbp), %rax
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6497c
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x61c60
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rdi
callq *%rax
movq -0x48(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x61c60
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x110(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jbe 0x6491a
movl -0x6c(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0xa4(%rbp), %edx
callq 0x5d570
movl -0xa4(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0xa4(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
jmp 0x647ff
jmp 0x646f8
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rdi
callq *%rax
leaq -0x90(%rbp), %rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopl (%rax,%rax)