// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r15
movq %rdi, %r12
xorl %r13d, %r13d
movl $0x8, %edx
movl $0x610, %ecx            # imm = 0x610
movq %rsi, %rdi
xorl %esi, %esi
callq *%r12
movl $0x0, %ebx
testq %rax, %rax
je 0xf48a
movq %rax, %r14
leaq 0x8(%rax), %rbx
addq $0xd8, %rax
movq %r13, 0x8(%r14)
movl $0x108, 0x10(%r14)      # imm = 0x108
movb $0x1, %cl
movb %cl, 0x12c(%r14)
movq %rax, 0x20(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%r14)
movq %r13, 0x28(%r14)
movl %r13d, 0xc0(%r14)
movq %rbx, 0x58(%r14)
movq %r13, 0x60(%r14)
movq %r13, 0xb0(%r14)
movq %r13, 0xc4(%r14)
movb %cl, 0xd4(%r14)
movq $0x1, 0xcc(%r14)
movb %r13b, 0x14(%r14)
movq %r13, 0xb8(%r14)
movq %r12, 0xd8(%r14)
movq %r15, 0xe0(%r14)
movq %rbx, 0x1a0(%r14)
xorl %edi, %edi
callq 0x5330
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, (%rdi)
movq %rcx, 0x8(%rdi)
leaq 0x132c3(%rip), %rcx     # 0x22650
movq %rcx, 0x10(%rdi)
leaq -0xe3(%rip), %rcx       # 0xf2b5
movq %rcx, 0x18(%rdi)
movl $0x20, %esi
movl %eax, %edx
callq 0xf5fb
movl %eax, 0x128(%r14)
movb %r13b, 0x12f(%r14)
movl %r13d, 0x120(%r14)
movq %r13, 0x198(%r14)
movq %r13, 0x1a8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x100(%r14)
movq %r13, 0x110(%r14)
movw $0x7, 0x12d(%r14)
movups %xmm0, 0x130(%r14)
movups %xmm0, 0x140(%r14)
movups %xmm0, 0x150(%r14)
movups %xmm0, 0x160(%r14)
movups %xmm0, 0x170(%r14)
movq %r13, 0x180(%r14)
movq $0x610, 0xe8(%r14) # imm = 0x610
movq %r13, 0xf0(%r14)
movabsq $0xc800000000, %rax     # imm = 0xC800000000
movq %rax, 0x188(%r14)
movl $0xc8, 0x190(%r14)
movq %r13, 0x2b8(%r14)
movups %xmm0, 0x2a8(%r14)
movups %xmm0, 0x298(%r14)
movups %xmm0, 0x288(%r14)
movups %xmm0, 0x278(%r14)
leaq 0x29(%rip), %rsi        # 0xf49b
movq %rbx, %rdi
xorl %edx, %edx
callq 0x866b
testl %eax, %eax
je 0xf48a
movq %rbx, %rdi
callq 0xf55f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq