// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/msort.c
// Function: msort_r
static int
msort_r(void *base, size_t nmemb, size_t size, void *cmpinfo,
        GtCompareWithData cmp)
{
  int i, sense;
  int big, iflag;
  unsigned char *f1, *f2, *t, *b, *tp2, *q, *l1 = NULL, *l2;
  unsigned char *list2, *list1, *p2, *p, *last, **p1;

  if (size < PSIZE / 2) {   /* Pointers must fit into 2 * size. */
    errno = EINVAL;
    return (-1);
  }

  /*
   * XXX
   * Stupid subtraction for the Cray.
   */
  iflag = 0;
  if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
    iflag = 1;

  if ((list2 = gt_malloc(nmemb * size + PSIZE)) == NULL)
    return (-1);

  list1 = base;
  setup(list1, list2, nmemb, size, cmpinfo, cmp);
  last = list2 + nmemb * size;
  i = big = 0;
  while (*EVAL(list2) != last) {
      l2 = list1;
      p1 = EVAL(list1);
      for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
        p2 = *EVAL(p2);
        f1 = l2;
        f2 = l1 = list1 + (p2 - list2);
        if (p2 != last)
          p2 = *EVAL(p2);
        l2 = list1 + (p2 - list2);
        while (f1 < l1 && f2 < l2) {
          if ((*cmp)(f1, f2, cmpinfo) <= 0) {
            q = f2;
            b = f1, t = l1;
            sense = -1;
          } else {
            q = f1;
            b = f2, t = l2;
            sense = 0;
          }
          if (!big) { /* here i = 0 */
            while ((b += size) < t && cmp(q, b, cmpinfo) >sense)
              if (++i == 6) {
                big = 1;
                goto EXPONENTIAL;
              }
          } else {
EXPONENTIAL:          for (i = size; ; i <<= 1)
              if ((p = (b + i)) >= t) {
                if ((p = t - size) > b &&
                (*cmp)(q, p, cmpinfo) <= sense)
                  t = p;
                else
                  b = p;
                break;
              } else if ((*cmp)(q, p, cmpinfo) <= sense) {
                t = p;
                if (i == size)
                  big = 0;
                goto FASTCASE;
              } else
                b = p;
            while (t > b+size) {
              i = (((t - b) / size) >> 1) * size;
              if ((*cmp)(q, p = b + i, cmpinfo) <= sense)
                t = p;
              else
                b = p;
            }
            goto COPY;
FASTCASE:         while (i > size)
              if ((*cmp)(q,
                p = b + (i >>= 1),
                cmpinfo) <= sense)
                t = p;
              else
                b = p;
COPY:           b = t;
          }
          i = size;
          if (q == f1) {
            if (iflag) {
              ICOPY_LIST(f2, tp2, b);
              ICOPY_ELT(f1, tp2, i);
            } else {
              CCOPY_LIST(f2, tp2, b);
              CCOPY_ELT(f1, tp2, i);
            }
          } else {
            if (iflag) {
              ICOPY_LIST(f1, tp2, b);
              ICOPY_ELT(f2, tp2, i);
            } else {
              CCOPY_LIST(f1, tp2, b);
              CCOPY_ELT(f2, tp2, i);
            }
          }
        }
        if (f2 < l2) {
          if (iflag)
            ICOPY_LIST(f2, tp2, l2);
          else
            CCOPY_LIST(f2, tp2, l2);
        } else if (f1 < l1) {
          if (iflag)
            ICOPY_LIST(f1, tp2, l1);
          else
            CCOPY_LIST(f1, tp2, l1);
        }
        *p1 = l2;
      }
      tp2 = list1;  /* swap list1, list2 */
      list1 = list2;
      list2 = tp2;
      last = list2 + nmemb*size;
  }
  if (base == list2) {
    memmove(list2, list1, nmemb*size);
    list2 = list1;
  }
  gt_free(list2);
  return (0);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rdx, 0x98(%rsp)
