// File: /workspace/github_c_makefile_star2_O0/atomlang[P]atomlang/src/pk_vm.c
// Function: pkInterpretSource
PkResult pkInterpretSource(PKVM* vm, PkStringPtr source, PkStringPtr path,
                           const PkCompileOptions* options) {

  String* path_name = newString(vm, path.string);
  if (path.on_done) path.on_done(vm, path);
  vmPushTempRef(vm, &path_name->_super); // path_name.

  // TODO: Should I clean the script if it already exists before compiling it?

  // Load a new script to the vm's scripts cache.
  Script* scr = vmGetScript(vm, path_name);
  if (scr == NULL) {
    scr = newScript(vm, path_name, false);
    vmPushTempRef(vm, &scr->_super); // scr.
    mapSet(vm, vm->scripts, VAR_OBJ(path_name), VAR_OBJ(scr));
    vmPopTempRef(vm); // scr.
  }
  vmPopTempRef(vm); // path_name.

  // Compile the source.
  PkResult result = compile(vm, scr, source.string, options);
  if (source.on_done) source.on_done(vm, source);
  if (result != PK_RESULT_SUCCESS) return result;

  // Set script initialized to true before the execution ends to prevent cyclic
  // inclusion cause a crash.
  scr->initialized = true;

  return runFiber(vm, newFiber(vm, scr->body));
}

// Assembly:
subq $0x88, %rsp
leaq 0xb0(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x90(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq 0x78(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movq (%rax), %rcx
movq %rcx, 0x50(%rsp)
cmpq $0x0, (%rax)
jne 0x924b
xorl %eax, %eax
movl %eax, 0x34(%rsp)
jmp 0x925c
movq 0x38(%rsp), %rax
movq (%rax), %rdi
callq 0x2130
movl %eax, 0x34(%rsp)
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %edx
callq 0x2760
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x68(%rsp)
cmpq $0x0, 0x8(%rax)
je 0x92b5
movq 0x38(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x78(%rsp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rsp)
callq *%rax
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x9420
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x94f0
movq %rax, 0x60(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x9349
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rsi
xorl %edx, %edx
callq 0x46d0
movq %rax, 0x60(%rsp)
movq 0x78(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x9420
movq 0x78(%rsp), %rdi
movq 0x78(%rsp), %rax
movq 0x128(%rax), %rsi
movq 0x68(%rsp), %rdx
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %rdx
movq 0x60(%rsp), %rcx
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %rcx
callq 0x61a0
movq 0x78(%rsp), %rdi
callq 0x95c0
movq 0x78(%rsp), %rdi
callq 0x95c0
movq 0x40(%rsp), %rax
movq 0x78(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq (%rax), %rdx
movq 0x70(%rsp), %rcx
callq 0x15420
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x5c(%rsp)
cmpq $0x0, 0x8(%rax)
je 0x93b3
movq 0x40(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x78(%rsp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rsp)
callq *%rax
cmpl $0x0, 0x5c(%rsp)
je 0x93c7
movl 0x5c(%rsp), %eax
movl %eax, 0x84(%rsp)
jmp 0x9407
movq 0x60(%rsp), %rax
movb $0x1, 0x88(%rax)
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x80(%rax), %rsi
callq 0x2b50
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x9630
movl %eax, 0x84(%rsp)
movl 0x84(%rsp), %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)