// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqliteDbRelease
static int unqliteDbRelease(unqlite *pDb)
{
	unqlite_db *pStore = &pDb->sDB;
	unqlite_vm *pVm,*pNext;
	int rc = UNQLITE_OK;
	if( (pDb->iFlags & UNQLITE_FL_DISABLE_AUTO_COMMIT) == 0 ){
		/* Commit any outstanding transaction */
		rc = unqlitePagerCommit(pStore->pPager);
		if( rc != UNQLITE_OK ){
			/* Rollback the transaction */
			rc = unqlitePagerRollback(pStore->pPager,FALSE);
		}
	}else{
		/* Rollback any outstanding transaction */
		rc = unqlitePagerRollback(pStore->pPager,FALSE);
	}
	/* Close the pager */
	unqlitePagerClose(pStore->pPager);
	/* Release any active VM's */
	pVm = pDb->pVms;
	for(;;){
		if( pDb->iVm < 1 ){
			break;
		}
		/* Point to the next entry */
		pNext = pVm->pNext;
		unqliteVmRelease(pVm);
		pVm = pNext;
		pDb->iVm--;
	}
	/* Release the Jx9 handle */
	jx9_release(pStore->pJx9);
	/* Set a dummy magic number */
	pDb->nMagic = 0x7250;
	/* Release the whole memory subsystem */
	SyMemBackendRelease(&pDb->sMem);
	/* Commit or rollback result */
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd8(%rdi), %rdi
testb $0x1, 0x10c(%rbx)
jne 0x280bc
callq 0x2b6e3
testl %eax, %eax
je 0x28292
movq 0xd8(%rbx), %rdi
xorl %esi, %esi
callq 0x2ba31
movl %eax, %r14d
movq 0xd8(%rbx), %r15
movq %r15, %rdi
callq 0x327b7
testb $0x1, 0x16d(%r15)
je 0x280f1
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x280f1
movq 0x50(%r15), %rsi
callq 0xc700
cmpl $0x0, 0x1fc(%r15)
jne 0x2811b
cmpl $0x0, 0x1f0(%r15)
jle 0x2811b
movq %r15, %rdi
xorl %esi, %esi
callq 0x33bcd
movq (%r15), %rdi
movq 0x30(%r15), %rsi
callq 0x33c59
movq 0x198(%r15), %rdi
testq %rdi, %rdi
je 0x28134
callq 0x3415d
andq $0x0, 0x198(%r15)
movq 0x100(%rbx), %rdi
movl 0x108(%rbx), %eax
testl %eax, %eax
jle 0x28164
movq 0xe8(%rdi), %r15
callq 0x28b6f
movl 0x108(%rbx), %eax
decl %eax
movl %eax, 0x108(%rbx)
movq %r15, %rdi
jmp 0x28141
movq 0xe0(%rbx), %r15
testq %r15, %r15
je 0x28272
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x28272
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2819b
movq 0x5ff28(%rip), %rax     # 0x880c0
callq *0x20(%rax)
cmpl $0x2, 0x5ff2e(%rip)     # 0x880d0
jb 0x281b5
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x28272
movq %r15, %rdi
callq 0x3201e
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x281f1
movq 0x5fef0(%rip), %rax     # 0x880c0
callq *0x30(%rax)
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x281f1
movq 0x5feda(%rip), %rax     # 0x880c0
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x281f1
callq *%rax
movq 0x5fed0(%rip), %rdi     # 0x880c8
testq %rdi, %rdi
je 0x28207
movq 0x5febc(%rip), %rax     # 0x880c0
callq *0x20(%rax)
movq 0x5feda(%rip), %rax     # 0x880e8
cmpq %r15, %rax
jne 0x28221
movq 0x108(%rax), %rax
movq %rax, 0x5fec7(%rip)     # 0x880e8
movq 0x108(%r15), %rax
movq 0x110(%r15), %rcx
testq %rcx, %rcx
je 0x2823b
movq %rax, 0x108(%rcx)
testq %rax, %rax
je 0x28247
movq %rcx, 0x110(%rax)
decl 0x5fe93(%rip)           # 0x880e0
movq 0x5fe74(%rip), %rdi     # 0x880c8
testq %rdi, %rdi
je 0x28263
movq 0x5fe60(%rip), %rax     # 0x880c0
callq *0x30(%rax)
leaq 0x5fd9e(%rip), %rdi     # 0x88008
movq %r15, %rsi
callq 0x27bf8
movl $0x7250, 0x120(%rbx)    # imm = 0x7250
movq %rbx, %rdi
callq 0x27b23
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x280c6