// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/hashtable.c
// Function: gt_hashtable_foreach_ordered
int gt_hashtable_foreach_ordered(GtHashtable *ht, Elemvisitfunc iter,
                                 void *data, GtCompare cmp, GtError *err)
{
  GtArray *hash_entries;
  void *elem;
  GtUword i;
  int had_err;
  gt_error_check(err);
  gt_assert(ht && iter && cmp);
  gt_rwlock_wrlock(ht->lock);
  hash_entries = gt_array_new(ht->table_info.elem_size);
  {
    struct hash_to_array_data visitor_data = { ht->table_info.elem_size,
                                               hash_entries };

    had_err = gt_hashtable_foreach_g(ht, gt_ht_save_entry_to_array,
                                     &visitor_data, err, false);
  }
  gt_rwlock_unlock(ht->lock);
  if (!had_err) {
    size_t hash_size;
    gt_qsort_r(gt_array_get_space(hash_entries), gt_array_size(hash_entries),
               gt_array_elem_size(hash_entries), data, (GtCompareWithData)cmp);
    hash_size = gt_array_size(hash_entries);
    gt_assert(hash_size == gt_hashtable_fill(ht));
    for (i = 0; !had_err && i < hash_size; i++) {
      elem = gt_array_get(hash_entries, i);
      had_err = iter(elem, data, err);
    }
  }
  gt_array_delete(hash_entries);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %r14
testq %r8, %r8
je 0x56c2f
movq %rbx, %rdi
callq 0xc103
testb %al, %al
jne 0x56d63
testq %r14, %r14
je 0x56d35
testq %r15, %r15
je 0x56d35
testq %rbp, %rbp
je 0x56d35
movq 0x68(%r14), %rdi
callq 0x15e99
movq 0x10(%r14), %rdi
callq 0x4b380
movq %rax, %r12
movq 0x10(%r14), %rax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
movq %r12, 0x8(%rdx)
leaq 0x2ff(%rip), %rsi       # 0x56f75
movq %r14, %rdi
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x56dc9
movl %eax, %r13d
movq 0x68(%r14), %rdi
callq 0x15f0a
testl %r13d, %r13d
je 0x56caf
movq %r12, %rdi
callq 0x4c19d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x4b7ab
movq %r14, 0x10(%rsp)
movq %rax, %r14
movq %r12, %rdi
callq 0x4b988
movq %rax, %r13
movq %r12, %rdi
callq 0x4b995
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq 0x8(%rsp), %rcx
movq %rbp, %r8
callq 0x5ab10
movq %r12, %rdi
callq 0x4b988
movq %rax, %rbp
movq 0x10(%rsp), %rax
movl 0x54(%rax), %eax
cmpq %rax, %rbp
jne 0x56d91
xorl %r13d, %r13d
xorl %r14d, %r14d
testl %r13d, %r13d
jne 0x56c95
cmpq %rbp, %r14
jae 0x56c95
movq %r12, %rdi
movq %r14, %rsi
callq 0x4b48e
movq %rax, %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq *%r15
movl %eax, %r13d
incq %r14
jmp 0x56d0a
movq 0xd727c(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x73320(%rip), %rsi     # 0xca066
leaq 0x836e0(%rip), %rdx     # 0xda42d
leaq 0x836bc(%rip), %rcx     # 0xda410
leaq 0x8364e(%rip), %r8      # 0xda3a9
movl $0x23a, %r9d            # imm = 0x23A
jmp 0x56dbd
movq 0xd724e(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x732f2(%rip), %rsi     # 0xca066
leaq 0x738de(%rip), %rdx     # 0xca659
leaq 0x8368e(%rip), %rcx     # 0xda410
leaq 0x83620(%rip), %r8      # 0xda3a9
movl $0x239, %r9d            # imm = 0x239
jmp 0x56dbd
movq 0xd7220(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x732c4(%rip), %rsi     # 0xca066
leaq 0x83696(%rip), %rdx     # 0xda43f
leaq 0x83660(%rip), %rcx     # 0xda410
leaq 0x835f2(%rip), %r8      # 0xda3a9
movl $0x24a, %r9d            # imm = 0x24A
xorl %eax, %eax
callq 0xb8c0
callq 0xb300