// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/ltable.c
// Function: luaH_newkey
TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
  Node *mp;
  TValue aux;
  if (ttisnil(key)) luaG_runerror(L, "table index is nil");
  else if (ttisfloat(key)) {
    lua_Integer k;
    if (luaV_tointeger(key, &k, 0)) {  /* index is int? */
      setivalue(&aux, k);
      key = &aux;  /* insert it as an integer */
    }
    else if (luai_numisnan(fltvalue(key)))
      luaG_runerror(L, "table index is NaN");
  }
  mp = mainposition(t, key);
  if (!ttisnil(gval(mp)) || isdummy(mp)) {  /* main position is taken? */
    Node *othern;
    Node *f = getfreepos(t);  /* get a free place */
    if (f == NULL) {  /* cannot find a free place? */
      rehash(L, t, key);  /* grow table */
      /* whatever called 'newkey' takes care of TM cache */
      return luaH_set(L, t, key);  /* insert key into grown table */
    }
    lua_assert(!isdummy(f));
    othern = mainposition(t, gkey(mp));
    if (othern != mp) {  /* is colliding node out of its main position? */
      /* yes; move colliding node into free position */
      while (othern + gnext(othern) != mp)  /* find previous */
        othern += gnext(othern);
      gnext(othern) = cast_int(f - othern);  /* rechain to point to 'f' */
      *f = *mp;  /* copy colliding node into free pos. (mp->next also goes) */
      if (gnext(mp) != 0) {
        gnext(f) += cast_int(mp - f);  /* correct 'next' */
        gnext(mp) = 0;  /* now 'mp' is free */
      }
      setnilvalue(gval(mp));
    }
    else {  /* colliding node is in its own main position */
      /* new node will go into free position */
      if (gnext(mp) != 0)
        gnext(f) = cast_int((mp + gnext(mp)) - f);  /* chain new position */
      else lua_assert(gnext(f) == 0);
      gnext(mp) = cast_int(f - mp);
      mp = f;
    }
  }
  setnodekey(L, &mp->i_key, key);
  luaC_barrierback(L, t, key);
  lua_assert(ttisnil(gval(mp)));
  return gval(mp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x17670
movq -0x10(%rbp), %rdi
leaq 0x1da77(%rip), %rsi     # 0x350e0
movb $0x0, %al
callq 0x98e0
movq -0x20(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x176e2
movq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x19870
cmpl $0x0, %eax
je 0x176b6
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movl $0x13, 0x8(%rax)
leaq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x176e0
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movq -0x20(%rbp), %rax
ucomisd (%rax), %xmm0
jne 0x176cc
jp 0x176cc
jmp 0x176de
movq -0x10(%rbp), %rdi
leaq 0x1da1c(%rip), %rsi     # 0x350f3
movb $0x0, %al
callq 0x98e0
jmp 0x176e0
jmp 0x176e2
jmp 0x176e4
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x17900
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x17710
leaq 0x1d9a2(%rip), %rax     # 0x350a8
cmpq %rax, -0x28(%rbp)
jne 0x1787a
movq -0x18(%rbp), %rdi
callq 0x17b90
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x1774f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x17bf0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x17480
movq %rax, -0x8(%rbp)
jmp 0x178f5
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
callq 0x17900
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x17823
jmp 0x17774
movq -0x50(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq -0x28(%rbp), %rax
je 0x177a8
movq -0x50(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x17774
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x17816
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x1c(%rax), %ecx
movl %ecx, 0x1c(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x17878
movq -0x28(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x17856
movq -0x28(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x58(%rbp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x17858
jmp 0x17858
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1787a
movq -0x28(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x178eb
movq -0x18(%rbp), %rax
movzbl 0x9(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x178eb
movq -0x20(%rbp), %rax
movq (%rax), %rax
movzbl 0x9(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x178eb
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xd820
jmp 0x178ed
jmp 0x178ed
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop