// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9_init
JX9_PRIVATE int jx9_init(jx9 **ppEngine)
{
	jx9 *pEngine;
	int rc;
#if defined(UNTRUST)
	if( ppEngine == 0 ){
		return JX9_CORRUPT;
	}
#endif
	*ppEngine = 0;
	/* One-time automatic library initialization */
	rc = Jx9CoreInitialize();
	if( rc != JX9_OK ){
		return rc;
	}
	/* Allocate a new engine */
	pEngine = (jx9 *)SyMemBackendPoolAlloc(&sJx9MPGlobal.sAllocator, sizeof(jx9));
	if( pEngine == 0 ){
		return JX9_NOMEM;
	}
	/* Zero the structure */
	SyZero(pEngine, sizeof(jx9));
	/* Initialize engine fields */
	pEngine->nMagic = JX9_ENGINE_MAGIC;
	rc = SyMemBackendInitFromParent(&pEngine->sAllocator, &sJx9MPGlobal.sAllocator);
	if( rc != JX9_OK ){
		goto Release;
	}
#if defined(JX9_ENABLE_THREADS)
	SyMemBackendDisbaleMutexing(&pEngine->sAllocator);
#endif
	/* Default configuration */
	SyBlobInit(&pEngine->xConf.sErrConsumer, &pEngine->sAllocator);
	/* Install a default compile-time error consumer routine */
	pEngine->xConf.xErr = jx9VmBlobConsumer;
	pEngine->xConf.pErrData = &pEngine->xConf.sErrConsumer;
	/* Built-in vfs */
	pEngine->pVfs = sJx9MPGlobal.pVfs;
#if defined(JX9_ENABLE_THREADS)
	if( sJx9MPGlobal.nThreadingLevel > JX9_THREAD_LEVEL_SINGLE ){
		 /* Associate a recursive mutex with this instance */
		 pEngine->pMutex = SyMutexNew(sJx9MPGlobal.pMutexMethods, SXMUTEX_TYPE_RECURSIVE);
		 if( pEngine->pMutex == 0 ){
			 rc = JX9_NOMEM;
			 goto Release;
		 }
	 }
#endif
	/* Link to the list of active engines */
#if defined(JX9_ENABLE_THREADS)
	/* Enter the global mutex */
	 SyMutexEnter(sJx9MPGlobal.pMutexMethods, sJx9MPGlobal.pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel == JX9_THREAD_LEVEL_SINGLE */
#endif
	MACRO_LD_PUSH(sJx9MPGlobal.pEngines, pEngine);
	sJx9MPGlobal.nEngine++;
#if defined(JX9_ENABLE_THREADS)
	/* Leave the global mutex */
	 SyMutexLeave(sJx9MPGlobal.pMutexMethods, sJx9MPGlobal.pMutex); /* NO-OP if sJx9MPGlobal.nThreadingLevel == JX9_THREAD_LEVEL_SINGLE */
#endif
	/* Write a pointer to the new instance */
	*ppEngine = pEngine;
	return JX9_OK;
Release:
	SyMemBackendRelease(&pEngine->sAllocator);
	SyMemBackendPoolFree(&sJx9MPGlobal.sAllocator,pEngine);
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
callq 0x6b540
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x670b0
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x67277
leaq 0x88329(%rip), %rdi     # 0xef3e0
movl $0x120, %esi            # imm = 0x120
callq 0x541f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x670d8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x67277
movq -0x18(%rbp), %rdi
movl $0x120, %esi            # imm = 0x120
callq 0x54280
movq -0x18(%rbp), %rax
movl $0xf874bcd7, 0x118(%rax) # imm = 0xF874BCD7
movq -0x18(%rbp), %rdi
leaq 0x882e1(%rip), %rsi     # 0xef3e0
callq 0x60230
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x67112
jmp 0x67258
movq -0x18(%rbp), %rdi
callq 0x602f0
movq -0x18(%rbp), %rdi
addq $0xc0, %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0x58bb0
movq -0x18(%rbp), %rax
leaq 0x4582(%rip), %rcx      # 0x6b6c0
movq %rcx, 0xc0(%rax)
movq -0x18(%rbp), %rcx
addq $0xc0, %rcx
addq $0x10, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq 0x8834a(%rip), %rcx     # 0xef4b0
movq -0x18(%rbp), %rax
movq %rcx, 0xb8(%rax)
cmpl $0x1, 0x88330(%rip)     # 0xef4a8
jbe 0x671b3
movq 0x88317(%rip), %rax     # 0xef498
movl $0x2, %edi
callq *0x10(%rax)
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
jne 0x671b1
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
jmp 0x67258
jmp 0x671b3
cmpq $0x0, 0x882e5(%rip)     # 0xef4a0
je 0x671d1
movq 0x882d4(%rip), %rax     # 0xef498
movq 0x20(%rax), %rax
movq 0x882d1(%rip), %rdi     # 0xef4a0
callq *%rax
cmpq $0x0, 0x882e7(%rip)     # 0xef4c0
jne 0x671e8
movq -0x18(%rbp), %rax
movq %rax, 0x882da(%rip)     # 0xef4c0
jmp 0x67217
movq 0x882d1(%rip), %rcx     # 0xef4c0
movq -0x18(%rbp), %rax
movq %rcx, 0x108(%rax)
movq -0x18(%rbp), %rcx
movq 0x882bb(%rip), %rax     # 0xef4c0
movq %rcx, 0x110(%rax)
movq -0x18(%rbp), %rax
movq %rax, 0x882a9(%rip)     # 0xef4c0
movl 0x8829b(%rip), %eax     # 0xef4b8
addl $0x1, %eax
movl %eax, 0x88292(%rip)     # 0xef4b8
cmpq $0x0, 0x88272(%rip)     # 0xef4a0
je 0x67244
movq 0x88261(%rip), %rax     # 0xef498
movq 0x30(%rax), %rax
movq 0x8825e(%rip), %rdi     # 0xef4a0
callq *%rax
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x67277
movq -0x18(%rbp), %rdi
callq 0x543e0
movq -0x18(%rbp), %rsi
leaq 0x88174(%rip), %rdi     # 0xef3e0
callq 0x54490
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq