// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lapi.c
// Function: lua_pcallk
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
                        lua_KContext ctx, lua_KFunction 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_errfunc = L->errfunc;
    L->errfunc = func;
    setoah(ci->callstatus, L->allowhook);  /* save value of 'allowhook' */
    ci->callstatus |= CIST_YPCALL;  /* function can do error recovery */
    luaD_call(L, c.func, nresults);  /* 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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x823d
movq $0x0, -0x48(%rbp)
jmp 0x8260
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x5f20
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x38(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x8298
movq -0x8(%rbp), %rax
movzwl 0xc4(%rax), %eax
cmpl $0x0, %eax
jle 0x82cd
movl -0x10(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
subq %rax, %rcx
movq -0x48(%rbp), %r8
leaq 0x114(%rip), %rsi       # 0x83d0
leaq -0x38(%rbp), %rdx
callq 0xc200
movl %eax, -0x3c(%rbp)
jmp 0x8391
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
subq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x58(%rbp), %rax
movzbl 0x42(%rax), %eax
andl $-0x2, %eax
movq -0x8(%rbp), %rcx
movzbl 0xcc(%rcx), %ecx
orl %ecx, %eax
movb %al, %cl
movq -0x58(%rbp), %rax
movb %cl, 0x42(%rax)
movq -0x58(%rbp), %rax
movzbl 0x42(%rax), %ecx
orl $0x10, %ecx
movb %cl, 0x42(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x10(%rbp), %edx
callq 0xbb90
movq -0x58(%rbp), %rax
movzbl 0x42(%rax), %ecx
andl $-0x11, %ecx
movb %cl, 0x42(%rax)
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb0(%rax)
movl $0x0, -0x3c(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x83c1
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x83c1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x8(%rax)
movl -0x3c(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)