// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/lua/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;
  void *l = (*f)(ud, NULL, 0, state_size(LG));
  if (l == NULL) return NULL;
  L = tostate(l);
  g = &((LG *)L)->g;
  L->next = NULL;
  L->tt = LUA_TTHREAD;
  g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);
  L->marked = luaC_white(g);
  set2bits(L->marked, FIXEDBIT, SFIXEDBIT);
  preinit_state(L, g);
  g->frealloc = f;
  g->ud = ud;
  g->mainthread = L;
  g->uvhead.u.l.prev = &g->uvhead;
  g->uvhead.u.l.next = &g->uvhead;
  g->GCthreshold = 0;  /* mark it as unfinished state */
  g->strt.size = 0;
  g->strt.nuse = 0;
  g->strt.hash = NULL;
  setnilvalue(registry(L));
  luaZ_initbuffer(L, &g->buff);
  g->panic = NULL;
  g->gcstate = GCSpause;
  g->rootgc = obj2gco(L);
  g->sweepstrgc = 0;
  g->sweepgc = &g->rootgc;
  g->gray = NULL;
  g->grayagain = NULL;
  g->weak = NULL;
  g->tmudata = NULL;
  g->totalbytes = sizeof(LG);
  g->gcpause = LUAI_GCPAUSE;
  g->gcstepmul = LUAI_GCMUL;
  g->gcdept = 0;
  for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
  if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
    /* memory allocation error: free partial state */
    close_state(L);
    L = NULL;
  }
  else
    luai_userstateopen(L);
  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, %edx
movl $0x268, %ecx            # imm = 0x268
movq %rdx, %rsi
callq *%rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x13a9e
movq $0x0, -0x8(%rbp)
jmp 0x13cad
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0xb8, %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 $0x21, 0x20(%rax)
movq -0x30(%rbp), %rax
movzbl 0x20(%rax), %eax
andl $0x3, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x28(%rbp), %rax
movzbl 0x9(%rax), %ecx
orl $0x60, %ecx
movb %cl, 0x9(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x13780
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x30(%rbp), %rcx
addq $0xb8, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x30(%rbp), %rcx
addq $0xb8, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl $0x0, 0xa8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x98(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x21(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x30(%rbp), %rcx
addq $0x28, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x30(%rbp), %rax
movq $0x268, 0x78(%rax)      # imm = 0x268
movq -0x30(%rbp), %rax
movl $0xc8, 0x90(%rax)
movq -0x30(%rbp), %rax
movl $0xc8, 0x94(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x88(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x9, -0x1c(%rbp)
jge 0x13c79
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq $0x0, 0xe0(%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x13c54
movq -0x28(%rbp), %rdi
leaq 0x3c(%rip), %rsi        # 0x13cc0
xorl %eax, %eax
movl %eax, %edx
callq 0xb000
cmpl $0x0, %eax
je 0x13ca5
movq -0x28(%rbp), %rdi
callq 0x13db0
movq $0x0, -0x28(%rbp)
jmp 0x13ca5
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)