// File: /workspace/github_c_makefile_star2_O3/atomlang[P]atomlang/src/pk_compiler.c
// Function: compilerImport
static inline Script* compilerImport(Compiler* compiler) {
  ASSERT(compiler->scope_depth == DEPTH_GLOBAL, OOPS);

  // Get the script (from core libs or vm's cache or compile new one).
  // And push it on the stack.
  if (match(compiler, TK_NAME)) { //< Core library.
    return importCoreLib(compiler, compiler->previous.start,
                         compiler->previous.length);

  } else if (match(compiler, TK_STRING)) { //< Local library.
    Var var_path = compiler->previous.value;
    ASSERT(IS_OBJ_TYPE(var_path, OBJ_STRING), OOPS);
    String* path = (String*)AS_OBJ(var_path);
    return importFile(compiler, path->data);
  }

  // Invalid token after import/from keyword.
  parseError(compiler, "Expected a module name or path to import.");
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $-0x1, 0xa0(%rdi)
jne 0x12a56
movq %rdi, %rbx
movl 0x50(%rdi), %eax
cmpl $0x49, %eax
je 0x126eb
cmpl $0x47, %eax
jne 0x127ae
movq %rbx, %rdi
callq 0x10771
cmpl $-0x1, 0xa0(%rbx)
jne 0x12a60
movl 0x40(%rbx), %ecx
movq (%rbx), %rsi
movq 0x38(%rbx), %rdx
movq 0x18b0(%rbx), %rdi
callq 0x9306
movl %eax, %ebp
movq 0x18b0(%rbx), %rax
movq 0x60(%rax), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r15
movq (%rbx), %rax
movq 0x130(%rax), %rdi
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
orq %r15, %rsi
callq 0x9e0f
movq %rax, %r14
movabsq $0x7ffd000000000000, %rax # imm = 0x7FFD000000000000
cmpq %rax, %r14
jne 0x127c7
addq $0x1c, %r15
leaq 0xb055(%rip), %rsi      # 0x1d72b
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x10d4f
jmp 0x12a21
movabsq $-0x4000000000000, %r15 # imm = 0xFFFC000000000000
movq %rbx, %rdi
callq 0x10771
movq 0x48(%rbx), %r14
leaq -0x1(%r15), %rax
cmpq %rax, %r14
jbe 0x12a5b
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %r14
cmpl $0x0, (%r14)
jne 0x12a5b
cmpl $-0x1, 0xa0(%rbx)
jne 0x12a65
addq $0x1c, %r14
movq (%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r14, 0x38(%rsp)
movq 0x108(%r15), %rax
testq %rax, %rax
je 0x1281d
movq 0x18b0(%rbx), %rcx
movq 0x18(%rcx), %rdx
addq $0x1c, %rdx
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *%rax
movq (%r12), %r12
testq %r12, %r12
jne 0x12820
movq 0x18b0(%rbx), %rax
movq 0x18(%rax), %rcx
addq $0x1c, %rcx
leaq 0xafb2(%rip), %rsi      # 0x1d753
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x10d4f
leaq 0xaf3e(%rip), %rsi      # 0x1d6f3
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d4f
jmp 0x12a21
movq %rbx, %rdi
movl $0x26, %esi
callq 0x10fbe
movq %rbx, %rdi
xorl %esi, %esi
callq 0x11014
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r15d
andl %r15d, %esi
movq %rbx, %rdi
callq 0x10fbe
andl %r15d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10fbe
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %r14
cmpl $0x4, (%r14)
je 0x12a21
callq 0x4fd6
movq %r14, %r12
movq 0x18b0(%rbx), %r14
movq (%rbx), %r13
movq %r12, %rdi
callq 0x2140
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %eax, %ecx
callq 0x9306
movl %eax, %ebp
movq 0x18b0(%rbx), %rax
movq 0x60(%rax), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r12
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x12878
movups 0x38(%rsp), %xmm0
movups 0x48(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
callq *%rax
movq 0x128(%r15), %rdi
movq %r12, %r13
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %r13
movq %r13, %rsi
callq 0x9e0f
movq %rax, %r14
movabsq $0x7ffd000000000000, %rax # imm = 0x7FFD000000000000
cmpq %rax, %r14
jne 0x129d0
movq 0x110(%r15), %rax
testq %rax, %rax
je 0x12a33
leaq 0x1c(%r12), %rdx
leaq 0x58(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rdx, 0x30(%rsp)
callq *%rax
cmpq $0x0, (%r14)
je 0x12a3f
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x8ff9
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0xb71b
movq 0x128(%r15), %rsi
movabsq $-0x4000000000000, %rcx # imm = 0xFFFC000000000000
orq %r14, %rcx
movq %r15, %rdi
movq %r13, %rdx
callq 0x9f38
movq %r15, %rdi
callq 0xb78e
movq %rbx, %rdi
movl $0x26, %esi
callq 0x10fbe
movq %rbx, %rdi
xorl %esi, %esi
callq 0x11014
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r12d
andl %r12d, %esi
movq %rbx, %rdi
callq 0x10fbe
andl %r12d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10fbe
callq 0xb378
movw %ax, 0x2e(%rsp)
movq 0x98(%rbx), %rax
testq %rax, %rax
je 0x12978
movzwl (%rax), %eax
movw %ax, 0x2e(%rsp)
leaq 0x2e(%rsp), %rcx
movb $0x0, 0x1(%rcx)
movq 0x58(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0xfea4
movl %eax, %ebp
movq 0x60(%rsp), %rax
testq %rax, %rax
movq 0x30(%rsp), %r12
je 0x129ba
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
callq *%rax
testl %ebp, %ebp
je 0x12a21
leaq 0xae1f(%rip), %rsi      # 0x1d7e4
movq %rbx, %rdi
movq %r12, %rdx
jmp 0x126df
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %r14
cmpl $0x4, (%r14)
jne 0x12a6a
movq %rbx, %rdi
movl $0x26, %esi
callq 0x10fbe
movq %rbx, %rdi
xorl %esi, %esi
callq 0x11014
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r15d
andl %r15d, %esi
movq %rbx, %rdi
callq 0x10fbe
andl %r15d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10fbe
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xad3c(%rip), %rsi      # 0x1d776
jmp 0x127b5
leaq 0xad81(%rip), %rsi      # 0x1d7c7
xorl %r14d, %r14d
movq %rbx, %rdi
movq 0x30(%rsp), %rdx
jmp 0x126df
callq 0x4ec8
callq 0x4efe
callq 0x4fa0
callq 0x4f34
callq 0x4f6a