// File: /workspace/github_c_makefile_star2_O2/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, %r15
movl 0x8(%rdx), %eax
cmpl $0x3, %eax
je 0xedca
testl %eax, %eax
jne 0xee03
leaq 0x10f3b(%rip), %rsi     # 0x1fd00
jmp 0xf098
leaq 0x30(%rsp), %rsi
movq %rbp, %rdi
xorl %edx, %edx
callq 0xfed4
testl %eax, %eax
je 0xedf4
movq 0x30(%rsp), %rax
leaq 0x20(%rsp), %rbp
movq %rax, (%rbp)
movl $0x13, 0x8(%rbp)
jmp 0xee03
movsd (%rbp), %xmm0
ucomisd %xmm0, %xmm0
jp 0xf091
movq %r14, %rdi
movq %rbp, %rsi
callq 0xf0a2
movq %rax, %r12
leaq 0x10ec8(%rip), %rax     # 0x1fce0
cmpq %rax, %r12
je 0xee29
cmpl $0x0, 0x8(%r12)
je 0xf04b
movq 0x18(%r14), %rax
movq 0x20(%r14), %rbx
xorl %r13d, %r13d
leaq (%rbx,%r13), %rcx
cmpq %rax, %rcx
jbe 0xeed3
leaq (%rbx,%r13), %rcx
addq $-0x20, %rcx
movq %rcx, 0x20(%r14)
addq $-0x20, %r13
cmpl $0x0, 0x18(%rcx)
jne 0xee34
leaq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0xf0a2
leaq (%rbx,%r13), %rcx
cmpq %r12, %rax
je 0xf011
movq %rax, %rdx
movslq 0x1c(%rax), %rax
shlq $0x5, %rax
addq %rdx, %rax
cmpq %r12, %rax
jne 0xee71
movq %rbx, %rax
subq %rdx, %rax
addq %r13, %rax
shrq $0x5, %rax
movl %eax, 0x1c(%rdx)
movupd (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rcx)
movupd %xmm0, (%rcx)
cmpl $0x0, 0x1c(%r12)
je 0xeec8
movq %r12, %rax
subq %rbx, %rax
subq %r13, %rax
shrq $0x5, %rax
addl %eax, 0x1c(%rbx,%r13)
andl $0x0, 0x1c(%r12)
andl $0x0, 0x8(%r12)
jmp 0xf04b
xorl %eax, %eax
cmpq $0x20, %rax
je 0xeee5
andl $0x0, 0x30(%rsp,%rax,4)
incq %rax
jmp 0xeed5
movq %rbp, 0x10(%rsp)
xorl %eax, %eax
pushq $0x1
popq %rcx
xorl %ebp, %ebp
movl %ecx, %edx
cmpq $0x20, %rax
je 0xef35
movl 0xc(%r14), %edi
movl %ecx, %esi
cmpl %edi, %ecx
jbe 0xef09
movl %edi, %esi
cmpl %edi, %edx
ja 0xef35
xorl %edi, %edi
cmpl %esi, %edx
ja 0xef28
movq 0x10(%r14), %r8
leal -0x1(%rdx), %r9d
shlq $0x4, %r9
cmpl $0x1, 0x8(%r8,%r9)
sbbl $-0x1, %edi
incl %edx
jmp 0xef0b
addl %edi, 0x30(%rsp,%rax,4)
addl %edi, %ebp
incq %rax
addl %ecx, %ecx
jmp 0xeef3
movq %r15, 0x18(%rsp)
movb 0xb(%r14), %cl
pushq $0x1
popq %r13
movl %r13d, %eax
shll %cl, %eax
cltq
xorl %ebx, %ebx
leaq 0x30(%rsp), %r12
movl $0x0, 0xc(%rsp)
movq %rax, %r15
negq %r15
shlq $0x5, %rax
orq $0x10, %rax
incq %r15
cmpq $0x1, %r15
je 0xef9a
leaq -0x20(%rax), %rcx
movq 0x18(%r14), %rdi
cmpl $0x0, -0x28(%rdi,%rax)
movq %rcx, %rax
je 0xef66
addq %rcx, %rdi
movq %r12, %rsi
callq 0xf403
addl %eax, %ebx
incl 0xc(%rsp)
negq %r15
movq %r15, %rax
jmp 0xef5b
addl %ebp, %ebx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xf403
addl %ebx, %eax
xorl %esi, %esi
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x18(%rsp), %rbx
movl %r13d, %edi
shrl %edi
cmpl %edi, %eax
jbe 0xefe7
movl (%r12), %r8d
addl %r8d, %esi
cmpl %edi, %esi
movl %ecx, %edi
cmoval %esi, %edi
movl %edx, %r9d
cmoval %r13d, %r9d
testl %r8d, %r8d
cmovnel %edi, %ecx
cmovnel %r9d, %edx
addl %r13d, %r13d
addq $0x4, %r12
jmp 0xefb6
addl 0xc(%rsp), %ebp
subl %ecx, %ebp
incl %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0xea32
movq %rbx, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq 0xecaa
movq %rax, %r12
jmp 0xf07c
movslq 0x1c(%r12), %rax
testq %rax, %rax
je 0xf039
shlq $0x5, %rax
movq %r12, %rdx
subq %rbx, %rdx
addq %rax, %rdx
subq %r13, %rdx
shrq $0x5, %rdx
movl %edx, 0x1c(%rbx,%r13)
addq %r13, %rbx
jmp 0xf03c
addq %r13, %rbx
subq %r12, %rbx
shrq $0x5, %rbx
movl %ebx, 0x1c(%r12)
movq %rcx, %r12
movq (%rbp), %rax
movq %rax, 0x10(%r12)
movl 0x8(%rbp), %eax
movl %eax, 0x18(%r12)
testb $0x40, %al
je 0xf07c
testb $0x4, 0x9(%r14)
je 0xf07c
movq (%rbp), %rax
testb $0x3, 0x9(%rax)
je 0xf07c
movq %r15, %rdi
movq %r14, %rsi
callq 0x9823
movq %r12, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10c7b(%rip), %rsi     # 0x1fd13
movq %r15, %rdi
xorl %eax, %eax
callq 0x7930