// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9_vm_release
JX9_PRIVATE int jx9_vm_release(jx9_vm *pVm)
{
	jx9 *pEngine;
	int rc;
	/* Ticket 1433-002: NULL VM is harmless operation */
	if ( JX9_VM_MISUSE(pVm) ){
		return JX9_CORRUPT;
	}
#if defined(JX9_ENABLE_THREADS)
	 /* Acquire VM mutex */
	 SyMutexEnter(sJx9MPGlobal.pMutexMethods, pVm->pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel != JX9_THREAD_LEVEL_MULTI */
	 if( sJx9MPGlobal.nThreadingLevel > JX9_THREAD_LEVEL_SINGLE && 
		 JX9_THRD_VM_RELEASE(pVm) ){
			 return JX9_ABORT; /* Another thread have released this instance */
	 }
#endif
	pEngine = pVm->pEngine;
	rc = jx9VmRelease(&(*pVm));
#if defined(JX9_ENABLE_THREADS)
	 /* Leave VM mutex */
	 SyMutexLeave(sJx9MPGlobal.pMutexMethods, pVm->pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel != JX9_THREAD_LEVEL_MULTI */
	 /* Release VM mutex */
	 SyMutexRelease(sJx9MPGlobal.pMutexMethods, pVm->pMutex) /* NO-OP if sJx9MPGlobal.nThreadingLevel != JX9_THREAD_LEVEL_MULTI */
#endif
	if( rc == JX9_OK ){
		/* Unlink from the list of active VM */
#if defined(JX9_ENABLE_THREADS)
			/* Acquire engine mutex */
			SyMutexEnter(sJx9MPGlobal.pMutexMethods, pEngine->pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel != JX9_THREAD_LEVEL_MULTI */
			if( sJx9MPGlobal.nThreadingLevel > JX9_THREAD_LEVEL_SINGLE && 
				JX9_THRD_ENGINE_RELEASE(pEngine) ){
					return JX9_ABORT; /* Another thread have released this instance */
			}
#endif
		MACRO_LD_REMOVE(pEngine->pVms, pVm);
		pEngine->iVm--;
		/* Release the memory chunk allocated to this VM */
		SyMemBackendPoolFree(&pEngine->sAllocator, pVm);
#if defined(JX9_ENABLE_THREADS)
			/* Leave engine mutex */
			SyMutexLeave(sJx9MPGlobal.pMutexMethods, pEngine->pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel != JX9_THREAD_LEVEL_MULTI */
#endif	
	}
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x54ff3
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0x6e8(%rax) # imm = 0xDEAD2BAD
jne 0x54fff
movl $0xffffffe8, -0x4(%rbp) # imm = 0xFFFFFFE8
jmp 0x551e6
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x55025
movq 0x9a484(%rip), %rax     # 0xef498
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xb8(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x9a47c(%rip)     # 0xef4a8
jbe 0x5504a
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0x6e8(%rax) # imm = 0xDEAD2BAD
jne 0x5504a
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x551e6
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x66ba0
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x5508b
movq 0x9a41e(%rip), %rax     # 0xef498
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xb8(%rcx), %rdi
callq *%rax
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x550bf
movq 0x9a3f8(%rip), %rax     # 0xef498
cmpq $0x0, 0x18(%rax)
je 0x550bf
movq 0x9a3ea(%rip), %rax     # 0xef498
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xb8(%rcx), %rdi
callq *%rax
cmpl $0x0, -0x1c(%rbp)
jne 0x551e0
movq -0x18(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x550ef
movq 0x9a3ba(%rip), %rax     # 0xef498
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0xf0(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x9a3b2(%rip)     # 0xef4a8
jbe 0x55114
movq -0x18(%rbp), %rax
cmpl $0xf874bcd7, 0x118(%rax) # imm = 0xF874BCD7
je 0x55114
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x551e6
movq -0x18(%rbp), %rax
movq 0xf8(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x55142
movq -0x18(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x6d8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x6e0(%rax)
je 0x5516d
movq -0x10(%rbp), %rax
movq 0x6d8(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x6e0(%rax), %rax
movq %rcx, 0x6d8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x6d8(%rax)
je 0x55198
movq -0x10(%rbp), %rax
movq 0x6e0(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x6d8(%rax), %rax
movq %rcx, 0x6e0(%rax)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x100(%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x54490
movq -0x18(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x551de
movq 0x9a2cb(%rip), %rax     # 0xef498
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0xf0(%rcx), %rdi
callq *%rax
jmp 0x551e0
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop