// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlite_vm_release
int unqlite_vm_release(unqlite_vm *pVm)
{
	int rc;
	if( UNQLITE_VM_MISUSE(pVm) ){
		return UNQLITE_CORRUPT;
	}
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Acquire VM mutex */
	 SyMutexEnter(sUnqlMPGlobal.pMutexMethods, pVm->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
	 if( sUnqlMPGlobal.nThreadingLevel > UNQLITE_THREAD_LEVEL_SINGLE && 
		 UNQLITE_THRD_VM_RELEASE(pVm) ){
			 return UNQLITE_ABORT; /* Another thread have released this instance */
	 }
#endif
	/* Release the VM */
	 rc = unqliteVmRelease(pVm);
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Leave VM mutex */
	 SyMutexLeave(sUnqlMPGlobal.pMutexMethods,pVm->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
	 /* Release VM mutex */
	 SyMutexRelease(sUnqlMPGlobal.pMutexMethods,pVm->pMutex) /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
#endif
	 if( rc == UNQLITE_OK ){
		 unqlite *pDb = pVm->pDb;
		 /* Unlink from the list of active VM's */
#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
		MACRO_LD_REMOVE(pDb->pVms, pVm);
		pDb->iVm--;
		/* Release the memory chunk allocated to this instance */
		SyMemBackendPoolFree(&pDb->sMem,pVm);
#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 $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x55793
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0xf8(%rax) # imm = 0xDEAD2BAD
jne 0x5579f
movl $0xffffffe8, -0x4(%rbp) # imm = 0xFFFFFFE8
jmp 0x55982
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x557c5
movq 0x990c4(%rip), %rax     # 0xee878
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xc0(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x990bc(%rip)     # 0xee888
jbe 0x557ea
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0xf8(%rax) # imm = 0xDEAD2BAD
jne 0x557ea
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x55982
movq -0x10(%rbp), %rdi
callq 0x55990
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x5581c
movq 0x9906d(%rip), %rax     # 0xee878
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xc0(%rcx), %rdi
callq *%rax
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x55850
movq 0x99047(%rip), %rax     # 0xee878
cmpq $0x0, 0x18(%rax)
je 0x55850
movq 0x99039(%rip), %rax     # 0xee878
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xc0(%rcx), %rdi
callq *%rax
cmpl $0x0, -0x14(%rbp)
jne 0x5597c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x5588b
movq 0x98ffe(%rip), %rax     # 0xee878
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0xf8(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x98ff6(%rip)     # 0xee888
jbe 0x558b0
movq -0x20(%rbp), %rax
cmpl $0xdb7c2712, 0x120(%rax) # imm = 0xDB7C2712
je 0x558b0
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x55982
movq -0x20(%rbp), %rax
movq 0x100(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x558de
movq -0x20(%rbp), %rax
movq 0x100(%rax), %rax
movq 0xe8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x100(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x55909
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rax
movq %rcx, 0xe8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
je 0x55934
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rax
movq %rcx, 0xf0(%rax)
movq -0x20(%rbp), %rax
movl 0x108(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x108(%rax)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x54490
movq -0x20(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x5597a
movq 0x98f0f(%rip), %rax     # 0xee878
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0xf8(%rcx), %rdi
callq *%rax
jmp 0x5597c
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)