// File: /workspace/github_c_makefile_star2_O2/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 0x15b06
testl %eax, %eax
jne 0x15b16
leaq 0xa007(%rip), %rsi      # 0x1fb08
jmp 0x15d7c
movsd (%r13), %xmm0
ucomisd %xmm0, %xmm0
jp 0x15d75
movq %r14, %rdi
movq %r13, %rsi
callq 0x15d86
movq %rax, %r12
leaq 0x9fb5(%rip), %rax      # 0x1fae0
cmpq %rax, %r12
je 0x15b3c
cmpl $0x0, 0x8(%r12)
je 0x15d2e
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
cmpq %rax, %rcx
jbe 0x15bae
leaq -0x28(%rcx), %rbx
movq %rbx, 0x28(%r14)
cmpl $0x0, -0x10(%rcx)
movq %rbx, %rcx
jne 0x15b44
leaq 0x10(%r12), %rsi
movq %r14, %rdi
callq 0x15d86
cmpq %r12, %rax
je 0x15d1d
movq %rax, %rcx
movq 0x20(%rax), %rax
cmpq %r12, %rax
jne 0x15b70
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)
andq $0x0, 0x20(%r12)
andl $0x0, 0x8(%r12)
jmp 0x15d2e
xorl %eax, %eax
cmpq $0x1f, %rax
je 0x15bc0
andl $0x0, 0x20(%rsp,%rax,4)
incq %rax
jmp 0x15bb0
xorl %eax, %eax
pushq $0x1
popq %rcx
xorl %ebp, %ebp
movl %ecx, %edx
cmpq $0x1f, %rax
je 0x15c28
movl 0x38(%r14), %esi
movl %ecx, %edi
cmpl %esi, %ecx
jle 0x15bdf
movl %esi, %edi
cmpl %esi, %edx
jg 0x15c28
movslq %edx, %rsi
movslq %edi, %rdx
incq %rdx
cmpq %rsi, %rdx
cmovleq %rsi, %rdx
movq %rdx, %rdi
subq %rsi, %rdi
shlq $0x4, %rsi
addq $-0x8, %rsi
xorl %r8d, %r8d
subq $0x1, %rdi
jb 0x15c19
movq 0x18(%r14), %r9
cmpl $0x1, (%r9,%rsi)
sbbl $-0x1, %r8d
addq $0x10, %rsi
jmp 0x15c00
addl %r8d, 0x20(%rsp,%rax,4)
addl %r8d, %ebp
incq %rax
addl %ecx, %ecx
jmp 0x15bc9
movq %r13, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movb 0xb(%r14), %cl
pushq $0x1
popq %rbx
movl %ebx, %eax
shll %cl, %eax
movslq %eax, %r15
xorl %r13d, %r13d
leaq 0x20(%rsp), %r12
movl $0x0, 0xc(%rsp)
imulq $0x28, %r15, %rax
negq %r15
addq $0x10, %rax
incq %r15
cmpq $0x1, %r15
je 0x15c8d
leaq -0x28(%rax), %rcx
movq 0x20(%r14), %rdi
cmpl $0x0, -0x30(%rdi,%rax)
movq %rcx, %rax
je 0x15c5b
addq %rcx, %rdi
movq %r12, %rsi
callq 0x160cb
addl %eax, %r13d
incl 0xc(%rsp)
negq %r15
jmp 0x15c50
addl %ebp, %r13d
movq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x160cb
addl %r13d, %eax
movq %r15, %r13
xorl %esi, %esi
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x18(%rsp), %r15
movl %ebx, %edi
shrl %edi
cmpl %eax, %edi
jae 0x15ce9
movl (%r12), %r8d
leal (%r8,%rsi), %r9d
cmpl %edi, %r9d
setg %dil
testl %r8d, %r8d
cmovgl %r9d, %esi
setg %r8b
testb %dil, %r8b
cmovnel %r9d, %ecx
cmovnel %ebx, %edx
cmpl %eax, %esi
je 0x15ce9
addl %ebx, %ebx
addq $0x4, %r12
jmp 0x15cb1
addl 0xc(%rsp), %ebp
subl %ecx, %ebp
incl %ebp
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0x15728
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x159e4
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 0x15d60
movq (%r13), %rax
testb $0x3, 0x9(%rax)
je 0x15d60
testb $0x4, 0x9(%r14)
je 0x15d60
movq %r15, %rdi
movq %r14, %rsi
callq 0xc1db
movq %r12, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9d9f(%rip), %rsi      # 0x1fb1b
movq %r15, %rdi
xorl %eax, %eax
callq 0xaa89