// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/ldo.c
// Function: resume
static void resume (lua_State *L, void *ud) {
  int nCcalls = L->nCcalls;
  StkId firstArg = cast(StkId, ud);
  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;
    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? */
        int n;
        ci->u.c.status = LUA_YIELD;  /* 'default' status */
        ci->callstatus |= CIST_YIELDED;
        lua_unlock(L);
        n = (*ci->u.c.k)(L);  /* call continuation */
        lua_lock(L);
        api_checknelems(L, n);
        firstArg = L->top - n;  /* yield results come from continuation */
      }
      luaD_poscall(L, firstArg);  /* finish 'luaD_precall' */
    }
    unroll(L, NULL);
  }
  lua_assert(nCcalls == L->nCcalls);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rax
movzwl 0x46(%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
cmpl $0xc8, 0x24(%rsp)
jl 0x11133
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x2487e(%rip), %rsi     # 0x359ac
callq 0x11a20
movq 0x30(%rsp), %rax
movzbl 0xa(%rax), %eax
cmpl $0x0, %eax
jne 0x11199
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
addq $0x80, %rcx
cmpq %rcx, %rax
je 0x1116d
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x248a9(%rip), %rsi     # 0x35a11
callq 0x11a20
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $-0x10, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x105e0
cmpl $0x0, %eax
jne 0x11194
movq 0x30(%rsp), %rdi
callq 0x28c60
jmp 0x11273
movq 0x30(%rsp), %rax
movzbl 0xa(%rax), %eax
cmpl $0x1, %eax
je 0x111bd
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x2487f(%rip), %rsi     # 0x35a37
callq 0x11a20
movq 0x30(%rsp), %rax
movb $0x0, 0xa(%rax)
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x10(%rsp), %rax
addq 0x28(%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movzbl 0x22(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x111fd
movq 0x30(%rsp), %rdi
callq 0x28c60
jmp 0x11263
movq 0x10(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0x11254
movq 0x10(%rsp), %rax
movb $0x1, 0x49(%rax)
movq 0x10(%rsp), %rax
movzbl 0x22(%rax), %ecx
orl $0x8, %ecx
movb %cl, 0x22(%rax)
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rsp), %rdi
callq *%rax
movl %eax, 0xc(%rsp)
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xc(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x109d0
movq 0x30(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11360
jmp 0x11273
addq $0x38, %rsp
retq
nopl (%rax,%rax)