// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movq %r8, 0xa0(%rsp)
movq 0xc0(%rsp), %rax
subq $0x0, %rax
andq $0x7, %rax
cmpq $0x0, %rax
jne 0x8fd77
movq 0xb0(%rsp), %rax
andq $0x7, %rax
cmpq $0x0, %rax
je 0x8fd82
movl $0x2, %eax
movl %eax, 0x1c(%rsp)
jmp 0x8fd9c
movq 0xb0(%rsp), %rdx
movl $0x1, %eax
xorl %ecx, %ecx
cmpq $0x8, %rdx
cmovel %ecx, %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x64(%rsp)
movl $0x0, 0x60(%rsp)
cmpq $0x7, 0xb8(%rsp)
jae 0x8ff0f
movq 0xc0(%rsp), %rax
addq 0xb0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %rdx
imulq 0xb0(%rsp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x8ff0a
movq 0x70(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rcx
xorl %eax, %eax
cmpq 0xc0(%rsp), %rcx
movb %al, 0x1b(%rsp)
jbe 0x8fe4c
movq 0xa0(%rsp), %rax
movq 0x78(%rsp), %rdi
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
addq %rcx, %rdi
movq 0x78(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
cmpl $0x0, %eax
setg %al
movb %al, 0x1b(%rsp)
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x8fe59
jmp 0x8fef1
jmp 0x8fe5b
cmpl $0x0, 0x64(%rsp)
jne 0x8fea4
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
movq (%rax,%rcx), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rdx
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx)
jmp 0x8fece
movq 0x78(%rsp), %rdi
movq 0x78(%rsp), %rsi
xorl %eax, %eax
subq 0xb0(%rsp), %rax
addq %rax, %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x8fed0
jmp 0x8fed2
movq 0xb0(%rsp), %rdx
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
jmp 0x8fe04
jmp 0x8fef3
movq 0xb0(%rsp), %rax
addq 0x70(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x8fdd0
jmp 0x90778
movq 0xc0(%rsp), %rax
movq 0xb8(%rsp), %rcx
shrq %rcx
imulq 0xb0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x70(%rsp)
cmpq $0x7, 0xb8(%rsp)
jbe 0x9007a
movq 0xc0(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0xc0(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq $0x1, %rcx
imulq 0xb0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
cmpq $0x28, 0xb8(%rsp)
jbe 0x90051
movq 0xb8(%rsp), %rax
shrq $0x3, %rax
imulq 0xb0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x78(%rsp), %rdi
movq 0x78(%rsp), %rsi
addq 0x58(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x58(%rsp), %rax
shlq %rax
addq %rax, %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0x90890
movq %rax, 0x78(%rsp)
movq 0x70(%rsp), %rdi
xorl %eax, %eax
subq 0x58(%rsp), %rax
addq %rax, %rdi
movq 0x70(%rsp), %rsi
movq 0x70(%rsp), %rdx
addq 0x58(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0x90890
movq %rax, 0x70(%rsp)
movq 0x68(%rsp), %rdi
movq 0x58(%rsp), %rcx
shlq %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq 0x68(%rsp), %rsi
xorl %eax, %eax
subq 0x58(%rsp), %rax
addq %rax, %rsi
movq 0x68(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0x90890
movq %rax, 0x68(%rsp)
movq 0x78(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0x90890
movq %rax, 0x70(%rsp)
jmp 0x9007c
cmpl $0x0, 0x64(%rsp)
jne 0x900b5
movq 0xc0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
jmp 0x900d5
movq 0xc0(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x900d7
movq 0xc0(%rsp), %rax
addq 0xb0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
movq 0xc0(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq $0x1, %rcx
imulq 0xb0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
jmp 0x90129
movq 0x90(%rsp), %rcx
xorl %eax, %eax
cmpq 0x88(%rsp), %rcx
movb %al, 0x1a(%rsp)
ja 0x90175
movq 0xa0(%rsp), %rax
movq 0x90(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
cltq
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
setle %al
movb %al, 0x1a(%rsp)
movb 0x1a(%rsp), %al
testb $0x1, %al
jne 0x90182
jmp 0x9022f
cmpq $0x0, 0x50(%rsp)
jne 0x90212
movl $0x1, 0x60(%rsp)
cmpl $0x0, 0x64(%rsp)
jne 0x901d5
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x90(%rsp), %rax
movq (%rax), %rcx
movq 0x98(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
jmp 0x901f8
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x901fa
movq 0xb0(%rsp), %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xb0(%rsp), %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x90129
jmp 0x90231
movq 0x90(%rsp), %rcx
xorl %eax, %eax
cmpq 0x88(%rsp), %rcx
movb %al, 0x19(%rsp)
ja 0x9027d
movq 0xa0(%rsp), %rax
movq 0x88(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
cltq
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
setge %al
movb %al, 0x19(%rsp)
movb 0x19(%rsp), %al
testb $0x1, %al
jne 0x9028a
jmp 0x90347
cmpq $0x0, 0x50(%rsp)
jne 0x90322
movl $0x1, 0x60(%rsp)
cmpl $0x0, 0x64(%rsp)
jne 0x902dd
movq 0x88(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq (%rax), %rcx
movq 0x88(%rsp), %rax
movq %rcx, (%rax)
movq 0x30(%rsp), %rcx
movq 0x80(%rsp), %rax
movq %rcx, (%rax)
jmp 0x90300
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x90302
movq 0xb0(%rsp), %rdx
movq 0x80(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0xb0(%rsp), %rdx
movq 0x88(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x88(%rsp)
jmp 0x90231
movq 0x90(%rsp), %rax
cmpq 0x88(%rsp), %rax
jbe 0x9035e
jmp 0x90409
jmp 0x90360
cmpl $0x0, 0x64(%rsp)
jne 0x9039f
movq 0x90(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x88(%rsp), %rax
movq (%rax), %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, (%rax)
jmp 0x903c2
movq 0x90(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x903c4
movl $0x1, 0x60(%rsp)
movq 0xb0(%rsp), %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xb0(%rsp), %rdx
movq 0x88(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x88(%rsp)
jmp 0x90127
cmpl $0x0, 0x60(%rsp)
jne 0x90568
movq 0xc0(%rsp), %rax
addq 0xb0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %rdx
imulq 0xb0(%rsp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x90563
movq 0x70(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rcx
xorl %eax, %eax
cmpq 0xc0(%rsp), %rcx
movb %al, 0x18(%rsp)
jbe 0x904a5
movq 0xa0(%rsp), %rax
movq 0x78(%rsp), %rdi
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
addq %rcx, %rdi
movq 0x78(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
cmpl $0x0, %eax
setg %al
movb %al, 0x18(%rsp)
movb 0x18(%rsp), %al
testb $0x1, %al
jne 0x904b2
jmp 0x9054a
jmp 0x904b4
cmpl $0x0, 0x64(%rsp)
jne 0x904fd
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
movq (%rax,%rcx), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rdx
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx)
jmp 0x90527
movq 0x78(%rsp), %rdi
movq 0x78(%rsp), %rsi
xorl %eax, %eax
subq 0xb0(%rsp), %rax
addq %rax, %rsi
movq 0xb0(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
jmp 0x90529
jmp 0x9052b
movq 0xb0(%rsp), %rdx
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
jmp 0x9045d
jmp 0x9054c
movq 0xb0(%rsp), %rax
addq 0x70(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x90429
jmp 0x90778
movq 0xc0(%rsp), %rax
movq 0xb8(%rsp), %rcx
imulq 0xb0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x98(%rsp), %rax
movq 0xc0(%rsp), %rcx
subq %rcx, %rax
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jge 0x905ce
movq 0x98(%rsp), %rax
movq 0xc0(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0x905e6
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jle 0x90622
movq 0xc0(%rsp), %rdi
movq 0x90(%rsp), %rsi
xorl %eax, %eax
subq 0x50(%rsp), %rax
addq %rax, %rsi
movq 0x50(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
subq %rcx, %rax
movq 0x68(%rsp), %rcx
movq 0x80(%rsp), %rdx
subq %rdx, %rcx
subq 0xb0(%rsp), %rcx
cmpq %rcx, %rax
jae 0x9066c
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x8(%rsp)
jmp 0x90689
movq 0x68(%rsp), %rax
movq 0x80(%rsp), %rcx
subq %rcx, %rax
subq 0xb0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jle 0x906c2
movq 0x90(%rsp), %rdi
movq 0x68(%rsp), %rsi
xorl %eax, %eax
subq 0x50(%rsp), %rax
addq %rax, %rsi
movq 0x50(%rsp), %rax
movl %eax, %edx
movl 0x64(%rsp), %ecx
callq 0x90780
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x50(%rsp)
cmpq 0xb0(%rsp), %rax
jbe 0x9071d
movq 0xc0(%rsp), %rdi
movq 0x50(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0xb0(%rsp)
movq %rax, %rsi
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
movq 0xa0(%rsp), %r8
callq 0x8fd20
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x50(%rsp)
cmpq 0xb0(%rsp), %rax
jbe 0x90771
movq 0x68(%rsp), %rax
xorl %ecx, %ecx
subq 0x50(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0xc0(%rsp)
movq 0x50(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0xb0(%rsp)
movq %rax, 0xb8(%rsp)
jmp 0x90773
jmp 0x90778
jmp 0x8fd4f
addq $0xc8, %rsp
retq