// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlite_kv_append_fmt
int unqlite_kv_append_fmt(unqlite *pDb,const void *pKey,int nKeyLen,const char *zFormat,...)
{
	unqlite_kv_engine *pEngine;
	int rc;
	if( UNQLITE_DB_MISUSE(pDb) ){
		return UNQLITE_CORRUPT;
	}
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Acquire DB mutex */
	 SyMutexEnter(sUnqlMPGlobal.pMutexMethods, pDb->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
	 if( sUnqlMPGlobal.nThreadingLevel > UNQLITE_THREAD_LEVEL_SINGLE && 
		 UNQLITE_THRD_DB_RELEASE(pDb) ){
			 return UNQLITE_ABORT; /* Another thread have released this instance */
	 }
#endif
	 /* Point to the underlying storage engine */
	 pEngine = unqlitePagerGetKvEngine(pDb);
	 if( pEngine->pIo->pMethods->xAppend == 0 ){
		 /* Storage engine does not implement such method */
		 unqliteGenError(pDb,"xAppend() method not implemented in the underlying storage engine");
		 rc = UNQLITE_NOTIMPLEMENTED;
	 }else{
		 if( nKeyLen < 0 ){
			 /* Assume a null terminated string and compute it's length */
			 nKeyLen = SyStrlen((const char *)pKey);
		 }
		 if( !nKeyLen ){
			 unqliteGenError(pDb,"Empty key");
			 rc = UNQLITE_EMPTY;
		 }else{
			 SyBlob sWorker; /* Working buffer */
			 va_list ap;
			 SyBlobInit(&sWorker,&pDb->sMem);
			 /* Format the data */
			 va_start(ap,zFormat);
			 SyBlobFormatAp(&sWorker,zFormat,ap);
			 va_end(ap);
			 /* Perform the requested operation */
			 rc = pEngine->pIo->pMethods->xAppend(pEngine,pKey,nKeyLen,SyBlobData(&sWorker),SyBlobLength(&sWorker));
			 /* Clean up */
			 SyBlobRelease(&sWorker);
		 }
	 }
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Leave DB mutex */
	 SyMutexLeave(sUnqlMPGlobal.pMutexMethods,pDb->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
#endif
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r8, -0x100(%rbp)
movq %r9, -0xf8(%rbp)
testb %al, %al
je 0x31f63
movaps %xmm0, -0xf0(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm2, -0xd0(%rbp)
movaps %xmm3, -0xc0(%rbp)
movaps %xmm4, -0xb0(%rbp)
movaps %xmm5, -0xa0(%rbp)
movaps %xmm6, -0x90(%rbp)
movaps %xmm7, -0x80(%rbp)
movl $0xffffffe8, %r13d      # imm = 0xFFFFFFE8
testq %rdi, %rdi
je 0x3211e
movq %rdi, %rbx
cmpl $0xdb7c2712, 0x120(%rdi) # imm = 0xDB7C2712
jne 0x3211e
movq %rcx, %r12
movl %edx, %r15d
movq %rsi, %r14
movq 0xf8(%rbx), %rdi
testq %rdi, %rdi
je 0x31fa4
movq 0x647d7(%rip), %rax     # 0x96778
callq *0x20(%rax)
cmpl $0x2, 0x647dd(%rip)     # 0x96788
jb 0x31fc3
movl $0xfffffff6, %r13d      # imm = 0xFFFFFFF6
cmpl $0xdb7c2712, 0x120(%rbx) # imm = 0xDB7C2712
jne 0x3211e
movq 0xd8(%rbx), %rax
movq 0x10(%rax), %r13
movq (%r13), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x40(%rax)
je 0x3201a
testl %r15d, %r15d
jns 0x3203f
cmpb $0x0, (%r14)
movq %r14, %r15
je 0x3203c
leaq 0x2(%r14), %r15
cmpb $0x0, -0x1(%r15)
je 0x32034
cmpb $0x0, (%r15)
je 0x3203c
cmpb $0x0, 0x1(%r15)
je 0x32039
leaq 0x4(%r15), %rax
cmpb $0x0, 0x2(%r15)
movq %rax, %r15
jne 0x31fef
addq $-0x2, %rax
movq %rax, %r15
jmp 0x3203c
leaq 0x4373f(%rip), %rsi     # 0x75760
movq %rbx, %rdi
callq 0x31af5
movl $0xffffffef, %r13d      # imm = 0xFFFFFFEF
jmp 0x32108
decq %r15
jmp 0x3203c
incq %r15
subl %r14d, %r15d
testl %r15d, %r15d
je 0x320f3
leaq -0x48(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq %rbx, -0x8(%rcx)
xorl %eax, %eax
movl %eax, 0x10(%rcx)
movabsq $0x3000000020, %rcx     # imm = 0x3000000020
leaq -0x70(%rbp), %rdx
movq %rcx, (%rdx)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rdx)
leaq -0x120(%rbp), %rcx
movq %rcx, 0x10(%rdx)
leaq -0x2c(%rbp), %r8
movl %eax, (%r8)
movq %rdx, (%rsp)
leaq -0x50(%rbp), %rsi
movl $0x6, %edi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r9
callq 0x351b4
movq (%r13), %rax
movq 0x8(%rax), %rax
leaq -0x50(%rbp), %rdx
movq 0x8(%rdx), %rcx
movl 0x10(%rdx), %r8d
movq %rdx, %r12
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq *0x40(%rax)
movl %eax, %r13d
testb $0x6, 0x18(%r12)
jne 0x320e0
cmpl $0x0, -0x3c(%rbp)
je 0x320e0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3503f
leaq -0x48(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x0, 0x10(%rax)
jmp 0x32108
leaq 0x4365c(%rip), %rsi     # 0x75756
movq %rbx, %rdi
callq 0x31af5
movl $0xfffffffd, %r13d      # imm = 0xFFFFFFFD
movq 0xf8(%rbx), %rdi
testq %rdi, %rdi
je 0x3211e
movq 0x6465d(%rip), %rax     # 0x96778
callq *0x30(%rax)
movl %r13d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq