// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/radix_sort.c
// Function: gt_radixsort_inplace
static void gt_radixsort_inplace(GtRadixsortinfo *radixsortinfo,
                                 GtRadixvalues *radixvalues,
                                 GtUword len)
{
  const size_t shift = (sizeof (GtUword) - 1) * CHAR_BIT;
  const size_t doubleshift = (2 * sizeof (GtUword) - 1) * CHAR_BIT;
  const size_t flba_index = 0;
#ifdef GT_THREADS_ENABLED
  const unsigned int threads = GT_THREADS_JOBS;
#else
  const unsigned int threads = 1U;
#endif

  if (len > (GtUword) GT_COUNTBASETYPE_MAX)
  {
    fprintf(stderr,"%s, line %d: assertion failed: if you want to sort arrays "
                    "of length > 2^{32}-1, then recompile code by setting "
                   "#define GT_RADIX_LARGEARRAYS\n",__FILE__,__LINE__);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_assert(radixsortinfo != NULL);
  if (radixsortinfo->elemtype == GtRadixelemtypeGtUwordPair)
  {
    gt_radixsort_ulongpair_shuffle(radixsortinfo->rbuf,
                                   radixvalues->ulongpairptr,
                                   (GtCountbasetype) len,shift);
  } else
  {
    if (radixsortinfo->elemtype == GtRadixelemtypeGtUword)
    {
      gt_radixsort_ulong_shuffle(radixsortinfo->rbuf,radixvalues->ulongptr,
                                 (GtCountbasetype) len,shift);
    } else
    {
      if (radixsortinfo->elemtype == GtRadixelemtypeGtuint64keyPair)
      {
        gt_radixsort_uint64keypair_shuffle(radixsortinfo->rbuf,
                                           radixvalues->uint64keypairptr,
                                           (GtCountbasetype) len,doubleshift);
      } else
      {
        gt_radixsort_flba_shuffle(radixsortinfo->rbuf,
                                  radixvalues->flbaptr,
                                  (GtCountbasetype) len,flba_index);
      }
    }
  }
  GT_STACK_MAKEEMPTY(&radixsortinfo->stack);
  if (radixsortinfo->elemtype == GtRadixelemtypeGtUwordPair)
  {
    gt_radixsort_ulongpair_process_bin(&radixsortinfo->stack,
                                       radixsortinfo->rbuf,
                                       radixvalues->ulongpairptr,
                                       shift);
  } else
  {
    if (radixsortinfo->elemtype == GtRadixelemtypeGtUword)
    {
      gt_radixsort_ulong_process_bin(&radixsortinfo->stack,
                                     radixsortinfo->rbuf,
                                     radixvalues->ulongptr,shift);
    } else
    {
      if (radixsortinfo->elemtype == GtRadixelemtypeGtuint64keyPair)
      {
        gt_radixsort_uint64keypair_process_bin(&radixsortinfo->stack,
                                               radixsortinfo->rbuf,
                                               radixvalues->uint64keypairptr,
                                               doubleshift);
      } else
      {
        gt_radixsort_flba_process_bin(&radixsortinfo->stack,
                                      radixsortinfo->rbuf,
                                      radixvalues->flbaptr,
                                      flba_index);
      }
    }
  }
  if (threads == 1U || radixsortinfo->stack.nextfree < (GtUword) threads)
  {
    if (radixsortinfo->elemtype == GtRadixelemtypeGtUwordPair)
    {
      gt_radixsort_ulongpair_sub_inplace(radixsortinfo->rbuf,
                                         &radixsortinfo->stack);
    } else
    {
      if (radixsortinfo->elemtype == GtRadixelemtypeGtUword)
      {
        gt_radixsort_ulong_sub_inplace(radixsortinfo->rbuf,
                                       &radixsortinfo->stack);
      } else
      {
        if (radixsortinfo->elemtype == GtRadixelemtypeGtuint64keyPair)
        {
          gt_radixsort_uint64keypair_sub_inplace(radixsortinfo->rbuf,
                                                 &radixsortinfo->stack);
        } else
        {
          gt_radixsort_flba_sub_inplace(radixsortinfo->rbuf,
                                        &radixsortinfo->stack);
        }
      }
    }
  } else
  {
#ifdef GT_THREADS_ENABLED
    GtUword last = 0, j;
    unsigned int t;

    gt_assert(radixsortinfo->stack.nextfree <= UINT8_MAX+1);
    for (j=0; j<radixsortinfo->stack.nextfree; j++)
    {
      radixsortinfo->lentab[j] = (GtUword) radixsortinfo->stack.space[j].len;
    }
    gt_evenly_divide_lentab(radixsortinfo->endindexes,
                            radixsortinfo->lentab,
                            radixsortinfo->stack.nextfree,len,threads);
    for (t = 0; t < threads; t++)
    {
      GT_STACK_MAKEEMPTY(&radixsortinfo->threadinfo[t].stack);
      for (j = last; j <= radixsortinfo->endindexes[t]; j++)
      {
        GT_STACK_PUSH(&radixsortinfo->threadinfo[t].stack,
                      radixsortinfo->stack.space[j]);
      }
      last = radixsortinfo->endindexes[t] + 1;
      radixsortinfo->threadinfo[t].thread
        = gt_thread_new (gt_radixsort_thread_caller,
                         radixsortinfo->threadinfo + t,NULL);
      gt_assert (radixsortinfo->threadinfo[t].thread != NULL);
    }
    for (t = 0; t < threads; t++)
    {
      gt_thread_join(radixsortinfo->threadinfo[t].thread);
      gt_thread_delete(radixsortinfo->threadinfo[t].thread);
    }
#endif
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
shrq $0x20, %rax
jne 0x11533b
movq %rdi, %rbx
testq %rdi, %rdi
je 0x115340
movq %rdx, %r14
movq %rsi, %r15
leaq 0x3aff9a(%rip), %rax    # 0x4c4e18
movl (%rax), %r13d
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq (%rsi), %rsi
testl %eax, %eax
je 0x114ebd
cmpl $0x2, %eax
je 0x114eae
cmpl $0x1, %eax
jne 0x114ecc
movl $0x38, %ecx
movl %r14d, %edx
callq 0x11565e
jmp 0x114ed6
movl $0x78, %ecx
movl %r14d, %edx
callq 0x116010
jmp 0x114ed6
movl $0x38, %ecx
movl %r14d, %edx
callq 0x115b7d
jmp 0x114ed6
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x116612
movq $0x0, 0x10(%rbx)
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rsi
movq (%r15), %rdx
testl %eax, %eax
je 0x114f1a
cmpl $0x2, %eax
je 0x114f0b
cmpl $0x1, %eax
jne 0x114f29
movl $0x38, %ecx
movq %rbx, %rdi
callq 0x116c6e
jmp 0x114f33
movl $0x78, %ecx
movq %rbx, %rdi
callq 0x11705c
jmp 0x114f33
movl $0x38, %ecx
movq %rbx, %rdi
callq 0x116e78
jmp 0x114f33
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x117299
cmpl $0x1, %r13d
je 0x114f42
movq 0x10(%rbx), %rax
cmpq %r13, %rax
jae 0x114f7f
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq %rbx, %rsi
addq $0x18, %rsp
testl %eax, %eax
je 0x11530e
cmpl $0x2, %eax
je 0x1152ff
cmpl $0x1, %eax
jne 0x11531d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x117513
cmpq $0x100, %rax            # imm = 0x100
ja 0x115345
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x114fbe
movq 0x3028(%rbx), %rax
movq 0x3060(%rbx), %rcx
addq $0x8, %rax
xorl %edx, %edx
movl (%rax), %esi
movq %rsi, (%rcx,%rdx,8)
incq %rdx
movq 0x10(%rbx), %rdi
addq $0x18, %rax
cmpq %rdi, %rdx
jb 0x114fa8
testq %r13, %r13
je 0x11534a
movq 0x3060(%rbx), %rsi
movq 0x3068(%rbx), %rax
movq %rax, 0x8(%rsp)
cmpq $0x2, %rdi
jb 0x114ffe
movq (%rsi), %rax
movl $0x1, %ecx
movq %rax, %rdx
addq %rdx, %rax
movq (%rsi,%rcx,8), %rdx
movq %rax, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rdi
jne 0x114feb
movq %r14, %rax
xorl %edx, %edx
divq %r13
movq %rax, 0x10(%rsp)
leal -0x1(%r13), %eax
leaq (%rsi,%rdi,8), %r10
addq $-0x8, %r10
decq %rdi
cmpl $0x2, %r13d
movl $0x1, %ecx
cmovael %r13d, %ecx
movq %rcx, (%rsp)
xorl %r11d, %r11d
xorl %r14d, %r14d
addq 0x10(%rsp), %r14
subl $0x1, %edx
movl $0x0, %ecx
cmovbl %ecx, %edx
sbbq $-0x1, %r14
movq %rdi, %r12
cmpq %rax, %r11
je 0x1150dd
testq %r11, %r11
je 0x115065
movq 0x8(%rsp), %rcx
movq -0x8(%rcx,%r11,8), %rcx
incq %rcx
jmp 0x115067
xorl %ecx, %ecx
leaq (%rsi,%rcx,8), %r8
movq %r8, %r13
movq %r10, %rbp
movq %r10, %r15
cmpq %rbp, %r13
ja 0x1150cd
movq %rbp, %rcx
subq %r13, %rcx
sarq $0x4, %rcx
leaq (,%rcx,8), %rcx
addq %r13, %rcx
cmpq %r8, %rcx
jb 0x11532c
cmpq %r10, %rcx
ja 0x11532c
movq (%rcx), %r9
cmpq %r14, %r9
jne 0x1150b4
subq %rsi, %rcx
sarq $0x3, %rcx
movq %rcx, %r12
jmp 0x1150c6
ja 0x1150bf
addq $0x8, %rcx
movq %rcx, %r13
jmp 0x1150c6
leaq -0x8(%rcx), %rbp
movq %rcx, %r15
cmpq %r14, %r9
jne 0x115074
jmp 0x1150dd
subq %rsi, %r15
jb 0x115336
sarq $0x3, %r15
movq %r15, %r12
movq 0x8(%rsp), %rcx
movq %r12, (%rcx,%r11,8)
incq %r11
cmpq (%rsp), %r11
jne 0x115031
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x3070(%rbx), %rax
imulq $0x3048, %r13, %rbp     # imm = 0x3048
movq $0x0, 0x10(%rax,%rbp)
movq 0x3068(%rbx), %rax
movq (%rax,%r13,8), %r12
cmpq %r12, %r14
ja 0x11526e
movq 0x3070(%rbx), %rcx
movq (%rcx,%rbp), %rax
cmpq %rax, 0x10(%rcx,%rbp)
jne 0x11520e
addq %rbp, %rcx
cmpq 0x18(%rcx), %rax
jne 0x115147
xorl %edi, %edi
jmp 0x11514e
movq 0x3028(%rcx), %rdi
addq 0x20(%rcx), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
leaq 0x262bdf(%rip), %rdx    # 0x377d40
movl $0x2c7, %ecx            # imm = 0x2C7
callq 0x1094e6
movq 0x3070(%rbx), %rsi
movq %rax, 0x3028(%rsi,%rbp)
movq 0x18(%rsi,%rbp), %rax
cmpq %rax, (%rsi,%rbp)
jne 0x1151a0
addq %rbp, %rsi
movq 0x3028(%rsi), %rdi
addq $0x28, %rsi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
callq 0x17660
movq 0x3070(%rbx), %rax
cmpq $0x0, 0x3030(%rax,%rbp)
je 0x1151fe
movq 0x3070(%rbx), %rax
cmpq $0x0, 0x20(%rax,%rbp)
je 0x1151fe
addq %rbp, %rax
xorl %r12d, %r12d
xorl %r15d, %r15d
movq (%rax), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x3, %rdi
addq 0x3028(%rax), %rdi
addq %r12, %rdi
callq *0x3030(%rax)
incq %r15
movq 0x3070(%rbx), %rcx
leaq (%rcx,%rbp), %rax
addq $0x18, %r12
cmpq 0x20(%rcx,%rbp), %r15
jb 0x1151ca
movq 0x3070(%rbx), %rax
movq 0x20(%rax,%rbp), %rcx
addq %rcx, (%rax,%rbp)
movq 0x3070(%rbx), %rax
movq 0x3028(%rax,%rbp), %rcx
movq 0x10(%rax,%rbp), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x10(%rax,%rbp)
leaq (%rdx,%rdx,2), %rax
movq 0x3028(%rbx), %rdx
leaq (%r14,%r14,2), %rsi
movq 0x10(%rdx,%rsi,8), %rdi
movq %rdi, 0x10(%rcx,%rax,8)
movups (%rdx,%rsi,8), %xmm0
movups %xmm0, (%rcx,%rax,8)
movq 0x3070(%rbx), %rax
movq 0x10(%rax,%rbp), %rcx
cmpq %rcx, 0x8(%rax,%rbp)
jae 0x115266
addq %rbp, %rax
movq %rcx, 0x8(%rax)
incq %r14
jmp 0x115110
movq 0x3070(%rbx), %rsi
addq %rbp, %rsi
leaq 0x2457(%rip), %rdi      # 0x1176d6
xorl %edx, %edx
callq 0x122488
movq 0x3070(%rbx), %rcx
movq %rax, 0x3040(%rcx,%rbp)
testq %rax, %rax
je 0x115331
incq %r12
incq %r13
movq %r12, %r14
cmpq (%rsp), %r13
jne 0x1150f9
imulq $0x3048, (%rsp), %r14   # imm = 0x3048
xorl %r15d, %r15d
movq 0x3070(%rbx), %rax
movq 0x3040(%rax,%r15), %rdi
callq 0x122527
movq 0x3070(%rbx), %rax
movq 0x3040(%rax,%r15), %rdi
callq 0x12268d
addq $0x3048, %r15           # imm = 0x3048
cmpq %r15, %r14
jne 0x1152bc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1175f1
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x117582
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x117660
callq 0x34d18
callq 0x34d8a
callq 0x34d51
callq 0x34e35
callq 0x34dfc
callq 0x34cdf
callq 0x34dc3