// File: /workspace/github_c_makefile_star2_O1/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 $0xa8, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movl 0x8(%rdx), %eax
cmpl $0x3, %eax
je 0x1708f
testl %eax, %eax
jne 0x1709f
leaq 0xaa9e(%rip), %rsi      # 0x21b28
jmp 0x17352
movsd (%r13), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1734b
movq %r14, %rdi
movq %r13, %rsi
callq 0x1735c
movq %rax, %rbx
leaq 0xaa4c(%rip), %rax      # 0x21b00
cmpq %rax, %rbx
je 0x170c3
cmpl $0x0, 0x8(%rbx)
je 0x17304
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
cmpq %rax, %rcx
jbe 0x170e3
leaq -0x28(%rcx), %r12
movq %r12, 0x28(%r14)
cmpl $0x0, -0x10(%rcx)
movq %r12, %rcx
jne 0x170cb
jmp 0x170e6
xorl %r12d, %r12d
testq %r12, %r12
je 0x17141
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x1735c
cmpq %rbx, %rax
je 0x172b9
movq %rax, %rcx
movq 0x20(%rax), %rax
cmpq %rbx, %rax
jne 0x17100
movq %r12, 0x20(%rcx)
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r12)
movupd (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%r12)
movupd %xmm0, (%r12)
movq $0x0, 0x20(%rbx)
movl $0x0, 0x8(%rbx)
jmp 0x172c9
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8c(%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 0x38(%r14), %eax
xorl %ecx, %ecx
movl $0x1, %esi
xorl %r11d, %r11d
movl $0x1, %edx
movl %edx, %edi
cmpl %eax, %edx
jle 0x1719e
movl %eax, %edi
cmpl %eax, %esi
jle 0x1719e
xorl %edi, %edi
jmp 0x171e4
xorl %r8d, %r8d
cmpl %edi, %esi
jg 0x171d9
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 0x171c1
incl %edi
movl %edi, %esi
addl %r8d, 0x20(%rsp,%rcx,4)
addl %r8d, %r11d
movb $0x1, %dil
testb %dil, %dil
je 0x171f4
incq %rcx
addl %edx, %edx
cmpq $0x1f, %rcx
jne 0x1718e
movl %r11d, 0xc(%rsp)
movq %r13, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movb 0xb(%r14), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
notl %eax
leaq (%rax,%rax,4), %rax
leaq 0x28(,%rax,8), %r13
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x20(%r14), %rax
cmpl $0x0, -0x20(%rax,%r13)
je 0x17244
leaq (%rax,%r13), %rdi
addq $-0x18, %rdi
leaq 0x20(%rsp), %rsi
callq 0x17732
addl %eax, %ebp
incl %r15d
addq $-0x28, %r13
jne 0x17221
addl 0xc(%rsp), %ebp
leaq 0x20(%rsp), %r13
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x17732
addl %ebp, %eax
jle 0x172cb
movl $0x1, %esi
xorl %r8d, %r8d
xorl %edx, %edx
xorl %r11d, %r11d
xorl %edi, %edi
movl 0xc(%rsp), %ecx
movl (%r13), %r9d
leal (%r9,%rdi), %r10d
cmpl %r8d, %r10d
setg %r8b
testl %r9d, %r9d
cmovgl %r10d, %edi
setg %r9b
testb %r8b, %r9b
cmovnel %r10d, %r11d
cmovnel %esi, %edx
cmpl %eax, %edi
je 0x172d4
leal (%rsi,%rsi), %r9d
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq $0x4, %r13
movl %esi, %r8d
cmpl %eax, %esi
movl %r9d, %esi
jl 0x17277
jmp 0x172d4
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r12)
movq %r12, 0x20(%rbx)
movq %r12, %rbx
jmp 0x172ff
xorl %r11d, %r11d
xorl %edx, %edx
movl 0xc(%rsp), %ecx
addl %r15d, %ecx
subl %r11d, %ecx
incl %ecx
movq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x16b90
movq %r15, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %r13
movq %r13, %rdx
callq 0x16f5c
testq %r12, %r12
je 0x17339
movq (%r13), %rax
movq %rax, 0x10(%rbx)
movl 0x8(%r13), %eax
movl %eax, 0x18(%rbx)
testb $0x40, 0x8(%r13)
je 0x17336
movq (%r13), %rax
testb $0x3, 0x9(%rax)
je 0x17336
testb $0x4, 0x9(%r14)
je 0x17336
movq %r15, %rdi
movq %r14, %rsi
callq 0xc962
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa7e9(%rip), %rsi      # 0x21b3b
movq %r15, %rdi
xorl %eax, %eax
callq 0xaf1a