// File: /workspace/github_c_makefile_star2_O1/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 0x7188
movq %rdi, %r15
movq 0x18(%rdi), %rbx
movl %esi, %eax
leaq 0x1a069(%rip), %rcx     # 0x210fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, 0x57(%rbx)
jmp 0x7185
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0xa7e2
jmp 0x7188
movb 0x57(%rbx), %bpl
movb $0x1, 0x57(%rbx)
testl %edx, %edx
je 0x7152
movslq %edx, %r14
shlq $0xa, %r14
addq 0x18(%rbx), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xeaa4
movq 0x18(%r15), %rax
cmpq $0x0, 0x18(%rax)
jg 0x7167
jmp 0x716f
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xeaa4
movb $0x1, 0x57(%rbx)
jmp 0x7188
movl 0xb4(%rbx), %r14d
movl %edx, 0xb4(%rbx)
jmp 0x7188
movl 0xb8(%rbx), %r14d
cmpl $0x29, %edx
movl $0x28, %eax
cmovgel %edx, %eax
movl %eax, 0xb8(%rbx)
jmp 0x7188
movq 0x18(%rbx), %r14
addq 0x10(%rbx), %r14
shrq $0xa, %r14
jmp 0x7188
movl 0x18(%rbx), %r14d
addl 0x10(%rbx), %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
jmp 0x7188
movzbl 0x57(%rbx), %r14d
jmp 0x7188
movq %rbx, %rdi
movq $-0x960, %rsi           # imm = 0xF6A0
callq 0xeaa4
movl $0x1, %r14d
movq %r15, %rdi
callq 0xa65d
movb %bpl, 0x57(%rbx)
testq %r14, %r14
jle 0x7185
xorl %r14d, %r14d
cmpb $0x7, 0x55(%rbx)
sete %r14b
jmp 0x7188
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq