/* Executes a return hook for Lua and C functions and sets/corrects 'oldpc'. (Note that this correction is needed by the line hook, so it is done even when return hooks are off.)  */
static void rethook(lua_State *L, CallInfo *ci, int nres)
/* Executes a return hook for Lua and C functions and sets/corrects 'oldpc'. (Note that this correction is needed by the line hook, so it is done even when return hooks are off.)  */
static void rethook(lua_State *L, CallInfo *ci, int nres)
{
    StkId firstres = L->top - nres;
    int delta = 0;
    int ftransfer;
    if (isLua(ci)) {
      Proto *p = ci_func(ci)->p;
      if (p->is_vararg)
        delta = ci->u.l.nextraargs + p->numparams + 1;
    }
    ci->func += delta;
    ftransfer = cast(unsigned short, firstres - ci->func);
    luaD_hook(L, LUA_HOOKRET, -1, ftransfer, nres);
    ci->func -= delta;
  }
  if (isLua(ci = ci->previous))
    L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p);
}