// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdx), %eax
cmpl $0x3, %eax
je 0x10187
testl %eax, %eax
jne 0x101c3
leaq 0x12b56(%rip), %rsi     # 0x22cd8
jmp 0x1049c
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x116b2
testl %eax, %eax
je 0x101b4
movq 0x10(%rsp), %rax
leaq 0x98(%rsp), %r15
movq %rax, (%r15)
movl $0x13, 0x8(%r15)
jmp 0x101c3
movsd (%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x10495
movq %r14, %rdi
movq %r15, %rsi
callq 0x104a6
movq %rax, %r12
leaq 0x12ae0(%rip), %rax     # 0x22cb8
cmpq %rax, %r12
je 0x101e9
cmpl $0x0, 0x8(%r12)
je 0x10450
movq 0x18(%r14), %rax
movq 0x20(%r14), %r13
xorl %ebp, %ebp
movq %r13, %rcx
addq %rbp, %rcx
cmpq %rax, %rcx
jbe 0x1029f
leaq -0x20(,%rbp), %rcx
addq %r13, %rcx
movq %rcx, 0x20(%r14)
addq $-0x20, %rbp
cmpl $0x0, 0x18(%rcx)
jne 0x101f3
leaq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x104a6
movq %r13, %rcx
addq %rbp, %rcx
cmpq %r12, %rax
je 0x10416
movq %rax, %rdx
movslq 0x1c(%rax), %rax
shlq $0x5, %rax
addq %rdx, %rax
cmpq %r12, %rax
jne 0x10237
movq %r13, %rax
subq %rdx, %rax
addq %rbp, %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 0x10291
movq %r12, %rax
subq %r13, %rax
subq %rbp, %rax
shrq $0x5, %rax
addl %eax, 0x1c(%r13,%rbp)
movl $0x0, 0x1c(%r12)
movl $0x0, 0x8(%r12)
jmp 0x10450
movq %rbx, (%rsp)
xorpd %xmm0, %xmm0
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)
movapd %xmm0, 0x10(%rsp)
movl 0xc(%r14), %eax
xorl %ecx, %ecx
movl $0x1, %edx
xorl %ebp, %ebp
movl $0x1, %esi
movl %esi, %edi
cmpl %eax, %esi
jbe 0x102f8
movl %eax, %edi
cmpl %eax, %edx
ja 0x10331
xorl %r8d, %r8d
cmpl %edi, %edx
ja 0x1031e
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 0x10306
addl %r8d, 0x10(%rsp,%rcx,4)
addl %r8d, %ebp
incq %rcx
addl %esi, %esi
cmpq $0x20, %rcx
jne 0x102ec
movq %r15, 0x8(%rsp)
movb 0xb(%r14), %cl
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
shll %cl, %ebx
notl %ebx
shlq $0x5, %rbx
orq $0x10, %rbx
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
xorl %r15d, %r15d
movq 0x18(%r14), %rdi
cmpl $0x0, -0x8(%rdi,%rbx)
je 0x10372
addq %rbx, %rdi
movq %r12, %rsi
callq 0x108c1
addl %eax, %r15d
incl %r13d
addq $-0x20, %rbx
cmpq $-0x10, %rbx
jne 0x10356
addl %ebp, %r15d
leaq 0x10(%rsp), %r12
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x108c1
addl %r15d, %eax
je 0x103e5
movl $0x1, %esi
xorl %r8d, %r8d
xorl %edx, %edx
xorl %ecx, %ecx
xorl %edi, %edi
movq (%rsp), %rbx
movl (%r12), %r9d
addl %r9d, %edi
cmpl %r8d, %edi
movl %ecx, %r8d
cmoval %edi, %r8d
movl %edx, %r10d
cmoval %esi, %r10d
testl %r9d, %r9d
cmovnel %r8d, %ecx
cmovnel %r10d, %edx
leal (%rsi,%rsi), %r9d
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq $0x4, %r12
movl %esi, %r8d
cmpl %esi, %eax
movl %r9d, %esi
ja 0x103a8
jmp 0x103ed
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rsp), %rbx
addl %r13d, %ebp
subl %ecx, %ebp
incl %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0xfcc2
movq %rbx, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
callq 0x1005a
movq %rax, %r12
jmp 0x10480
movslq 0x1c(%r12), %rax
testq %rax, %rax
je 0x1043e
shlq $0x5, %rax
movq %r12, %rdx
subq %r13, %rdx
addq %rax, %rdx
subq %rbp, %rdx
shrq $0x5, %rdx
movl %edx, 0x1c(%r13,%rbp)
addq %rbp, %r13
jmp 0x10441
addq %rbp, %r13
subq %r12, %r13
shrq $0x5, %r13
movl %r13d, 0x1c(%r12)
movq %rcx, %r12
movq (%r15), %rax
movq %rax, 0x10(%r12)
movl 0x8(%r15), %eax
movl %eax, 0x18(%r12)
testb $0x40, %al
je 0x10480
testb $0x4, 0x9(%r14)
je 0x10480
movq (%r15), %rax
testb $0x3, 0x9(%rax)
je 0x10480
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa246
movq %r12, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1284f(%rip), %rsi     # 0x22ceb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7dd3