// File: /workspace/github_c_makefile_star2_O0/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
subq $0x120, %rsp            # imm = 0x120
testb %al, %al
je 0x58a04
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)
movq %r9, -0xf8(%rbp)
movq %r8, -0x100(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x58a38
movq -0x10(%rbp), %rax
cmpl $0xdb7c2712, 0x120(%rax) # imm = 0xDB7C2712
je 0x58a44
movl $0xffffffe8, -0x4(%rbp) # imm = 0xFFFFFFE8
jmp 0x58b9f
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x58a6a
movq 0x95e1f(%rip), %rax     # 0xee878
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xf8(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x95e17(%rip)     # 0xee888
jbe 0x58a8f
movq -0x10(%rbp), %rax
cmpl $0xdb7c2712, 0x120(%rax) # imm = 0xDB7C2712
je 0x58a8f
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x58b9f
movq -0x10(%rbp), %rdi
callq 0x58930
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x38(%rax)
jne 0x58aca
movq -0x10(%rbp), %rdi
leaq 0x69122(%rip), %rsi     # 0xc1bdb
callq 0x58950
movl $0xffffffef, -0x34(%rbp) # imm = 0xFFFFFFEF
jmp 0x58b73
cmpl $0x0, -0x1c(%rbp)
jge 0x58adc
movq -0x18(%rbp), %rdi
callq 0x55d10
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x58afb
movq -0x10(%rbp), %rdi
leaq 0x69131(%rip), %rsi     # 0xc1c1e
callq 0x58950
movl $0xfffffffd, -0x34(%rbp) # imm = 0xFFFFFFFD
jmp 0x58b71
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x58bb0
leaq -0x70(%rbp), %rax
leaq -0x120(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq -0x28(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x56b10
leaq -0x70(%rbp), %rax
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x38(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x50(%rbp), %rcx
movl -0x48(%rbp), %r8d
callq *%rax
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x58c00
jmp 0x58b73
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x58b99
movq 0x95cf0(%rip), %rax     # 0xee878
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xf8(%rcx), %rdi
callq *%rax
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)