LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/xiane[P]libvphevcodec/vdi.cpp
// Function: vdi_wait_vpu_busy(unsigned int, unsigned int, unsigned int)
s32 vdi_wait_vpu_busy(u32 core_idx, u32 timeoutMs, u32 addr_bit_busy_flag) {
    ulong elapse, cur;
    struct timeval tv;
    s32 i;
    u32 normalReg = 1;
    tv.tv_sec = 0;
    tv.tv_usec = 0;
    gettimeofday(&tv, NULL);
    elapse = tv.tv_sec * 1000 + tv.tv_usec / 1000;

    if (addr_bit_busy_flag & 0x8000)
        normalReg = 0;

    i = 0;
    while (1) {
        if (normalReg == 1) {
            if (vdi_read_register(core_idx, addr_bit_busy_flag) == 0)
                break;
        } else {
            if (vdi_fio_read_register(core_idx, addr_bit_busy_flag) == 0)
                break;
        }
        i++;
        gettimeofday(&tv, NULL);
        cur = tv.tv_sec * 1000 + tv.tv_usec / 1000;
        if ((cur - elapse) > timeoutMs) {
            for (i = 0; i < 20; i++) {
                VLOG(ERR, "[VDI] vdi_wait_vpu_busy timeout, timeoutMs: %d, PC=0x%x",
						timeoutMs, vdi_read_register(core_idx, W4_VCPU_CUR_PC));
            }
            return -1;
        }
        usleep(5);
    }
    VLOG(DEBUG, "[VDI] vdi_wait_vpu_busy i = %d", i);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movl %esi, %ebx
movl %edi, %ebp
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, (%r12)
movq %r12, %rdi
xorl %esi, %esi
callq 0x22b0
movq (%r12), %r15
movabsq $-0x20c49ba5e353f7cf, %rax # imm = 0xDF3B645A1CAC0831
imulq 0x8(%r12)
movq %rdx, %r12
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %r12
addq %rax, %r12
movl %r14d, %eax
movq %rax, 0x10(%rsp)
movl %ebx, %r13d
testw %r14w, %r14w
js 0x812a
testl %ebp, %ebp
jne 0x813c
cmpl $0x0, 0x280dc(%rip)     # 0x301e4
js 0x813c
cmpb $0x0, 0x280d7(%rip)     # 0x301e8
je 0x813c
movq 0x280fe(%rip), %rax     # 0x30218
movq 0x10(%rsp), %rcx
cmpl $0x0, (%rax,%rcx)
jne 0x813c
jmp 0x81e0
movl %ebp, %edi
movl %r14d, %esi
callq 0x2030
testl %eax, %eax
je 0x81e0
movq %rsp, %rdi
xorl %esi, %esi
callq 0x22b0
movq (%rsp), %rcx
subq %r15, %rcx
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rsp)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %r12, %rdx
imulq $0x3e8, %rcx, %rax      # imm = 0x3E8
addq %rdx, %rax
cmpq %r13, %rax
ja 0x818b
movl $0x5, %edi
callq 0x2240
jmp 0x80f7
movl $0x14, %r12d
leaq 0x255c3(%rip), %r15     # 0x2d75b
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testl %ebp, %ebp
jne 0x81c3
cmpl $0x0, 0x28036(%rip)     # 0x301e4
js 0x81c3
cmpb $0x0, 0x28031(%rip)     # 0x301e8
je 0x81c3
movq 0x28058(%rip), %rax     # 0x30218
movl 0x4(%rax), %edx
movq %r15, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x2050
movl $0xa, %edi
callq 0x2220
decl %r12d
jne 0x819e
jmp 0x81e3
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiane[P]libvphevcodec/vdi.cpp
// Function: vdi_wait_interrupt(unsigned int, unsigned int)
s32 vdi_wait_interrupt(u32 coreIdx, u32 timeout) {
    s32 intr_reason = 0;
    s32 ret;
    vdi_info_t *vdi;
    vpudrv_intr_info_t intr_info;

    if (coreIdx >= MAX_NUM_VPU_CORE)
        return -1;

    vdi = &s_vdi_info[coreIdx];
    if (!vdi || vdi->vpu_fd < 0 || vdi->opened == 0)
        return -1;

    intr_info.timeout = timeout;
    intr_info.intr_reason = 0;
    ret = ioctl(vdi->vpu_fd, VDI_IOCTL_WAIT_INTERRUPT, (void*) &intr_info);
    if (ret != 0)
        return -1;

    intr_reason = intr_info.intr_reason;
    return intr_reason;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %edi, %edi
jne 0x823c
movl 0x27fdc(%rip), %edi     # 0x301e4
testl %edi, %edi
js 0x823c
cmpb $0x0, 0x27fd5(%rip)     # 0x301e8
je 0x823c
movq %rsp, %r14
movl %esi, (%r14)
movl $0x0, 0x4(%r14)
xorl %ebx, %ebx
movl $0x40085602, %esi       # imm = 0x40085602
movq %r14, %rdx
xorl %eax, %eax
callq 0x2230
negl %eax
sbbl %ebx, %ebx
orl 0x4(%r14), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiane[P]libvphevcodec/vdi.cpp
// Function: flush_memory(unsigned int, vpu_buffer_t*)
s32 flush_memory(u32 core_idx, vpu_buffer_t *vb) {
    vdi_info_t *vdi;
    s32 i, ret = -1;
    vpu_buffer_t vdb;

    if (core_idx >= MAX_NUM_VPU_CORE)
        return -1;

    vdi = &s_vdi_info[core_idx];
    if (!vdi || vdi->vpu_fd < 0 || vdi->opened == 0)
        return -1;

    memset(&vdb, 0x00, sizeof(vpu_buffer_t));

    for (i = 0; i < MAX_VPU_BUFFER_POOL; i++) {
        if (vdi->vpu_buffer_pool[i].vdb.phys_addr == vb->phys_addr) {
            vdb = vdi->vpu_buffer_pool[i].vdb;
            break;
        }
    }
    VLOG(DEBUG, "[VDI] flush_memory vdb.size = %d", vdb.size);
    if (vdb.size > 0)
        ret = ioctl(vdi->vpu_fd, VDI_IOCTL_FLUSH_BUFFER, (void*) &vdb);
    return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %edi, %edi
je 0x8250
retq
movl 0x27f8e(%rip), %edi     # 0x301e4
testl %edi, %edi
js 0x824f
cmpb $0x0, 0x27f87(%rip)     # 0x301e8
je 0x824f
movq 0x8(%rsi), %rsi
movl $0x88, %ecx
leaq 0x27f6d(%rip), %rdx     # 0x301e0
cmpq %rsi, (%rcx,%rdx)
je 0x8288
addq $0x28, %rcx
cmpq $0x2888, %rcx           # imm = 0x2888
jne 0x8273
jmp 0x824f
subq $0x28, %rsp
movups -0x8(%rcx,%rdx), %xmm0
movups 0x8(%rcx,%rdx), %xmm1
movaps %xmm0, (%rsp)
movaps %xmm1, 0x10(%rsp)
cmpl $0x0, (%rsp)
je 0x82b4
movq %rsp, %rdx
movl $0x4020560d, %esi       # imm = 0x4020560D
xorl %eax, %eax
callq 0x2230
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lua.c
// Function: main
int main (int argc, char **argv) {
  int status, result;
  lua_State *L = luaL_newstate();  /* create state */
  if (L == NULL) {
    l_message(argv[0], "cannot create state: not enough memory");
    return EXIT_FAILURE;
  }
  /* call 'pmain' in protected mode */
  lua_pushcfunction(L, &pmain);
  lua_pushinteger(L, argc);  /* 1st argument */
  lua_pushlightuserdata(L, argv); /* 2nd argument */
  status = lua_pcall(L, 2, 1, 0);
  result = lua_toboolean(L, -1);  /* get result */
  finalreport(L, status);
  lua_close(L);
  return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
callq 0xa4f7
testq %rax, %rax
je 0x6a76
movq %rax, %rbx
leaq 0xd4(%rip), %rsi        # 0x6add
movq %rax, %rdi
xorl %edx, %edx
callq 0x8061
movslq %ebp, %rsi
movq %rbx, %rdi
callq 0x7e95
movq %rbx, %rdi
movq %r14, %rsi
callq 0x80ff
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8776
movl %eax, %ebp
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7cc4
movl %eax, %r14d
testl %ebp, %ebp
jne 0x6a8c
movq %rbx, %rdi
callq 0x14988
testl %r14d, %r14d
sete %al
testl %ebp, %ebp
setne %cl
orb %al, %cl
movzbl %cl, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq (%r14), %rdi
leaq 0x19590(%rip), %rsi     # 0x20010
callq 0x6610
movl $0x1, %eax
jmp 0x6a71
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7992
cmpl $0x4, %eax
jne 0x6aaf
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x7cea
jmp 0x6ab1
xorl %eax, %eax
testq %rax, %rax
leaq 0x1978f(%rip), %rsi     # 0x2024a
cmovneq %rax, %rsi
movq 0x2684a(%rip), %rdi     # 0x2d310
callq 0x6610
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x7688
jmp 0x6a59
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lua.c
// Function: docall
static int docall (lua_State *L, int narg, int nres) {
  int status;
  int base = lua_gettop(L) - narg;  /* function index */
  lua_pushcfunction(L, traceback);  /* push traceback function */
  lua_insert(L, base);  /* put it under chunk and args */
  globalL = L;  /* to be available to 'laction' */
  signal(SIGINT, laction);
  status = lua_pcall(L, narg, nres, base);
  signal(SIGINT, SIG_DFL);
  lua_remove(L, base);  /* remove traceback function */
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
callq 0x7674
movl %eax, %ebp
subl %r15d, %ebp
leaq 0x98(%rip), %rsi        # 0x739c
movq %rbx, %rdi
xorl %edx, %edx
callq 0x8061
movq %rbx, %rdi
movl %ebp, %esi
callq 0x789f
movq %rbx, 0x26001(%rip)     # 0x2d320
leaq 0xe1(%rip), %rsi        # 0x7407
movl $0x2, %edi
callq 0x62f0
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8776
movl %eax, %r14d
movl $0x2, %edi
xorl %esi, %esi
callq 0x62f0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x77ed
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lua.c
// Function: report
static int report (lua_State *L, int status) {
  if (status != LUA_OK && !lua_isnil(L, -1)) {
    const char *msg = lua_tostring(L, -1);
    if (msg == NULL) msg = "(error object is not a string)";
    l_message(progname, msg);
    lua_pop(L, 1);
    /* force a complete garbage collection in case of errors */
    lua_gc(L, LUA_GCCOLLECT, 0);
  }
  return status;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
testl %esi, %esi
je 0x7388
movq %rdi, %r14
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7992
testl %eax, %eax
jne 0x7392
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x6732
jmp 0x7388
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lua.c
// Function: traceback
static int traceback (lua_State *L) {
  const char *msg = lua_tostring(L, 1);
  if (msg)
    luaL_traceback(L, L, msg, 1);
  else if (!lua_isnoneornil(L, 1)) {  /* is there an error object? */
    if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
      lua_pushliteral(L, "(no error message)");
  }
  return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x7cea
movq %rbx, %rdi
testq %rax, %rax
je 0x73cb
movq %rbx, %rsi
movq %rax, %rdx
movl $0x1, %ecx
callq 0x8dd4
movl $0x1, %eax
popq %rbx
retq
movl $0x1, %esi
callq 0x7992
testl %eax, %eax
jle 0x73c4
leaq 0x18e3f(%rip), %rdx     # 0x2021f
movq %rbx, %rdi
movl $0x1, %esi
callq 0x9fde
testl %eax, %eax
jne 0x73c4
leaq 0x18e32(%rip), %rsi     # 0x2022a
movl $0x12, %edx
movq %rbx, %rdi
callq 0x7ecb
jmp 0x73c4
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lua.c
// Function: pushline
static int pushline (lua_State *L, int firstline) {
  char buffer[LUA_MAXINPUT];
  char *b = buffer;
  size_t l;
  const char *prmt = get_prompt(L, firstline);
  int readstatus = lua_readline(L, b, prmt);
  lua_pop(L, 1);  /* remove result from 'get_prompt' */
  if (readstatus == 0)
    return 0;  /* no input */
  l = strlen(b);
  if (l > 0 && b[l-1] == '\n')  /* line ends with newline? */
    b[l-1] = '\0';  /* remove it */
  if (firstline && b[0] == '=')  /* first line starts with `=' ? */
    lua_pushfstring(L, "return %s", b+1);  /* change it to `return' */
  else
    lua_pushstring(L, b);
  lua_freeline(L, b);
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
leaq 0x18e81(%rip), %rax     # 0x202ec
leaq 0x18e72(%rip), %rsi     # 0x202e4
cmoveq %rax, %rsi
leaq 0x18e78(%rip), %rax     # 0x202f5
leaq 0x18e72(%rip), %r15     # 0x202f6
cmoveq %rax, %r15
callq 0x8137
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x7cea
testq %rax, %rax
cmovneq %rax, %r15
movq 0x25b1b(%rip), %r12     # 0x2cfc8
movq (%r12), %rsi
movq %r15, %rdi
callq 0x61e0
movq (%r12), %rdi
callq 0x63c0
movq 0x25b07(%rip), %rax     # 0x2cfd0
movq (%rax), %rdx
movq %rsp, %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x62b0
movq %rax, %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x7688
testq %r15, %r15
je 0x753a
movq %rsp, %rdi
callq 0x6170
testq %rax, %rax
je 0x7507
cmpb $0xa, -0x1(%rsp,%rax)
jne 0x7507
movb $0x0, -0x1(%rsp,%rax)
testl %ebp, %ebp
je 0x7529
cmpb $0x3d, (%rsp)
jne 0x7529
leaq 0x1(%rsp), %rdx
leaq 0x18dbd(%rip), %rsi     # 0x202da
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7fb4
jmp 0x7534
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x7f1a
movl $0x1, %r14d
movl %r14d, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_checkstack
LUA_API int lua_checkstack (lua_State *L, int size) {
  int res;
  CallInfo *ci = L->ci;
  lua_lock(L);
  if (L->stack_last - L->top > size)  /* stack large enough? */
    res = 1;  /* yes; check is OK */
  else {  /* no; need to grow stack */
    int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
    if (inuse > LUAI_MAXSTACK - size)  /* can grow without overflow? */
      res = 0;  /* no */
    else  /* try to grow stack */
      res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
  }
  if (res && ci->top < L->top + size)
    ci->top = L->top + size;  /* adjust frame top */
  lua_unlock(L);
  return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, 0xc(%rsp)
movq 0x10(%rdi), %rax
movq 0x20(%rdi), %r14
movq 0x30(%rdi), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movslq %esi, %rcx
cmpq %rcx, %rdx
jle 0x758f
shlq $0x4, %rcx
addq %rax, %rcx
movl $0x1, %ebp
cmpq %rcx, 0x8(%r14)
jae 0x75c2
movq %rcx, 0x8(%r14)
jmp 0x75c2
movq %rdi, %rbx
subq 0x38(%rdi), %rax
shrq $0x4, %rax
addl $0x5, %eax
movl $0xf4240, %ecx          # imm = 0xF4240
subl %esi, %ecx
xorl %ebp, %ebp
cmpl %ecx, %eax
jg 0x75c2
leaq 0x27(%rip), %rsi        # 0x75d8
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0xb337
testl %eax, %eax
je 0x75cd
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x10(%rbx), %rax
movslq 0xc(%rsp), %rcx
jmp 0x7577
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_xmove
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  int i;
  if (from == to) return;
  lua_lock(to);
  api_checknelems(from, n);
  api_check(from, G(from) == G(to), "moving among independent states");
  api_check(from, to->ci->top - to->top >= n, "not enough elements to move");
  from->top -= n;
  for (i = 0; i < n; i++) {
    setobj2s(to, to->top++, from->top + i);
  }
  lua_unlock(to);
}

// Assembly:
cmpq %rsi, %rdi
je 0x7626
movslq %edx, %rax
movq %rax, %rcx
shlq $0x4, %rcx
subq %rcx, 0x10(%rdi)
testl %eax, %eax
jle 0x7626
movl %edx, %eax
shlq $0x4, %rax
xorl %ecx, %ecx
movq 0x10(%rdi), %rdx
movq 0x10(%rsi), %r8
leaq 0x10(%r8), %r9
movq %r9, 0x10(%rsi)
movq (%rdx,%rcx), %r9
movq %r9, (%r8)
movl 0x8(%rdx,%rcx), %edx
movl %edx, 0x8(%r8)
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x75fe
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_remove
LUA_API void lua_remove (lua_State *L, int idx) {
  StkId p;
  lua_lock(L);
  p = index2addr(L, idx);
  api_checkstackindex(L, idx, p);
  while (++p < L->top) setobjs2s(L, p-1, p);
  L->top--;
  lua_unlock(L);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x781c
addq $0x10, %rax
movq 0x10(%rbx), %rcx
cmpq %rcx, %rax
jae 0x7812
movq (%rax), %rcx
movq %rcx, -0x10(%rax)
movl 0x8(%rax), %ecx
movl %ecx, -0x8(%rax)
jmp 0x77f6
addq $-0x10, %rcx
movq %rcx, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_insert
LUA_API void lua_insert (lua_State *L, int idx) {
  StkId p;
  StkId q;
  lua_lock(L);
  p = index2addr(L, idx);
  api_checkstackindex(L, idx, p);
  for (q = L->top; q > p; q--)  /* use L->top as a temporary */
    setobjs2s(L, q, q - 1);
  setobjs2s(L, p, L->top);
  lua_unlock(L);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movq 0x10(%rbx), %rcx
cmpq %rax, %rcx
jbe 0x78ce
movq -0x10(%rcx), %rdx
movq %rdx, (%rcx)
movl -0x8(%rcx), %edx
movl %edx, 0x8(%rcx)
leaq -0x10(%rcx), %rdx
movq %rdx, %rcx
cmpq %rax, %rdx
ja 0x78b1
movq 0x10(%rbx), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: moveto
static void moveto (lua_State *L, TValue *fr, int idx) {
  TValue *to = index2addr(L, idx);
  api_checkvalidindex(L, to);
  setobj(L, to, fr);
  if (idx < LUA_REGISTRYINDEX)  /* function upvalue? */
    luaC_barrier(L, clCvalue(L->ci->func), fr);
  /* LUA_REGISTRYINDEX does not need gc barrier
     (collector revisits it before finishing collection) */
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, %esi
callq 0x781c
movq (%r14), %rcx
movq %rcx, (%rax)
movl 0x8(%r14), %ecx
movl %ecx, 0x8(%rax)
cmpl $0xfff0b9d8, %ebp       # imm = 0xFFF0B9D8
setge %al
testb $0x40, %cl
sete %cl
orb %al, %cl
jne 0x7942
movq (%r14), %rdx
testb $0x3, 0x9(%rdx)
je 0x7942
movq 0x20(%rbx), %rax
movq (%rax), %rax
movq (%rax), %rsi
testb $0x4, 0x9(%rsi)
jne 0x7947
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xc950
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_arith
LUA_API void lua_arith (lua_State *L, int op) {
  StkId o1;  /* 1st operand */
  StkId o2;  /* 2nd operand */
  lua_lock(L);
  if (op != LUA_OPUNM) /* all other operations expect two operands */
    api_checknelems(L, 2);
  else {  /* for unary minus, add fake 2nd operand */
    api_checknelems(L, 1);
    setobjs2s(L, L->top, L->top - 1);
    L->top++;
  }
  o1 = L->top - 2;
  o2 = L->top - 1;
  if (ttisnumber(o1) && ttisnumber(o2)) {
    setnvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));
  }
  else
    luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));
  L->top--;
  lua_unlock(L);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r8d
movq %rdi, %rbx
movq 0x10(%rdi), %r14
cmpl $0x6, %esi
jne 0x7ae0
movq -0x10(%r14), %rax
movq %rax, (%r14)
movl -0x8(%r14), %eax
movl %eax, 0x8(%r14)
movq 0x10(%rbx), %r14
addq $0x10, %r14
movq %r14, 0x10(%rbx)
cmpl $0x3, -0x18(%r14)
jne 0x7b12
cmpl $0x3, -0x8(%r14)
jne 0x7b12
movsd -0x20(%r14), %xmm0
movsd -0x10(%r14), %xmm1
movl %r8d, %edi
callq 0x10911
movsd %xmm0, -0x20(%r14)
movl $0x3, -0x18(%r14)
jmp 0x7b2c
leaq -0x20(%r14), %rdx
addq $-0x10, %r14
addl $0x6, %r8d
movq %rbx, %rdi
movq %rdx, %rsi
movq %r14, %rcx
callq 0x1951d
addq $-0x10, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_tonumberx
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) {
  TValue n;
  const TValue *o = index2addr(L, idx);
  if (tonumber(o, &n)) {
    if (isnum) *isnum = 1;
    return nvalue(o);
  }
  else {
    if (isnum) *isnum = 0;
    return 0;
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
callq 0x781c
cmpl $0x3, 0x8(%rax)
je 0x7c06
movq %rsp, %rsi
movq %rax, %rdi
callq 0x18aac
testq %rax, %rax
je 0x7c1b
testq %rbx, %rbx
je 0x7c11
movl $0x1, (%rbx)
movsd (%rax), %xmm0
addq $0x10, %rsp
popq %rbx
retq
xorps %xmm0, %xmm0
testq %rbx, %rbx
je 0x7c15
movl $0x0, (%rbx)
jmp 0x7c15
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_tointegerx
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum) {
  TValue n;
  const TValue *o = index2addr(L, idx);
  if (tonumber(o, &n)) {
    lua_Integer res;
    lua_Number num = nvalue(o);
    lua_number2integer(res, num);
    if (isnum) *isnum = 1;
    return res;
  }
  else {
    if (isnum) *isnum = 0;
    return 0;
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
callq 0x781c
cmpl $0x3, 0x8(%rax)
je 0x7c4e
movq %rsp, %rsi
movq %rax, %rdi
callq 0x18aac
testq %rax, %rax
je 0x7c65
cvttsd2si (%rax), %rax
movl $0x1, %ecx
testq %rbx, %rbx
je 0x7c5f
movl %ecx, (%rbx)
addq $0x10, %rsp
popq %rbx
retq
xorl %ecx, %ecx
movl $0x0, %eax
jmp 0x7c58
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_tounsignedx
LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) {
  TValue n;
  const TValue *o = index2addr(L, idx);
  if (tonumber(o, &n)) {
    lua_Unsigned res;
    lua_Number num = nvalue(o);
    lua_number2unsigned(res, num);
    if (isnum) *isnum = 1;
    return res;
  }
  else {
    if (isnum) *isnum = 0;
    return 0;
  }
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
callq 0x781c
cmpl $0x3, 0x8(%rax)
je 0x7c93
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x18aac
testq %rax, %rax
je 0x7cbb
movsd (%rax), %xmm0
addsd 0x18691(%rip), %xmm0    # 0x20330
movsd %xmm0, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl $0x1, %ecx
testq %rbx, %rbx
je 0x7cb5
movl %ecx, (%rbx)
addq $0x20, %rsp
popq %rbx
retq
xorl %ecx, %ecx
movl $0x0, %eax
jmp 0x7cae
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_tolstring
LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
  StkId o = index2addr(L, idx);
  if (!ttisstring(o)) {
    lua_lock(L);  /* `luaV_tostring' may create a new string */
    if (!luaV_tostring(L, o)) {  /* conversion failed? */
      if (len != NULL) *len = 0;
      lua_unlock(L);
      return NULL;
    }
    luaC_checkGC(L);
    o = index2addr(L, idx);  /* previous call may reallocate the stack */
    lua_unlock(L);
  }
  if (len != NULL) *len = tsvalue(o)->len;
  return svalue(o);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
callq 0x781c
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x4, %ecx
je 0x7d32
movq %r14, %rdi
movq %rax, %rsi
callq 0x18b00
testl %eax, %eax
je 0x7d4d
movq 0x18(%r14), %rax
cmpq $0x0, 0x18(%rax)
jle 0x7d28
movq %r14, %rdi
callq 0xd766
movq %r14, %rdi
movl %ebp, %esi
callq 0x781c
testq %rbx, %rbx
je 0x7d41
movq (%rax), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, (%rbx)
movq (%rax), %rax
addq $0x18, %rax
popq %rbx
popq %r14
popq %rbp
retq
testq %rbx, %rbx
je 0x7d59
movq $0x0, (%rbx)
xorl %eax, %eax
jmp 0x7d48
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawlen
LUA_API size_t lua_rawlen (lua_State *L, int idx) {
  StkId o = index2addr(L, idx);
  switch (ttypenv(o)) {
    case LUA_TSTRING: return tsvalue(o)->len;
    case LUA_TUSERDATA: return uvalue(o)->len;
    case LUA_TTABLE: return luaH_getn(hvalue(o));
    default: return 0;
  }
}

// Assembly:
pushq %rax
callq 0x781c
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x7, %ecx
je 0x7d8d
cmpl $0x5, %ecx
je 0x7d81
cmpl $0x4, %ecx
jne 0x7d96
movq (%rax), %rax
movq 0x10(%rax), %rax
jmp 0x7d98
movq (%rax), %rdi
callq 0x176c7
cltq
jmp 0x7d98
movq (%rax), %rax
movq 0x20(%rax), %rax
jmp 0x7d98
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_touserdata
LUA_API void *lua_touserdata (lua_State *L, int idx) {
  StkId o = index2addr(L, idx);
  switch (ttypenv(o)) {
    case LUA_TUSERDATA: return (rawuvalue(o) + 1);
    case LUA_TLIGHTUSERDATA: return pvalue(o);
    default: return NULL;
  }
}

// Assembly:
pushq %rax
callq 0x781c
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x2, %ecx
je 0x7ddc
cmpl $0x7, %ecx
jne 0x7de1
movq (%rax), %rax
addq $0x28, %rax
jmp 0x7de3
movq (%rax), %rax
jmp 0x7de3
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_topointer
LUA_API const void *lua_topointer (lua_State *L, int idx) {
  StkId o = index2addr(L, idx);
  switch (ttype(o)) {
    case LUA_TTABLE: return hvalue(o);
    case LUA_TLCL: return clLvalue(o);
    case LUA_TCCL: return clCvalue(o);
    case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));
    case LUA_TTHREAD: return thvalue(o);
    case LUA_TUSERDATA:
    case LUA_TLIGHTUSERDATA:
      return lua_touserdata(L, idx);
    default: return NULL;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x781c
movq %rax, %rcx
movl 0x8(%rax), %edx
andl $0x3f, %edx
xorl %eax, %eax
leal -0x2(%rdx), %esi
cmpl $0x6, %esi
ja 0x7e4e
leaq 0x1851e(%rip), %rdx     # 0x20340
movslq (%rdx,%rsi,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movq %r14, %rdi
movl %ebx, %esi
callq 0x781c
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x2, %ecx
je 0x7e63
cmpl $0x7, %ecx
jne 0x7e68
movq (%rax), %rax
addq $0x28, %rax
jmp 0x7e5b
cmpl $0x16, %edx
je 0x7e58
cmpl $0x26, %edx
jne 0x7e5b
movq (%rcx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%rax), %rax
jmp 0x7e5b
xorl %eax, %eax
jmp 0x7e5b
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_pushlstring
LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {
  TString *ts;
  lua_lock(L);
  luaC_checkGC(L);
  ts = luaS_newlstr(L, s, len);
  setsvalue2s(L, L->top, ts);
  api_incr_top(L);
  lua_unlock(L);
  return getstr(ts);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpq $0x0, 0x18(%rax)
jle 0x7eec
movq %rbx, %rdi
callq 0xd766
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x14b50
movq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movzbl 0x8(%rax), %edx
orl $0x40, %edx
movl %edx, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
addq $0x18, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_pushstring
LUA_API const char *lua_pushstring (lua_State *L, const char *s) {
  if (s == NULL) {
    lua_pushnil(L);
    return NULL;
  }
  else {
    TString *ts;
    lua_lock(L);
    luaC_checkGC(L);
    ts = luaS_new(L, s);
    setsvalue2s(L, L->top, ts);
    api_incr_top(L);
    lua_unlock(L);
    return getstr(ts);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x7f63
movq %rsi, %r14
movq 0x18(%rbx), %rax
cmpq $0x0, 0x18(%rax)
jle 0x7f3c
movq %rbx, %rdi
callq 0xd766
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14d1a
movq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movzbl 0x8(%rax), %edx
orl $0x40, %edx
movl %edx, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
addq $0x18, %rax
jmp 0x7f78
movq 0x10(%rbx), %rax
movl $0x0, 0x8(%rax)
addq $0x10, %rax
movq %rax, 0x10(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_pushcclosure
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
  lua_lock(L);
  if (n == 0) {
    setfvalue(L->top, fn);
  }
  else {
    Closure *cl;
    api_checknelems(L, n);
    api_check(L, n <= MAXUPVAL, "upvalue index too large");
    luaC_checkGC(L);
    cl = luaF_newCclosure(L, n);
    cl->c.f = fn;
    L->top -= n;
    while (n--)
      setobj2n(L, &cl->c.upvalue[n], L->top + n);
    setclCvalue(L, L->top, cl);
  }
  api_incr_top(L);
  lua_unlock(L);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x80cc
movl %edx, %ebp
movq 0x18(%rbx), %rax
cmpq $0x0, 0x18(%rax)
jle 0x8084
movq %rbx, %rdi
callq 0xd766
movq %rbx, %rdi
movl %ebp, %esi
callq 0xc658
movq %r14, 0x18(%rax)
movslq %ebp, %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
subq %rdx, 0x10(%rbx)
addq $0x10, %rdx
movq 0x10(%rbx), %rsi
movq -0x20(%rdx,%rsi), %rdi
movq %rdi, (%rax,%rdx)
movl -0x18(%rdx,%rsi), %esi
movl %esi, 0x8(%rax,%rdx)
addq $-0x10, %rdx
decq %rcx
jne 0x80a4
movl $0x66, %ecx
movq %rax, %r14
jmp 0x80d1
movl $0x16, %ecx
movq 0x10(%rbx), %rax
movq %r14, (%rax)
movl %ecx, 0x8(%rax)
addq $0x10, 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_getglobal
LUA_API void lua_getglobal (lua_State *L, const char *var) {
  Table *reg = hvalue(&G(L)->l_registry);
  const TValue *gt;  /* global table */
  lua_lock(L);
  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
  setsvalue2s(L, L->top++, luaS_new(L, var));
  luaV_gettable(L, gt, L->top - 1, L->top - 1);
  lua_unlock(L);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq 0x40(%rax), %rdi
movl $0x2, %esi
callq 0x17528
movq %rax, %r15
movq 0x10(%r14), %r12
leaq 0x10(%r12), %rax
movq %rax, 0x10(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14d1a
movq %rax, (%r12)
movzbl 0x8(%rax), %eax
orl $0x40, %eax
movl %eax, 0x8(%r12)
movq 0x10(%r14), %rcx
addq $-0x10, %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rcx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x18b59
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawgeti
LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
  StkId t;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setobj2s(L, L->top, luaH_getint(hvalue(t), n));
  api_incr_top(L);
  lua_unlock(L);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
callq 0x781c
movq (%rax), %rdi
movl %ebx, %esi
callq 0x17528
movq 0x10(%r14), %rcx
movq (%rax), %rdx
movq %rdx, (%rcx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
addq $0x10, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawgetp
LUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) {
  StkId t;
  TValue k;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setpvalue(&k, cast(void *, p));
  setobj2s(L, L->top, luaH_get(hvalue(t), &k));
  api_incr_top(L);
  lua_unlock(L);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r14
callq 0x781c
leaq 0x8(%rsp), %rsi
movq %rbx, (%rsi)
movl $0x2, 0x8(%rsi)
movq (%rax), %rdi
callq 0x175ea
movq 0x10(%r14), %rcx
movq (%rax), %rdx
movq %rdx, (%rcx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
addq $0x10, 0x10(%r14)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_getmetatable
LUA_API int lua_getmetatable (lua_State *L, int objindex) {
  const TValue *obj;
  Table *mt = NULL;
  int res;
  lua_lock(L);
  obj = index2addr(L, objindex);
  switch (ttypenv(obj)) {
    case LUA_TTABLE:
      mt = hvalue(obj)->metatable;
      break;
    case LUA_TUSERDATA:
      mt = uvalue(obj)->metatable;
      break;
    default:
      mt = G(L)->mt[ttypenv(obj)];
      break;
  }
  if (mt == NULL)
    res = 0;
  else {
    sethvalue(L, L->top, mt);
    api_incr_top(L);
    res = 1;
  }
  lua_unlock(L);
  return res;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpq $0x7, %rcx
je 0x833d
cmpl $0x5, %ecx
jne 0x8346
movq (%rax), %rax
addq $0x10, %rax
jmp 0x8354
movq 0x18(%rbx), %rax
leaq (%rax,%rcx,8), %rax
addq $0x1a8, %rax            # imm = 0x1A8
movq (%rax), %rax
testq %rax, %rax
je 0x8376
movq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movl $0x45, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
movl $0x1, %eax
jmp 0x8378
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_getuservalue
LUA_API void lua_getuservalue (lua_State *L, int idx) {
  StkId o;
  lua_lock(L);
  o = index2addr(L, idx);
  api_check(L, ttisuserdata(o), "userdata expected");
  if (uvalue(o)->env) {
    sethvalue(L, L->top, uvalue(o)->env);
  } else
    setnilvalue(L->top);
  api_incr_top(L);
  lua_unlock(L);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movq (%rax), %rax
movq 0x18(%rax), %rcx
movq 0x10(%rbx), %rax
testq %rcx, %rcx
je 0x83a3
movq %rcx, (%rax)
movl $0x45, 0x8(%rax)
movq 0x10(%rbx), %rax
jmp 0x83aa
movl $0x0, 0x8(%rax)
addq $0x10, %rax
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_setglobal
LUA_API void lua_setglobal (lua_State *L, const char *var) {
  Table *reg = hvalue(&G(L)->l_registry);
  const TValue *gt;  /* global table */
  lua_lock(L);
  api_checknelems(L, 1);
  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
  setsvalue2s(L, L->top++, luaS_new(L, var));
  luaV_settable(L, gt, L->top - 1, L->top - 2);
  L->top -= 2;  /* pop value and key */
  lua_unlock(L);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x40(%rax), %rdi
movl $0x2, %esi
callq 0x17528
movq %rax, %r15
movq 0x10(%rbx), %r12
leaq 0x10(%r12), %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14d1a
movq %rax, (%r12)
movzbl 0x8(%rax), %eax
orl $0x40, %eax
movl %eax, 0x8(%r12)
movq 0x10(%rbx), %rcx
leaq -0x10(%rcx), %rdx
addq $-0x20, %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18d16
addq $-0x20, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_setfield
LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
  StkId t;
  lua_lock(L);
  api_checknelems(L, 1);
  t = index2addr(L, idx);
  setsvalue2s(L, L->top++, luaS_new(L, k));
  luaV_settable(L, t, L->top - 1, L->top - 2);
  L->top -= 2;  /* pop value and key */
  lua_unlock(L);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
callq 0x781c
movq %rax, %r15
movq 0x10(%rbx), %r12
leaq 0x10(%r12), %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14d1a
movq %rax, (%r12)
movzbl 0x8(%rax), %eax
orl $0x40, %eax
movl %eax, 0x8(%r12)
movq 0x10(%rbx), %rcx
leaq -0x10(%rcx), %rdx
addq $-0x20, %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18d16
addq $-0x20, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawset
LUA_API void lua_rawset (lua_State *L, int idx) {
  StkId t;
  lua_lock(L);
  api_checknelems(L, 2);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
  invalidateTMcache(hvalue(t));
  luaC_barrierback(L, gcvalue(t), L->top-1);
  L->top -= 2;
  lua_unlock(L);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movq %rax, %r14
movq 0x10(%rbx), %r15
movq (%rax), %rsi
leaq -0x20(%r15), %rdx
movq %rbx, %rdi
callq 0x1703b
movq -0x10(%r15), %rcx
movq %rcx, (%rax)
movl -0x8(%r15), %ecx
movl %ecx, 0x8(%rax)
movq (%r14), %rax
movb $0x0, 0xa(%rax)
movq 0x10(%rbx), %rax
testb $0x40, -0x8(%rax)
je 0x8515
movq -0x10(%rax), %rcx
testb $0x3, 0x9(%rcx)
je 0x8515
movq (%r14), %rsi
testb $0x4, 0x9(%rsi)
je 0x8515
movq %rbx, %rdi
callq 0xca79
movq 0x10(%rbx), %rax
addq $-0x20, %rax
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawseti
LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
  StkId t;
  lua_lock(L);
  api_checknelems(L, 1);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  luaH_setint(L, hvalue(t), n, L->top - 1);
  luaC_barrierback(L, gcvalue(t), L->top-1);
  L->top--;
  lua_unlock(L);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rdi, %rbx
callq 0x781c
movq %rax, %r14
movq (%rax), %rsi
movq 0x10(%rbx), %rcx
addq $-0x10, %rcx
movq %rbx, %rdi
movl %ebp, %edx
callq 0x16fda
movq 0x10(%rbx), %rax
testb $0x40, -0x8(%rax)
je 0x8572
movq -0x10(%rax), %rcx
testb $0x3, 0x9(%rcx)
je 0x8572
movq (%r14), %rsi
testb $0x4, 0x9(%rsi)
je 0x8572
movq %rbx, %rdi
callq 0xca79
movq 0x10(%rbx), %rax
addq $-0x10, %rax
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_rawsetp
LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
  StkId t;
  TValue k;
  lua_lock(L);
  api_checknelems(L, 1);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setpvalue(&k, cast(void *, p));
  setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
  luaC_barrierback(L, gcvalue(t), L->top - 1);
  L->top--;
  lua_unlock(L);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rdi, %rbx
callq 0x781c
movq %rax, %r14
movq %rsp, %rdx
movq %r15, (%rdx)
movl $0x2, 0x8(%rdx)
movq 0x10(%rbx), %r15
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x1703b
movq -0x10(%r15), %rcx
movq %rcx, (%rax)
movl -0x8(%r15), %ecx
movl %ecx, 0x8(%rax)
movq 0x10(%rbx), %rax
testb $0x40, -0x8(%rax)
je 0x85e9
movq -0x10(%rax), %rcx
testb $0x3, 0x9(%rcx)
je 0x85e9
movq (%r14), %rsi
testb $0x4, 0x9(%rsi)
je 0x85e9
movq %rbx, %rdi
callq 0xca79
movq 0x10(%rbx), %rax
addq $-0x10, %rax
movq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_setmetatable
LUA_API int lua_setmetatable (lua_State *L, int objindex) {
  TValue *obj;
  Table *mt;
  lua_lock(L);
  api_checknelems(L, 1);
  obj = index2addr(L, objindex);
  if (ttisnil(L->top - 1))
    mt = NULL;
  else {
    api_check(L, ttistable(L->top - 1), "table expected");
    mt = hvalue(L->top - 1);
  }
  switch (ttypenv(obj)) {
    case LUA_TTABLE: {
      hvalue(obj)->metatable = mt;
      if (mt) {
        luaC_objbarrierback(L, gcvalue(obj), mt);
        luaC_checkfinalizer(L, gcvalue(obj), mt);
      }
      break;
    }
    case LUA_TUSERDATA: {
      uvalue(obj)->metatable = mt;
      if (mt) {
        luaC_objbarrier(L, rawuvalue(obj), mt);
        luaC_checkfinalizer(L, gcvalue(obj), mt);
      }
      break;
    }
    default: {
      G(L)->mt[ttypenv(obj)] = mt;
      break;
    }
  }
  L->top--;
  lua_unlock(L);
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movq %rax, %r15
movq 0x10(%rbx), %rax
cmpl $0x0, -0x8(%rax)
je 0x861b
movq -0x10(%rax), %r14
jmp 0x861e
xorl %r14d, %r14d
movl 0x8(%r15), %eax
andl $0xf, %eax
cmpq $0x7, %rax
je 0x8656
cmpl $0x5, %eax
jne 0x868d
movq (%r15), %rax
movq %r14, 0x10(%rax)
testq %r14, %r14
je 0x8699
testb $0x3, 0x9(%r14)
movq (%r15), %rsi
je 0x8680
testb $0x4, 0x9(%rsi)
je 0x8680
movq %rbx, %rdi
callq 0xca79
jmp 0x867d
movq (%r15), %rax
movq %r14, 0x10(%rax)
testq %r14, %r14
je 0x8699
testb $0x3, 0x9(%r14)
movq (%r15), %rsi
je 0x8680
testb $0x4, 0x9(%rsi)
je 0x8680
movq %rbx, %rdi
movq %r14, %rdx
callq 0xc950
movq (%r15), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xcb82
jmp 0x8699
movq 0x18(%rbx), %rcx
movq %r14, 0x1a8(%rcx,%rax,8)
addq $-0x10, 0x10(%rbx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_setuservalue
LUA_API void lua_setuservalue (lua_State *L, int idx) {
  StkId o;
  lua_lock(L);
  api_checknelems(L, 1);
  o = index2addr(L, idx);
  api_check(L, ttisuserdata(o), "userdata expected");
  if (ttisnil(L->top - 1))
    uvalue(o)->env = NULL;
  else {
    api_check(L, ttistable(L->top - 1), "table expected");
    uvalue(o)->env = hvalue(L->top - 1);
    luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
  }
  L->top--;
  lua_unlock(L);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x781c
movq 0x10(%rbx), %rcx
cmpl $0x0, -0x8(%rcx)
je 0x86e8
movq -0x10(%rcx), %rcx
movq (%rax), %rdx
movq %rcx, 0x18(%rdx)
movq 0x10(%rbx), %rcx
movq -0x10(%rcx), %rdx
testb $0x3, 0x9(%rdx)
je 0x86f3
movq (%rax), %rsi
testb $0x4, 0x9(%rsi)
je 0x86f3
movq %rbx, %rdi
callq 0xc950
jmp 0x86f3
movq (%rax), %rax
movq $0x0, 0x18(%rax)
addq $-0x10, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_callk
LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
                        lua_CFunction k) {
  StkId func;
  lua_lock(L);
  api_check(L, k == NULL || !isLua(L->ci),
    "cannot use continuations inside hooks");
  api_checknelems(L, nargs+1);
  api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
  checkresults(L, nargs, nresults);
  func = L->top - (nargs+1);
  if (k != NULL && L->nny == 0) {  /* need to prepare continuation? */
    L->ci->u.c.k = k;  /* save continuation */
    L->ci->u.c.ctx = ctx;  /* save context */
    luaD_call(L, func, nresults, 1);  /* do the call */
  }
  else  /* no continuation or no yieldable */
    luaD_call(L, func, nresults, 0);  /* just do the call */
  adjustresults(L, nresults);
  lua_unlock(L);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
notl %esi
movslq %esi, %rsi
shlq $0x4, %rsi
addq 0x10(%rdi), %rsi
xorl %eax, %eax
testq %r8, %r8
je 0x874c
cmpw $0x0, 0x44(%rbx)
jne 0x874c
movq 0x20(%rbx), %rax
movq %r8, 0x38(%rax)
movq 0x20(%rbx), %rax
movl %ecx, 0x30(%rax)
movl $0x1, %eax
movq %rbx, %rdi
movl %ebp, %edx
movl %eax, %ecx
callq 0xbafd
cmpl $-0x1, %ebp
jne 0x876f
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rcx
cmpq %rax, 0x8(%rcx)
jae 0x876f
movq %rax, 0x8(%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_pcallk
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
                        int ctx, lua_CFunction k) {
  struct CallS c;
  int status;
  ptrdiff_t func;
  lua_lock(L);
  api_check(L, k == NULL || !isLua(L->ci),
    "cannot use continuations inside hooks");
  api_checknelems(L, nargs+1);
  api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
  checkresults(L, nargs, nresults);
  if (errfunc == 0)
    func = 0;
  else {
    StkId o = index2addr(L, errfunc);
    api_checkstackindex(L, errfunc, o);
    func = savestack(L, o);
  }
  c.func = L->top - (nargs+1);  /* function to be called */
  if (k == NULL || L->nny > 0) {  /* no continuation or no yieldable? */
    c.nresults = nresults;  /* do a 'conventional' protected call */
    status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
  }
  else {  /* prepare continuation (call is already protected by 'resume') */
    CallInfo *ci = L->ci;
    ci->u.c.k = k;  /* save continuation */
    ci->u.c.ctx = ctx;  /* save context */
    /* save information for error recovery */
    ci->extra = savestack(L, c.func);
    ci->u.c.old_allowhook = L->allowhook;
    ci->u.c.old_errfunc = L->errfunc;
    L->errfunc = func;
    /* mark that function may do error recovery */
    ci->callstatus |= CIST_YPCALL;
    luaD_call(L, c.func, nresults, 1);  /* do the call */
    ci->callstatus &= ~CIST_YPCALL;
    L->errfunc = ci->u.c.old_errfunc;
    status = LUA_OK;  /* if it is here, there were no errors */
  }
  adjustresults(L, nresults);
  lua_unlock(L);
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r9, %r15
movl %r8d, %r14d
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
testl %ecx, %ecx
je 0x87a7
movq %rbx, %rdi
movl %ecx, %esi
callq 0x781c
movq %rax, %r8
subq 0x38(%rbx), %r8
jmp 0x87aa
xorl %r8d, %r8d
notl %r12d
movslq %r12d, %rcx
shlq $0x4, %rcx
addq 0x10(%rbx), %rcx
movq %rcx, (%rsp)
testq %r15, %r15
je 0x87c8
cmpw $0x0, 0x44(%rbx)
je 0x87e3
movq %rsp, %rdx
movl %ebp, 0x8(%rdx)
subq 0x38(%rbx), %rcx
leaq 0x86(%rip), %rsi        # 0x885f
movq %rbx, %rdi
callq 0xbeca
jmp 0x883b
movq 0x20(%rbx), %r12
movq %r15, 0x38(%r12)
movl %r14d, 0x30(%r12)
movq %rcx, %rax
subq 0x38(%rbx), %rax
movq %rax, 0x28(%r12)
movb 0x49(%rbx), %al
movb %al, 0x48(%r12)
movq 0x78(%rbx), %rax
movq %rax, 0x40(%r12)
movq %r8, 0x78(%rbx)
orb $0x10, 0x22(%r12)
movq %rbx, %rdi
movq %rcx, %rsi
movl %ebp, %edx
movl $0x1, %ecx
callq 0xbafd
andb $-0x11, 0x22(%r12)
movq 0x40(%r12), %rax
movq %rax, 0x78(%rbx)
xorl %eax, %eax
cmpl $-0x1, %ebp
jne 0x8852
movq 0x10(%rbx), %rcx
movq 0x20(%rbx), %rdx
cmpq %rcx, 0x8(%rdx)
jae 0x8852
movq %rcx, 0x8(%rdx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_load
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
                      const char *chunkname, const char *mode) {
  ZIO z;
  int status;
  lua_lock(L);
  if (!chunkname) chunkname = "?";
  luaZ_init(L, &z, reader, data);
  status = luaD_protectedparser(L, &z, chunkname, mode);
  if (status == LUA_OK) {  /* no errors? */
    LClosure *f = clLvalue(L->top - 1);  /* get newly created function */
    if (f->nupvalues == 1) {  /* does it have one upvalue? */
      /* get global table from registry */
      Table *reg = hvalue(&G(L)->l_registry);
      const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
      /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
      setobj(L, f->upvals[0]->v, gt);
      luaC_barrier(L, f->upvals[0], gt);
    }
  }
  lua_unlock(L);
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %r8, %r14
movq %rdx, %rax
movq %rsi, %rdx
movq %rdi, %rbx
testq %rcx, %rcx
leaq 0x17fb3(%rip), %r15     # 0x20844
cmovneq %rcx, %r15
leaq 0x8(%rsp), %r12
movq %r12, %rsi
movq %rax, %rcx
callq 0x1aac3
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0xbf49
movl %eax, %ebp
testl %eax, %eax
jne 0x8911
movq 0x10(%rbx), %rax
movq -0x10(%rax), %r14
cmpb $0x1, 0xa(%r14)
jne 0x8911
movq 0x18(%rbx), %rax
movq 0x40(%rax), %rdi
movl $0x2, %esi
callq 0x17528
movq 0x20(%r14), %rcx
movq 0x10(%rcx), %rcx
movq (%rax), %rdx
movq %rdx, (%rcx)
movl 0x8(%rax), %edx
movl %edx, 0x8(%rcx)
testb $0x40, %dl
je 0x8911
movq (%rax), %rdx
testb $0x3, 0x9(%rdx)
je 0x8911
movq 0x20(%r14), %rsi
testb $0x4, 0x9(%rsi)
je 0x8911
movq %rbx, %rdi
callq 0xc950
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_newuserdata
LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
  Udata *u;
  lua_lock(L);
  luaC_checkGC(L);
  u = luaS_newudata(L, size, NULL);
  setuvalue(L, L->top, u);
  api_incr_top(L);
  lua_unlock(L);
  return u + 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpq $0x0, 0x18(%rax)
jle 0x8b80
movq %rbx, %rdi
callq 0xd766
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x14d41
movq 0x10(%rbx), %rcx
movq %rax, (%rcx)
movl $0x47, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
addq $0x28, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq