// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/lua-5.1.5/src/ldo.c
// Function: luaD_precall
int luaD_precall (lua_State *L, StkId func, int nresults) {
  LClosure *cl;
  ptrdiff_t funcr;
  if (!(ttisfunction(func))) /* `func' is not a function? */
    func = tryfuncTM(L, func);  /* check the `function' tag method */
  funcr = savestack(L, func);
  cl = &clvalue(func)->l;
  L->ci->savedpc = L->savedpc;
  if (!cl->isC) {  /* Lua function? prepare its call */
    CallInfo *ci;
    StkId st, base;
    Proto *p = cl->p;
    luaD_checkstack(L, p->maxstacksize);
    func = restorestack(L, funcr);
    if (!p->is_vararg) {  /* no varargs? */
      base = func + 1;
      if (L->top > base + p->numparams)
        L->top = base + p->numparams;
    }
    else {  /* vararg function */
      int nargs = cast_int(L->top - func) - 1;
      base = adjust_varargs(L, p, nargs);
      func = restorestack(L, funcr);  /* previous call may change the stack */
    }
    ci = inc_ci(L);  /* now `enter' new function */
    ci->func = func;
    L->base = ci->base = base;
    ci->top = L->base + p->maxstacksize;
    lua_assert(ci->top <= L->stack_last);
    L->savedpc = p->code;  /* starting point */
    ci->tailcalls = 0;
    ci->nresults = nresults;
    for (st = L->top; st < ci->top; st++)
      setnilvalue(st);
    L->top = ci->top;
    if (L->hookmask & LUA_MASKCALL) {
      L->savedpc++;  /* hooks assume 'pc' is already incremented */
      luaD_callhook(L, LUA_HOOKCALL, -1);
      L->savedpc--;  /* correct 'pc' */
    }
    return PCRLUA;
  }
  else {  /* if is a C function, call it */
    CallInfo *ci;
    int n;
    luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */
    ci = inc_ci(L);  /* now `enter' new function */
    ci->func = restorestack(L, funcr);
    L->base = ci->base = ci->func + 1;
    ci->top = L->top + LUA_MINSTACK;
    lua_assert(ci->top <= L->stack_last);
    ci->nresults = nresults;
    if (L->hookmask & LUA_MASKCALL)
      luaD_callhook(L, LUA_HOOKCALL, -1);
    lua_unlock(L);
    n = (*curr_func(L)->c.f)(L);  /* do the actual call */
    lua_lock(L);
    if (n < 0)  /* yielding? */
      return PCRYIELD;
    else {
      luaD_poscall(L, L->top - n);
      return PCRC;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x6, 0x8(%rsi)
je 0x5d554
movq %rbx, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x5f010
movq %rax, %r15
movq 0x40(%rbx), %r12
cmpl $0x6, 0x8(%rax)
je 0x5d4f8
leaq 0x90e95(%rip), %rdx     # 0xee382
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5f08c
movq 0x10(%rbx), %rax
cmpq %r14, %rax
jbe 0x5d51a
movq -0x10(%rax), %rcx
movq %rcx, (%rax)
movl -0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
leaq -0x10(%rax), %rcx
movq %rcx, %rax
cmpq %r14, %rcx
ja 0x5d501
movq 0x38(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x10, %rax
jg 0x5d535
movq %rbx, %rdi
movl $0x1, %esi
callq 0x576ac
addq $0x10, 0x10(%rbx)
subq %r12, %r14
movq 0x40(%rbx), %rax
movq (%r15), %rcx
movq %rcx, (%rax,%r14)
movl 0x8(%r15), %ecx
movl %ecx, 0x8(%rax,%r14)
addq %rax, %r14
movq %r14, %r15
movq (%r14), %rax
movq 0x28(%rbx), %rcx
subq 0x40(%rbx), %r15
movq 0x30(%rbx), %rdx
movq %rdx, 0x18(%rcx)
cmpb $0x0, 0xa(%rax)
je 0x5d5a1
movq 0x38(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x140, %rax            # imm = 0x140
jg 0x5d58d
movq %rbx, %rdi
movl $0x14, %esi
callq 0x576ac
movq 0x28(%rbx), %rax
cmpq 0x48(%rbx), %rax
je 0x5d5fb
addq $0x28, %rax
movq %rax, 0x28(%rbx)
jmp 0x5d603
movq 0x20(%rax), %r13
movq 0x38(%rbx), %rax
subq 0x10(%rbx), %rax
movzbl 0x73(%r13), %esi
movl %esi, %ecx
shll $0x4, %ecx
cmpq %rcx, %rax
jg 0x5d5c4
movq %rbx, %rdi
callq 0x576ac
movq 0x40(%rbx), %r14
addq %r15, %r14
movb 0x72(%r13), %al
testb %al, %al
je 0x5d680
movq %r15, 0x20(%rsp)
movq 0x10(%rbx), %rsi
subq %r14, %rsi
shrq $0x4, %rsi
movzbl 0x71(%r13), %edi
cmpl %edi, %esi
jle 0x5d6a6
decl %esi
jmp 0x5d6c5
movq %rbx, %rdi
callq 0x5ee2a
movq 0x40(%rbx), %rcx
leaq (%rcx,%r15), %rdx
movq %rdx, 0x8(%rax)
addq %r15, %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq %rcx, 0x18(%rbx)
movl $0x140, %ecx            # imm = 0x140
addq 0x10(%rbx), %rcx
movq %rcx, 0x10(%rax)
movl %ebp, 0x20(%rax)
testb $0x1, 0x64(%rbx)
je 0x5d642
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5ee78
movq 0x28(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
js 0x5d676
movq 0x10(%rbx), %rsi
movl %eax, %eax
shlq $0x4, %rax
subq %rax, %rsi
movq %rbx, %rdi
callq 0x5ef37
movl $0x1, %ebp
jmp 0x5d9ce
movl $0x2, %ebp
jmp 0x5d9ce
leaq 0x10(%r14), %r12
movzbl 0x71(%r13), %eax
shll $0x4, %eax
addq %r14, %rax
addq $0x10, %rax
cmpq %rax, 0x10(%rbx)
jbe 0x5d82f
movq %rax, 0x10(%rbx)
jmp 0x5d82f
movq 0x10(%rbx), %rcx
movl %edi, %edx
subl %esi, %edx
incl %edx
movl $0x0, 0x8(%rcx)
addq $0x10, %rcx
decl %edx
jne 0x5d6b0
movq %rcx, 0x10(%rbx)
movl %edi, %esi
testb $0x4, %al
jne 0x5d6d1
xorl %r15d, %r15d
jmp 0x5d7c4
movq 0x20(%rbx), %rax
movq 0x78(%rax), %rcx
cmpq 0x70(%rax), %rcx
jb 0x5d6f3
movq %rdi, %r15
movq %rbx, %rdi
movq %rsi, %r14
callq 0x57814
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, 0x4(%rsp)
movq %rsi, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
subl %edi, %ebp
movq 0x38(%rbx), %rax
subq 0x10(%rbx), %rax
movq %r13, 0x18(%rsp)
movzbl 0x73(%r13), %esi
movl %esi, %ecx
shll $0x4, %ecx
cmpq %rcx, %rax
jg 0x5d729
movq %rbx, %rdi
callq 0x576ac
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1, %edx
callq 0x58df1
movq %rax, %r15
movl %ebp, (%rsp)
testl %ebp, %ebp
jle 0x5d77f
movl (%rsp), %ebp
movq %rbp, %r13
shlq $0x4, %r13
negq %r13
xorl %r12d, %r12d
movq 0x10(%rbx), %r14
incq %r12
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x592ee
movq (%r14,%r13), %rcx
movq %rcx, (%rax)
movl 0x8(%r14,%r13), %ecx
movl %ecx, 0x8(%rax)
addq $0x10, %r13
cmpq %r12, %rbp
jne 0x5d752
leaq 0x94031(%rip), %rsi     # 0xf17b7
movl $0x1, %edx
movq %rbx, %rdi
callq 0x583e8
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x5f123
cvtsi2sdl (%rsp), %xmm0
movsd %xmm0, (%rax)
movl $0x3, 0x8(%rax)
movl 0x4(%rsp), %ebp
movq 0x18(%rsp), %r13
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x10(%rbx), %r12
testl %edi, %edi
je 0x5d80b
movl %esi, %ecx
shlq $0x4, %rcx
movq %r12, %rax
subq %rcx, %rax
addq $0x8, %rax
shll $0x4, %edi
xorl %ecx, %ecx
movq 0x10(%rbx), %rdx
leaq 0x10(%rdx), %rsi
movq %rsi, 0x10(%rbx)
movq -0x8(%rax,%rcx), %rsi
movq %rsi, (%rdx)
movl (%rax,%rcx), %esi
movl %esi, 0x8(%rdx)
movl $0x0, (%rax,%rcx)
addq $0x10, %rcx
cmpq %rcx, %rdi
jne 0x5d7e1
testq %r15, %r15
je 0x5d826
movq 0x10(%rbx), %rax
leaq 0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
movq %r15, (%rax)
movl $0x5, 0x8(%rax)
movq 0x20(%rsp), %r14
addq 0x40(%rbx), %r14
movq 0x28(%rbx), %rax
cmpq 0x48(%rbx), %rax
je 0x5d843
addq $0x28, %rax
movq %rax, 0x28(%rbx)
jmp 0x5d84b
movq %rbx, %rdi
callq 0x5ee2a
movq %r14, 0x8(%rax)
movq %r12, (%rax)
movq %r12, 0x18(%rbx)
movzbl 0x73(%r13), %edi
movl %edi, %edx
shll $0x4, %edx
addq %r12, %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%r13), %rcx
movq %rcx, 0x30(%rbx)
movl $0x0, 0x24(%rax)
movl %ebp, 0x20(%rax)
movq 0x10(%rbx), %rax
cmpq %rdx, %rax
jae 0x5d9a4
shll $0x4, %edi
addq %r12, %rdi
leaq 0x10(%rax), %rsi
cmpq %rsi, %rdi
cmovbeq %rsi, %rdi
movq %rax, %rsi
notq %rsi
addq %rdi, %rsi
movq %rsi, %xmm0
shrq $0x4, %rsi
addq $0x4, %rsi
andq $-0x4, %rsi
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x4, %xmm0
addq $0x38, %rax
xorl %edi, %edi
movdqa 0x90047(%rip), %xmm1    # 0xed910
movdqa 0x9004f(%rip), %xmm2    # 0xed920
movdqa 0x90057(%rip), %xmm3    # 0xed930
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdi, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %r8d
notl %r8d
testb $0x1, %r8b
je 0x5d92d
movl $0x0, -0x30(%rax)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x5d944
movl $0x0, -0x20(%rax)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %r8d
testb $0x1, %r8b
je 0x5d981
movl $0x0, -0x10(%rax)
pextrw $0x4, %xmm5, %r8d
testb $0x1, %r8b
je 0x5d993
movl $0x0, (%rax)
addq $0x4, %rdi
addq $0x40, %rax
cmpq %rdi, %rsi
jne 0x5d8e1
movq %rdx, 0x10(%rbx)
xorl %ebp, %ebp
testb $0x1, 0x64(%rbx)
je 0x5d9ce
addq $0x4, %rcx
movq %rcx, 0x30(%rbx)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5ee78
addq $-0x4, 0x30(%rbx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq