// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %r14
cmpl $0x9, %esi
ja 0x6f0c
movq %rdi, %r15
movq 0x18(%rdi), %rbx
movl %esi, %eax
leaq 0x182f1(%rip), %rcx     # 0x1f10c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, 0x57(%rbx)
xorl %r14d, %r14d
jmp 0x6f0c
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0xa056
jmp 0x6f0c
movb 0x57(%rbx), %bpl
movb $0x1, 0x57(%rbx)
testl %edx, %edx
je 0x6ee6
movslq %edx, %r14
shlq $0xa, %r14
addq 0x18(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdea8
movq 0x18(%r15), %rax
cmpq $0x0, 0x18(%rax)
jle 0x6e7b
movq %r15, %rdi
callq 0x9f05
movb %bpl, 0x57(%rbx)
testq %r14, %r14
jg 0x6f01
jmp 0x6e28
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xdea8
movb $0x1, 0x57(%rbx)
jmp 0x6f0c
movl 0xb4(%rbx), %r14d
movl %edx, 0xb4(%rbx)
jmp 0x6f0c
movl 0xb8(%rbx), %r14d
cmpl $0x29, %edx
pushq $0x28
popq %rax
cmovgel %edx, %eax
movl %eax, 0xb8(%rbx)
jmp 0x6f0c
movq 0x18(%rbx), %r14
addq 0x10(%rbx), %r14
shrq $0xa, %r14
jmp 0x6f0c
movl 0x18(%rbx), %r14d
addl 0x10(%rbx), %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
jmp 0x6f0c
movzbl 0x57(%rbx), %r14d
jmp 0x6f0c
movq %rbx, %rdi
movq $-0x960, %rsi           # imm = 0xF6A0
callq 0xdea8
movq %r15, %rdi
callq 0x9f05
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