// File: /workspace/github_c_makefile_star2_O3/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
movl $0x8, %edx
movl $0x2c0, %ecx            # imm = 0x2C0
movq %rsi, %rdi
xorl %esi, %esi
callq *%r15
testq %rax, %rax
je 0x1480e
movq %rax, %rbx
addq $0xd0, %rax
xorl %r12d, %r12d
movq %r12, (%rbx)
movb $0x8, 0x8(%rbx)
movb $0x21, 0x124(%rbx)
movw $0x1, 0x9(%rbx)
movb %r12b, 0x126(%rbx)
movq %rax, 0x18(%rbx)
movq %r12, 0x38(%rbx)
movq %r12, 0x20(%rbx)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rbx)
movups %xmm0, 0x58(%rbx)
movw $0x100, 0x48(%rbx)      # imm = 0x100
movq %r12, 0x4c(%rbx)
movq %r15, 0xd0(%rbx)
movq %r14, 0xd8(%rbx)
movq %rbx, 0x1d8(%rbx)
xorl %edi, %edi
callq 0x6390
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, (%rdi)
movq %rcx, 0x8(%rdi)
leaq 0xc8d7(%rip), %rcx      # 0x20fd0
movq %rcx, 0x10(%rdi)
leaq -0xc6(%rip), %rcx       # 0x1463e
movq %rcx, 0x18(%rdi)
movl $0x20, %esi
movl %eax, %edx
callq 0x14a14
movl %eax, 0x120(%rbx)
movq %rbx, %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, 0x198(%rbx)
movq %rax, 0x1a0(%rbx)
movb %r12b, 0x127(%rbx)
movl $0x0, 0x118(%rbx)
movq %r12, 0x1a8(%rbx)
movq %r12, 0x1b8(%rbx)
movq %r12, 0x1d0(%rbx)
movq %r12, 0x1e0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xf8(%rbx)
movq %r12, 0x108(%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
movq %r12, 0xe8(%rbx)
movabsq $0xc8000000c8, %rax     # imm = 0xC8000000C8
movq %rax, 0x1c0(%rbx)
movl $0xc8, 0x1c8(%rbx)
movq %r12, 0x2b8(%rbx)
movups %xmm0, 0x2a8(%rbx)
movups %xmm0, 0x298(%rbx)
movups %xmm0, 0x288(%rbx)
movups %xmm0, 0x278(%rbx)
leaq 0x2d(%rip), %rsi        # 0x1481d
movq %rbx, %rdi
xorl %edx, %edx
callq 0xb337
testl %eax, %eax
je 0x1480b
movq %rbx, %rdi
callq 0x14906
xorl %r12d, %r12d
jmp 0x1480e
movq %rbx, %r12
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq