// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/ranked_list.c
// Function: gt_ranked_list_unit_test
int gt_ranked_list_unit_test(GtError *err)
{
  int had_err = 0;
  GtRankedList *rl;
  GtRankedListIter *iter;
  GtArray *arr;
  const GtUword nof_best = 30UL, nof_tests = 100UL;
  GtRankedListTestStruct *mystr;
  int values[8] = {-3, 4, 1, 545, 24, 33, 22, 42},
      i, j;
  gt_error_check(err);

  rl = gt_ranked_list_new(5UL, gt_ranked_list_cmp_numbers, NULL, NULL);
  gt_ensure(rl != NULL);
  gt_ensure(gt_ranked_list_size(rl) == 0);

  iter = gt_ranked_list_iter_new_from_first(rl);
  mystr = gt_ranked_list_iter_next(iter);
  gt_ensure(mystr == NULL);
  mystr = gt_ranked_list_iter_next(iter);
  gt_ensure(mystr == NULL);
  gt_ranked_list_iter_delete(iter);

  iter = gt_ranked_list_iter_new_from_last(rl);
  mystr = gt_ranked_list_iter_prev(iter);
  gt_ensure(mystr == NULL);
  mystr = gt_ranked_list_iter_prev(iter);
  gt_ensure(mystr == NULL);
  gt_ranked_list_iter_delete(iter);

  for (i = 0; i < 8; i++) {
    gt_ranked_list_insert(rl, values+i);
    if (i < 5)
      gt_ensure(gt_ranked_list_size(rl) == (GtUword) i + 1UL);
    else
      gt_ensure(gt_ranked_list_size(rl) == 5UL);
  }
  gt_ensure((*(int*) gt_ranked_list_first(rl)) == 545);
  gt_ensure((*(int*) gt_ranked_list_last(rl)) == 22);
  gt_ranked_list_delete(rl);

  for (j = 0; (GtUword) j < nof_tests; j++) {
    rl = gt_ranked_list_new(30UL, gt_ranked_list_cmp_teststructs, gt_free_func,
                            NULL);
    arr = gt_array_new(sizeof (GtRankedListTestStruct));
    for (i = 0; i < 200; i++) {
      GtRankedListTestStruct newstr,
                             *ptr;
      newstr.id = (GtUword) i;
      newstr.score = (GtUword) (random() % (2*nof_best));
      gt_array_add(arr, newstr);
      ptr = gt_malloc(sizeof (*ptr));
      ptr->id = newstr.id;
      ptr->score = newstr.score;
      gt_ranked_list_insert(rl, ptr);
        if ((GtUword) i < nof_best)
        gt_ensure(gt_ranked_list_size(rl) == (GtUword) i + 1UL);
      else
        gt_ensure(gt_ranked_list_size(rl) == nof_best);
    }
    gt_array_sort_stable_with_data(arr, gt_ranked_list_cmp_teststructs, NULL);
    gt_array_reverse(arr);

    gt_ensure(gt_ranked_list_size(rl) == nof_best);
    iter = gt_ranked_list_iter_new_from_first(rl);

    i = 0;
    for (mystr = gt_ranked_list_iter_next(iter);
         mystr != NULL;
         mystr = gt_ranked_list_iter_next(iter)) {
      GtRankedListTestStruct *str = (GtRankedListTestStruct*)
                                         gt_array_get(arr, (GtUword) i++);
      gt_ensure(mystr != NULL);
      gt_ensure(mystr->id == str->id);
      gt_ensure(mystr->score == str->score);
      /*
      printf("id: "GT_WU"/"GT_WU", score "GT_WU"/"GT_WU"\n", mystr->id,
             str->id, mystr->score, str->score); */
    }
    gt_ranked_list_iter_delete(iter);

    gt_array_delete(arr);
    gt_ranked_list_delete(rl);
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbp
movaps 0x22a0ca(%rip), %xmm0   # 0x397890
movaps %xmm0, 0x40(%rsp)
movaps 0x22a0ae(%rip), %xmm0   # 0x397880
movaps %xmm0, 0x30(%rsp)
testq %rdi, %rdi
je 0x16d7ec
movq %rbp, %rdi
callq 0x101a9a
testb %al, %al
jne 0x16de88
leaq 0x229f3b(%rip), %rsi    # 0x39772e
movl $0x38, %edi
movl $0x35, %edx
callq 0x1092b2
movq %rax, %r14
xorl %r13d, %r13d
movq %r13, (%rax)
movq $0x5, 0x8(%rax)
movq %r13, 0x18(%rax)
leaq 0x66f(%rip), %rdi       # 0x16de8d
movq %rdi, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %esi, %esi
callq 0xea0c4
movq %rax, 0x30(%r14)
movq %rax, %rdi
callq 0xea194
movq %rax, %r15
testq %rax, %rax
je 0x16d876
leaq 0x1f9cef(%rip), %rsi    # 0x36753a
leaq 0x229f10(%rip), %rdx    # 0x397762
leaq 0x229ef0(%rip), %rcx    # 0x397749
leaq 0x229ece(%rip), %r8     # 0x39772e
movq %rbp, %rdi
movl $0xf7, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x229eb1(%rip), %rdx    # 0x39772e
movl $0x1, %edi
movl $0x8, %esi
movl $0x8e, %ecx
callq 0x1093ef
movq %rax, %rbx
movq 0x30(%r14), %rdi
callq 0xea108
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x16d6ce
testq %r15, %r15
jne 0x16d8e4
testq %rax, %rax
je 0x16d8e4
leaq 0x1f9c81(%rip), %rsi    # 0x36753a
leaq 0x229ebf(%rip), %rdx    # 0x39777f
leaq 0x229e82(%rip), %rcx    # 0x397749
leaq 0x229e60(%rip), %r8     # 0x39772e
movq %rbp, %rdi
movl $0xfb, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x16d6ce
testl %r13d, %r13d
jne 0x16d928
testq %rax, %rax
je 0x16d928
leaq 0x1f9c3d(%rip), %rsi    # 0x36753a
leaq 0x229e7b(%rip), %rdx    # 0x39777f
leaq 0x229e3e(%rip), %rcx    # 0x397749
leaq 0x229e1c(%rip), %r8     # 0x39772e
movq %rbp, %rdi
movl $0xfd, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x229dff(%rip), %r15    # 0x39772e
movq %rbx, %rdi
movq %r15, %rsi
movl $0xc8, %edx
callq 0x109670
movl $0x1, %edi
movl $0x8, %esi
movq %r15, %rdx
movl $0x96, %ecx
callq 0x1093ef
movq %rax, %r15
movq 0x30(%r14), %rdi
callq 0xea0f8
movq %rax, (%r15)
movq %r15, %rdi
callq 0x16d6ff
testl %r13d, %r13d
jne 0x16d9a9
testq %rax, %rax
je 0x16d9a9
leaq 0x1f9bbc(%rip), %rsi    # 0x36753a
leaq 0x229dfa(%rip), %rdx    # 0x39777f
leaq 0x229dbd(%rip), %rcx    # 0x397749
leaq 0x229d9b(%rip), %r8     # 0x39772e
movq %rbp, %rdi
movl $0x102, %r9d            # imm = 0x102
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %r14, (%rsp)
movq %r15, %rdi
callq 0x16d6ff
testl %r13d, %r13d
jne 0x16d9f1
testq %rax, %rax
je 0x16d9f1
leaq 0x1f9b74(%rip), %rsi    # 0x36753a
leaq 0x229db2(%rip), %rdx    # 0x39777f
leaq 0x229d75(%rip), %rcx    # 0x397749
leaq 0x229d53(%rip), %r8     # 0x39772e
movq %rbp, %rdi
movl $0x104, %r9d            # imm = 0x104
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x229d36(%rip), %rsi    # 0x39772e
movq %r15, %rdi
movl $0xc8, %edx
callq 0x109670
leaq 0x30(%rsp), %r15
xorl %r12d, %r12d
movq (%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x16d54b
xorl %ebx, %ebx
cmpq $0x4, %r12
ja 0x16da69
testl %r13d, %r13d
jne 0x16da6e
movq 0x30(%r14), %rdi
callq 0xea194
leaq 0x1(%r12), %rcx
movb $0x1, %r14b
cmpq %rax, %rcx
je 0x16dab9
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x1f9aee(%rip), %rsi    # 0x36753a
leaq 0x229d3a(%rip), %rdx    # 0x39778d
leaq 0x229cef(%rip), %rcx    # 0x397749
leaq 0x229ccd(%rip), %r8     # 0x39772e
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x16daad
testl %r13d, %r13d
je 0x16da73
xorl %r14d, %r14d
jmp 0x16dab4
movq 0x30(%r14), %rdi
callq 0xea194
movb $0x1, %r14b
cmpq $0x5, %rax
je 0x16dab9
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x1f9aa8(%rip), %rsi    # 0x36753a
leaq 0x229d21(%rip), %rdx    # 0x3977ba
leaq 0x229ca9(%rip), %rcx    # 0x397749
leaq 0x229c87(%rip), %r8     # 0x39772e
movl $0x10c, %r9d            # imm = 0x10C
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
incq %r12
addq $0x4, %r15
movl %ebx, %r13d
cmpq $0x8, %r12
jne 0x16da0d
movq %rbp, 0x8(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r14b, %r14b
je 0x16db28
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x16d631
cmpl $0x221, (%rax)          # imm = 0x221
jne 0x16db2e
movq %rbx, %rdi
callq 0x16d615
xorl %ebp, %ebp
cmpl $0x16, (%rax)
je 0x16db61
leaq 0x1f9a34(%rip), %rsi    # 0x36753a
leaq 0x229cf6(%rip), %rdx    # 0x397803
leaq 0x229c35(%rip), %rcx    # 0x397749
leaq 0x229c13(%rip), %r8     # 0x39772e
movq 0x8(%rsp), %rdi
movl $0x10f, %r9d            # imm = 0x10F
jmp 0x16db55
movq (%rsp), %rbx
jmp 0x16db61
leaq 0x1f9a05(%rip), %rsi    # 0x36753a
leaq 0x229c9d(%rip), %rdx    # 0x3977d9
leaq 0x229c06(%rip), %rcx    # 0x397749
leaq 0x229be4(%rip), %r8     # 0x39772e
movq 0x8(%rsp), %rdi
movl $0x10e, %r9d            # imm = 0x10E
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x16d730
leaq 0x229bbe(%rip), %r13    # 0x39772e
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl $0x38, %edi
movq %r13, %rsi
movl $0x35, %edx
callq 0x1092b2
movq %rax, %rbx
movq $0x0, (%rax)
movq $0x1e, 0x8(%rax)
leaq -0x64472(%rip), %rax    # 0x10972f
movq %rax, 0x18(%rbx)
leaq 0x2f4(%rip), %rdi       # 0x16dea0
movq %rdi, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
xorl %esi, %esi
callq 0xea0c4
movq %rax, 0x30(%rbx)
movl $0x10, %edi
callq 0xd46fc
movq %rax, (%rsp)
movl $0x1, %r14d
leaq -0x1(%r14), %r15
movq %r15, 0x20(%rsp)
callq 0x125bcc
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, %rcx
movl $0x88888889, %edx       # imm = 0x88888889
imulq %rdx, %rcx
shrq $0x25, %rcx
imull $0x3c, %ecx, %ecx
subl %ecx, %eax
movq %rax, 0x28(%rsp)
movl $0x10, %edx
movq (%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xd49ce
movl $0x10, %edi
movq %r13, %rsi
movl $0x11c, %edx            # imm = 0x11C
callq 0x1092b2
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x16d54b
xorl %r12d, %r12d
cmpq $0x1d, %r15
ja 0x16dc81
testl %ebp, %ebp
jne 0x16dc85
movq 0x30(%rbx), %rdi
callq 0xea194
movb $0x1, %r15b
cmpq %rax, %r14
je 0x16dccf
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x1f98d2(%rip), %rsi    # 0x36753a
leaq 0x229b1e(%rip), %rdx    # 0x39778d
leaq 0x229ad3(%rip), %rcx    # 0x397749
movq %r13, %r8
movl $0x121, %r9d            # imm = 0x121
jmp 0x16dcc2
testl %ebp, %ebp
je 0x16dc8a
xorl %r15d, %r15d
jmp 0x16dcc9
movq 0x30(%rbx), %rdi
callq 0xea194
movb $0x1, %r15b
cmpq $0x1e, %rax
je 0x16dccf
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x1f988f(%rip), %rsi    # 0x36753a
leaq 0x229b79(%rip), %rdx    # 0x39782b
leaq 0x229a90(%rip), %rcx    # 0x397749
movq %r13, %r8
movl $0x123, %r9d            # imm = 0x123
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
incq %r14
movl %r12d, %ebp
cmpq $0xc9, %r14
jne 0x16dbd6
movq (%rsp), %r14
movq %r14, %rdi
leaq 0x1b0(%rip), %rsi       # 0x16dea0
xorl %edx, %edx
callq 0xd4b5c
movq %r14, %rdi
callq 0xd4906
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x16dd49
movq 0x30(%rbx), %rdi
callq 0xea194
xorl %ebp, %ebp
cmpq $0x1e, %rax
je 0x16dd49
movq 0x8(%rsp), %rdi
leaq 0x1f9814(%rip), %rsi    # 0x36753a
leaq 0x229afe(%rip), %rdx    # 0x39782b
leaq 0x229a15(%rip), %rcx    # 0x397749
movq %r13, %r8
movl $0x128, %r9d            # imm = 0x128
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %edi
movl $0x8, %esi
movq %r13, %rdx
movl $0x8e, %ecx
callq 0x1093ef
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0xea108
movq %rax, (%r14)
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x16d6ce
testq %rax, %rax
je 0x16de45
movq %rax, %r14
xorl %r12d, %r12d
movq %rbx, %r15
movq %r13, %rbx
movl %ebp, %r13d
movq (%rsp), %rdi
movq %r12, %rsi
callq 0xd47ba
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r13d, %r13d
je 0x16ddaf
movq %rbx, %r13
jmp 0x16de29
movq (%r14), %rcx
cmpq (%rax), %rcx
movq %rbx, %r13
jne 0x16ddfa
movq 0x8(%r14), %rcx
xorl %ebp, %ebp
cmpq 0x8(%rax), %rcx
movq %r15, %rbx
je 0x16de2c
movq 0x8(%rsp), %rdi
leaq 0x1f9765(%rip), %rsi    # 0x36753a
leaq 0x229a88(%rip), %rdx    # 0x397864
leaq 0x229966(%rip), %rcx    # 0x397749
movq %r13, %r8
movl $0x133, %r9d            # imm = 0x133
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x16de2c
movq 0x8(%rsp), %rdi
leaq 0x1f9734(%rip), %rsi    # 0x36753a
leaq 0x229a42(%rip), %rdx    # 0x39784f
leaq 0x229935(%rip), %rcx    # 0x397749
movq %r13, %r8
movl $0x132, %r9d            # imm = 0x132
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rbx
movq 0x18(%rsp), %rdi
callq 0x16d6ce
movq %rax, %r14
incq %r12
testq %rax, %rax
jne 0x16dd8b
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movl $0xc8, %edx
callq 0x109670
movq (%rsp), %rdi
callq 0xd4ef4
movq %rbx, %rdi
callq 0x16d730
movl 0x14(%rsp), %eax
incl %eax
cmpl $0x64, %eax
jne 0x16db72
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4fb45