// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmExecIncludedFile
static sxi32 VmExecIncludedFile(
	 jx9_context *pCtx, /* Call Context */
	 SyString *pPath,   /* Script path or URL*/
	 int IncludeOnce    /* TRUE if called from import() or require_once() */
	 )
{
	sxi32 rc;
#ifndef JX9_DISABLE_BUILTIN_FUNC
	const jx9_io_stream *pStream;
	SyBlob sContents;
	void *pHandle;
	jx9_vm *pVm;
	int isNew;
	/* Initialize fields */
	pVm = pCtx->pVm;
	SyBlobInit(&sContents, &pVm->sAllocator);
	isNew = 0;
	/* Extract the associated stream */
	pStream = jx9VmGetStreamDevice(pVm, &pPath->zString, pPath->nByte);
	/*
	 * Open the file or the URL [i.e: http://jx9.symisc.net/example/hello.jx9.txt"] 
	 * in a read-only mode.
	 */
	pHandle = jx9StreamOpenHandle(pVm, pStream,pPath->zString, JX9_IO_OPEN_RDONLY, TRUE, 0, TRUE, &isNew);
	if( pHandle == 0 ){
		return SXERR_IO;
	}
	rc = SXRET_OK; /* Stupid cc warning */
	if( IncludeOnce && !isNew ){
		/* Already included */
		rc = SXERR_EXISTS;
	}else{
		/* Read the whole file contents */
		rc = jx9StreamReadWholeFile(pHandle, pStream, &sContents);
		if( rc == SXRET_OK ){
			SyString sScript;
			/* Compile and execute the script */
			SyStringInitFromBuf(&sScript, SyBlobData(&sContents), SyBlobLength(&sContents));
			VmEvalChunk(pCtx->pVm, &(*pCtx), &sScript, 0, TRUE);
		}
	}
	/* Pop from the set of included file */
	(void)SySetPop(&pVm->aFiles);
	/* Close the handle */
	jx9StreamCloseHandle(pStream, pHandle);
	/* Release the working buffer */
	SyBlobRelease(&sContents);
#else
	pCtx = 0; /* cc warning */
	pPath = 0;
	IncludeOnce = 0;
	rc = SXERR_IO;
#endif /* JX9_DISABLE_BUILTIN_FUNC */
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r13d
movq %rsi, %r12
movq %rdi, -0x58(%rbp)
movq 0x60(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, -0x48(%rbp)
movq %rbx, -0x50(%rbp)
xorl %eax, %eax
movl %eax, -0x38(%rbp)
leaq -0x2c(%rbp), %r15
movl %eax, (%r15)
movl 0x8(%rsi), %edx
movq %rbx, %rdi
callq 0x51bfb
movq %rax, %r14
movq (%r12), %rdx
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
pushq %r15
pushq $0x1
callq 0x51dad
addq $0x10, %rsp
testq %rax, %rax
je 0x51be3
movq %rax, %r12
testl %r13d, %r13d
je 0x51b69
movl $0xfffffff5, %r13d      # imm = 0xFFFFFFF5
cmpl $0x0, -0x2c(%rbp)
je 0x51ba8
leaq -0x50(%rbp), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x52035
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x51ba8
movq -0x48(%rbp), %rax
leaq -0x68(%rbp), %rdx
movq %rax, (%rdx)
movl -0x40(%rbp), %eax
movl %eax, 0x8(%rdx)
movq -0x58(%rbp), %rsi
movq 0x60(%rsi), %rdi
movl $0x1, %ecx
callq 0x48143
xorl %r13d, %r13d
movl 0x3f8(%rbx), %eax
testl %eax, %eax
je 0x51bba
decl %eax
movl %eax, 0x3f8(%rbx)
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x51bc8
movq %r12, %rdi
callq *%rax
testb $0x6, -0x38(%rbp)
jne 0x51be9
cmpl $0x0, -0x3c(%rbp)
je 0x51be9
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3490d
jmp 0x51be9
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq