// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdx), %eax
cmpl $0x3, %eax
je 0xfb52
testl %eax, %eax
jne 0xfb8e
leaq 0x1211b(%rip), %rsi     # 0x21c68
jmp 0xfe6e
leaq 0x20(%rsp), %rsi
movq %rbp, %rdi
xorl %edx, %edx
callq 0x10e26
testl %eax, %eax
je 0xfb7f
movq 0x20(%rsp), %rax
leaq 0xa8(%rsp), %rbp
movq %rax, (%rbp)
movl $0x13, 0x8(%rbp)
jmp 0xfb8e
movsd (%rbp), %xmm0
ucomisd %xmm0, %xmm0
jp 0xfe67
movq %r14, %rdi
movq %rbp, %rsi
callq 0xfe78
movq %rax, %r15
leaq 0x120a5(%rip), %rax     # 0x21c48
cmpq %rax, %r15
je 0xfbb3
cmpl $0x0, 0x8(%r15)
je 0xfe21
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
cmpq %rax, %rcx
jbe 0xfbd3
leaq -0x20(%rcx), %r12
movq %r12, 0x20(%r14)
cmpl $0x0, -0x8(%rcx)
movq %r12, %rcx
jne 0xfbbb
jmp 0xfbd6
xorl %r12d, %r12d
testq %r12, %r12
je 0xfc51
leaq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0xfe78
cmpq %r15, %rax
je 0xfdb9
movq %rax, %rcx
movslq 0x1c(%rax), %rax
shlq $0x5, %rax
addq %rcx, %rax
cmpq %r15, %rax
jne 0xfbf0
movq %r12, %rax
subq %rcx, %rax
shrq $0x5, %rax
movl %eax, 0x1c(%rcx)
movupd (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%r12)
movupd %xmm0, (%r12)
cmpl $0x0, 0x1c(%r15)
je 0xfc44
movq %r15, %rax
subq %r12, %rax
shrq $0x5, %rax
addl %eax, 0x1c(%r12)
movl $0x0, 0x1c(%r15)
movl $0x0, 0x8(%r15)
jmp 0xfde6
movq %rbp, 0x18(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x90(%rsp)
movapd %xmm0, 0x80(%rsp)
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movl 0xc(%r14), %eax
xorl %ecx, %ecx
movl $0x1, %edx
xorl %r11d, %r11d
movl $0x1, %esi
movl %esi, %edi
cmpl %eax, %esi
jbe 0xfcb3
movl %eax, %edi
cmpl %eax, %edx
jbe 0xfcb3
xorl %edi, %edi
jmp 0xfce4
xorl %r8d, %r8d
cmpl %edi, %edx
ja 0xfcd9
movq 0x10(%r14), %r9
xorl %r8d, %r8d
leal -0x1(%rdx), %r10d
shlq $0x4, %r10
cmpl $0x1, 0x8(%r9,%r10)
sbbl $-0x1, %r8d
incl %edx
cmpl %edi, %edx
jbe 0xfcc1
addl %r8d, 0x20(%rsp,%rcx,4)
addl %r8d, %r11d
movb $0x1, %dil
testb %dil, %dil
je 0xfcf4
incq %rcx
addl %esi, %esi
cmpq $0x20, %rcx
jne 0xfca3
movl %r11d, 0x4(%rsp)
movq %r15, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movb 0xb(%r14), %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
shll %cl, %ebp
notl %ebp
shlq $0x5, %rbp
orq $0x10, %rbp
xorl %r15d, %r15d
leaq 0x20(%rsp), %r13
xorl %ebx, %ebx
movq 0x18(%r14), %rdi
cmpl $0x0, -0x8(%rdi,%rbp)
je 0xfd3d
addq %rbp, %rdi
movq %r13, %rsi
callq 0x1024a
addl %eax, %ebx
incl %r15d
addq $-0x20, %rbp
cmpq $-0x10, %rbp
jne 0xfd22
addl 0x4(%rsp), %ebx
leaq 0x20(%rsp), %r13
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1024a
addl %ebx, %eax
je 0xfde8
movl $0x1, %esi
xorl %r8d, %r8d
xorl %edx, %edx
xorl %r11d, %r11d
xorl %edi, %edi
movq 0x8(%rsp), %rbx
movl (%r13), %r9d
addl %r9d, %edi
cmpl %r8d, %edi
movl %r11d, %r8d
cmoval %edi, %r8d
movl %edx, %r10d
cmoval %esi, %r10d
testl %r9d, %r9d
cmovnel %r8d, %r11d
cmovnel %r10d, %edx
leal (%rsi,%rsi), %r9d
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq $0x4, %r13
movl %esi, %r8d
cmpl %esi, %eax
movl %r9d, %esi
ja 0xfd7c
jmp 0xfdf2
movslq 0x1c(%r15), %rax
testq %rax, %rax
je 0xfdd5
shlq $0x5, %rax
addq %r15, %rax
subq %r12, %rax
shrq $0x5, %rax
movl %eax, 0x1c(%r12)
movq %r12, %rax
subq %r15, %rax
shrq $0x5, %rax
movl %eax, 0x1c(%r15)
movq %r12, %r15
jmp 0xfe1c
xorl %r11d, %r11d
xorl %edx, %edx
movq 0x8(%rsp), %rbx
movl 0x4(%rsp), %ecx
addl %r15d, %ecx
subl %r11d, %ecx
incl %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf78b
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xfa25
movq 0x10(%rsp), %r15
testq %r12, %r12
je 0xfe55
movq (%rbp), %rax
movq %rax, 0x10(%r15)
movl 0x8(%rbp), %eax
movl %eax, 0x18(%r15)
testb $0x40, 0x8(%rbp)
je 0xfe52
testb $0x4, 0x9(%r14)
je 0xfe52
movq (%rbp), %rax
testb $0x3, 0x9(%rax)
je 0xfe52
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ee6
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11e0d(%rip), %rsi     # 0x21c7b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7cd8