// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_db_sort
void hmm_annot_db_sort(hmm_annot_db_t *annot_db, hmm_annot_so_t so)
{
    if (so == annot_db->so) return;
    switch(so) {
        case ORDER_GNAME:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc1);
            break;
        case ORDER_GID:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc2);
            break;
        case ORDER_SNAME:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc3);
            break;
        case ORDER_SID:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc4);
            break;
        case ORDER_SID_OG:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc5);
            break;
        case ORDER_SID_CO:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc6);
            break;
        default:
            fprintf(stderr, "[E::%s] undefined sorting: %d\n", __func__, so);
            exit(EXIT_FAILURE);
    }
    annot_db->so = so;
    hmm_annot_db_sort_index(annot_db);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl %esi, 0x40(%rdi)
je 0x455e
movl %esi, %r14d
leal -0x1(%r14), %eax
cmpl $0x6, %eax
jae 0x4564
movq %rdi, %rbx
movl %eax, %eax
leaq 0x4945(%rip), %rcx      # 0x8d90
movq (%rcx,%rax,8), %rcx
movq (%rdi), %rsi
movq 0x10(%rdi), %rdi
pushq $0x50
popq %rdx
callq 0x20d0
movl %r14d, 0x40(%rbx)
movq 0x48(%rbx), %rdi
callq 0x2050
andq $0x0, 0x48(%rbx)
movl 0x40(%rbx), %ecx
leal 0x1(%rcx), %eax
cmpl $0x7, %eax
ja 0x458e
pushq $0x17
popq %rcx
btl %eax, %ecx
jb 0x455e
movl $0xe0, %ecx
btl %eax, %ecx
jae 0x44ea
movq 0x10(%rbx), %r15
movl 0x1c(%rbx), %r14d
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x21f0
movl 0x4c(%r15), %ecx
movq (%rbx), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
movl %edx, %r8d
cmpq %r8, %rdi
jbe 0x4545
imulq $0x50, %r8, %r8
movl 0x4c(%r15,%r8), %r8d
cmpl %r8d, %ecx
je 0x44e6
movl %edx, %r9d
subl %esi, %r9d
shlq $0x20, %rsi
orq %rsi, %r9
movl %ecx, %ecx
movq %r9, (%rax,%rcx,8)
movl %edx, %esi
movl %r8d, %ecx
incl %edx
jmp 0x44b4
movq 0x10(%rbx), %r15
movl 0x18(%rbx), %r14d
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x21f0
movl $0x1fffffff, %edi       # imm = 0x1FFFFFFF
movl 0x48(%r15), %ecx
andl %edi, %ecx
movq (%rbx), %r8
pushq $0x1
popq %rdx
xorl %esi, %esi
movl %edx, %r9d
cmpq %r9, %r8
jbe 0x4545
imulq $0x50, %r9, %r9
movl 0x48(%r15,%r9), %r9d
andl %edi, %r9d
cmpl %r9d, %ecx
je 0x4541
movl %edx, %r10d
subl %esi, %r10d
shlq $0x20, %rsi
orq %rsi, %r10
movl %ecx, %ecx
movq %r10, (%rax,%rcx,8)
movl %edx, %esi
movl %r9d, %ecx
incl %edx
jmp 0x4510
subl %esi, %edx
shlq $0x20, %rsi
movl %edx, %edx
orq %rsi, %rdx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq %rax, 0x48(%rbx)
movl %r14d, 0x44(%rbx)
popq %rbx
popq %r14
popq %r15
retq
movq 0x4a85(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x2081(%rip), %rsi      # 0x65f6
leaq 0x2099(%rip), %rdx      # 0x6615
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2220
pushq $0x1
popq %rdi
callq 0x2370
movq 0x4a5b(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x2057(%rip), %rsi      # 0x65f6
leaq 0x20ca(%rip), %rdx      # 0x6670
jmp 0x457f