// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/uint64hashtable.c
// Function: gt_uint64hashtable_insertionindex
GtUword gt_uint64hashtable_insertionindex(GtUint64hashtable *table,
                                                uint64_t key)
{
  gt_assert(table != NULL);
  if (key > 0)
  {
    size_t pos, hashadd = 0, iteration;
    const uint64_t emptymark = 0;

#ifndef NDEBUG
    size_t first_pos;
#endif
    pos = gt_uint64hashtable_h1(key, table->alloc);
#ifndef NDEBUG
    first_pos = pos;
#endif
    for (iteration = 0; iteration < table->alloc; iteration++)
    {
      gt_assert(pos < table->alloc);
      if (table->hspace[pos].key == emptymark)
      {
        return ULONG_MAX;
      }
      if (table->hspace[pos].key == key)
      {
        gt_assert(table->hspace[pos].count > 0);
        return --table->hspace[pos].count;
      }
      table->countcollisions++;
      if (hashadd == 0)
      {
        hashadd = gt_uint64hashtable_h2(key, table->alloc);
      }
      gt_assert(hashadd > 0);
      pos += hashadd;
      if (pos >= table->alloc)
      {
        pos -= table->alloc;
      }
      gt_assert(pos != first_pos);
    }
    fprintf(stderr, "function %s, file %s, line %d.\n"
                    "Cannot find empty slot in hashtable: "
                    "This is probably a bug, please report it.\n",
                    __func__, __FILE__, __LINE__);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  } else
  {
    gt_assert(table->zero_occurs);
    gt_assert(table->zero_count > 0);
    return --table->zero_count;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x18c0a0
testq %rsi, %rsi
je 0x18c059
movq (%rdi), %r10
movq 0x10(%rdi), %r11
movq %rsi, %rax
shrq $0x20, %rax
imull $0x9e3779b1, %esi, %edx # imm = 0x9E3779B1
imull $0x9e3779b1, %eax, %eax # imm = 0x9E3779B1
movl %eax, %r8d
roll $0xe, %r8d
movl %eax, %ecx
subl %r8d, %ecx
movl %ecx, %r8d
roll $0xb, %r8d
xorl %ecx, %edx
subl %r8d, %edx
xorl %edx, %eax
movl %edx, %r8d
roll $0x19, %r8d
subl %r8d, %eax
xorl %eax, %ecx
movl %eax, %r8d
roll $0x10, %r8d
subl %r8d, %ecx
xorl %ecx, %edx
movl %ecx, %r8d
roll $0x4, %r8d
subl %r8d, %edx
xorl %edx, %eax
roll $0xe, %edx
subl %edx, %eax
xorl %eax, %ecx
roll $0x18, %eax
subl %eax, %ecx
xorl %r9d, %r9d
movq %rcx, %rax
xorl %edx, %edx
divq %r11
movq %rdx, %r8
leaq -0x1(%r11), %rbx
cmpq $0x1, %r11
movq %r11, %r14
adcq $0x0, %r14
movq %rdx, %r15
cmpq %r11, %r15
jae 0x18c096
movq %r15, %rax
shlq $0x4, %rax
movq (%r10,%rax), %rdx
testq %rdx, %rdx
je 0x18c071
cmpq %rsi, %rdx
je 0x18c07a
incq 0x18(%rdi)
testq %r9, %r9
jne 0x18c038
movq %rcx, %rax
xorl %edx, %edx
divq %rbx
movq %rdx, %r9
incq %r9
addq %r9, %r15
cmpq %r11, %r15
movl $0x0, %eax
cmovaeq %r11, %rax
subq %rax, %r15
cmpq %r8, %r15
je 0x18c09b
decq %r14
jne 0x18c003
callq 0x5a697
cmpb $0x0, 0x30(%rdi)
je 0x18c0a5
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x18c0aa
addq $0x20, %rdi
movq %rdi, %r10
jmp 0x18c08a
movq $-0x1, %rax
jmp 0x18c090
addq %rax, %r10
movq 0x8(%r10), %rax
testq %rax, %rax
je 0x18c0af
addq $0x8, %r10
decq %rax
movq %rax, (%r10)
popq %rbx
popq %r14
popq %r15
retq
callq 0x5a65e
callq 0x5a6cc
callq 0x5a7b0
callq 0x5a73e
callq 0x5a777
callq 0x5a705