// File: /workspace/github_c_makefile_star2_O1/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 0x53369
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 0x534fd
addq $0x10, %rsp
testq %rax, %rax
je 0x53351
movq %rax, %r12
testl %r13d, %r13d
je 0x532c6
movl $0xfffffff5, %r13d      # imm = 0xFFFFFFF5
cmpl $0x0, -0x2c(%rbp)
je 0x53305
leaq -0x50(%rbp), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x53771
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x53305
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 0x491c7
xorl %r13d, %r13d
movl 0x3f8(%rbx), %eax
testl %eax, %eax
je 0x53317
decl %eax
movl %eax, 0x3f8(%rbx)
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x53325
movq %r12, %rdi
callq *%rax
leaq -0x48(%rbp), %rbx
testb $0x6, 0x10(%rbx)
jne 0x53342
cmpl $0x0, -0x3c(%rbp)
je 0x53342
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3503f
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl $0x0, 0x10(%rbx)
jmp 0x53357
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq