// File: /workspace/github_c_makefile_star2_O1/tylerneylon[P]APIsWithLua/lua/ldo.c
// Function: luaD_precall
int luaD_precall (lua_State *L, StkId func, int nresults) {
  lua_CFunction f;
  CallInfo *ci;
  switch (ttype(func)) {
    case LUA_TCCL:  /* C closure */
      f = clCvalue(func)->f;
      goto Cfunc;
    case LUA_TLCF:  /* light C function */
      f = fvalue(func);
     Cfunc: {
      int n;  /* number of returns */
      checkstackp(L, LUA_MINSTACK, func);  /* ensure minimum stack size */
      ci = next_ci(L);  /* now 'enter' new function */
      ci->nresults = nresults;
      ci->func = func;
      ci->top = L->top + LUA_MINSTACK;
      lua_assert(ci->top <= L->stack_last);
      ci->callstatus = 0;
      if (L->hookmask & LUA_MASKCALL)
        luaD_hook(L, LUA_HOOKCALL, -1);
      lua_unlock(L);
      n = (*f)(L);  /* do the actual call */
      lua_lock(L);
      api_checknelems(L, n);
      luaD_poscall(L, ci, L->top - n, n);
      return 1;
    }
    case LUA_TLCL: {  /* Lua function: prepare its call */
      StkId base;
      Proto *p = clLvalue(func)->p;
      int n = cast_int(L->top - func) - 1;  /* number of real arguments */
      int fsize = p->maxstacksize;  /* frame size */
      checkstackp(L, fsize, func);
      if (p->is_vararg != 1) {  /* do not use vararg? */
        for (; n < p->numparams; n++)
          setnilvalue(L->top++);  /* complete missing arguments */
        base = func + 1;
      }
      else
        base = adjust_varargs(L, p, n);
      ci = next_ci(L);  /* now 'enter' new function */
      ci->nresults = nresults;
      ci->func = func;
      ci->u.l.base = base;
      L->top = ci->top = base + fsize;
      lua_assert(ci->top <= L->stack_last);
      ci->u.l.savedpc = p->code;  /* starting point */
      ci->callstatus = CIST_LUA;
      if (L->hookmask & LUA_MASKCALL)
        callhook(L, ci);
      return 0;
    }
    default: {  /* not a function */
      checkstackp(L, 1, func);  /* ensure space for metamethod */
      tryfuncTM(L, func);  /* try to get '__call' metamethod */
      return luaD_precall(L, func, nresults);  /* now it must be a function */
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%r14), %eax
andl $0x3f, %eax
cmpl $0x6, %eax
je 0x8980
cmpl $0x16, %eax
je 0x8a6c
cmpl $0x26, %eax
je 0x8a63
movq 0x30(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x10, %rax
jg 0x8934
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x8923
movq %rbx, %rdi
callq 0xa65d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x86e3
addq 0x38(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x17, %edx
callq 0x10304
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x6, %ecx
jne 0x8bfb
movq 0x10(%rbx), %rcx
cmpq %r14, %rcx
jbe 0x896f
movups -0x10(%rcx), %xmm0
movups %xmm0, (%rcx)
leaq -0x10(%rcx), %rdx
movq %rdx, %rcx
cmpq %r14, %rdx
ja 0x895c
addq $0x10, 0x10(%rbx)
movups (%rax), %xmm0
movups %xmm0, (%r14)
jmp 0x88dc
movq (%r14), %rax
movq 0x18(%rax), %r13
movq 0x10(%rbx), %r12
movq 0x30(%rbx), %rax
subq %r12, %rax
subq %r14, %r12
shrq $0x4, %r12
movzbl 0xc(%r13), %r15d
sarq $0x4, %rax
cmpq %r15, %rax
jg 0x89cd
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x89be
movq %rbx, %rdi
callq 0xa65d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x86e3
addq 0x38(%rbx), %r14
cmpb $0x1, 0xb(%r13)
movzbl 0xa(%r13), %eax
movl %ebp, 0x4(%rsp)
jne 0x8b24
movq 0x10(%rbx), %rbp
xorl %ecx, %ecx
cmpl $0x2, %r12d
jl 0x8a3f
testb %al, %al
je 0x8a3f
leal -0x1(%r12), %ecx
movslq %ecx, %rcx
addl $-0x2, %r12d
leal -0x1(%rax), %edx
cmpl %edx, %r12d
cmovael %edx, %r12d
incl %r12d
shlq $0x4, %rcx
movq %rbp, %rdx
subq %rcx, %rdx
addq $0x8, %rdx
xorl %ecx, %ecx
movq 0x10(%rbx), %rsi
leaq 0x10(%rsi), %rdi
movq %rdi, 0x10(%rbx)
movups -0x8(%rdx), %xmm0
movups %xmm0, (%rsi)
movl $0x0, (%rdx)
incq %rcx
addq $0x10, %rdx
cmpq %rcx, %r12
jne 0x8a1a
subl %ecx, %eax
jbe 0x8b49
movq 0x10(%rbx), %rcx
movl $0x0, 0x8(%rcx)
addq $0x10, %rcx
decl %eax
jne 0x8a4b
movq %rcx, 0x10(%rbx)
jmp 0x8b49
movq (%r14), %rax
addq $0x18, %rax
jmp 0x8a6f
movq %r14, %rax
movq (%rax), %r12
movq 0x30(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x14f, %rax            # imm = 0x14F
jg 0x8aaa
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x8a99
movq %rbx, %rdi
callq 0xa65d
movq %rbx, %rdi
movl $0x14, %esi
callq 0x86e3
addq 0x38(%rbx), %r14
movq 0x20(%rbx), %rax
movq 0x18(%rax), %r15
testq %r15, %r15
jne 0x8ac2
movq %rbx, %rdi
callq 0xeacc
movq %rax, %r15
movq %r15, 0x20(%rbx)
movw %bp, 0x40(%r15)
movq %r14, (%r15)
movl $0x140, %eax            # imm = 0x140
addq 0x10(%rbx), %rax
movq %rax, 0x8(%r15)
movb $0x0, 0x42(%r15)
testb $0x1, 0xc8(%rbx)
je 0x8af8
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x880d
movq %rbx, %rdi
callq *%r12
movq 0x10(%rbx), %rdx
movslq %eax, %rcx
movq %rcx, %rax
shlq $0x4, %rax
subq %rax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8c0d
movl $0x1, %ebp
jmp 0x8bea
cmpl %eax, %r12d
jg 0x8b45
movq 0x10(%rbx), %rcx
subl %r12d, %eax
incl %eax
movl $0x0, 0x8(%rcx)
addq $0x10, %rcx
decl %eax
jne 0x8b32
movq %rcx, 0x10(%rbx)
leaq 0x10(%r14), %rbp
movq 0x20(%rbx), %rax
movq 0x18(%rax), %r12
testq %r12, %r12
jne 0x8b61
movq %rbx, %rdi
callq 0xeacc
movq %rax, %r12
movq %r12, 0x20(%rbx)
movl 0x4(%rsp), %eax
movw %ax, 0x40(%r12)
movq %r14, (%r12)
movq %rbp, 0x20(%r12)
shll $0x4, %r15d
addq %rbp, %r15
movq %r15, 0x8(%r12)
movq %r15, 0x10(%rbx)
movq 0x38(%r13), %rax
movq %rax, 0x28(%r12)
movb $0x2, 0x42(%r12)
xorl %ebp, %ebp
testb $0x1, 0xc8(%rbx)
je 0x8bea
addq $0x4, %rax
movq %rax, 0x28(%r12)
movq 0x10(%r12), %rax
xorl %ebp, %ebp
testb $0x2, 0x42(%rax)
movl $0x0, %esi
je 0x8bd7
movq 0x28(%rax), %rax
movl -0x4(%rax), %eax
andl $0x3f, %eax
cmpl $0x25, %eax
jne 0x8bd7
movb $0x22, 0x42(%r12)
movl $0x4, %esi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x880d
addq $-0x4, 0x28(%r12)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a145(%rip), %rdx     # 0x22d47
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7c9a