// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/lua-5.1.5/src/ltable.c
// Function: newkey
static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
  Node *mp = mainposition(t, key);
  if (!ttisnil(gval(mp)) || mp == dummynode) {
    Node *othern;
    Node *n = getfreepos(t);  /* get a free place */
    if (n == NULL) {  /* cannot find a free place? */
      rehash(L, t, key);  /* grow table */
      return luaH_set(L, t, key);  /* re-insert key into grown table */
    }
    lua_assert(n != dummynode);
    othern = mainposition(t, key2tval(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;
    }
  }
  gkey(mp)->value = key->value; gkey(mp)->tt = key->tt;
  luaC_barriert(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 $0x98, %rsp
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x5f454
movq %rax, %r15
leaq 0x8e593(%rip), %rax     # 0xed748
cmpq %rax, %r15
je 0x5f1c5
cmpl $0x0, 0x8(%r15)
je 0x5f401
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
leaq -0x28(%rcx), %r14
movq %r14, 0x28(%rbx)
cmpq %rax, %rcx
jbe 0x5f1e5
cmpl $0x0, -0x10(%rcx)
movq %r14, %rcx
jne 0x5f1cd
jmp 0x5f1e8
xorl %r14d, %r14d
testq %r14, %r14
je 0x5f241
leaq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x5f454
cmpq %r15, %rax
je 0x5f3b3
movq %rax, %rcx
movq 0x20(%rax), %rax
cmpq %r15, %rax
jne 0x5f202
movq %r14, 0x20(%rcx)
movq 0x20(%r15), %rax
movq %rax, 0x20(%r14)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movq $0x0, 0x20(%r15)
movl $0x0, 0x8(%r15)
jmp 0x5f3c2
xorps %xmm0, %xmm0
movups %xmm0, 0x7c(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl 0x38(%rbx), %ecx
xorl %edx, %edx
movl $0x1, %edi
xorl %ebp, %ebp
movl $0x1, %esi
movl %esi, %r8d
cmpl %ecx, %esi
jle 0x5f28b
movl %ecx, %r8d
cmpl %ecx, %edi
jle 0x5f28b
xorl %r8d, %r8d
jmp 0x5f2d4
xorl %r9d, %r9d
cmpl %r8d, %edi
jg 0x5f2c9
movq 0x18(%rbx), %r9
movslq %edi, %r11
movslq %r8d, %rdi
leaq -0x1(%r11), %r10
shlq $0x4, %r11
addq %r9, %r11
addq $-0x8, %r11
xorl %r9d, %r9d
cmpl $0x1, (%r11)
sbbl $-0x1, %r9d
incq %r10
addq $0x10, %r11
cmpq %rdi, %r10
jl 0x5f2af
incl %r8d
movl %r8d, %edi
addl %r9d, 0x20(%rsp,%rdx,4)
addl %r9d, %ebp
movb $0x1, %r8b
testb %r8b, %r8b
je 0x5f2e4
incq %rdx
addl %esi, %esi
cmpq $0x1b, %rdx
jne 0x5f278
movl %ebp, 0x4(%rsp)
movq %r13, 0x18(%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movb 0xb(%rbx), %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
shll %cl, %r15d
notl %r15d
leaq (%r15,%r15,4), %rcx
incq %r15
leaq (%rax,%rcx,8), %r13
addq $0x10, %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpl $0x0, -0x8(%r13)
je 0x5f333
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
callq 0x5f4f5
addl %eax, %r12d
incl %ebp
addq $-0x28, %r13
decq %r15
jne 0x5f31a
addl 0x4(%rsp), %r12d
leaq 0x20(%rsp), %r13
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0x5f4f5
addl %r12d, %eax
jle 0x5f3c4
movl $0x1, %esi
xorl %r8d, %r8d
xorl %edx, %edx
xorl %r11d, %r11d
xorl %edi, %edi
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r12
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 0x5f3d3
leal (%rsi,%rsi), %r9d
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq $0x4, %r13
movl %esi, %r8d
cmpl %eax, %esi
movl %r9d, %esi
jl 0x5f371
jmp 0x5f3d3
movq 0x20(%r15), %rax
movq %rax, 0x20(%r14)
movq %r14, 0x20(%r15)
movq %r14, %r15
jmp 0x5f3fc
xorl %r11d, %r11d
xorl %edx, %edx
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r12
movl 0x4(%rsp), %ecx
addl %ebp, %ecx
subl %r11d, %ecx
incl %ecx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5f565
movq %r12, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %r13
movq %r13, %rdx
callq 0x59204
testq %r14, %r14
je 0x5f442
movq (%r13), %rax
movq %rax, 0x10(%r15)
movl 0x8(%r13), %eax
movl %eax, 0x18(%r15)
cmpl $0x4, 0x8(%r13)
jl 0x5f43f
movq (%r13), %rax
testb $0x3, 0x9(%rax)
je 0x5f43f
movb 0x9(%rbx), %al
testb $0x4, %al
je 0x5f43f
movq 0x20(%r12), %rcx
andb $-0x5, %al
movb %al, 0x9(%rbx)
movq 0x40(%rcx), %rax
movq %rax, 0x30(%rbx)
movq %rbx, 0x40(%rcx)
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq