// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/hashtable.c
// Function: gt_ht_insert
static int
gt_ht_insert(GtHashtable *ht, const void *elem, void **stor_ptr)
{
  htsize_t insert_pos;
  do {
    htsize_t elem_hash = gt_ht_elem_hash_idx(ht, elem), idx,
      link = elem_hash;
    if (HT_GET_LINK(ht, link) == free_mark)
    {
      /* we can insert at initial link and start a new chain */
      insert_pos = link;
      break;
    }
    else if (gt_ht_elem_hash_idx(ht, gt_ht_elem_ptr(ht, link)) != elem_hash)
    {
      /* relocate chained element */
      htsize_t reloc_idx = link, reloc_referent, new_idx;
      gt_ht_traverse_list_of_key(ht, gt_ht_elem_ptr(ht, reloc_idx),,
                              if (link == reloc_idx)
                                break;,
                              reloc_referent = idx;);
      new_idx = gt_ht_find_free_idx(ht, reloc_referent, -1);
      gt_ht_cp_elem(ht, new_idx, gt_ht_elem_ptr(ht, reloc_idx));
      HT_SET_LINK(ht, new_idx,
                  HT_GET_LINK(ht, reloc_idx));
      HT_SET_LINK(ht, reloc_referent, new_idx);
      insert_pos = link;
      break;
    }
    do {
      idx = link;
      link = HT_GET_LINK(ht, idx);
      if (!ht->table_info.cmp(elem, gt_ht_elem_ptr(ht, idx))) {
        if (stor_ptr)
          *stor_ptr = gt_ht_elem_ptr(ht, idx);
        /* don't insert elements already present! */
        return 0;
      }
    } while (link != end_mark);
    {
      /* we can search, starting at idx, for a
       * free position to insert elem */
      htsize_t referent = idx,
        new_idx = gt_ht_find_free_idx(ht, idx, +1);
      HT_SET_LINK(ht, referent, new_idx);
      insert_pos = new_idx;
    }
  } while (0);
  gt_ht_cp_elem(ht, insert_pos, elem);
  if (stor_ptr)
    *stor_ptr = gt_ht_elem_ptr(ht, insert_pos);
  HT_SET_LINK(ht, insert_pos, end_mark);
  ht->current_fill += 1;
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq *(%rbx)
movl %eax, %r12d
andl 0x48(%rbx), %r12d
movq 0x58(%rbx), %rax
cmpl $-0x1, (%rax,%r12,4)
je 0x7809b
movq 0x10(%rbx), %rdi
imulq %r12, %rdi
addq 0x30(%rbx), %rdi
callq *(%rbx)
andl 0x48(%rbx), %eax
cmpl %r12d, %eax
jne 0x78024
movq 0x58(%rbx), %rax
movl %r12d, %r13d
movl (%rax,%r13,4), %r12d
movq 0x10(%rbx), %rsi
imulq %r13, %rsi
addq 0x30(%rbx), %rsi
movq %r15, %rdi
callq *0x18(%rbx)
testl %eax, %eax
je 0x780e9
cmpl $-0x2, %r12d
jne 0x77fdc
movq %rbx, %rdi
movl %r13d, %esi
movl $0x1, %edx
callq 0x79258
movq 0x58(%rbx), %rcx
movl %eax, (%rcx,%r13,4)
movl %eax, %r12d
jmp 0x7809b
movq %r14, (%rsp)
movq 0x10(%rbx), %rdi
imulq %r12, %rdi
addq 0x30(%rbx), %rdi
callq *(%rbx)
andl 0x48(%rbx), %eax
movq 0x58(%rbx), %rcx
movl %eax, %r13d
movl (%rcx,%r13,4), %eax
cmpl %r12d, %eax
je 0x7804d
testl %eax, %eax
jns 0x7803d
movq %rbx, %rdi
movl %r13d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x79258
movl %eax, %ebp
movq 0x10(%rbx), %rdx
movq 0x30(%rbx), %rax
movq %rdx, %rsi
imulq %r12, %rsi
addq %rax, %rsi
movl %ebp, %r14d
movq %rdx, %rdi
imulq %r14, %rdi
addq %rax, %rdi
callq 0xb520
movq 0x58(%rbx), %rax
movl (%rax,%r12,4), %ecx
movl %ecx, (%rax,%r14,4)
movq 0x58(%rbx), %rax
movl %ebp, (%rax,%r13,4)
movq (%rsp), %r14
movq 0x10(%rbx), %rdx
movq %rdx, %rdi
imulq %r12, %rdi
addq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0xb520
testq %r14, %r14
je 0x780c6
movq 0x10(%rbx), %rax
imulq %r12, %rax
addq 0x30(%rbx), %rax
movq %rax, (%r14)
movq 0x58(%rbx), %rax
movl $0xfffffffe, (%rax,%r12,4) # imm = 0xFFFFFFFE
incl 0x54(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
testq %r14, %r14
je 0x780da
imulq 0x10(%rbx), %r13
addq 0x30(%rbx), %r13
movq %r13, (%r14)
jmp 0x780da