// File: /workspace/github_c_makefile_star2_O3/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 0x228c2e(%rip), %xmm0   # 0x38e4b0
movaps %xmm0, 0x40(%rsp)
movaps 0x228c12(%rip), %xmm0   # 0x38e4a0
movaps %xmm0, 0x30(%rsp)
testq %rdi, %rdi
je 0x1658a8
movq %rbp, %rdi
callq 0xfcc32
testb %al, %al
jne 0x165f44
leaq 0x228a9f(%rip), %rsi    # 0x38e34e
movl $0x38, %edi
movl $0x35, %edx
callq 0x104226
movq %rax, %r14
xorl %r13d, %r13d
movq %r13, (%rax)
movq $0x5, 0x8(%rax)
movq %r13, 0x18(%rax)
leaq 0x66f(%rip), %rdi       # 0x165f49
movq %rdi, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %esi, %esi
callq 0xe5b60
movq %rax, 0x30(%r14)
movq %rax, %rdi
callq 0xe5c30
movq %rax, %r15
testq %rax, %rax
je 0x165932
leaq 0x1f8b37(%rip), %rsi    # 0x35e43e
leaq 0x228a74(%rip), %rdx    # 0x38e382
leaq 0x228a54(%rip), %rcx    # 0x38e369
leaq 0x228a32(%rip), %r8     # 0x38e34e
movq %rbp, %rdi
movl $0xf7, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x228a15(%rip), %rdx    # 0x38e34e
movl $0x1, %edi
movl $0x8, %esi
movl $0x8e, %ecx
callq 0x10436a
movq %rax, %rbx
movq 0x30(%r14), %rdi
callq 0xe5ba4
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x16578a
testq %r15, %r15
jne 0x1659a0
testq %rax, %rax
je 0x1659a0
leaq 0x1f8ac9(%rip), %rsi    # 0x35e43e
leaq 0x228a23(%rip), %rdx    # 0x38e39f
leaq 0x2289e6(%rip), %rcx    # 0x38e369
leaq 0x2289c4(%rip), %r8     # 0x38e34e
movq %rbp, %rdi
movl $0xfb, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x16578a
testl %r13d, %r13d
jne 0x1659e4
testq %rax, %rax
je 0x1659e4
leaq 0x1f8a85(%rip), %rsi    # 0x35e43e
leaq 0x2289df(%rip), %rdx    # 0x38e39f
leaq 0x2289a2(%rip), %rcx    # 0x38e369
leaq 0x228980(%rip), %r8     # 0x38e34e
movq %rbp, %rdi
movl $0xfd, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x228963(%rip), %r15    # 0x38e34e
movq %rbx, %rdi
movq %r15, %rsi
movl $0xc8, %edx
callq 0x1045eb
movl $0x1, %edi
movl $0x8, %esi
movq %r15, %rdx
movl $0x96, %ecx
callq 0x10436a
movq %rax, %r15
movq 0x30(%r14), %rdi
callq 0xe5b94
movq %rax, (%r15)
movq %r15, %rdi
callq 0x1657bb
testl %r13d, %r13d
jne 0x165a65
testq %rax, %rax
je 0x165a65
leaq 0x1f8a04(%rip), %rsi    # 0x35e43e
leaq 0x22895e(%rip), %rdx    # 0x38e39f
leaq 0x228921(%rip), %rcx    # 0x38e369
leaq 0x2288ff(%rip), %r8     # 0x38e34e
movq %rbp, %rdi
movl $0x102, %r9d            # imm = 0x102
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %r14, (%rsp)
movq %r15, %rdi
callq 0x1657bb
testl %r13d, %r13d
jne 0x165aad
testq %rax, %rax
je 0x165aad
leaq 0x1f89bc(%rip), %rsi    # 0x35e43e
leaq 0x228916(%rip), %rdx    # 0x38e39f
leaq 0x2288d9(%rip), %rcx    # 0x38e369
leaq 0x2288b7(%rip), %r8     # 0x38e34e
movq %rbp, %rdi
movl $0x104, %r9d            # imm = 0x104
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x22889a(%rip), %rsi    # 0x38e34e
movq %r15, %rdi
movl $0xc8, %edx
callq 0x1045eb
leaq 0x30(%rsp), %r15
xorl %r12d, %r12d
movq (%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x165607
xorl %ebx, %ebx
cmpq $0x4, %r12
ja 0x165b25
testl %r13d, %r13d
jne 0x165b2a
movq 0x30(%r14), %rdi
callq 0xe5c30
leaq 0x1(%r12), %rcx
movb $0x1, %r14b
cmpq %rax, %rcx
je 0x165b75
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x1f8936(%rip), %rsi    # 0x35e43e
leaq 0x22889e(%rip), %rdx    # 0x38e3ad
leaq 0x228853(%rip), %rcx    # 0x38e369
leaq 0x228831(%rip), %r8     # 0x38e34e
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x165b69
testl %r13d, %r13d
je 0x165b2f
xorl %r14d, %r14d
jmp 0x165b70
movq 0x30(%r14), %rdi
callq 0xe5c30
movb $0x1, %r14b
cmpq $0x5, %rax
je 0x165b75
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x1f88f0(%rip), %rsi    # 0x35e43e
leaq 0x228885(%rip), %rdx    # 0x38e3da
leaq 0x22880d(%rip), %rcx    # 0x38e369
leaq 0x2287eb(%rip), %r8     # 0x38e34e
movl $0x10c, %r9d            # imm = 0x10C
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
incq %r12
addq $0x4, %r15
movl %ebx, %r13d
cmpq $0x8, %r12
jne 0x165ac9
movq %rbp, 0x8(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r14b, %r14b
je 0x165be4
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x1656ed
cmpl $0x221, (%rax)          # imm = 0x221
jne 0x165bea
movq %rbx, %rdi
callq 0x1656d1
xorl %ebp, %ebp
cmpl $0x16, (%rax)
je 0x165c1d
leaq 0x1f887c(%rip), %rsi    # 0x35e43e
leaq 0x22885a(%rip), %rdx    # 0x38e423
leaq 0x228799(%rip), %rcx    # 0x38e369
leaq 0x228777(%rip), %r8     # 0x38e34e
movq 0x8(%rsp), %rdi
movl $0x10f, %r9d            # imm = 0x10F
jmp 0x165c11
movq (%rsp), %rbx
jmp 0x165c1d
leaq 0x1f884d(%rip), %rsi    # 0x35e43e
leaq 0x228801(%rip), %rdx    # 0x38e3f9
leaq 0x22876a(%rip), %rcx    # 0x38e369
leaq 0x228748(%rip), %r8     # 0x38e34e
movq 0x8(%rsp), %rdi
movl $0x10e, %r9d            # imm = 0x10E
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x1657ec
leaq 0x228722(%rip), %r13    # 0x38e34e
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl $0x38, %edi
movq %r13, %rsi
movl $0x35, %edx
callq 0x104226
movq %rax, %rbx
movq $0x0, (%rax)
movq $0x1e, 0x8(%rax)
leaq -0x615b3(%rip), %rax    # 0x1046aa
movq %rax, 0x18(%rbx)
leaq 0x2f4(%rip), %rdi       # 0x165f5c
movq %rdi, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
xorl %esi, %esi
callq 0xe5b60
movq %rax, 0x30(%rbx)
movl $0x10, %edi
callq 0xd214c
movq %rax, (%rsp)
movl $0x1, %r14d
leaq -0x1(%r14), %r15
movq %r15, 0x20(%rsp)
callq 0x11fe0c
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 0xd2410
movl $0x10, %edi
movq %r13, %rsi
movl $0x11c, %edx            # imm = 0x11C
callq 0x104226
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x165607
xorl %r12d, %r12d
cmpq $0x1d, %r15
ja 0x165d3d
testl %ebp, %ebp
jne 0x165d41
movq 0x30(%rbx), %rdi
callq 0xe5c30
movb $0x1, %r15b
cmpq %rax, %r14
je 0x165d8b
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x1f871a(%rip), %rsi    # 0x35e43e
leaq 0x228682(%rip), %rdx    # 0x38e3ad
leaq 0x228637(%rip), %rcx    # 0x38e369
movq %r13, %r8
movl $0x121, %r9d            # imm = 0x121
jmp 0x165d7e
testl %ebp, %ebp
je 0x165d46
xorl %r15d, %r15d
jmp 0x165d85
movq 0x30(%rbx), %rdi
callq 0xe5c30
movb $0x1, %r15b
cmpq $0x1e, %rax
je 0x165d8b
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
leaq 0x1f86d7(%rip), %rsi    # 0x35e43e
leaq 0x2286dd(%rip), %rdx    # 0x38e44b
leaq 0x2285f4(%rip), %rcx    # 0x38e369
movq %r13, %r8
movl $0x123, %r9d            # imm = 0x123
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
incq %r14
movl %r12d, %ebp
cmpq $0xc9, %r14
jne 0x165c92
movq (%rsp), %r14
movq %r14, %rdi
leaq 0x1b0(%rip), %rsi       # 0x165f5c
xorl %edx, %edx
callq 0xd25a2
movq %r14, %rdi
callq 0xd2349
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x165e05
movq 0x30(%rbx), %rdi
callq 0xe5c30
xorl %ebp, %ebp
cmpq $0x1e, %rax
je 0x165e05
movq 0x8(%rsp), %rdi
leaq 0x1f865c(%rip), %rsi    # 0x35e43e
leaq 0x228662(%rip), %rdx    # 0x38e44b
leaq 0x228579(%rip), %rcx    # 0x38e369
movq %r13, %r8
movl $0x128, %r9d            # imm = 0x128
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %edi
movl $0x8, %esi
movq %r13, %rdx
movl $0x8e, %ecx
callq 0x10436a
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0xe5ba4
movq %rax, (%r14)
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x16578a
testq %rax, %rax
je 0x165f01
movq %rax, %r14
xorl %r12d, %r12d
movq %rbx, %r15
movq %r13, %rbx
movl %ebp, %r13d
movq (%rsp), %rdi
movq %r12, %rsi
callq 0xd2207
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r13d, %r13d
je 0x165e6b
movq %rbx, %r13
jmp 0x165ee5
movq (%r14), %rcx
cmpq (%rax), %rcx
movq %rbx, %r13
jne 0x165eb6
movq 0x8(%r14), %rcx
xorl %ebp, %ebp
cmpq 0x8(%rax), %rcx
movq %r15, %rbx
je 0x165ee8
movq 0x8(%rsp), %rdi
leaq 0x1f85ad(%rip), %rsi    # 0x35e43e
leaq 0x2285ec(%rip), %rdx    # 0x38e484
leaq 0x2284ca(%rip), %rcx    # 0x38e369
movq %r13, %r8
movl $0x133, %r9d            # imm = 0x133
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x165ee8
movq 0x8(%rsp), %rdi
leaq 0x1f857c(%rip), %rsi    # 0x35e43e
leaq 0x2285a6(%rip), %rdx    # 0x38e46f
leaq 0x228499(%rip), %rcx    # 0x38e369
movq %r13, %r8
movl $0x132, %r9d            # imm = 0x132
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rbx
movq 0x18(%rsp), %rdi
callq 0x16578a
movq %rax, %r14
incq %r12
testq %rax, %rax
jne 0x165e47
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movl $0xc8, %edx
callq 0x1045eb
movq (%rsp), %rdi
callq 0xd2938
movq %rbx, %rdi
callq 0x1657ec
movl 0x14(%rsp), %eax
incl %eax
cmpl $0x64, %eax
jne 0x165c2e
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4ec50