// File: /workspace/github_c_makefile_star2_O1/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 0x2f059
callq 0x32f35
testl %eax, %eax
je 0x2f290
movq 0xd8(%rbx), %rdi
xorl %esi, %esi
callq 0x33245
movl %eax, %r14d
movq 0xd8(%rbx), %r15
movq %r15, %rdi
callq 0x3abb8
testb $0x1, 0x16d(%r15)
je 0x2f08e
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x2f08e
movq 0x50(%r15), %rsi
callq 0xc6e0
cmpl $0x0, 0x1fc(%r15)
je 0x2f237
movq 0x198(%r15), %rdi
testq %rdi, %rdi
je 0x2f0b8
callq 0x3c994
movq $0x0, 0x198(%r15)
cmpl $0x0, 0x108(%rbx)
jle 0x2f0fe
movq 0x100(%rbx), %r15
movq 0xe0(%r15), %rdi
movq 0xe8(%r15), %r12
callq 0x2f5cf
addq $0x8, %r15
movq %r15, %rdi
callq 0x2ea67
movl 0x108(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x108(%rbx)
movq %r12, %r15
cmpl $0x1, %eax
jg 0x2f0c8
movq 0xe0(%rbx), %r15
testq %r15, %r15
je 0x2f213
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x2f213
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2f135
movq 0x67f6e(%rip), %rax     # 0x970a0
callq *0x20(%rax)
cmpl $0x2, 0x67f74(%rip)     # 0x970b0
jb 0x2f14f
cmpl $0xf874bcd7, 0x118(%r15) # imm = 0xF874BCD7
jne 0x2f213
movq %r15, %rdi
callq 0x3a2f2
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2f16d
movq 0x67f36(%rip), %rax     # 0x970a0
callq *0x30(%rax)
movq 0xf0(%r15), %rdi
testq %rdi, %rdi
je 0x2f18b
movq 0x67f20(%rip), %rax     # 0x970a0
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2f18b
callq *%rax
movq 0x67f16(%rip), %rdi     # 0x970a8
testq %rdi, %rdi
je 0x2f1a1
movq 0x67f02(%rip), %rax     # 0x970a0
callq *0x20(%rax)
movq 0x67f20(%rip), %rax     # 0x970c8
cmpq %r15, %rax
jne 0x2f1bb
movq 0x108(%rax), %rax
movq %rax, 0x67f0d(%rip)     # 0x970c8
movq 0x110(%r15), %rax
testq %rax, %rax
je 0x2f1d5
movq 0x108(%r15), %rcx
movq %rcx, 0x108(%rax)
movq 0x108(%r15), %rcx
testq %rcx, %rcx
je 0x2f1e8
movq %rax, 0x110(%rcx)
decl 0x67ed2(%rip)           # 0x970c0
movq 0x67eb3(%rip), %rdi     # 0x970a8
testq %rdi, %rdi
je 0x2f204
movq 0x67e9f(%rip), %rax     # 0x970a0
callq *0x30(%rax)
leaq 0x67ddd(%rip), %rdi     # 0x96fe8
movq %r15, %rsi
callq 0x2eb38
movl $0x7250, 0x120(%rbx)    # imm = 0x7250
movq %rbx, %rdi
callq 0x2ea67
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x1f0(%r15)
jle 0x2f09c
cmpl $0x0, 0x1f4(%r15)
je 0x2f266
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 0x2f09c
movq (%r15), %r13
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x3503f
jmp 0x2f09c
xorl %r14d, %r14d
jmp 0x2f063