// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lstate.c
// Function: lua_newstate
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
  int i;
  lua_State *L;
  global_State *g;
  LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG)));
  if (l == NULL) return NULL;
  L = &l->l.l;
  g = &l->g;
  L->next = NULL;
  L->tt = LUA_TTHREAD;
  g->currentwhite = bitmask(WHITE0BIT);
  L->marked = luaC_white(g);
  preinit_thread(L, g);
  g->frealloc = f;
  g->ud = ud;
  g->mainthread = L;
  g->seed = makeseed(L);
  g->gcrunning = 0;  /* no GC while building state */
  g->GCestimate = 0;
  g->strt.size = g->strt.nuse = 0;
  g->strt.hash = NULL;
  setnilvalue(&g->l_registry);
  g->panic = NULL;
  g->version = NULL;
  g->gcstate = GCSpause;
  g->gckind = KGC_NORMAL;
  g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL;
  g->sweepgc = NULL;
  g->gray = g->grayagain = NULL;
  g->weak = g->ephemeron = g->allweak = NULL;
  g->twups = NULL;
  g->totalbytes = sizeof(LG);
  g->GCdebt = 0;
  g->gcfinnum = 0;
  g->gcpause = LUAI_GCPAUSE;
  g->gcstepmul = LUAI_GCMUL;
  for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
  if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
    /* memory allocation error: free partial state */
    close_state(L);
    L = NULL;
  }
  return L;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl $0x8, %edx
movl $0x610, %ecx            # imm = 0x610
callq *%rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x15f30
movq $0x0, -0x8(%rbp)
jmp 0x16163
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movb $0x8, 0x8(%rax)
movq -0x30(%rbp), %rax
movb $0x1, 0x54(%rax)
movq -0x30(%rbp), %rax
movzbl 0x54(%rax), %eax
andl $0x3, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15c10
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq -0x28(%rbp), %rdi
callq 0x16170
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x57(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x3c(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0xc0(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0xd0(%rax)
movq -0x30(%rbp), %rax
movb $0x7, 0x55(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x56(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0xa0(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x98(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x90(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x88(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x80(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0xa8(%rax)
movq -0x30(%rbp), %rax
movq $0x610, 0x10(%rax)      # imm = 0x610
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0xb0(%rax)
movq -0x30(%rbp), %rax
movl $0xc8, 0xb4(%rax)
movq -0x30(%rbp), %rax
movl $0xc8, 0xb8(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x9, -0x1c(%rbp)
jge 0x16131
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq $0x0, 0x1a0(%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1610c
movq -0x28(%rbp), %rdi
leaq 0xf4(%rip), %rsi        # 0x16230
xorl %eax, %eax
movl %eax, %edx
callq 0xac40
cmpl $0x0, %eax
je 0x1615b
movq -0x28(%rbp), %rdi
callq 0x162b0
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)