// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %rdi, %r13
movaps 0x228934(%rip), %xmm0   # 0x32e8b0
movaps %xmm0, 0x30(%rsp)
movaps 0x228918(%rip), %xmm0   # 0x32e8a0
movaps %xmm0, 0x20(%rsp)
testq %rdi, %rdi
je 0x105fa2
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x106529
leaq 0x5b8(%rip), %rsi       # 0x106561
xorl %r12d, %r12d
pushq $0x5
popq %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x105c70
movq %rax, %r14
pushq $-0x1
popq %r15
testq %rax, %rax
je 0x105ff8
movq %r14, %rdi
callq 0x105e11
testq %rax, %rax
je 0x106029
leaq 0x1f841a(%rip), %rsi    # 0x2fe3f2
leaq 0x22879e(%rip), %rdx    # 0x32e77d
leaq 0x228773(%rip), %rcx    # 0x32e759
leaq 0x228751(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0xf7, %r9d
jmp 0x10601d
leaq 0x1f83f3(%rip), %rsi    # 0x2fe3f2
leaq 0x22876c(%rip), %rdx    # 0x32e772
leaq 0x22874c(%rip), %rcx    # 0x32e759
leaq 0x22872a(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0xf6, %r9d
xorl %eax, %eax
callq 0x89dbb
movb $0x1, %r12b
jmp 0x10602c
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x105e1a
movq %rax, %rbx
movq %rax, %rdi
callq 0x105e8a
testb %r12b, %r12b
jne 0x106079
testq %rax, %rax
je 0x106079
leaq 0x1f83a2(%rip), %rsi    # 0x2fe3f2
leaq 0x228743(%rip), %rdx    # 0x32e79a
leaq 0x2286fb(%rip), %rcx    # 0x32e759
leaq 0x2286d9(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0xfb, %r9d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r15
movq %rbx, %rdi
callq 0x105e8a
testl %r15d, %r15d
jne 0x1060bb
testq %rax, %rax
je 0x1060bb
leaq 0x1f8360(%rip), %rsi    # 0x2fe3f2
leaq 0x228701(%rip), %rdx    # 0x32e79a
leaq 0x2286b9(%rip), %rcx    # 0x32e759
leaq 0x228697(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0xfd, %r9d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r15
movq %rbx, %rdi
callq 0x105f4d
movq %r14, %rdi
callq 0x105e52
movq %rax, %rbx
movq %rax, %rdi
callq 0x105ebb
testl %r15d, %r15d
jne 0x106110
testq %rax, %rax
je 0x106110
leaq 0x1f830b(%rip), %rsi    # 0x2fe3f2
leaq 0x2286ac(%rip), %rdx    # 0x32e79a
leaq 0x228664(%rip), %rcx    # 0x32e759
leaq 0x228642(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0x102, %r9d            # imm = 0x102
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r15
movq %rbx, %rdi
callq 0x105ebb
testl %r15d, %r15d
jne 0x106152
testq %rax, %rax
je 0x106152
leaq 0x1f82c9(%rip), %rsi    # 0x2fe3f2
leaq 0x22866a(%rip), %rdx    # 0x32e79a
leaq 0x228622(%rip), %rcx    # 0x32e759
leaq 0x228600(%rip), %r8     # 0x32e73e
movq %r13, %rdi
movl $0x104, %r9d            # imm = 0x104
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r15
movq %r13, (%rsp)
movq %rbx, %rdi
callq 0x105f4d
leaq 0x20(%rsp), %rbx
pushq $-0x1
popq %r12
leaq 0x2285d0(%rip), %rbp    # 0x32e73e
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x10621c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x105d0f
cmpq $0x4, %r13
ja 0x1061c9
testl %r15d, %r15d
movl %r12d, %r15d
jne 0x106210
movq %r14, %rdi
callq 0x105e11
leaq 0x1(%r13), %rcx
cmpq %rax, %rcx
je 0x1061df
movq (%rsp), %rdi
leaq 0x1f8242(%rip), %rsi    # 0x2fe3f2
leaq 0x2285f1(%rip), %rdx    # 0x32e7a8
leaq 0x22859b(%rip), %rcx    # 0x32e759
movq %rbp, %r8
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x106206
testl %r15d, %r15d
movl %r12d, %r15d
jne 0x106210
movq %r14, %rdi
callq 0x105e11
cmpq $0x5, %rax
jne 0x1061e4
xorl %r15d, %r15d
jmp 0x106210
movq (%rsp), %rdi
leaq 0x1f8203(%rip), %rsi    # 0x2fe3f2
leaq 0x2285df(%rip), %rdx    # 0x32e7d5
leaq 0x22855c(%rip), %rcx    # 0x32e759
movq %rbp, %r8
movl $0x10c, %r9d            # imm = 0x10C
xorl %eax, %eax
callq 0x89dbb
movl %r12d, %r15d
incq %r13
addq $0x4, %rbx
jmp 0x106171
pushq $-0x1
popq %r12
testl %r15d, %r15d
jne 0x10629e
movq %r14, %rdi
callq 0x105df5
cmpl $0x221, (%rax)          # imm = 0x221
jne 0x10626d
movq %r14, %rdi
callq 0x105dd9
xorl %r12d, %r12d
cmpl $0x16, (%rax)
je 0x10629e
leaq 0x1f81a6(%rip), %rsi    # 0x2fe3f2
leaq 0x2285cb(%rip), %rdx    # 0x32e81e
leaq 0x2284ff(%rip), %rcx    # 0x32e759
leaq 0x2284dd(%rip), %r8     # 0x32e73e
movq (%rsp), %rdi
movl $0x10f, %r9d            # imm = 0x10F
jmp 0x106293
leaq 0x1f817e(%rip), %rsi    # 0x2fe3f2
leaq 0x228579(%rip), %rdx    # 0x32e7f4
leaq 0x2284d7(%rip), %rcx    # 0x32e759
leaq 0x2284b5(%rip), %r8     # 0x32e73e
movq (%rsp), %rdi
movl $0x10e, %r9d            # imm = 0x10E
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r12
movq %r14, %rdi
callq 0x105eec
xorl %eax, %eax
cmpl $0x64, %eax
je 0x106517
movl %eax, 0xc(%rsp)
pushq $0x1e
popq %rdi
leaq 0x2b5(%rip), %rsi       # 0x106574
leaq -0x72a87(%rip), %rdx    # 0x9383f
xorl %ecx, %ecx
callq 0x105c70
movq %rax, %rbx
pushq $0x10
popq %rdi
callq 0x5809c
movq %rax, %rbp
pushq $0x1
popq %r14
cmpq $0xc9, %r14
je 0x1063e3
leaq -0x1(%r14), %r15
movq %r15, 0x10(%rsp)
callq 0xb3a58
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
pushq $0x3c
popq %rcx
divl %ecx
movq %rdx, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %r13
movq %r13, %rdx
callq 0x5851d
movq %r13, %rdi
leaq 0x228415(%rip), %rsi    # 0x32e73e
movl $0x11c, %edx            # imm = 0x11C
callq 0x93160
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x105d0f
cmpq $0x1d, %r15
ja 0x10638e
testl %r12d, %r12d
pushq $-0x1
popq %r12
jne 0x1063db
movq %rbx, %rdi
callq 0x105e11
cmpq %rax, %r14
je 0x1063a5
movq (%rsp), %rdi
leaq 0x1f8081(%rip), %rsi    # 0x2fe3f2
leaq 0x228430(%rip), %rdx    # 0x32e7a8
leaq 0x2283da(%rip), %rcx    # 0x32e759
leaq 0x2283b8(%rip), %r8     # 0x32e73e
movl $0x121, %r9d            # imm = 0x121
jmp 0x1063d0
testl %r12d, %r12d
pushq $-0x1
popq %r12
jne 0x1063db
movq %rbx, %rdi
callq 0x105e11
cmpq $0x1e, %rax
jne 0x1063aa
xorl %r12d, %r12d
jmp 0x1063db
movq (%rsp), %rdi
leaq 0x1f803d(%rip), %rsi    # 0x2fe3f2
leaq 0x22848a(%rip), %rdx    # 0x32e846
leaq 0x228396(%rip), %rcx    # 0x32e759
leaq 0x228374(%rip), %r8     # 0x32e73e
movl $0x123, %r9d            # imm = 0x123
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r12
incq %r14
jmp 0x1062df
movq %rbp, %rdi
leaq 0x187(%rip), %rsi       # 0x106574
xorl %edx, %edx
callq 0x588be
movq %rbp, %rdi
callq 0x583f9
testl %r12d, %r12d
pushq $-0x1
popq %r12
jne 0x106447
movq %rbx, %rdi
callq 0x105e11
xorl %r12d, %r12d
cmpq $0x1e, %rax
je 0x106447
movq (%rsp), %rdi
leaq 0x1f7fd1(%rip), %rsi    # 0x2fe3f2
leaq 0x22841e(%rip), %rdx    # 0x32e846
leaq 0x22832a(%rip), %rcx    # 0x32e759
leaq 0x228308(%rip), %r8     # 0x32e73e
movl $0x128, %r9d            # imm = 0x128
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r12
movq %rbx, %rdi
callq 0x105e1a
movq %rax, %r15
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x105e8a
testq %rax, %rax
je 0x1064f4
movq %rax, %r13
movq %rbp, %rdi
movq %r14, %rsi
callq 0x581aa
testl %r12d, %r12d
pushq $-0x1
popq %r12
jne 0x1064ec
movq (%r13), %rcx
cmpq (%rax), %rcx
jne 0x1064bb
movq 0x8(%r13), %rcx
xorl %r12d, %r12d
cmpq 0x8(%rax), %rcx
je 0x1064ec
movq (%rsp), %rdi
leaq 0x1f7f54(%rip), %rsi    # 0x2fe3f2
leaq 0x2283da(%rip), %rdx    # 0x32e87f
leaq 0x2282ad(%rip), %rcx    # 0x32e759
leaq 0x22828b(%rip), %r8     # 0x32e73e
movl $0x133, %r9d            # imm = 0x133
jmp 0x1064e1
movq (%rsp), %rdi
leaq 0x1f7f2c(%rip), %rsi    # 0x2fe3f2
leaq 0x22839d(%rip), %rdx    # 0x32e86a
leaq 0x228285(%rip), %rcx    # 0x32e759
leaq 0x228263(%rip), %r8     # 0x32e73e
movl $0x132, %r9d            # imm = 0x132
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r12
incq %r14
jmp 0x106455
movq %r15, %rdi
callq 0x105f4d
movq %rbp, %rdi
callq 0x58eb9
movq %rbx, %rdi
callq 0x105eec
movl 0xc(%rsp), %eax
incl %eax
jmp 0x1062a8
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x331a38(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1dead9(%rip), %rsi    # 0x2e5013
leaq 0x1dec7e(%rip), %rdx    # 0x2e51bf
leaq 0x228211(%rip), %rcx    # 0x32e759
leaq 0x2281ef(%rip), %r8     # 0x32e73e
movl $0xf3, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390