// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
pushq $0x8
popq %rdx
movl $0x2c0, %ecx            # imm = 0x2C0
movq %rsi, %rdi
xorl %esi, %esi
callq *%r15
testq %rax, %rax
je 0x13454
movq %rax, %rbx
leaq 0xd0(%rax), %rsi
andq $0x0, (%rax)
movw $0x108, 0x8(%rax)       # imm = 0x108
movb $0x21, 0x124(%rax)
xorl %r12d, %r12d
movb %r12b, 0x126(%rax)
movq %rax, %rdi
callq 0x1319e
movq %r15, 0xd0(%rbx)
movq %r14, 0xd8(%rbx)
movq %rbx, 0x1d8(%rbx)
xorl %edi, %edi
callq 0x6380
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, (%rdi)
movq %rcx, 0x8(%rdi)
leaq 0xbc52(%rip), %rcx      # 0x1efa0
movq %rcx, 0x10(%rdi)
leaq -0x9b(%rip), %rcx       # 0x132be
movq %rcx, 0x18(%rdi)
pushq $0x20
popq %rsi
movl %eax, %edx
callq 0x13633
movl %eax, 0x120(%rbx)
movq %rbx, %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, 0x198(%rbx)
movq %rax, 0x1a0(%rbx)
movb %r12b, 0x127(%rbx)
andl $0x0, 0x118(%rbx)
andq $0x0, 0x1a8(%rbx)
andq $0x0, 0x1b8(%rbx)
andq $0x0, 0x1d0(%rbx)
andq $0x0, 0x1e0(%rbx)
andq $0x0, 0x108(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xf8(%rbx)
movb $0x5, 0x125(%rbx)
movups %xmm0, 0x130(%rbx)
movups %xmm0, 0x140(%rbx)
movups %xmm0, 0x150(%rbx)
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x170(%rbx)
movq $0x2c0, 0xe0(%rbx) # imm = 0x2C0
andq $0x0, 0xe8(%rbx)
movabsq $0xc8000000c8, %rax     # imm = 0xC8000000C8
movq %rax, 0x1c0(%rbx)
movl $0xc8, 0x1c8(%rbx)
pushq $0x4f
popq %rax
cmpq $0x58, %rax
je 0x1342f
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x1341f
leaq 0x2d(%rip), %rsi        # 0x13463
movq %rbx, %rdi
xorl %edx, %edx
callq 0xad8d
testl %eax, %eax
je 0x13451
movq %rbx, %rdi
callq 0x13548
xorl %r12d, %r12d
jmp 0x13454
movq %rbx, %r12
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq