// File: /workspace/github_c_makefile_star2_O3/tylerneylon[P]APIsWithLua/lua/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: {
      l_mem debt = 1;  /* =1 to signal that it did an actual step */
      lu_byte oldrunning = g->gcrunning;
      g->gcrunning = 1;  /* allow GC to run */
      if (data == 0) {
        luaE_setdebt(g, -GCSTEPSIZE);  /* to do a "small" step */
        luaC_step(L);
      }
      else {  /* add 'data' to total debt */
        debt = cast(l_mem, data) * 1024 + g->GCdebt;
        luaE_setdebt(g, debt);
        luaC_checkGC(L);
      }
      g->gcrunning = oldrunning;  /* restore previous state */
      if (debt > 0 && g->gcstate == GCSpause)  /* end of cycle? */
        res = 1;  /* signal it */
      break;
    }
    case LUA_GCSETPAUSE: {
      res = g->gcpause;
      g->gcpause = data;
      break;
    }
    case LUA_GCSETSTEPMUL: {
      res = g->gcstepmul;
      if (data < 40) data = 40;  /* avoid ridiculous low values (and 0) */
      g->gcstepmul = data;
      break;
    }
    case LUA_GCISRUNNING: {
      res = g->gcrunning;
      break;
    }
    default: res = -1;  /* invalid option */
  }
  lua_unlock(L);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x9, %esi
ja 0x72cb
movq %rdi, %r15
movq 0x18(%rdi), %rbx
movl %esi, %eax
leaq 0x1af54(%rip), %rcx     # 0x2212c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, 0x57(%rbx)
xorl %r14d, %r14d
jmp 0x72cb
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0xab33
jmp 0x72cb
movb 0x57(%rbx), %bpl
movb $0x1, 0x57(%rbx)
testl %edx, %edx
je 0x72a5
movslq %edx, %r14
shlq $0xa, %r14
addq 0x18(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xefdc
movq 0x18(%r15), %rax
cmpq $0x0, 0x18(%rax)
jle 0x7238
movq %r15, %rdi
callq 0xa9cc
movb %bpl, 0x57(%rbx)
testq %r14, %r14
jg 0x72c0
jmp 0x71e5
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xefdc
movb $0x1, 0x57(%rbx)
jmp 0x72cb
movl 0xb4(%rbx), %r14d
movl %edx, 0xb4(%rbx)
jmp 0x72cb
movl 0xb8(%rbx), %r14d
cmpl $0x29, %edx
movl $0x28, %eax
cmovgel %edx, %eax
movl %eax, 0xb8(%rbx)
jmp 0x72cb
movq 0x18(%rbx), %r14
addq 0x10(%rbx), %r14
shrq $0xa, %r14
jmp 0x72cb
movl 0x18(%rbx), %r14d
addl 0x10(%rbx), %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
jmp 0x72cb
movzbl 0x57(%rbx), %r14d
jmp 0x72cb
movq %rbx, %rdi
movq $-0x960, %rsi           # imm = 0xF6A0
callq 0xefdc
movq %r15, %rdi
callq 0xa9cc
movb %bpl, 0x57(%rbx)
xorl %r14d, %r14d
cmpb $0x7, 0x55(%rbx)
sete %r14b
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq