// File: /workspace/github_c_makefile_star2_O3/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/ltable.c
// Function: luaH_newkey
TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
  Node *mp;
  if (ttisnil(key)) luaG_runerror(L, "table index is nil");
  else if (ttisnumber(key) && luai_numisnan(L, nvalue(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 *n = getfreepos(t);  /* get a free place */
    if (n == NULL) {  /* cannot find a free place? */
      rehash(L, t, key);  /* grow table */
      /* whatever called 'newkey' take care of TM cache and GC barrier */
      return luaH_set(L, t, key);  /* insert key into grown table */
    }
    lua_assert(!isdummy(n));
    othern = mainposition(t, gkey(mp));
    if (othern != mp) {  /* is colliding node out of its main position? */
      /* yes; move colliding node into free position */
      while (gnext(othern) != mp) othern = gnext(othern);  /* find previous */
      gnext(othern) = n;  /* redo the chain with `n' in place of `mp' */
      *n = *mp;  /* copy colliding node into free pos. (mp->next also goes) */
      gnext(mp) = NULL;  /* now `mp' is free */
      setnilvalue(gval(mp));
    }
    else {  /* colliding node is in its own main position */
      /* new node will go into free position */
      gnext(n) = gnext(mp);  /* chain new position */
      gnext(mp) = n;
      mp = n;
    }
  }
  setobj2t(L, gkey(mp), key);
  luaC_barrierback(L, obj2gco(t), key);
  lua_assert(ttisnil(gval(mp)));
  return gval(mp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movl 0x8(%rdx), %eax
cmpl $0x3, %eax
je 0x1716e
testl %eax, %eax
jne 0x1717e
leaq 0xa9b7(%rip), %rsi      # 0x21b20
jmp 0x17417
movsd (%r13), %xmm0
ucomisd %xmm0, %xmm0
jp 0x17410
movq %r14, %rdi
movq %r13, %rsi
callq 0x17421
movq %rax, %r12
leaq 0xa965(%rip), %rax      # 0x21af8
cmpq %rax, %r12
je 0x171a4
cmpl $0x0, 0x8(%r12)
je 0x173c9
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
cmpq %rax, %rcx
jbe 0x1721c
leaq -0x28(%rcx), %rbx
movq %rbx, 0x28(%r14)
cmpl $0x0, -0x10(%rcx)
movq %rbx, %rcx
jne 0x171ac
leaq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x17421
cmpq %r12, %rax
je 0x173b8
movq %rax, %rcx
movq 0x20(%rax), %rax
cmpq %r12, %rax
jne 0x171d8
movq %rbx, 0x20(%rcx)
movq 0x20(%r12), %rax
movq %rax, 0x20(%rbx)
movupd (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rbx)
movupd %xmm0, (%rbx)
movq $0x0, 0x20(%r12)
movl $0x0, 0x8(%r12)
jmp 0x173c9
movq %r15, (%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x7c(%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 0x38(%r14), %eax
xorl %ecx, %ecx
movl $0x1, %esi
xorl %ebp, %ebp
movl $0x1, %edx
movl %edx, %edi
cmpl %eax, %edx
jle 0x17272
movl %eax, %edi
cmpl %eax, %esi
jg 0x172c0
xorl %r8d, %r8d
cmpl %edi, %esi
jg 0x172ad
movq 0x18(%r14), %r8
movslq %esi, %r10
movslq %edi, %rsi
leaq -0x1(%r10), %r9
shlq $0x4, %r10
addq %r8, %r10
addq $-0x8, %r10
xorl %r8d, %r8d
cmpl $0x1, (%r10)
sbbl $-0x1, %r8d
incq %r9
addq $0x10, %r10
cmpq %rsi, %r9
jl 0x17295
incl %edi
movl %edi, %esi
addl %r8d, 0x10(%rsp,%rcx,4)
addl %r8d, %ebp
incq %rcx
addl %edx, %edx
cmpq $0x1f, %rcx
jne 0x17266
movq %r13, 0x8(%rsp)
movb 0xb(%r14), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
notl %eax
leaq (%rax,%rax,4), %rax
leaq 0x28(,%rax,8), %r15
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
xorl %ebx, %ebx
movq 0x20(%r14), %rax
cmpl $0x0, -0x20(%rax,%r15)
je 0x17309
leaq (%rax,%r15), %rdi
addq $-0x18, %rdi
movq %r12, %rsi
callq 0x177e6
addl %eax, %ebx
incl %r13d
addq $-0x28, %r15
jne 0x172e8
addl %ebp, %ebx
leaq 0x10(%rsp), %r12
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x177e6
addl %ebx, %eax
jle 0x1737b
movl $0x1, %esi
xorl %r8d, %r8d
xorl %edx, %edx
xorl %ecx, %ecx
xorl %edi, %edi
movq (%rsp), %rbx
movl (%r12), %r9d
leal (%r9,%rdi), %r10d
cmpl %r8d, %r10d
setg %r8b
testl %r9d, %r9d
cmovgl %r10d, %edi
setg %r9b
testb %r8b, %r9b
cmovnel %r10d, %ecx
cmovnel %esi, %edx
cmpl %eax, %edi
je 0x17383
leal (%rsi,%rsi), %r9d
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq $0x4, %r12
movl %esi, %r8d
cmpl %eax, %esi
movl %r9d, %esi
jb 0x17339
jmp 0x17383
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 0x16c6f
movq %rbx, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1703b
movq 0x20(%r12), %rax
movq %rax, 0x20(%rbx)
movq %rbx, 0x20(%r12)
movq %rbx, %r12
movq (%r13), %rax
movq %rax, 0x10(%r12)
movl 0x8(%r13), %eax
movl %eax, 0x18(%r12)
testb $0x40, %al
je 0x173fb
movq (%r13), %rax
testb $0x3, 0x9(%rax)
je 0x173fb
testb $0x4, 0x9(%r14)
je 0x173fb
movq %r15, %rdi
movq %r14, %rsi
callq 0xca79
movq %r12, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa71c(%rip), %rsi      # 0x21b33
movq %r15, %rdi
xorl %eax, %eax
callq 0xb027