// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd8(%rdi), %rdi
testb $0x1, 0x10c(%rbx)
jne 0x2eb82
callq 0x328fd
testl %eax, %eax
je 0x2edb2
movq 0xd8(%rbx), %rdi
xorl %esi, %esi
callq 0x32be8
movl %eax, %r14d
movq 0xd8(%rbx), %r15
movq %r15, %rdi
callq 0x3a2dd
testb $0x1, 0x16d(%r15)
je 0x2ebb7
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x2ebb7
movq 0x50(%r15), %rsi
callq 0xc6e0
cmpl $0x0, 0x1fc(%r15)
je 0x2ed59
movq 0x198(%r15), %rdi
testq %rdi, %rdi
je 0x2ebe1
callq 0x3c009
movq $0x0, 0x198(%r15)
cmpl $0x0, 0x108(%rbx)
jle 0x2ec27
movq 0x100(%rbx), %r15
movq 0xe0(%r15), %rdi
movq 0xe8(%r15), %r12
callq 0x2f0f4
addq $0x8, %r15
movq %r15, %rdi
callq 0x2e588
movl 0x108(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x108(%rbx)
movq %r12, %r15
cmpl $0x1, %eax
jg 0x2ebf1
movq 0xe0(%rbx), %r15
testq %r15, %r15
je 0x2ed35
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x2ed35
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2ec5e
movq 0x66445(%rip), %rax     # 0x950a0
callq *0x20(%rax)
cmpl $0x2, 0x6644b(%rip)     # 0x950b0
jb 0x2ec78
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x2ed35
movq %r15, %rdi
callq 0x399fe
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2ecb4
movq 0x6640d(%rip), %rax     # 0x950a0
callq *0x30(%rax)
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2ecb4
movq 0x663f7(%rip), %rax     # 0x950a0
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2ecb4
callq *%rax
movq 0x663ed(%rip), %rdi     # 0x950a8
testq %rdi, %rdi
je 0x2ecca
movq 0x663d9(%rip), %rax     # 0x950a0
callq *0x20(%rax)
movq 0x663f7(%rip), %rax     # 0x950c8
cmpq %r15, %rax
jne 0x2ece4
movq 0x108(%rax), %rax
movq %rax, 0x663e4(%rip)     # 0x950c8
movq 0x108(%r15), %rax
movq 0x110(%r15), %rcx
testq %rcx, %rcx
je 0x2ecfe
movq %rax, 0x108(%rcx)
testq %rax, %rax
je 0x2ed0a
movq %rcx, 0x110(%rax)
decl 0x663b0(%rip)           # 0x950c0
movq 0x66391(%rip), %rdi     # 0x950a8
testq %rdi, %rdi
je 0x2ed26
movq 0x6637d(%rip), %rax     # 0x950a0
callq *0x30(%rax)
leaq 0x662bb(%rip), %rdi     # 0x94fe8
movq %r15, %rsi
callq 0x2e659
movl $0x7250, 0x120(%rbx)    # imm = 0x7250
movq %rbx, %rdi
callq 0x2e588
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x1f0(%r15)
jle 0x2ebc5
cmpl $0x0, 0x1f4(%r15)
je 0x2ed88
movq 0x30(%r15), %rdi
movq (%rdi), %rax
xorl %esi, %esi
callq *0x40(%rax)
movl $0x0, 0x1f4(%r15)
movq 0x30(%r15), %r12
testq %r12, %r12
je 0x2ebc5
movq (%r15), %r13
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x3490d
jmp 0x2ebc5
xorl %r14d, %r14d
jmp 0x2eb8c