// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lapi.c
// Function: lua_gc
LUA_API int lua_gc (lua_State *L, int what, int data) {
  int res = 0;
  global_State *g;
  lua_lock(L);
  g = G(L);
  switch (what) {
    case LUA_GCSTOP: {
      g->gcrunning = 0;
      break;
    }
    case LUA_GCRESTART: {
      luaE_setdebt(g, 0);
      g->gcrunning = 1;
      break;
    }
    case LUA_GCCOLLECT: {
      luaC_fullgc(L, 0);
      break;
    }
    case LUA_GCCOUNT: {
      /* GC values are expressed in Kbytes: #bytes/2^10 */
      res = cast_int(gettotalbytes(g) >> 10);
      break;
    }
    case LUA_GCCOUNTB: {
      res = cast_int(gettotalbytes(g) & 0x3ff);
      break;
    }
    case LUA_GCSTEP: {
      if (g->gckind == KGC_GEN) {  /* generational mode? */
        res = (g->GCestimate == 0);  /* true if it will do major collection */
        luaC_forcestep(L);  /* do a single step */
      }
      else {
       lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
       if (g->gcrunning)
         debt += g->GCdebt;  /* include current debt */
       luaE_setdebt(g, debt);
       luaC_forcestep(L);
       if (g->gcstate == GCSpause)  /* end of cycle? */
         res = 1;  /* signal it */
      }
      break;
    }
    case LUA_GCSETPAUSE: {
      res = g->gcpause;
      g->gcpause = data;
      break;
    }
    case LUA_GCSETMAJORINC: {
      res = g->gcmajorinc;
      g->gcmajorinc = data;
      break;
    }
    case LUA_GCSETSTEPMUL: {
      res = g->gcstepmul;
      g->gcstepmul = data;
      break;
    }
    case LUA_GCISRUNNING: {
      res = g->gcrunning;
      break;
    }
    case LUA_GCGEN: {  /* change collector to generational mode */
      luaC_changemode(L, KGC_GEN);
      break;
    }
    case LUA_GCINC: {  /* change collector to incremental mode */
      luaC_changemode(L, KGC_NORMAL);
      break;
    }
    default: res = -1;  /* invalid option */
  }
  lua_unlock(L);
  return res;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movl %edx, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
movl 0x2c(%rsp), %eax
movq %rax, 0x8(%rsp)
subq $0xb, %rax
ja 0xb7d0
movq 0x8(%rsp), %rax
leaq 0x29d7e(%rip), %rcx     # 0x353a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rsp), %rax
movb $0x0, 0x57(%rax)
jmp 0xb7d8
movq 0x18(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f880
movq 0x18(%rsp), %rax
movb $0x1, 0x57(%rax)
jmp 0xb7d8
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x13fe0
jmp 0xb7d8
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
addq 0x18(%rcx), %rax
shrq $0xa, %rax
movl %eax, 0x24(%rsp)
jmp 0xb7d8
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
addq 0x18(%rcx), %rax
andq $0x3ff, %rax            # imm = 0x3FF
movl %eax, 0x24(%rsp)
jmp 0xb7d8
movq 0x18(%rsp), %rax
movzbl 0x56(%rax), %eax
cmpl $0x2, %eax
jne 0xb6da
movq 0x18(%rsp), %rax
cmpq $0x0, 0x28(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x24(%rsp)
movq 0x30(%rsp), %rdi
callq 0x13a20
jmp 0xb73d
movslq 0x28(%rsp), %rax
shlq $0xa, %rax
subq $0x960, %rax            # imm = 0x960
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmpb $0x0, 0x57(%rax)
je 0xb70c
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1f880
movq 0x30(%rsp), %rdi
callq 0x13a20
movq 0x18(%rsp), %rax
movzbl 0x55(%rax), %eax
cmpl $0x5, %eax
jne 0xb73b
movl $0x1, 0x24(%rsp)
jmp 0xb73d
jmp 0xb7d8
movq 0x18(%rsp), %rax
movl 0xf0(%rax), %eax
movl %eax, 0x24(%rsp)
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0xf0(%rax)
jmp 0xb7d8
movq 0x18(%rsp), %rax
movl 0xf4(%rax), %eax
movl %eax, 0x24(%rsp)
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0xf4(%rax)
jmp 0xb7d8
movq 0x18(%rsp), %rax
movl 0xf8(%rax), %eax
movl %eax, 0x24(%rsp)
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0xf8(%rax)
jmp 0xb7d8
movq 0x18(%rsp), %rax
movzbl 0x57(%rax), %eax
movl %eax, 0x24(%rsp)
jmp 0xb7d8
movq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x13250
jmp 0xb7d8
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x13250
jmp 0xb7d8
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movl 0x24(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)