// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/qsort_r.c
// Function: gt_qsort_r
void
gt_qsort_r(void *a, size_t n, size_t es, void *data, GtCompareWithData cmp)
{
  char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
  int swaptype, swap_cnt;
  long d, r;

  while (1)
  {
    SWAPINIT(a, es);
    swap_cnt = 0;
    if (n < 7) {
      for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
        for (pl = pm;
             pl > (char *)a && cmp(pl - es, pl, data) > 0;
             pl -= es)
          swap(pl, pl - es);
      return;
    }
    pm = (char *)a + (n / 2) * es;
    if (n > 7) {
      pl = a;
      pn = (char *)a + (n - 1) * es;
      if (n > 40) {
        d = (n / 8) * es;
        pl = med3(pl, pl + d, pl + 2 * d, cmp, data);
        pm = med3(pm - d, pm, pm + d, cmp, data);
        pn = med3(pn - 2 * d, pn - d, pn, cmp, data);
      }
      pm = med3(pl, pm, pn, cmp, data);
    }
    swap(a, pm);
    pa = pb = (char *)a + es;

    pc = pd = (char *)a + (n - 1) * es;
    for (;;) {
      while (pb <= pc && (r = cmp(pb, a, data)) <= 0) {
        if (r == 0) {
          swap_cnt = 1;
          swap(pa, pb);
          pa += es;
        }
        pb += es;
      }
      while (pb <= pc && (r = cmp(pc, a, data)) >= 0) {
        if (r == 0) {
          swap_cnt = 1;
          swap(pc, pd);
          pd -= es;
        }
        pc -= es;
      }
      if (pb > pc)
        break;
      swap(pb, pc);
      swap_cnt = 1;
      pb += es;
      pc -= es;
    }
    if (swap_cnt == 0) {  /* Switch to insertion sort */
      for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
        for (pl = pm;
             pl > (char *)a && cmp(pl - es, pl, data) > 0;
             pl -= es)
          swap(pl, pl - es);
      return;
    }

    pn = (char *)a + n * es;
    r = GT_MIN(pa - (char *)a, pb - pa);
    vecswap(a, pb - r, r);
    r = GT_MIN(pd - pc, pn - pd - es);
    vecswap(pb, pn - r, r);
    if ((r = pb - pa) > es)
      gt_qsort_r(a, r / es, es, data, cmp);
    if ((r = pd - pc) > es) {
      /* Iterate rather than recurse to save stack space */
      a = pn - r;
      n = r / es;
    }
    else
      break;
  }
/*            qsort(pn - r, r / es, es, cmp);*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
movq %rdx, %r9
negq %r9
xorl %ecx, %ecx
cmpq $0x8, %rdx
setne %cl
movl %r12d, %eax
orl %ebx, %eax
testb $0x7, %al
sete 0x7(%rsp)
movl $0x2, %eax
movl %ecx, 0x6c(%rsp)
cmovel %ecx, %eax
movl %eax, 0x24(%rsp)
cmpq $0x7, %rsi
movq %rdx, 0x28(%rsp)
movq %r9, 0x48(%rsp)
jae 0x7b89a
movq %r12, %r14
imulq %rbx, %r15
cmpq %rbx, %r15
jle 0x7c016
movq %r14, %r13
addq %r14, %r15
movq 0x28(%rsp), %rax
leaq (%r14,%rax), %rbx
cltq
movq %rax, %rcx
shrq $0x3, %rcx
incq %rax
movq %rax, 0x8(%rsp)
incq %rcx
movq %rcx, 0x40(%rsp)
movq %r15, 0x30(%rsp)
cmpq %r14, %rbx
jbe 0x7b87c
movq %r13, %rbp
movq %rbx, %r15
movq %r15, %r12
addq %r9, %r15
movq %r15, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
movq 0x48(%rsp), %r9
testl %eax, %eax
jle 0x7b87c
cmpl $0x0, 0x24(%rsp)
je 0x7b83c
cmpb $0x0, 0x7(%rsp)
je 0x7b84c
movq 0x28(%rsp), %rax
addq %rbp, %rax
movq 0x40(%rsp), %rcx
xorl %edx, %edx
movq (%rax,%rdx), %rsi
movq (%rbp,%rdx), %rdi
movq %rdi, (%rax,%rdx)
movq %rsi, (%rbp,%rdx)
addq $0x8, %rdx
decq %rcx
cmpq $0x1, %rcx
jg 0x7b81b
jmp 0x7b870
movq (%r12), %rax
movq (%r15), %rcx
movq %rcx, (%r12)
movq %rax, (%r15)
jmp 0x7b870
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movb (%r12,%rax), %dl
movb (%rbp,%rax), %sil
movb %sil, (%r12,%rax)
movb %dl, (%rbp,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7b853
addq %r9, %rbp
cmpq %r14, %r15
ja 0x7b7e0
movq 0x28(%rsp), %rax
addq %rax, %rbx
addq %rax, %r13
movq 0x30(%rsp), %r15
cmpq %r15, %rbx
jb 0x7b7d1
jmp 0x7c016
movslq %ebx, %rax
movq %rax, %rcx
shrq $0x3, %rcx
incq %rax
movq %rax, 0x40(%rsp)
incq %rcx
movq %rcx, 0x60(%rsp)
movq %r15, %r13
shrq %r13
imulq %rbx, %r13
addq %r12, %r13
cmpq $0x7, %r15
movq %r15, 0x30(%rsp)
je 0x7bb04
leaq -0x1(%r15), %rax
imulq %rbx, %rax
addq %r12, %rax
cmpq $0x29, %r15
movq %rax, 0x8(%rsp)
jb 0x7b94e
movq %r15, %rbp
shrq $0x3, %rbp
imulq %rbx, %rbp
leaq (%r12,%rbp), %r15
leaq (%r12,%rbp,2), %rax
movq %rax, 0x58(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdx
movq 0x18(%rsp), %rbx
callq *%rbx
movl %eax, 0x50(%rsp)
movq %r15, 0x38(%rsp)
movq %r15, %rdi
movq 0x58(%rsp), %r15
movq %r15, %rsi
movq %r14, %rdx
callq *%rbx
cmpl $0x0, 0x50(%rsp)
js 0x7b956
testl %eax, %eax
jg 0x7b974
movq %r12, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovsq %r12, %r15
jmp 0x7b96f
movq %r12, %rbx
jmp 0x7ba94
testl %eax, %eax
js 0x7b974
movq %r12, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovnsq %r12, %r15
movq %r15, 0x38(%rsp)
movq %r13, %rdi
subq %rbp, %rdi
movq %r13, %r15
addq %rbp, %r15
movq %rdi, 0x70(%rsp)
movq %r13, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdx
movq 0x18(%rsp), %rbx
callq *%rbx
movl %eax, 0x58(%rsp)
movq %r13, %rdi
movq %r15, 0x50(%rsp)
movq %r15, %rsi
movq %r14, %rdx
callq *%rbx
cmpl $0x0, 0x58(%rsp)
js 0x7b9c8
testl %eax, %eax
jg 0x7b9eb
movq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq 0x50(%rsp), %r13
movq %r13, %rsi
jmp 0x7b9dc
testl %eax, %eax
js 0x7b9eb
movq 0x70(%rsp), %r13
movq %r13, %rdi
movq 0x50(%rsp), %rbx
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovsq %rbx, %r13
leaq (,%rbp,2), %rax
negq %rbp
movq 0x8(%rsp), %r15
movq %r15, %rdi
subq %rax, %rdi
addq %r15, %rbp
movq %rdi, 0x50(%rsp)
movq %rbp, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdx
movq 0x18(%rsp), %rbx
callq *%rbx
movl %eax, 0x58(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *%rbx
cmpl $0x0, 0x58(%rsp)
js 0x7ba5b
testl %eax, %eax
movq 0x38(%rsp), %rbx
jg 0x7ba8a
movq 0x50(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovsq %r14, %r15
jmp 0x7ba83
testl %eax, %eax
movq 0x38(%rsp), %rbx
js 0x7ba8a
movq 0x50(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovnsq %r14, %r15
movq %r15, 0x8(%rsp)
jmp 0x7ba8f
movq %rbp, 0x8(%rsp)
movq 0x30(%rsp), %r15
movq %rbx, 0x38(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdx
movq 0x18(%rsp), %rbx
callq *%rbx
movl %eax, %ebp
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
callq *%rbx
testl %ebp, %ebp
js 0x7badc
testl %eax, %eax
movq 0x28(%rsp), %rbx
jg 0x7bb04
movq 0x38(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
jmp 0x7baf5
testl %eax, %eax
movq 0x28(%rsp), %rbx
js 0x7bb04
movq 0x38(%rsp), %r13
movq %r13, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
cmovsq %r14, %r13
cmpl $0x0, 0x24(%rsp)
je 0x7bb3a
testb $0x1, 0x7(%rsp)
je 0x7bb4c
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
movq (%r12,%rcx), %rdx
movq (%r13,%rcx), %rsi
movq %rsi, (%r12,%rcx)
movq %rdx, (%r13,%rcx)
addq $0x8, %rcx
decq %rax
cmpq $0x1, %rax
jg 0x7bb19
jmp 0x7bb71
movq (%r12), %rax
movq (%r13), %rcx
movq %rcx, (%r12)
movq %rax, (%r13)
jmp 0x7bb71
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movb (%r12,%rax), %dl
movb (%r13,%rax), %sil
movb %sil, (%r12,%rax)
movb %dl, (%r13,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7bb53
leaq (%r12,%rbx), %r14
decq %r15
imulq %rbx, %r15
addq %r12, %r15
movl $0x0, 0x8(%rsp)
movq %r15, %r13
movq %r14, %rbp
movq %r14, 0x38(%rsp)
cmpq %r13, %rbp
ja 0x7bc00
movq %rbp, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
jg 0x7bc00
jne 0x7bcec
cmpl $0x0, 0x24(%rsp)
je 0x7bbed
testb $0x1, 0x7(%rsp)
je 0x7bcbd
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
movq (%r14,%rcx), %rdx
movq (%rbp,%rcx), %rsi
movq %rsi, (%r14,%rcx)
movq %rdx, (%rbp,%rcx)
addq $0x8, %rcx
decq %rax
cmpq $0x1, %rax
jg 0x7bbc9
jmp 0x7bce1
movq (%r14), %rax
movq (%rbp), %rcx
movq %rcx, (%r14)
movq %rax, (%rbp)
jmp 0x7bce1
cmpq %r13, %rbp
seta %bl
ja 0x7bf0d
movq %r13, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
testl %eax, %eax
js 0x7bcf4
testl %eax, %eax
je 0x7bc2e
movq 0x48(%rsp), %r9
jmp 0x7bca9
cmpl $0x0, 0x24(%rsp)
movq 0x48(%rsp), %r9
je 0x7bc69
testb $0x1, 0x7(%rsp)
je 0x7bc79
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
movq (%r13,%rcx), %rdx
movq (%r15,%rcx), %rsi
movq %rsi, (%r13,%rcx)
movq %rdx, (%r15,%rcx)
addq $0x8, %rcx
decq %rax
cmpq $0x1, %rax
jg 0x7bc48
jmp 0x7bc9e
movq (%r13), %rax
movq (%r15), %rcx
movq %rcx, (%r13)
movq %rax, (%r15)
jmp 0x7bc9e
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movb (%r13,%rax), %dl
movb (%r15,%rax), %sil
movb %sil, (%r13,%rax)
movb %dl, (%r15,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7bc80
addq %r9, %r15
movl $0x1, 0x8(%rsp)
addq %r9, %r13
cmpq %r13, %rbp
seta %bl
jbe 0x7bc0c
jmp 0x7bd89
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movb (%r14,%rax), %dl
movb (%rbp,%rax), %sil
movb %sil, (%r14,%rax)
movb %dl, (%rbp,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7bcc4
addq %rbx, %r14
movl $0x1, 0x8(%rsp)
addq %rbx, %rbp
jmp 0x7bb92
testb %bl, %bl
jne 0x7bf0d
cmpl $0x0, 0x24(%rsp)
movq 0x28(%rsp), %rbx
movq 0x48(%rsp), %rdi
je 0x7bd3e
testb $0x1, 0x7(%rsp)
je 0x7bd50
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
movq (%rbp,%rcx), %rdx
movq (%r13,%rcx), %rsi
movq %rsi, (%rbp,%rcx)
movq %rdx, (%r13,%rcx)
addq $0x8, %rcx
decq %rax
cmpq $0x1, %rax
jg 0x7bd1b
jmp 0x7bd76
movq (%rbp), %rax
movq (%r13), %rcx
movq %rcx, (%rbp)
movq %rax, (%r13)
jmp 0x7bd76
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movb (%rbp,%rax), %dl
movb (%r13,%rax), %sil
movb %sil, (%rbp,%rax)
movb %dl, (%r13,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7bd57
addq %rbx, %rbp
addq %rdi, %r13
movl $0x1, 0x8(%rsp)
jmp 0x7bb92
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %rax
imulq %rbx, %rax
leaq (%r12,%rax), %rcx
movq %rcx, 0x30(%rsp)
cmpl $0x0, 0x8(%rsp)
je 0x7bf1c
movq %rbp, %rax
subq %r14, %rax
subq %r12, %r14
cmpq %rax, %r14
cmovgeq %rax, %r14
testq %r14, %r14
jle 0x7be19
movq %rbp, %rcx
subq %r14, %rcx
movslq %r14d, %rdx
testb $0x1, 0x7(%rsp)
je 0x7bdf8
shrq $0x3, %rdx
incq %rdx
xorl %esi, %esi
movq (%r12,%rsi), %rdi
movq (%rcx,%rsi), %r8
movq %r8, (%r12,%rsi)
movq %rdi, (%rcx,%rsi)
addq $0x8, %rsi
decq %rdx
cmpq $0x1, %rdx
jg 0x7bdd9
jmp 0x7be19
incq %rdx
xorl %esi, %esi
movb (%r12,%rsi), %dil
movb (%rcx,%rsi), %r8b
movb %r8b, (%r12,%rsi)
movb %dil, (%rcx,%rsi)
decq %rdx
incq %rsi
cmpq $0x1, %rdx
jg 0x7bdfd
movq %r15, %r10
subq %r13, %r10
addq %rbx, %r15
movq 0x30(%rsp), %rcx
movq %rcx, %rdx
subq %r15, %rdx
cmpq %rdx, %r10
cmovbq %r10, %rdx
testq %rdx, %rdx
jle 0x7be93
subq %rdx, %rcx
movslq %edx, %rdx
testb $0x1, 0x7(%rsp)
je 0x7be70
shrq $0x3, %rdx
incq %rdx
xorl %esi, %esi
movq (%rbp,%rsi), %rdi
movq (%rcx,%rsi), %r8
movq %r8, (%rbp,%rsi)
movq %rdi, (%rcx,%rsi)
addq $0x8, %rsi
decq %rdx
cmpq $0x1, %rdx
jg 0x7be4f
jmp 0x7be93
incq %rdx
xorl %esi, %esi
movb (%rbp,%rsi), %dil
movb (%rcx,%rsi), %r8b
movb %r8b, (%rbp,%rsi)
movb %dil, (%rcx,%rsi)
decq %rdx
incq %rsi
cmpq $0x1, %rdx
jg 0x7be75
cmpq %rbx, %rax
jbe 0x7bec0
xorl %edx, %edx
divq %rbx
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r10, %r14
callq 0x7b734
movq %r14, %r10
movq 0x48(%rsp), %r9
cmpq %rbx, %r10
jbe 0x7c016
movq 0x30(%rsp), %r14
subq %r10, %r14
movq %r10, %rax
xorl %edx, %edx
movq 0x28(%rsp), %rbx
divq %rbx
movq %rax, %r15
movl %ebx, %eax
orl %r14d, %eax
testb $0x7, %al
movl $0x2, %eax
cmovel 0x6c(%rsp), %eax
movl %eax, 0x24(%rsp)
sete 0x7(%rsp)
movq %r14, %r12
cmpq $0x7, %r15
jae 0x7b8b4
jmp 0x7b797
movq 0x28(%rsp), %rbx
movq 0x48(%rsp), %r9
jmp 0x7bd8e
cmpq %rbx, %rax
movq 0x38(%rsp), %rcx
jle 0x7c016
movslq 0x28(%rsp), %rax
movq %rax, %rdx
shrq $0x3, %rdx
incq %rax
movq %rax, 0x8(%rsp)
incq %rdx
movq %rdx, 0x40(%rsp)
movq %r12, %rbx
movq %rcx, %r14
cmpq %r12, %rcx
jbe 0x7bffd
movq %rbx, %rbp
movq %r14, %r15
movq %r15, %r13
addq %r9, %r15
movq %r15, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
callq *0x18(%rsp)
movq 0x48(%rsp), %r9
testl %eax, %eax
jle 0x7bffd
cmpl $0x0, 0x24(%rsp)
je 0x7bfbb
testb $0x1, 0x7(%rsp)
je 0x7bfcb
movq 0x28(%rsp), %rax
addq %rbp, %rax
movq 0x40(%rsp), %rcx
xorl %edx, %edx
movq (%rax,%rdx), %rsi
movq (%rbp,%rdx), %rdi
movq %rdi, (%rax,%rdx)
movq %rsi, (%rbp,%rdx)
addq $0x8, %rdx
decq %rcx
cmpq $0x1, %rcx
jg 0x7bf9a
jmp 0x7bff1
movq (%r13), %rax
movq (%r15), %rcx
movq %rcx, (%r13)
movq %rax, (%r15)
jmp 0x7bff1
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movb (%r13,%rax), %dl
movb (%rbp,%rax), %sil
movb %sil, (%r13,%rax)
movb %dl, (%rbp,%rax)
decq %rcx
incq %rax
cmpq $0x1, %rcx
jg 0x7bfd2
addq %r9, %rbp
cmpq %r12, %r15
ja 0x7bf5b
movq 0x28(%rsp), %rax
movq %r14, %rcx
addq %rax, %rcx
addq %rax, %rbx
cmpq 0x30(%rsp), %rcx
jb 0x7bf49
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)