// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/ldo.c
// Function: resume
static void resume (lua_State *L, void *ud) {
  int nCcalls = L->nCcalls;
  int n = *(cast(int*, ud));  /* number of arguments */
  StkId firstArg = L->top - n;  /* first argument */
  CallInfo *ci = L->ci;
  if (nCcalls >= LUAI_MAXCCALLS)
    resume_error(L, "C stack overflow", firstArg);
  if (L->status == LUA_OK) {  /* may be starting a coroutine */
    if (ci != &L->base_ci)  /* not in base level? */
      resume_error(L, "cannot resume non-suspended coroutine", firstArg);
    /* coroutine is in base level; start running it */
    if (!luaD_precall(L, firstArg - 1, LUA_MULTRET))  /* Lua function? */
      luaV_execute(L);  /* call it */
  }
  else if (L->status != LUA_YIELD)
    resume_error(L, "cannot resume dead coroutine", firstArg);
  else {  /* resuming from previous yield */
    L->status = LUA_OK;  /* mark that it is running (again) */
    ci->func = restorestack(L, ci->extra);
    if (isLua(ci))  /* yielded inside a hook? */
      luaV_execute(L);  /* just continue running Lua code */
    else {  /* 'common' yield */
      if (ci->u.c.k != NULL) {  /* does it have a continuation function? */
        lua_unlock(L);
        n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */
        lua_lock(L);
        api_checknelems(L, n);
        firstArg = L->top - n;  /* yield results come from continuation */
      }
      luaD_poscall(L, ci, firstArg, n);  /* finish 'luaD_precall' */
    }
    unroll(L, NULL);  /* run continuation */
  }
  lua_assert(nCcalls == L->nCcalls);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzwl 0xc6(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0xc8, -0x14(%rbp)
jl 0xbe7c
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x28770(%rip), %rsi     # 0x345e7
callq 0xc570
movq -0x8(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x0, %eax
jne 0xbed7
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
addq $0x60, %rcx
cmpq %rcx, %rax
je 0xbeae
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2874f(%rip), %rsi     # 0x345f8
callq 0xc570
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $-0x10, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xb270
cmpl $0x0, %eax
jne 0xbed2
movq -0x8(%rbp), %rdi
callq 0x1b2c0
jmp 0xbf9a
movq -0x8(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x1, %eax
je 0xbef8
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2872b(%rip), %rsi     # 0x3461e
callq 0xc570
movq -0x8(%rbp), %rax
movb $0x0, 0xc(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x28(%rbp), %rax
addq 0x38(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movzbl 0x42(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xbf32
movq -0x8(%rbp), %rdi
callq 0x1b2c0
jmp 0xbf8b
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xbf77
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq 0x30(%rcx), %rdx
movl $0x1, %esi
callq *%rax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x18(%rbp), %ecx
callq 0xb680
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc060
jmp 0xbf9a
addq $0x30, %rsp
popq %rbp
retq