// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/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 = bit2mask(WHITE0BIT, FIXEDBIT);
  L->marked = luaC_white(g);
  g->gckind = KGC_NORMAL;
  preinit_state(L, g);
  g->frealloc = f;
  g->ud = ud;
  g->mainthread = L;
  g->seed = makeseed(L);
  g->uvhead.u.l.prev = &g->uvhead;
  g->uvhead.u.l.next = &g->uvhead;
  g->gcrunning = 0;  /* no GC while building state */
  g->GCestimate = 0;
  g->strt.size = 0;
  g->strt.nuse = 0;
  g->strt.hash = NULL;
  setnilvalue(&g->l_registry);
  luaZ_initbuffer(L, &g->buff);
  g->panic = NULL;
  g->version = NULL;
  g->gcstate = GCSpause;
  g->allgc = NULL;
  g->finobj = NULL;
  g->tobefnz = NULL;
  g->sweepgc = g->sweepfin = NULL;
  g->gray = g->grayagain = NULL;
  g->weak = g->ephemeron = g->allweak = NULL;
  g->totalbytes = sizeof(LG);
  g->GCdebt = 0;
  g->gcpause = LUAI_GCPAUSE;
  g->gcmajorinc = LUAI_GCMAJOR;
  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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl $0x8, %edx
movl $0x2c0, %ecx            # imm = 0x2C0
callq *%rax
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x1fd71
movq $0x0, 0x30(%rsp)
jmp 0x20019
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rax
addq $0xd0, %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq $0x0, (%rax)
movq 0x10(%rsp), %rax
movb $0x8, 0x8(%rax)
movq 0x8(%rsp), %rax
movb $0x21, 0x54(%rax)
movq 0x8(%rsp), %rax
movzbl 0x54(%rax), %eax
andl $0x3, %eax
movb %al, %cl
movq 0x10(%rsp), %rax
movb %cl, 0x9(%rax)
movq 0x8(%rsp), %rax
movb $0x0, 0x56(%rax)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1fa80
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x108(%rax)
movq 0x10(%rsp), %rdi
callq 0x20030
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x50(%rax)
movq 0x8(%rsp), %rcx
addq $0xb0, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xc8(%rax)
movq 0x8(%rsp), %rcx
addq $0xb0, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xd0(%rax)
movq 0x8(%rsp), %rax
movb $0x0, 0x57(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x28(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x3c(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x38(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x30(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x48(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0xd8(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0xe8(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x100(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x110(%rax)
movq 0x8(%rsp), %rax
movb $0x5, 0x55(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x60(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x68(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0xa8(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x78(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x70(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x88(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x80(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0xa0(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x98(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x90(%rax)
movq 0x8(%rsp), %rax
movq $0x2c0, 0x10(%rax)      # imm = 0x2C0
movq 0x8(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x8(%rsp), %rax
movl $0xc8, 0xf0(%rax)
movq 0x8(%rsp), %rax
movl $0xc8, 0xf4(%rax)
movq 0x8(%rsp), %rax
movl $0xc8, 0xf8(%rax)
movl $0x0, 0x1c(%rsp)
cmpl $0x9, 0x1c(%rsp)
jge 0x1ffe2
movq 0x8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq $0x0, 0x1a8(%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1ffb8
movq 0x10(%rsp), %rdi
leaq 0x122(%rip), %rsi       # 0x20110
xorl %eax, %eax
movl %eax, %edx
callq 0xff40
cmpl $0x0, %eax
je 0x2000f
movq 0x10(%rsp), %rdi
callq 0x201d0
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)