LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: scriptGetGlobals
int scriptGetGlobals(Script* script, const char* name, uint32_t length) {
  for (uint32_t i = 0; i < script->global_names.count; i++) {
    uint32_t name_index = script->global_names.data[i];
    String* g_name = script->names.data[name_index];
    if (g_name->length == length && strncmp(g_name->data, name, length) == 0) {
      return (int)i;
    }
  }
  return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
movl 0x38(%rdi), %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r12, %r12
je 0xa656
movl %edx, %ebp
movq 0x30(%rdi), %r13
movq 0x60(%rdi), %rbx
movl %edx, %eax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
movl (%r13,%r14,4), %eax
movq (%rbx,%rax,8), %rdi
movb $0x1, %r15b
cmpl %ebp, 0x14(%rdi)
jne 0xa63e
addq $0x1c, %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x2090
testl %eax, %eax
jne 0xa63e
xorl %r15d, %r15d
movl %r14d, 0x4(%rsp)
testb %r15b, %r15b
je 0xa652
incq %r14
cmpq %r14, %r12
jne 0xa60e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xa656
movl 0x4(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: toRepr
String* toRepr(PKVM* vm, const Var value) {
  pkByteBuffer buff;
  pkByteBufferInit(&buff);
  _toStringInternal(vm, value, &buff, NULL, true);
  String* ret = newStringLength(vm, (const char*)buff.data, buff.count);
  pkByteBufferClear(&buff, vm);
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq %r14, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xabfe
movq (%r14), %rsi
movl 0x8(%r14), %edx
movq %rbx, %rdi
callq 0x7fc8
movq %rax, %r15
movq (%r14), %rsi
movl 0xc(%r14), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xb668
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: varTypeName
const char* varTypeName(Var v) {
  if (IS_NULL(v)) return "Null";
  if (IS_BOOL(v)) return "Bool";
  if (IS_NUM(v))  return "Number";

  ASSERT(IS_OBJ(v), OOPS);
  Object* obj = AS_OBJ(v);
  return getObjectTypeName(obj->type);
}

// Assembly:
movabsq $0x7ffc000000000000, %rax # imm = 0x7FFC000000000000
cmpq %rax, %rdi
jne 0xaa31
leaq 0x12890(%rip), %rax     # 0x1d2c0
retq
movq %rdi, %rcx
shrq %rcx
movabsq $0x3ffe800000000001, %rdx # imm = 0x3FFE800000000001
cmpq %rdx, %rcx
jne 0xaa4e
leaq 0x13fa9(%rip), %rax     # 0x1e9f6
retq
movq %rdi, %rcx
notq %rcx
testq %rcx, %rax
jne 0xaa7b
movq %rdi, %rax
shrq $0x32, %rax
cmpl $0x3ffe, %eax           # imm = 0x3FFE
jbe 0xaa83
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %rdi
movl (%rdi), %edi
jmp 0xa9fe
leaq 0x13f9c(%rip), %rax     # 0x1ea1e
retq
pushq %rax
callq 0x2902
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: isValuesEqual
bool isValuesEqual(Var v1, Var v2) {
  if (isValuesSame(v1, v2)) return true;

  // If we reach here only heap allocated objects could be compared.
  if (!IS_OBJ(v1) || !IS_OBJ(v2)) return false;

  Object* o1 = AS_OBJ(v1), *o2 = AS_OBJ(v2);
  if (o1->type != o2->type) return false;

  switch (o1->type) {
    case OBJ_RANGE:
      return ((Range*)o1)->from == ((Range*)o2)->from &&
             ((Range*)o1)->to   == ((Range*)o2)->to;

    case OBJ_STRING: {
      String* s1 = (String*)o1, *s2 = (String*)o2;
      return s1->hash == s2->hash &&
             s1->length == s2->length &&
             memcmp(s1->data, s2->data, s1->length) == 0;
    }

    case OBJ_LIST: {
      /*
      * l1 = []; list_append(l1, l1) # [[...]]
      * l2 = []; list_append(l2, l2) # [[...]]
      * l1 == l2 ## This will cause a stack overflow but not handling that
      *          ## (in python too).
      */
      List *l1 = (List*)o1, *l2 = (List*)o2;
      if (l1->elements.count != l2->elements.count) return false;
      Var* _v1 = l1->elements.data;
      Var* _v2 = l2->elements.data;
      for (uint32_t i = 0; i < l1->elements.count; i++) {
        if (!isValuesEqual(*_v1, *_v2)) return false;
        _v1++, _v2++;
      }
      return true;
    }

    default:
      return false;
  }
}

// Assembly:
cmpq %rsi, %rdi
jne 0xaa98
movb $0x1, %al
retq
movq %rdi, %rax
shrq $0x32, %rax
movl $0x3fff, %ecx           # imm = 0x3FFF
cmpl %ecx, %eax
setb %al
movq %rsi, %rdx
shrq $0x32, %rdx
cmpl %ecx, %edx
setb %cl
orb %al, %cl
jne 0xab10
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %rdi
andq %rax, %rsi
movl (%rdi), %eax
cmpl (%rsi), %eax
jne 0xab6f
testl %eax, %eax
je 0xab4b
cmpl $0x1, %eax
je 0xab13
cmpl $0x3, %eax
jne 0xab6f
movsd 0x10(%rdi), %xmm0
ucomisd 0x10(%rsi), %xmm0
jne 0xab6f
jp 0xab6f
movsd 0x18(%rsi), %xmm0
cmpeqsd 0x18(%rdi), %xmm0
movq %xmm0, %rax
andl $0x1, %eax
jmp 0xab71
xorl %eax, %eax
retq
movl 0x18(%rdi), %ebx
cmpl 0x18(%rsi), %ebx
jne 0xab6f
testq %rbx, %rbx
sete %al
je 0xab71
movq 0x10(%rsi), %r14
movq 0x10(%rdi), %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
movq (%r14,%r12,8), %rsi
callq 0xaa90
testb %al, %al
je 0xab6f
incq %r12
cmpl %r12d, %ebx
jne 0xab2e
movb $0x1, %al
jmp 0xab71
movl 0x10(%rdi), %eax
cmpl 0x10(%rsi), %eax
jne 0xab6f
movl 0x14(%rdi), %edx
cmpl 0x14(%rsi), %edx
jne 0xab6f
addq $0x1c, %rdi
addq $0x1c, %rsi
callq 0x22d0
testl %eax, %eax
sete %al
jmp 0xab71
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: toString
String* toString(PKVM* vm, const Var value) {

  // If it's already a string don't allocate a new string.
  if (IS_OBJ_TYPE(value, OBJ_STRING)) {
    return (String*)AS_OBJ(value);
  }

  pkByteBuffer buff;
  pkByteBufferInit(&buff);
  _toStringInternal(vm, value, &buff, NULL, false);
  String* ret = newStringLength(vm, (const char*)buff.data, buff.count);
  pkByteBufferClear(&buff, vm);
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsi, %rax
shrq $0x32, %rax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jb 0xabb4
movabsq $0xffffffffffff, %r14   # imm = 0xFFFFFFFFFFFF
andq %rsi, %r14
cmpl $0x0, (%r14)
je 0xabf1
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
movq %rbx, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xabfe
movq (%r15), %rsi
movl 0x8(%r15), %edx
movq %rbx, %rdi
callq 0x7fc8
movq %rax, %r14
movq (%r15), %rsi
movl 0xc(%r15), %edx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xb668
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_var.c
// Function: toBool
bool toBool(Var v) {

  if (IS_BOOL(v)) return AS_BOOL(v);
  if (IS_NULL(v)) return false;
  if (IS_NUM(v)) return AS_NUM(v) != 0;

  ASSERT(IS_OBJ(v), OOPS);
  Object* o = AS_OBJ(v);
  switch (o->type) {
    case OBJ_STRING: return ((String*)o)->length != 0;
    case OBJ_LIST:   return ((List*)o)->elements.count != 0;
    case OBJ_MAP:    return ((Map*)o)->count != 0;
    case OBJ_RANGE: // [[FALLTHROUGH]]
    case OBJ_SCRIPT:
    case OBJ_FUNC:
    case OBJ_FIBER:
    case OBJ_CLASS:
    case OBJ_INST:
      return true;
  }

  UNREACHABLE();
}

// Assembly:
pushq %rax
movq %rdi, %rax
shrq %rax
movabsq $0x3ffe800000000001, %rcx # imm = 0x3FFE800000000001
cmpq %rcx, %rax
jne 0xb468
movabsq $0x7ffd000000000002, %rax # imm = 0x7FFD000000000002
incq %rax
cmpq %rax, %rdi
sete %al
jmp 0xb4e0
movabsq $0x7ffc000000000000, %rax # imm = 0x7FFC000000000000
cmpq %rax, %rdi
jne 0xb47b
xorl %eax, %eax
jmp 0xb4e0
movq %rdi, %rcx
notq %rcx
testq %rcx, %rax
jne 0xb4c1
movq %rdi, %rax
shrq $0x32, %rax
cmpl $0x3ffe, %eax           # imm = 0x3FFE
jbe 0xb4e2
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %rdi
movl (%rdi), %ecx
movb $0x1, %al
leal -0x3(%rcx), %edx
cmpl $0x6, %edx
jb 0xb4e0
cmpl $0x2, %ecx
je 0xb4bb
cmpl $0x1, %ecx
je 0xb4d9
testl %ecx, %ecx
jne 0xb4e7
cmpl $0x0, 0x14(%rdi)
jmp 0xb4dd
callq 0xf397
xorpd %xmm1, %xmm1
cmpneqsd %xmm0, %xmm1
movq %xmm1, %rax
andl $0x1, %eax
jmp 0xb4e0
cmpl $0x0, 0x18(%rdi)
setne %al
popq %rcx
retq
callq 0x29d3
callq 0x2a09
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pkNewVM
PKVM* pkNewVM(PkConfiguration* config) {

  PkConfiguration default_config = pkNewConfiguration();

  if (config == NULL) config = &default_config;

  PKVM* vm = (PKVM*)config->realloc_fn(NULL, sizeof(PKVM), config->user_data);
  memset(vm, 0, sizeof(PKVM));

  vm->config = *config;
  vm->working_set_count = 0;
  vm->working_set_capacity = MIN_CAPACITY;
  vm->working_set = (Object**)vm->config.realloc_fn(
                       NULL, sizeof(Object*) * vm->working_set_capacity, NULL);
  vm->next_gc = INITIAL_GC_SIZE;
  vm->min_heap_size = MIN_HEAP_SIZE;
  vm->heap_fill_percent = HEAP_FILL_PERCENT;

  vm->scripts = newMap(vm);
  vm->core_libs = newMap(vm);
  vm->builtins_count = 0;

  initializeCore(vm);
  return vm;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
leaq -0x24(%rip), %rax       # 0xb511
movq %rsp, %r14
movq %rax, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movups %xmm0, 0x18(%r14)
movups %xmm0, 0x28(%r14)
movups %xmm0, 0x38(%r14)
movups %xmm0, 0x48(%r14)
testq %rdi, %rdi
cmovneq %rdi, %r14
movq 0x50(%r14), %rdx
movl $0x5f8, %esi            # imm = 0x5F8
xorl %edi, %edi
callq *(%r14)
movq %rax, %rbx
movl $0x5f8, %edx            # imm = 0x5F8
movq %rax, %rdi
xorl %esi, %esi
callq 0x21a0
leaq 0xc8(%rbx), %rdi
movl $0xb, %ecx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movabsq $0x800000000, %rax      # imm = 0x800000000
movq %rax, 0x30(%rbx)
movl $0x40, %esi
xorl %edi, %edi
xorl %edx, %edx
callq *0xc8(%rbx)
movq %rax, 0x28(%rbx)
movq $0xa00000, 0x10(%rbx)   # imm = 0xA00000
movq $0x100000, 0x18(%rbx)   # imm = 0x100000
movl $0x4b, 0x20(%rbx)
movq %rbx, %rdi
callq 0x81e9
movq %rax, 0x128(%rbx)
movq %rbx, %rdi
callq 0x81e9
movq %rax, 0x130(%rbx)
movl $0x0, 0x5e8(%rbx)
movq %rbx, %rdi
callq 0x13cec
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pkFreeVM
void pkFreeVM(PKVM* vm) {

  Object* obj = vm->first;
  while (obj != NULL) {
    Object* next = obj->next;
    freeObject(vm, obj);
    obj = next;
  }

  vm->working_set = (Object**)vm->config.realloc_fn(
    vm->working_set, 0, vm->config.user_data);

  // Tell the host application that it forget to release all of it's handles
  // before freeing the VM.
  __ASSERT(vm->handles == NULL, "Not all handles were released.");

  DEALLOCATE(vm, vm);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rsi
testq %rsi, %rsi
je 0xb626
movq 0x8(%rsi), %r14
movq %rbx, %rdi
callq 0xa2b4
movq %r14, %rsi
testq %r14, %r14
jne 0xb612
movq 0x28(%rbx), %rdi
movq 0x118(%rbx), %rdx
xorl %esi, %esi
callq *0xc8(%rbx)
movq %rax, 0x28(%rbx)
cmpq $0x0, 0xc0(%rbx)
jne 0xb663
movq 0xc8(%rbx), %rax
movq 0x118(%rbx), %rdx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
callq 0x2a38
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmRealloc
void* vmRealloc(PKVM* vm, void* memory, size_t old_size, size_t new_size) {

  // TODO: Debug trace allocations here.

  // Track the total allocated memory of the VM to trigger the GC.
  // if vmRealloc is called for freeing, the old_size would be 0 since
  // deallocated bytes are traced by garbage collector.
  vm->bytes_allocated += new_size - old_size;

  if (new_size > 0 && vm->bytes_allocated > vm->next_gc) {
    vmCollectGarbage(vm);
  }

  return vm->config.realloc_fn(memory, new_size, vm->config.user_data);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rcx, %rax
subq %rdx, %rax
addq 0x8(%rdi), %rax
movq %rax, 0x8(%rdi)
testq %rcx, %rcx
je 0xb697
cmpq 0x10(%r15), %rax
jbe 0xb697
movq %r15, %rdi
callq 0xe40f
movq 0xc8(%r15), %rax
movq 0x118(%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmNewHandle
PkHandle* vmNewHandle(PKVM* vm, Var value) {
  PkHandle* handle = (PkHandle*)ALLOCATE(vm, PkHandle);
  handle->value = value;
  handle->prev = NULL;
  handle->next = vm->handles;
  if (handle->next != NULL) handle->next->prev = handle;
  vm->handles = handle;
  return handle;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
addq $0x18, %rax
movq %rax, 0x8(%rdi)
cmpq 0x10(%rdi), %rax
jbe 0xb6ee
movq %rbx, %rdi
callq 0xe40f
movq 0x118(%rbx), %rdx
movl $0x18, %esi
xorl %edi, %edi
callq *0xc8(%rbx)
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
movq 0xc0(%rbx), %rcx
movq %rcx, 0x10(%rax)
testq %rcx, %rcx
je 0xb721
movq %rax, 0x8(%rcx)
movq %rax, 0xc0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pkReleaseHandle
void pkReleaseHandle(PKVM* vm, PkHandle* handle) {
  __ASSERT(handle != NULL, "Given handle was NULL.");

  // If the handle is the head of the vm's handle chain set it to the next one.
  if (handle == vm->handles) {
    vm->handles = handle->next;
  }

  // Remove the handle from the chain by connecting the both ends together.
  if (handle->next) handle->next->prev = handle->prev;
  if (handle->prev) handle->prev->next = handle->next;

  // Free the handle.
  DEALLOCATE(vm, handle);
}

// Assembly:
testq %rsi, %rsi
je 0xb780
cmpq %rsi, 0xc0(%rdi)
jne 0xb74d
movq 0x10(%rsi), %rax
movq %rax, 0xc0(%rdi)
movq 0x10(%rsi), %rax
testq %rax, %rax
je 0xb75e
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0xb76b
movq %rax, 0x10(%rcx)
movq 0xc8(%rdi), %rax
movq 0x118(%rdi), %rdx
movq %rsi, %rdi
xorl %esi, %esi
jmpq *%rax
pushq %rax
callq 0x2a6c
// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x80(%rsp), %r13
movq (%r13), %r15
testq %r15, %r15
je 0xb7b8
movq %r15, %rdi
callq 0x2140
movq %rax, %rdx
jmp 0xb7ba
xorl %edx, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7fc8
movq %rax, %r12
movq 0x8(%r13), %rax
testq %rax, %rax
je 0xb7e9
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq *%rax
leaq 0x60(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb8d6
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb903
movq %rax, %r15
testq %rax, %rax
jne 0xb854
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x90b5
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb8d6
movq 0x128(%rbx), %rsi
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %r12
movq %r15, %rcx
orq %rax, %rcx
movq %rbx, %rdi
movq %r12, %rdx
callq 0xa060
movq %rbx, %rdi
callq 0xb949
movq %rbx, %rdi
callq 0xb949
movq (%r13), %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq 0x10283
movl %eax, %ebp
movq 0x8(%r13), %rax
testq %rax, %rax
je 0xb891
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq *%rax
testl %ebp, %ebp
je 0xb8a6
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x88(%r15)
movq 0x80(%r15), %rsi
movq %rbx, %rdi
callq 0x828a
movq %rbx, %rdi
movq %rax, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb962
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmPushTempRef
void vmPushTempRef(PKVM* vm, Object* obj) {
  ASSERT(obj != NULL, "Cannot reference to NULL.");
  ASSERT(vm->temp_reference_count < MAX_TEMP_REFERENCE,
    "Too many temp references");
  vm->temp_reference[vm->temp_reference_count++] = obj;
}

// Assembly:
pushq %rax
testq %rsi, %rsi
je 0xb8f9
movslq 0xb8(%rdi), %rax
cmpq $0x10, %rax
jge 0xb8fe
leal 0x1(%rax), %ecx
movl %ecx, 0xb8(%rdi)
movq %rsi, 0x38(%rdi,%rax,8)
popq %rax
retq
callq 0x2ad6
callq 0x2aa0
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmGetScript
Script* vmGetScript(PKVM* vm, String* path) {
  Var scr = mapGet(vm->scripts, VAR_OBJ(path));
  if (IS_UNDEF(scr)) return NULL;
  ASSERT(AS_OBJ(scr)->type == OBJ_SCRIPT, OOPS);
  return (Script*)AS_OBJ(scr);
}

// Assembly:
pushq %rax
movq 0x128(%rdi), %rdi
movabsq $-0x4000000000000, %rax # imm = 0xFFFC000000000000
orq %rax, %rsi
callq 0x9f27
movabsq $0x7ffd000000000000, %rcx # imm = 0x7FFD000000000000
cmpq %rcx, %rax
jne 0xb930
xorl %eax, %eax
jmp 0xb942
movabsq $0xffffffffffff, %rcx   # imm = 0xFFFFFFFFFFFF
andq %rcx, %rax
cmpl $0x4, (%rax)
jne 0xb944
popq %rcx
retq
callq 0x2b0c
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pkRunFiber
PkResult pkRunFiber(PKVM* vm, PkHandle* fiber,
                    int argc, PkHandle** argv) {
  __ASSERT(fiber != NULL, "Handle fiber was NULL.");
  Var fb = fiber->value;
  __ASSERT(IS_OBJ_TYPE(fb, OBJ_FIBER), "Given handle is not a fiber.");
  Fiber* _fiber = (Fiber*)AS_OBJ(fb);

  Var* args[MAX_ARGC];
  for (int i = 0; i < argc; i++) {
    args[i] = &(argv[i]->value);
  }

  if (!vmPrepareFiber(vm, _fiber, argc, args)) {
    return PK_RESULT_RUNTIME_ERROR;
  }

  ASSERT(_fiber->frame_count == 1, OOPS);
  return runFiber(vm, _fiber);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
testq %rsi, %rsi
je 0xe042
movq (%rsi), %r14
movq %r14, %rax
shrq $0x32, %rax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jb 0xe03d
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %r14
cmpl $0x6, (%r14)
jne 0xe03d
movl %edx, %ebp
movq %rdi, %rbx
testl %edx, %edx
jle 0xdffb
movl %ebp, %edx
shlq $0x3, %rdx
movq %rsp, %rdi
movq %rcx, %rsi
callq 0x2280
movq %rsp, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0xe04c
testb %al, %al
je 0xe02c
cmpl $0x1, 0x4c(%r14)
jne 0xe047
movq %rbx, %rdi
movq %r14, %rsi
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
jmp 0xb962
movl $0x3, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
callq 0x432b
callq 0x4397
callq 0x4361
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pkResumeFiber
PkResult pkResumeFiber(PKVM* vm, PkHandle* fiber, PkVar value) {
  __ASSERT(fiber != NULL, "Handle fiber was NULL.");
  Var fb = fiber->value;
  __ASSERT(IS_OBJ_TYPE(fb, OBJ_FIBER), "Given handle is not a fiber.");
  Fiber* _fiber = (Fiber*)AS_OBJ(fb);

  if (!vmSwitchFiber(vm, _fiber, (Var*)value)) {
    return PK_RESULT_RUNTIME_ERROR;
  }

  return runFiber(vm, _fiber);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0xe28d
movq (%rsi), %r14
movq %r14, %rax
shrq $0x32, %rax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jb 0xe288
movabsq $0xffffffffffff, %rax   # imm = 0xFFFFFFFFFFFF
andq %rax, %r14
cmpl $0x6, (%r14)
jne 0xe288
movq %rdi, %rbx
movq %r14, %rsi
callq 0xe292
testb %al, %al
je 0xe27b
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xb962
movl $0x3, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4618
callq 0x464e
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmSwitchFiber
bool vmSwitchFiber(PKVM* vm, Fiber* fiber, Var* value) {
  if (fiber->state != FIBER_YIELDED) {
    switch (fiber->state) {
      case FIBER_NEW:
        _ERR_FAIL(newString(vm, "The fiber hasn't started. call fiber_run() "
          "to start."));
      case FIBER_RUNNING:
        _ERR_FAIL(newString(vm, "The fiber has already been running."));
      case FIBER_YIELDED: UNREACHABLE();
      case FIBER_DONE:
        _ERR_FAIL(newString(vm, "The fiber has done running."));
    }
    UNREACHABLE();
  }

  // Pass the resume argument if it has any.

  // Assert if we have a call frame and the stack size enough for the return
  // value and the resumed value.
  ASSERT(fiber->frame_count != 0, OOPS);
  ASSERT((fiber->stack + fiber->stack_size) - fiber->sp >= 2, OOPS);

  // fb->ret will points to the return value of the 'yield()' call.
  if (value == NULL) *fiber->ret = VAR_NULL;
  else *fiber->ret = *value;

  // Switch fiber.
  fiber->caller = vm->fiber;
  vm->fiber = fiber;

  // On success return true.
  return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rsi), %ebp
cmpl $0x2, %ebp
jne 0xe2ce
cmpl $0x0, 0x4c(%rsi)
je 0xe398
movslq 0x28(%rsi), %rax
shlq $0x3, %rax
addq 0x20(%rsi), %rax
subq 0x30(%rsi), %rax
cmpq $0x8, %rax
jle 0xe39d
testq %rdx, %rdx
je 0xe310
movq (%rdx), %rax
jmp 0xe31a
cmpl $0x3, %ebp
je 0xe359
cmpl $0x1, %ebp
je 0xe335
testl %ebp, %ebp
jne 0xe3a2
movq 0x5f0(%rbx), %rax
testq %rax, %rax
je 0xe38b
cmpq $0x0, 0x58(%rax)
jne 0xe3a7
leaq 0xf500(%rip), %rsi      # 0x1d806
movq %rbx, %rdi
movl $0x34, %edx
jmp 0xe37b
movabsq $0x7ffc000000000000, %rax # imm = 0x7FFC000000000000
movq 0x38(%rsi), %rcx
movq %rax, (%rcx)
movq 0x5f0(%rbx), %rax
movq %rax, 0x50(%rsi)
movq %rsi, 0x5f0(%rbx)
jmp 0xe38b
movq 0x5f0(%rbx), %rax
testq %rax, %rax
je 0xe38b
cmpq $0x0, 0x58(%rax)
jne 0xe3ac
leaq 0xf428(%rip), %rsi      # 0x1d777
movq %rbx, %rdi
movl $0x23, %edx
jmp 0xe37b
movq 0x5f0(%rbx), %rax
testq %rax, %rax
je 0xe38b
cmpq $0x0, 0x58(%rax)
jne 0xe3b1
leaq 0xf469(%rip), %rsi      # 0x1d7dc
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x7fc8
movq 0x5f0(%rbx), %rcx
movq %rax, 0x58(%rcx)
cmpl $0x2, %ebp
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x478b
callq 0x4755
callq 0x4726
callq 0x46f0
callq 0x46ba
callq 0x4684
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: vmYieldFiber
void vmYieldFiber(PKVM* vm, Var* value) {

  Fiber* caller = vm->fiber->caller;

  // Return the yield value to the caller fiber.
  if (caller != NULL) {
    if (value == NULL) *caller->ret = VAR_NULL;
    else *caller->ret = *value;
  }

  // Can be resumed by another caller fiber.
  vm->fiber->caller = NULL;
  vm->fiber->state = FIBER_YIELDED;
  vm->fiber = caller;
}

// Assembly:
movq 0x5f0(%rdi), %rax
movq 0x50(%rax), %rcx
testq %rcx, %rcx
je 0xe578
testq %rsi, %rsi
je 0xe567
movq (%rsi), %rdx
jmp 0xe571
movabsq $0x7ffc000000000000, %rdx # imm = 0x7FFC000000000000
movq 0x38(%rcx), %rsi
movq %rdx, (%rsi)
movq $0x0, 0x50(%rax)
movl $0x2, 0x10(%rax)
movq %rcx, 0x5f0(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: reportError
static void reportError(PKVM* vm) {
  ASSERT(VM_HAS_ERROR(vm), "runtimeError() should be called after an error.");
  // TODO: pass the error to the caller of the fiber.

  // Print the Error message and stack trace.
  if (vm->config.error_fn == NULL) return;
  Fiber* fiber = vm->fiber;
  vm->config.error_fn(vm, PK_ERROR_RUNTIME, NULL, -1, fiber->error->data);
  for (int i = fiber->frame_count - 1; i >= 0; i--) {
    CallFrame* frame = &fiber->frames[i];
    const Function* fn = frame->fn;
    ASSERT(!fn->is_native, OOPS);
    int line = fn->fn->oplines.data[frame->ip - fn->fn->opcodes.data - 1];
    vm->config.error_fn(vm, PK_ERROR_STACKTRACE, fn->owner->path->data, line,
                        fn->name);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x5f0(%rdi), %r14
movq 0x58(%r14), %r8
testq %r8, %r8
je 0xe64f
movq %rdi, %rbx
movq 0xd0(%rdi), %rax
testq %rax, %rax
je 0xe63e
addq $0x1c, %r8
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq *%rax
movslq 0x4c(%r14), %r15
testq %r15, %r15
jle 0xe63e
leaq (%r15,%r15,2), %rax
incq %r15
leaq -0x10(,%rax,8), %r12
movq 0x40(%r14), %rcx
movq (%rcx,%r12), %rax
cmpb $0x1, 0x30(%rax)
je 0xe64a
movq 0x38(%rax), %rdx
movq -0x8(%rcx,%r12), %rcx
movq (%rdx), %rsi
notq %rsi
shlq $0x2, %rsi
addq 0x10(%rdx), %rsi
movl (%rsi,%rcx,4), %ecx
movq 0x10(%rax), %r8
movq 0x18(%rax), %rax
movq 0x18(%rax), %rdx
addq $0x1c, %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq *0xd0(%rbx)
decq %r15
addq $-0x18, %r12
cmpq $0x1, %r15
jg 0xe5eb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x482d
callq 0x4863
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_vm.c
// Function: pushCallFrame
static inline void pushCallFrame(PKVM* vm, const Function* fn, Var* rbp) {
  ASSERT(!fn->is_native, "Native function shouldn't use call frames.");

  // Grow the stack frame if needed.
  if (vm->fiber->frame_count + 1 > vm->fiber->frame_capacity) {
    int new_capacity = vm->fiber->frame_capacity << 1;
    vm->fiber->frames = (CallFrame*)vmRealloc(vm, vm->fiber->frames,
                           sizeof(CallFrame) * vm->fiber->frame_capacity,
                           sizeof(CallFrame) * new_capacity);
    vm->fiber->frame_capacity = new_capacity;
  }

  // Grow the stack if needed.
  int needed = fn->fn->stack_size + (int)(vm->fiber->sp - vm->fiber->stack);
  if (vm->fiber->stack_size <= needed) growStack(vm, needed);

  CallFrame* frame = vm->fiber->frames + vm->fiber->frame_count++;
  frame->rbp = rbp;
  frame->fn = fn;
  frame->ip = fn->fn->opcodes.data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x1, 0x30(%rsi)
je 0xe798
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x5f0(%rdi), %rcx
movslq 0x48(%rcx), %rax
cmpl %eax, 0x4c(%rcx)
jl 0xe6b7
leal (%rax,%rax), %edi
movq 0x40(%rcx), %rsi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
movslq %edi, %r12
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %rcx
movq %r15, %rdi
callq 0xb668
movq 0x5f0(%r15), %rcx
movq %rax, 0x40(%rcx)
movl %r12d, 0x48(%rcx)
movq 0x38(%rbx), %rax
movq 0x5f0(%r15), %r13
movq 0x30(%r13), %rdi
subq 0x20(%r13), %rdi
shrq $0x3, %rdi
addl 0x20(%rax), %edi
cmpl %edi, 0x28(%r13)
jg 0xe75b
callq 0xf348
movq 0x20(%r13), %r12
movslq 0x28(%r13), %rdx
shlq $0x3, %rdx
movslq %eax, %rbp
leaq (,%rbp,8), %rcx
movq %r15, %rdi
movq %r12, %rsi
callq 0xb668
movq %rax, 0x20(%r13)
movl %ebp, 0x28(%r13)
cmpq %rax, %r12
je 0xe75b
movq 0x30(%r13), %rcx
movq 0x38(%r13), %rdx
subq %r12, %rcx
addq %rax, %rcx
movq %rcx, 0x30(%r13)
subq %r12, %rdx
addq %rax, %rdx
movq %rdx, 0x38(%r13)
movslq 0x4c(%r13), %rdx
testq %rdx, %rdx
jle 0xe75b
movq 0x40(%r13), %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
movq 0x10(%rcx,%rsi), %rdi
subq %r12, %rdi
addq %rax, %rdi
movq %rdi, 0x10(%rcx,%rsi)
addq $0x18, %rsi
cmpq %rsi, %rdx
jne 0xe742
movq 0x5f0(%r15), %rax
movq 0x40(%rax), %rcx
movslq 0x4c(%rax), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x4c(%rax)
leaq (%rdx,%rdx,2), %rax
movq %r14, 0x10(%rcx,%rax,8)
movq %rbx, 0x8(%rcx,%rax,8)
movq 0x38(%rbx), %rdx
movq (%rdx), %rdx
movq %rdx, (%rcx,%rax,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4899
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_debug.c
// Function: dumpValue
void dumpValue(PKVM* vm, Var value, pkByteBuffer* buff) {
  String* repr = toRepr(vm, value);
  vmPushTempRef(vm, &repr->_super);
  pkByteBufferAddString(buff, vm, repr->data, repr->length);
  vmPopTempRef(vm);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
callq 0xa850
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0xb8d6
movl 0x14(%r15), %ecx
addq $0x1c, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x8af2
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xb949
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_debug.c
// Function: dumpGlobalValues
void dumpGlobalValues(PKVM* vm) {
  Fiber* fiber = vm->fiber;
  int frame_ind = fiber->frame_count - 1;
  ASSERT(frame_ind >= 0, OOPS);
  CallFrame* frame = &fiber->frames[frame_ind];
  Script* scr = frame->fn->owner;

  for (uint32_t i = 0; i < scr->global_names.count; i++) {
    String* name = scr->names.data[scr->global_names.data[i]];
    Var value = scr->globals.data[i];
    printf("%10s = ", name->data);

    // Dump value. TODO: refactor.
    pkByteBuffer buff;
    pkByteBufferInit(&buff);
    dumpValue(vm, value, &buff);
    pkByteBufferWrite(&buff, vm, '\0');
    printf("%s", (const char*)buff.data);
    pkByteBufferClear(&buff, vm);

    printf("\n");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x5f0(%rdi), %rax
movslq 0x4c(%rax), %rcx
testq %rcx, %rcx
jle 0xf265
movq 0x40(%rax), %rax
leaq (%rcx,%rcx,2), %rcx
movq -0x10(%rax,%rcx,8), %rax
movq 0x18(%rax), %rbp
cmpl $0x0, 0x38(%rbp)
je 0xf256
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
leaq 0x11784(%rip), %r12     # 0x2095b
xorl %r14d, %r14d
movq 0x60(%rbp), %rax
movq 0x20(%rbp), %rcx
movq 0x30(%rbp), %rdx
movl (%rdx,%r14,4), %edx
movq (%rax,%rdx,8), %rsi
movq (%rcx,%r14,8), %r13
addq $0x1c, %rsi
leaq 0xe992(%rip), %rdi      # 0x1db8f
xorl %eax, %eax
callq 0x2150
movq %r15, %rdi
callq 0x8585
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xe7a0
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x8624
movq 0x8(%rsp), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2150
movq %r15, %rdi
movq %rbx, %rsi
callq 0x858c
movl $0xa, %edi
callq 0x2050
incq %r14
movl 0x38(%rbp), %eax
cmpq %rax, %r14
jb 0xf1da
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4a0a
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_debug.c
// Function: dumpStackFrame
void dumpStackFrame(PKVM* vm) {
  Fiber* fiber = vm->fiber;
  int frame_ind = fiber->frame_count - 1;
  ASSERT(frame_ind >= 0, OOPS);
  CallFrame* frame = &fiber->frames[frame_ind];
  Var* sp = fiber->sp - 1;

  printf("Frame[%d]\n", frame_ind);
  for (; sp >= frame->rbp; sp--) {
    printf("       ");

    // Dump value. TODO: refactor.
    pkByteBuffer buff;
    pkByteBufferInit(&buff);
    dumpValue(vm, *sp, &buff);
    pkByteBufferWrite(&buff, vm, '\0');
    printf("%s", (const char*)buff.data);
    pkByteBufferClear(&buff, vm);

    printf("\n");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x5f0(%rdi), %rax
movl 0x4c(%rax), %r14d
testl %r14d, %r14d
jle 0xf340
movq %rdi, %rbx
decl %r14d
movq 0x30(%rax), %r13
movq 0x40(%rax), %r15
leaq 0xe905(%rip), %rdi      # 0x1dba6
movl %r14d, %esi
xorl %eax, %eax
callq 0x2150
leaq (%r14,%r14,2), %rax
addq $-0x8, %r13
cmpq 0x10(%r15,%rax,8), %r13
jb 0xf331
leaq (%r15,%rax,8), %rbp
addq $0x10, %rbp
leaq 0xe886(%rip), %r14      # 0x1db4f
leaq 0x8(%rsp), %r15
leaq 0x11686(%rip), %r12     # 0x2095b
movq %r14, %rdi
xorl %eax, %eax
callq 0x2150
movq %r15, %rdi
callq 0x8585
movq (%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0xe7a0
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x8624
movq 0x8(%rsp), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2150
movq %r15, %rdi
movq %rbx, %rsi
callq 0x858c
movl $0xa, %edi
callq 0x2050
addq $-0x8, %r13
cmpq (%rbp), %r13
jae 0xf2d5
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4a40
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_utils.c
// Function: utilHashBits
uint32_t utilHashBits(uint64_t hash) {
  // From v8's ComputeLongHash() which in turn cites:
  // Thomas Wang, Integer Hash Functions.
  // http://www.concentric.net/~Ttwang/tech/inthash.htm
  hash = ~hash + (hash << 18);
  hash = hash ^ (hash >> 31);
  hash = hash * 21;
  hash = hash ^ (hash >> 11);
  hash = hash + (hash << 6);
  hash = hash ^ (hash >> 22);
  return (uint32_t)(hash & 0x3fffffff);
}

// Assembly:
movq %rdi, %rax
notq %rax
shlq $0x12, %rdi
addq %rax, %rdi
movq %rdi, %rax
shrq $0x1f, %rax
xorq %rdi, %rax
leaq (%rax,%rax,4), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, %rcx
shrq $0xb, %rcx
xorq %rax, %rcx
movq %rcx, %rdx
shlq $0x6, %rdx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x16, %rax
xorl %edx, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_utils.c
// Function: utf8_encodeBytesCount
int utf8_encodeBytesCount(int value) {
  if (value <= 0x7f) return 1;
  if (value <= 0x7ff) return 2;
  if (value <= 0xffff) return 3;
  if (value <= 0x10ffff) return 4;

  // if we're here means it's an invalid leading byte
  return 0;
}

// Assembly:
movl $0x1, %eax
cmpl $0x80, %edi
jl 0xf484
movl $0x2, %eax
cmpl $0x800, %edi            # imm = 0x800
jl 0xf484
movl $0x3, %eax
cmpl $0x10000, %edi          # imm = 0x10000
jl 0xf484
xorl %eax, %eax
cmpl $0x110000, %edi         # imm = 0x110000
setl %al
shll $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_utils.c
// Function: utf8_decodeBytesCount
int utf8_decodeBytesCount(uint8_t byte) {

  if ((byte >> 7) == 0b0) return 1;
  if ((byte >> 6) == 0b10) return 1; //< continuation byte
  if ((byte >> 5) == 0b110) return 2;
  if ((byte >> 4) == 0b1110) return 3;
  if ((byte >> 3) == 0b11110) return 4;

  // if we're here means it's an invalid utf8 byte
  return 1;
}

// Assembly:
testb %dil, %dil
setns %al
movl %edi, %ecx
andl $-0x40, %ecx
cmpl $0x80, %ecx
sete %cl
orb %al, %cl
movl $0x1, %eax
jne 0xf4d9
movl %edi, %ecx
andl $-0x20, %ecx
movl $0x2, %eax
cmpl $0xc0, %ecx
je 0xf4d9
movl %edi, %ecx
andl $-0x10, %ecx
movl $0x3, %eax
cmpl $0xe0, %ecx
je 0xf4d9
andl $-0x8, %edi
xorl %eax, %eax
cmpl $0xf0, %edi
sete %al
leal (%rax,%rax,2), %eax
incl %eax
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_utils.c
// Function: utf8_encodeValue
int utf8_encodeValue(int value, uint8_t* bytes) {

  if (value <= 0x7f) {
    *bytes = value & 0x7f;
    return 1;
  }

  // 2 byte character 110xxxxx 10xxxxxx -> last 6 bits write to 2nd byte and
  // first 5 bit write to first byte
  if (value <= 0x7ff) {
    *(bytes++) = (uint8_t)(0b11000000 | ((value & 0b11111000000) >> 6));
    *(bytes) = (uint8_t)(0b10000000 | ((value & 111111)));
    return 2;
  }

  // 3 byte character 1110xxxx 10xxxxxx 10xxxxxx -> from last, 6 bits write
  // to  3rd byte, next 6 bits write to 2nd byte, and 4 bits to first byte.
  if (value <= 0xffff) {
    *(bytes++) = (uint8_t)(0b11100000 | ((value & 0b1111000000000000) >> 12));
    *(bytes++) = (uint8_t)(0b10000000 | ((value & 0b111111000000) >> 6));
    *(bytes) =   (uint8_t)(0b10000000 | ((value & 0b111111)));
    return 3;
  }

  // 4 byte character 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx -> last 6 bits to
  // to 4th byte, next 6 bits to 3rd byte, next 6 bits to 2nd byte, 3 bits
  // first byte.
  if (value <= 0x10ffff) {
    *(bytes++) = (uint8_t)(0b11110000 | ((value & (0b111    << 18)) >> 18));
    *(bytes++) = (uint8_t)(0b10000000 | ((value & (0b111111 << 12)) >> 12));
    *(bytes++) = (uint8_t)(0b10000000 | ((value & (0b111111 << 6))  >> 6));
    *(bytes)   = (uint8_t)(0b10000000 | ((value &  0b111111)));
    return 4;
  }

  return 0;
}

// Assembly:
cmpl $0x7f, %edi
jg 0xf4ec
andb $0x7f, %dil
movb %dil, (%rsi)
movl $0x1, %eax
retq
cmpl $0x7ff, %edi            # imm = 0x7FF
jg 0xf511
movl %edi, %eax
shrl $0x6, %eax
andb $0x1f, %al
orb $-0x40, %al
movb %al, (%rsi)
andb $0x7, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rsi)
movl $0x2, %eax
retq
cmpl $0xffff, %edi           # imm = 0xFFFF
jg 0xf542
movl %edi, %eax
shrl $0xc, %eax
andb $0xf, %al
orb $-0x20, %al
movb %al, (%rsi)
movl %edi, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rsi)
movl $0x3, %eax
retq
xorl %eax, %eax
cmpl $0x10ffff, %edi         # imm = 0x10FFFF
jg 0xf580
movl %edi, %eax
shrl $0x12, %eax
andb $0x7, %al
orb $-0x10, %al
movb %al, (%rsi)
movl %edi, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rsi)
movl %edi, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x2(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x3(%rsi)
movl $0x4, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_utils.c
// Function: utf8_decodeBytes
int utf8_decodeBytes(uint8_t* bytes, int* value) {

  int continue_bytes = 0;
  int byte_count = 1;
  int _value = 0;

  if ((*bytes & 0b11000000) == 0b10000000) {
    *value = *bytes;
    return byte_count;
  }

  else if ((*bytes & 0b11100000) == 0b11000000) {
    continue_bytes = 1;
    _value = (*bytes & 0b11111);
  }

  else if ((*bytes & 0b11110000) == 0b11100000) {
    continue_bytes = 2;
    _value = (*bytes & 0b1111);
  }

  else if ((*bytes & 0b11111000) == 0b11110000) {
    continue_bytes = 3;
    _value = (*bytes & 0b111);
  }

  else {
    // Invalid leading byte
    return -1;
  }

  // now add the continuation bytes to the _value
  while (continue_bytes--) {
    bytes++, byte_count++;

    if ((*bytes & 0b11000000) != 0b10000000) return -1;

    _value = (_value << 6) | (*bytes & 0b00111111);
  }

  *value = _value;
  return byte_count;
}

// Assembly:
movzbl (%rdi), %ecx
movl %ecx, %edx
andl $-0x40, %edx
movl $0x1, %eax
cmpl $0x80, %edx
je 0xf61f
movl %ecx, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0xf5af
xorl %eax, %eax
movl $0x1f, %edx
jmp 0xf5e3
movl %ecx, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0xf5c7
movl $0x1, %eax
movl $0xf, %edx
jmp 0xf5e3
movl %ecx, %edx
andl $-0x8, %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xf0, %edx
jne 0xf621
movl $0x2, %eax
movl $0x7, %edx
andl %edx, %ecx
movl %eax, %edx
addl $0x2, %eax
incq %rdx
xorl %r8d, %r8d
movzbl 0x1(%rdi,%r8), %r9d
movl %r9d, %r10d
andl $-0x40, %r10d
cmpl $0x80, %r10d
jne 0xf622
movl %ecx, %r10d
shll $0x6, %r10d
andl $0x3f, %r9d
movl %r9d, %ecx
orl %r10d, %ecx
incq %r8
cmpl %r8d, %edx
jne 0xf5f0
movl %ecx, (%rsi)
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_compiler.c
// Function: exprAttrib
static void exprAttrib(Compiler* compiler) {
  consume(compiler, TK_NAME, "Expected an attribute name after '.'.");
  const char* name = compiler->previous.start;
  int length = compiler->previous.length;

  // Store the name in script's names.
  int index = scriptAddName(compiler->script, compiler->vm, name, length);

  if (compiler->l_value && matchAssignment(compiler)) {
    skipNewLines(compiler);

    TokenType assignment = compiler->previous.type;
    if (assignment != TK_EQ) {
      emitOpcode(compiler, OP_GET_ATTRIB_KEEP);
      emitShort(compiler, index);
      compileExpression(compiler);
      emitAssignment(compiler, assignment);
    } else {
      compileExpression(compiler);
    }

    emitOpcode(compiler, OP_SET_ATTRIB);
    emitShort(compiler, index);

  } else {
    emitOpcode(compiler, OP_GET_ATTRIB);
    emitShort(compiler, index);
  }

  compiler->is_last_call = false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xed0d(%rip), %rdx      # 0x1e346
movl $0x47, %esi
callq 0x11171
movq (%rbx), %rsi
movq 0x38(%rbx), %rdx
movl 0x40(%rbx), %ecx
movq 0x18b0(%rbx), %rdi
callq 0x93bb
movl %eax, %ebp
movl $0x30, %r14d
cmpb $0x1, 0x38cd(%rbx)
jne 0xf6f1
movq %rbx, %rdi
callq 0x12445
testb %al, %al
je 0xf6f1
movq %rbx, %rdi
callq 0x11e66
movl 0x30(%rbx), %r14d
movq %rbx, %rdi
cmpl $0x1a, %r14d
jne 0xf69b
movl $0x1, %esi
callq 0x12323
jmp 0xf6eb
movl $0x31, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r15d
andl %r15d, %esi
movq %rbx, %rdi
callq 0x1135b
andl %ebp, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1135b
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12323
movq %rbx, %rdi
movl %r14d, %esi
callq 0x124f5
movl $0x32, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movl %ebp, %esi
shrl $0x8, %esi
movl $0xff, %r14d
andl %r14d, %esi
movq %rbx, %rdi
callq 0x1135b
andl %r14d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1135b
movb $0x0, 0x38ce(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_compiler.c
// Function: exprBinaryOp
static void exprBinaryOp(Compiler* compiler) {
  TokenType op = compiler->previous.type;
  skipNewLines(compiler);
  parsePrecedence(compiler, (Precedence)(getRule(op)->precedence + 1));

  switch (op) {
    case TK_DOTDOT:  emitOpcode(compiler, OP_RANGE);      break;
    case TK_PERCENT: emitOpcode(compiler, OP_MOD);        break;
    case TK_AMP:     emitOpcode(compiler, OP_BIT_AND);    break;
    case TK_PIPE:    emitOpcode(compiler, OP_BIT_OR);     break;
    case TK_CARET:   emitOpcode(compiler, OP_BIT_XOR);    break;
    case TK_PLUS:    emitOpcode(compiler, OP_ADD);        break;
    case TK_MINUS:   emitOpcode(compiler, OP_SUBTRACT);   break;
    case TK_STAR:    emitOpcode(compiler, OP_MULTIPLY);   break;
    case TK_FSLASH:  emitOpcode(compiler, OP_DIVIDE);     break;
    case TK_GT:      emitOpcode(compiler, OP_GT);         break;
    case TK_LT:      emitOpcode(compiler, OP_LT);         break;
    case TK_EQEQ:    emitOpcode(compiler, OP_EQEQ);       break;
    case TK_NOTEQ:   emitOpcode(compiler, OP_NOTEQ);      break;
    case TK_GTEQ:    emitOpcode(compiler, OP_GTEQ);       break;
    case TK_LTEQ:    emitOpcode(compiler, OP_LTEQ);       break;
    case TK_SRIGHT:  emitOpcode(compiler, OP_BIT_RSHIFT); break;
    case TK_SLEFT:   emitOpcode(compiler, OP_BIT_LSHIFT); break;
    case TK_IN:      emitOpcode(compiler, OP_IN);         break;
    default:
      UNREACHABLE();
  }

  compiler->is_last_call = false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x30(%rdi), %r14
callq 0x11e66
leaq (%r14,%r14,2), %rax
leaq 0x1aaaa(%rip), %rcx     # 0x2a200
movl 0x10(%rcx,%rax,8), %esi
incl %esi
movq %rbx, %rdi
callq 0x12323
leal -0xf(%r14), %eax
cmpl $0x28, %eax
ja 0xf784
leaq 0xe440(%rip), %rcx      # 0x1dbb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x3d, %esi
jmp 0xf802
movl $0x49, %esi
cmpl $0x4, %r14d
je 0xf802
callq 0x4a76
movl $0x3b, %esi
jmp 0xf802
movl $0x3c, %esi
jmp 0xf802
movl $0x3e, %esi
jmp 0xf802
movl $0x39, %esi
jmp 0xf802
movl $0x44, %esi
jmp 0xf802
movl $0x3f, %esi
jmp 0xf802
movl $0x45, %esi
jmp 0xf802
movl $0x48, %esi
jmp 0xf802
movl $0x40, %esi
jmp 0xf802
movl $0x43, %esi
jmp 0xf802
movl $0x47, %esi
jmp 0xf802
movl $0x3a, %esi
jmp 0xf802
movl $0x46, %esi
jmp 0xf802
movl $0x42, %esi
jmp 0xf802
movl $0x4a, %esi
jmp 0xf802
movl $0x41, %esi
movq %rbx, %rdi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movb $0x0, 0x38ce(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_compiler.c
// Function: exprGrouping
static void exprGrouping(Compiler* compiler) {
  skipNewLines(compiler);
  compileExpression(compiler);
  skipNewLines(compiler);
  consume(compiler, TK_RPARAN, "Expected ')' after expression.");

  compiler->is_last_call = false;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x11e66
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12323
movq %rbx, %rdi
callq 0x11e66
leaq 0xea7e(%rip), %rdx      # 0x1e2c6
movq %rbx, %rdi
movl $0xa, %esi
callq 0x11171
movb $0x0, 0x38ce(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_compiler.c
// Function: exprCall
static void exprCall(Compiler* compiler) {

  // Compile parameters.
  int argc = 0;
  if (!match(compiler, TK_RPARAN)) {
    do {
      skipNewLines(compiler);
      compileExpression(compiler);
      skipNewLines(compiler);
      argc++;
    } while (match(compiler, TK_COMMA));
    consume(compiler, TK_RPARAN, "Expected ')' after parameter list.");
  }

  emitOpcode(compiler, OP_CALL);
  emitByte(compiler, argc);

  compiler->is_last_call = true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0xa, 0x50(%rdi)
jne 0xf876
movq %rbx, %rdi
callq 0x10b76
xorl %ebp, %ebp
jmp 0xf8e4
movq %rbx, %rdi
callq 0x11e66
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12323
movq %rbx, %rdi
callq 0x11e66
cmpl $0x5, 0x50(%rbx)
jne 0xf8d0
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x10b76
movq %rbx, %rdi
callq 0x11e66
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12323
movq %rbx, %rdi
callq 0x11e66
incl %ebp
cmpl $0x5, 0x50(%rbx)
je 0xf8a3
leaq 0xe698(%rip), %rdx      # 0x1df6f
movq %rbx, %rdi
movl $0xa, %esi
callq 0x11171
movq %rbx, %rdi
movl $0x27, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1135b
movb $0x1, 0x38ce(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/atomlang[P]atomlang/src/pk_compiler.c
// Function: exprList
static void exprList(Compiler* compiler) {

  emitOpcode(compiler, OP_PUSH_LIST);
  int size_index = emitShort(compiler, 0);

  int size = 0;
  do {
    skipNewLines(compiler);
    if (peek(compiler) == TK_RBRACKET) break;

    compileExpression(compiler);
    emitOpcode(compiler, OP_LIST_APPEND);
    size++;

    skipNewLines(compiler);
  } while (match(compiler, TK_COMMA));

  skipNewLines(compiler);
  consume(compiler, TK_RBRACKET, "Expected ']' after list elements.");

  _FN->opcodes.data[size_index] = (size >> 8) & 0xff;
  _FN->opcodes.data[size_index + 1] = size & 0xff;

  compiler->is_last_call = false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x6, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1135b
movl %eax, %ebp
movq %rbx, %rdi
callq 0x11e66
xorl %r14d, %r14d
cmpl $0xc, 0x50(%rbx)
je 0xf9a9
movl $0x1, %eax
movl %eax, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x12323
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1135b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x113b1
movq %rbx, %rdi
callq 0x11e66
cmpl $0x5, 0x50(%rbx)
jne 0xf9a9
movq %rbx, %rdi
callq 0x10b76
movq %rbx, %rdi
callq 0x11e66
leal 0x1(%r14), %eax
cmpl $0xc, 0x50(%rbx)
jne 0xf95a
movslq %ebp, %rbp
movq %rbx, %rdi
callq 0x11e66
leaq 0xe92a(%rip), %rdx      # 0x1e2e5
movq %rbx, %rdi
movl $0xc, %esi
callq 0x11171
movq 0x18c0(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movq %r14, %rcx
movb %ch, -0x1(%rax,%rbp)
movq 0x18c0(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movb %cl, (%rax,%rbp)
movb $0x0, 0x38ce(%rbx)
popq %rbx
popq %r14
popq %rbp
retq