movq %rcx, 0x90(%rsp)
movq %r8, 0x88(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x4, 0x98(%rsp)
jae 0x8e26e
callq 0xb060
movl $0x16, (%rax)
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x8eb66
movl $0x0, 0x78(%rsp)
movq 0x98(%rsp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
jne 0x8e2a6
movq 0xa8(%rsp), %rax
subq $0x0, %rax
andq $0x3, %rax
cmpq $0x0, %rax
jne 0x8e2a6
movl $0x1, 0x78(%rsp)
movq 0xa0(%rsp), %rdi
imulq 0x98(%rsp), %rdi
addq $0x8, %rdi
leaq 0xe1615(%rip), %rsi     # 0x16f8d7
movl $0xdc, %edx
callq 0xd2e0
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
jne 0x8e2e7
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x8eb66
movq 0xa8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %r8
movq 0x88(%rsp), %r9
callq 0x8ec00
movq 0x30(%rsp), %rax
movq 0xa0(%rsp), %rcx
imulq 0x98(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movl $0x0, 0x7c(%rsp)
movl $0x0, 0x84(%rsp)
movq 0x30(%rsp), %rax
addq $0x8, %rax
addq $-0x1, %rax
subq $0x0, %rax
andq $-0x8, %rax
movq (%rax), %rax
cmpq 0x10(%rsp), %rax
je 0x8eb0c
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rax
addq $0x8, %rax
addq $-0x1, %rax
subq $0x0, %rax
andq $-0x8, %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x50(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x8eacb
movq 0x20(%rsp), %rax
addq $0x8, %rax
addq $-0x1, %rax
subq $0x0, %rax
andq $-0x8, %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x68(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x8e429
movq 0x20(%rsp), %rax
addq $0x8, %rax
addq $-0x1, %rax
subq $0x0, %rax
andq $-0x8, %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x70(%rsp), %rcx
xorl %eax, %eax
cmpq 0x40(%rsp), %rcx
movb %al, 0x7(%rsp)
jae 0x8e466
movq 0x68(%rsp), %rax
cmpq 0x38(%rsp), %rax
setb %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x8e473
jmp 0x8e990
movq 0x88(%rsp), %rax
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq *%rax
cmpl $0x0, %eax
jg 0x8e4bf
movq 0x68(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x60(%rsp)
movl $0xffffffff, 0x80(%rsp) # imm = 0xFFFFFFFF
jmp 0x8e4e8
movq 0x70(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x60(%rsp)
movl $0x0, 0x80(%rsp)
cmpl $0x0, 0x7c(%rsp)
jne 0x8e56b
jmp 0x8e4f1
movq 0x98(%rsp), %rcx
addq 0x58(%rsp), %rcx
movq %rcx, 0x58(%rsp)
xorl %eax, %eax
cmpq 0x60(%rsp), %rcx
movb %al, 0x6(%rsp)
jae 0x8e53a
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq *%rax
cmpl 0x80(%rsp), %eax
setg %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
testb $0x1, %al
jne 0x8e544
jmp 0x8e566
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
cmpl $0x6, %eax
jne 0x8e564
movl $0x1, 0x7c(%rsp)
jmp 0x8e56d
jmp 0x8e4f1
jmp 0x8e773
jmp 0x8e56d
movq 0x98(%rsp), %rax
movl %eax, 0x84(%rsp)
movq 0x58(%rsp), %rax
movslq 0x84(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
cmpq 0x60(%rsp), %rax
jb 0x8e5f3
movq 0x60(%rsp), %rax
xorl %ecx, %ecx
subq 0x98(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
cmpq 0x58(%rsp), %rax
jbe 0x8e5e7
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq *%rax
cmpl 0x80(%rsp), %eax
jg 0x8e5e7
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x8e5f1
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x8e664
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq *%rax
cmpl 0x80(%rsp), %eax
jg 0x8e641
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
movslq 0x84(%rsp), %rax
cmpq 0x98(%rsp), %rax
jne 0x8e63c
movl $0x0, 0x7c(%rsp)
jmp 0x8e6fb
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x8e64d
jmp 0x8e64f
movl 0x84(%rsp), %eax
shll %eax
movl %eax, 0x84(%rsp)
jmp 0x8e57c
jmp 0x8e666
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
addq 0x98(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x8e6f9
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x98(%rsp)
shrq %rax
imulq 0x98(%rsp), %rax
movl %eax, 0x84(%rsp)
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
movslq 0x84(%rsp), %rcx
addq %rcx, %rsi
movq %rsi, 0x18(%rsp)
movq 0x90(%rsp), %rdx
callq *%rax
cmpl 0x80(%rsp), %eax
jg 0x8e6ea
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x8e6f4
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x8e666
jmp 0x8e769
jmp 0x8e6fd
movslq 0x84(%rsp), %rax
cmpq 0x98(%rsp), %rax
jbe 0x8e767
movq 0x88(%rsp), %rax
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl 0x84(%rsp), %ecx
sarl %ecx
movl %ecx, 0x84(%rsp)
movslq %ecx, %rcx
addq %rcx, %rsi
movq %rsi, 0x18(%rsp)
movq 0x90(%rsp), %rdx
callq *%rax
cmpl 0x80(%rsp), %eax
jg 0x8e75b
movq 0x18(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x8e765
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x8e6fd
jmp 0x8e769
movq 0x60(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x98(%rsp), %rax
movl %eax, 0x84(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x70(%rsp), %rax
jne 0x8e890
cmpl $0x0, 0x78(%rsp)
je 0x8e817
jmp 0x8e79b
movq 0x68(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
cmpq 0x58(%rsp), %rax
jb 0x8e79b
jmp 0x8e7d3
movq 0x70(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x70(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movslq 0x84(%rsp), %rax
subq $0x4, %rax
movl %eax, 0x84(%rsp)
cmpl $0x0, %eax
jne 0x8e7d3
jmp 0x8e88b
jmp 0x8e819
movq 0x68(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movq 0x68(%rsp), %rax
cmpq 0x58(%rsp), %rax
jb 0x8e819
jmp 0x8e84d
movq 0x70(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x70(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movl 0x84(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x84(%rsp)
cmpl $0x0, %eax
jne 0x8e84d
jmp 0x8e88b
jmp 0x8e98b
cmpl $0x0, 0x78(%rsp)
je 0x8e915
jmp 0x8e899
movq 0x70(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x70(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x58(%rsp), %rax
jb 0x8e899
jmp 0x8e8d1
movq 0x68(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movslq 0x84(%rsp), %rax
subq $0x4, %rax
movl %eax, 0x84(%rsp)
cmpl $0x0, %eax
jne 0x8e8d1
jmp 0x8e989
jmp 0x8e917
movq 0x70(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x70(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movq 0x70(%rsp), %rax
cmpq 0x58(%rsp), %rax
jb 0x8e917
jmp 0x8e94b
movq 0x68(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movl 0x84(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x84(%rsp)
cmpl $0x0, %eax
jne 0x8e94b
jmp 0x8e989
jmp 0x8e98b
jmp 0x8e443
movq 0x68(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x8ea18
cmpl $0x0, 0x78(%rsp)
je 0x8e9dd
jmp 0x8e9a5
movq 0x68(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
cmpq 0x38(%rsp), %rax
jb 0x8e9a5
jmp 0x8ea13
jmp 0x8e9df
movq 0x68(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movq 0x68(%rsp), %rax
cmpq 0x38(%rsp), %rax
jb 0x8e9df
jmp 0x8ea13
jmp 0x8ea9f
movq 0x70(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x8ea9d
cmpl $0x0, 0x78(%rsp)
je 0x8ea65
jmp 0x8ea2d
movq 0x70(%rsp), %rax
movl (%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x70(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x40(%rsp), %rax
jb 0x8ea2d
jmp 0x8ea9b
jmp 0x8ea67
movq 0x70(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x70(%rsp)
movb (%rax), %cl
movq 0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x50(%rsp)
movb %cl, (%rax)
movq 0x70(%rsp), %rax
cmpq 0x40(%rsp), %rax
jb 0x8ea67
jmp 0x8ea9b
jmp 0x8ea9d
jmp 0x8ea9f
movq 0x38(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rax
addq $0x8, %rax
addq $-0x1, %rax
subq $0x0, %rax
andq $-0x8, %rax
movq %rax, 0x8(%rsp)
jmp 0x8e3aa
movq 0x28(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0xa0(%rsp), %rcx
imulq 0x98(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0x8e354
movq 0xa8(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x8eb45
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0xa0(%rsp), %rdx
imulq 0x98(%rsp), %rdx
callq 0xba20
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
leaq 0xe0d86(%rip), %rsi     # 0x16f8d7
movl $0x147, %edx            # imm = 0x147
callq 0xdab0
movl $0x0, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)