// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlite_kv_store_fmt
int unqlite_kv_store_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->xReplace == 0 ){
		 /* Storage engine does not implement such method */
		 unqliteGenError(pDb,"xReplace() 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->xReplace(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 $0xe8, %rsp
movq %r8, -0xf0(%rbp)
movq %r9, -0xe8(%rbp)
testb %al, %al
je 0x2a5d9
movaps %xmm0, -0xe0(%rbp)
movaps %xmm1, -0xd0(%rbp)
movaps %xmm2, -0xc0(%rbp)
movaps %xmm3, -0xb0(%rbp)
movaps %xmm4, -0xa0(%rbp)
movaps %xmm5, -0x90(%rbp)
movaps %xmm6, -0x80(%rbp)
movaps %xmm7, -0x70(%rbp)
pushq $-0x18
popq %r13
testq %rdi, %rdi
je 0x2a71a
movq %rdi, %rbx
cmpl $0xdb7c2712, 0x120(%rdi) # imm = 0xDB7C2712
jne 0x2a71a
movq %rcx, %r12
movl %edx, %r15d
movq %rsi, %r14
movq 0xf8(%rbx), %rdi
testq %rdi, %rdi
je 0x2a618
movq 0x5d183(%rip), %rax     # 0x87798
callq *0x20(%rax)
cmpl $0x2, 0x5d189(%rip)     # 0x877a8
jb 0x2a631
cmpl $0xdb7c2712, 0x120(%rbx) # imm = 0xDB7C2712
jne 0x2a6eb
movq 0xd8(%rbx), %rax
movq 0x10(%rax), %r13
movq (%r13), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x38(%rax)
je 0x2a6d8
testl %r15d, %r15d
jns 0x2a65f
movq %r14, %rdi
callq 0x28e24
movl %eax, %r15d
testl %r15d, %r15d
je 0x2a6f1
xorps %xmm0, %xmm0
leaq -0x48(%rbp), %rax
movups %xmm0, 0x8(%rax)
movq %rbx, (%rax)
andl $0x0, 0x18(%rax)
movq %rax, %rdi
movabsq $0x3000000020, %rax     # imm = 0x3000000020
leaq -0x60(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
leaq -0x110(%rbp), %rax
movq %rax, 0x10(%rdx)
movq %r12, %rsi
callq 0x296e2
movq (%r13), %rax
movq 0x8(%rax), %rax
leaq -0x48(%rbp), %r12
movq 0x8(%r12), %rcx
movl 0x10(%r12), %r8d
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq *0x38(%rax)
movl %eax, %r13d
movq %r12, %rdi
callq 0x2a72f
jmp 0x2a704
leaq 0x3901c(%rip), %rsi     # 0x636fb
movq %rbx, %rdi
callq 0x2a542
pushq $-0x11
jmp 0x2a702
pushq $-0xa
popq %r13
jmp 0x2a71a
leaq 0x39046(%rip), %rsi     # 0x6373e
movq %rbx, %rdi
callq 0x2a542
pushq $-0x3
popq %r13
movq 0xf8(%rbx), %rdi
testq %rdi, %rdi
je 0x2a71a
movq 0x5d081(%rip), %rax     # 0x87798
callq *0x30(%rax)
movl %r13d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq