// File: /workspace/github_c_makefile_star2_O3/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 0x8b6f
cmpl $0x16, %eax
je 0x8c64
cmpl $0x26, %eax
je 0x8c5b
movq 0x30(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x10, %rax
jg 0x8b1c
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x8b0b
movq %rbx, %rdi
callq 0xa9cc
movq %rbx, %rdi
movl $0x1, %esi
callq 0x88b9
addq 0x38(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x17, %edx
callq 0x10974
movl 0x8(%rax), %ecx
andl $0xf, %ecx
cmpl $0x6, %ecx
jne 0x8df3
movq 0x10(%rbx), %rcx
cmpq %r14, %rcx
jbe 0x8b5b
movups -0x10(%rcx), %xmm0
movups %xmm0, (%rcx)
leaq -0x10(%rcx), %rdx
movq %rdx, %rcx
cmpq %r14, %rdx
ja 0x8b44
movq 0x10(%rbx), %rcx
addq $0x10, %rcx
movq %rcx, 0x10(%rbx)
movups (%rax), %xmm0
movups %xmm0, (%r14)
jmp 0x8ac4
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 0x8bbc
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x8bad
movq %rbx, %rdi
callq 0xa9cc
movq %rbx, %rdi
movl %r15d, %esi
callq 0x88b9
addq 0x38(%rbx), %r14
cmpb $0x1, 0xb(%r13)
movzbl 0xa(%r13), %eax
movl %ebp, 0x4(%rsp)
jne 0x8d1c
movq 0x10(%rbx), %rbp
xorl %ecx, %ecx
cmpl $0x2, %r12d
jl 0x8c37
testb %al, %al
je 0x8c37
leal -0x1(%r12), %ecx
movslq %ecx, %rsi
addl $-0x2, %r12d
leal -0x1(%rax), %ecx
cmpl %ecx, %r12d
cmovael %ecx, %r12d
leal 0x1(%r12), %ecx
shlq $0x4, %r12
addq $0x10, %r12
shlq $0x4, %rsi
movq %rbp, %rdx
subq %rsi, %rdx
addq $0x8, %rdx
xorl %esi, %esi
movq 0x10(%rbx), %rdi
leaq 0x10(%rdi), %r8
movq %r8, 0x10(%rbx)
movups -0x8(%rdx,%rsi), %xmm0
movups %xmm0, (%rdi)
movl $0x0, (%rdx,%rsi)
addq $0x10, %rsi
cmpq %rsi, %r12
jne 0x8c13
subl %ecx, %eax
jbe 0x8d41
movq 0x10(%rbx), %rcx
movl $0x0, 0x8(%rcx)
addq $0x10, %rcx
decl %eax
jne 0x8c43
movq %rcx, 0x10(%rbx)
jmp 0x8d41
movq (%r14), %rax
addq $0x18, %rax
jmp 0x8c67
movq %r14, %rax
movq (%rax), %r12
movq 0x30(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x14f, %rax            # imm = 0x14F
jg 0x8ca2
movq 0x18(%rbx), %rax
subq 0x38(%rbx), %r14
cmpq $0x0, 0x18(%rax)
jle 0x8c91
movq %rbx, %rdi
callq 0xa9cc
movq %rbx, %rdi
movl $0x14, %esi
callq 0x88b9
addq 0x38(%rbx), %r14
movq 0x20(%rbx), %rax
movq 0x18(%rax), %r15
testq %r15, %r15
jne 0x8cba
movq %rbx, %rdi
callq 0xf004
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 0x8cf0
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x89ed
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 0x8e05
movl $0x1, %ebp
jmp 0x8de2
cmpl %eax, %r12d
jg 0x8d3d
movq 0x10(%rbx), %rcx
subl %r12d, %eax
incl %eax
movl $0x0, 0x8(%rcx)
addq $0x10, %rcx
decl %eax
jne 0x8d2a
movq %rcx, 0x10(%rbx)
leaq 0x10(%r14), %rbp
movq 0x20(%rbx), %rax
movq 0x18(%rax), %r12
testq %r12, %r12
jne 0x8d59
movq %rbx, %rdi
callq 0xf004
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 0x8de2
addq $0x4, %rax
movq %rax, 0x28(%r12)
movq 0x10(%r12), %rax
xorl %ebp, %ebp
testb $0x2, 0x42(%rax)
movl $0x0, %esi
je 0x8dcf
movq 0x28(%rax), %rax
movl -0x4(%rax), %eax
andl $0x3f, %eax
cmpl $0x25, %eax
jne 0x8dcf
movb $0x22, 0x42(%r12)
movl $0x4, %esi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x89ed
addq $-0x4, 0x28(%r12)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1afdd(%rip), %rdx     # 0x23dd7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d95