// File: /workspace/github_c_makefile_star2_O3/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 0x10fd77
movq %rdi, %rbx
testq %rdi, %rdi
je 0x10fd7c
movq %rdx, %r14
movq %rsi, %r15
leaq 0x3aa54b(%rip), %rax    # 0x4b9e18
movl (%rax), %r12d
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq (%rsi), %rsi
testl %eax, %eax
je 0x10f90c
cmpl $0x2, %eax
je 0x10f8fd
cmpl $0x1, %eax
jne 0x10f91b
movl $0x38, %ecx
movl %r14d, %edx
callq 0x110096
jmp 0x10f925
movl $0x78, %ecx
movl %r14d, %edx
callq 0x110a42
jmp 0x10f925
movl $0x38, %ecx
movl %r14d, %edx
callq 0x1105c0
jmp 0x10f925
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x111017
movq $0x0, 0x10(%rbx)
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rsi
movq (%r15), %rdx
testl %eax, %eax
je 0x10f969
cmpl $0x2, %eax
je 0x10f95a
cmpl $0x1, %eax
jne 0x10f978
movl $0x38, %ecx
movq %rbx, %rdi
callq 0x11167a
jmp 0x10f982
movl $0x78, %ecx
movq %rbx, %rdi
callq 0x111a72
jmp 0x10f982
movl $0x38, %ecx
movq %rbx, %rdi
callq 0x111889
jmp 0x10f982
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x111cb4
cmpl $0x1, %r12d
je 0x10f991
movq 0x10(%rbx), %rax
cmpq %r12, %rax
jae 0x10f9ce
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq %rbx, %rsi
addq $0x18, %rsp
testl %eax, %eax
je 0x10fa5d
cmpl $0x2, %eax
je 0x10fa4e
cmpl $0x1, %eax
jne 0x10fa6c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x111f31
cmpq $0x100, %rax            # imm = 0x100
ja 0x10fd81
testq %rax, %rax
je 0x10fa7b
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), %rsi
addq $0x18, %rax
cmpq %rsi, %rdx
jb 0x10f9f7
testq %r12, %r12
je 0x10fd86
leaq 0x3068(%rbx), %rax
movq %rax, (%rsp)
movq 0x3068(%rbx), %r10
cmpq $0x2, %rsi
jb 0x10fa9f
movq (%rcx), %rax
movl $0x1, %edx
movq %rax, %rdi
addq %rdi, %rax
movq (%rcx,%rdx,8), %rdi
movq %rax, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rsi
jne 0x10fa39
jmp 0x10fa9f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11200f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x111fa0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11207e
testq %r12, %r12
je 0x10fd86
movq 0x3060(%rbx), %rcx
movq 0x3068(%rbx), %r10
leaq 0x3068(%rbx), %rax
movq %rax, (%rsp)
xorl %esi, %esi
movq %r14, %rax
xorl %edx, %edx
divq %r12
xorl %edi, %edi
leal -0x1(%r12), %r9d
leaq (%rcx,%rsi,8), %r8
addq $-0x8, %r8
decq %rsi
xorl %r11d, %r11d
xorl %r14d, %r14d
movq %r12, 0x8(%rsp)
movq %r10, 0x10(%rsp)
addq %rax, %r14
subl $0x1, %edx
cmovbl %edi, %edx
sbbq $-0x1, %r14
cmpq %r9, %r11
jne 0x10fae4
movq %rsi, (%r10,%r9,8)
jmp 0x10fb6c
testq %r11, %r11
je 0x10faf3
movq -0x8(%r10,%r11,8), %rdi
incq %rdi
jmp 0x10faf5
xorl %edi, %edi
movq %r8, %r15
cmpq %rsi, %rdi
jg 0x10fb4c
leaq (%rcx,%rdi,8), %rdi
movq %r8, %r10
movq %r8, %rbp
movq %rdi, %r12
movq %rbp, %r15
subq %r12, %r15
sarq $0x4, %r15
leaq (%r12,%r15,8), %r15
cmpq %rdi, %r15
jb 0x10fd68
cmpq %r8, %r15
ja 0x10fd68
movq (%r15), %r13
cmpq %r14, %r13
je 0x10fb55
ja 0x10fb40
addq $0x8, %r15
movq %r15, %r12
movq %r10, %r15
jmp 0x10fb47
leaq -0x8(%r15), %rbp
movq %r15, %r10
cmpq %rbp, %r12
jbe 0x10fb0a
cmpq %rcx, %r15
jb 0x10fd72
subq %rcx, %r15
sarq $0x3, %r15
movq 0x10(%rsp), %r10
movq %r15, (%r10,%r11,8)
movq 0x8(%rsp), %r12
xorl %edi, %edi
incq %r11
cmpq %r12, %r11
jne 0x10fac9
movq 0x3070(%rbx), %rsi
xorl %ebp, %ebp
xorl %r15d, %r15d
imulq $0x3048, %rbp, %r14     # imm = 0x3048
movq $0x0, 0x10(%rsi,%r14)
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp,8), %r12
cmpq %r12, %r15
ja 0x10fceb
xorl %eax, %eax
cmpq (%rsi,%r14), %rax
jne 0x10fc87
addq %r14, %rsi
cmpq 0x18(%rsi), %rax
jne 0x10fbc1
xorl %edi, %edi
jmp 0x10fbc8
movq 0x3028(%rsi), %rdi
addq 0x20(%rsi), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
leaq 0x25eef5(%rip), %rdx    # 0x36ead0
movl $0x2c7, %ecx            # imm = 0x2C7
callq 0x104461
movq 0x3070(%rbx), %rsi
movq %rax, 0x3028(%rsi,%r14)
movq (%rsi,%r14), %rcx
cmpq 0x18(%rsi,%r14), %rcx
jne 0x10fc1d
addq %r14, %rsi
addq $0x28, %rsi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rdx
movq %rax, %rdi
callq 0x17660
movq 0x3070(%rbx), %rsi
cmpq $0x0, 0x3030(%rsi,%r14)
je 0x10fc75
cmpq $0x0, 0x20(%rsi,%r14)
je 0x10fc7c
addq %r14, %rsi
xorl %r12d, %r12d
movq %rsi, %rax
xorl %r13d, %r13d
movq (%rax), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x3, %rdi
addq 0x3028(%rax), %rdi
addq %r12, %rdi
callq *0x3030(%rax)
incq %r13
movq 0x3070(%rbx), %rsi
leaq (%rsi,%r14), %rax
movq 0x20(%rsi,%r14), %rcx
addq $0x18, %r12
cmpq %rcx, %r13
jb 0x10fc3c
jmp 0x10fc7e
movq 0x20(%rsi,%r14), %rcx
jmp 0x10fc7e
xorl %ecx, %ecx
addq %rcx, (%rsi,%r14)
movq 0x10(%rsi,%r14), %rax
movq 0x3028(%rsi,%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rsi,%r14)
leaq (%rax,%rax,2), %rax
movq 0x3028(%rbx), %rdx
leaq (%r15,%r15,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), %rsi
movq 0x10(%rsi,%r14), %rax
cmpq %rax, 0x8(%rsi,%r14)
jae 0x10fcd4
leaq (%rsi,%r14), %rcx
movq %rax, 0x8(%rcx)
incq %r15
movq (%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbp,8), %r12
cmpq %r12, %r15
jbe 0x10fbaa
addq %r14, %rsi
leaq 0x23ff(%rip), %rdi      # 0x1120f4
xorl %edx, %edx
callq 0x11c738
movq 0x3070(%rbx), %rsi
movq %rax, 0x3040(%rsi,%r14)
testq %rax, %rax
je 0x10fd6d
incq %r12
incq %rbp
movq %r12, %r15
movq 0x8(%rsp), %r12
cmpq %r12, %rbp
jne 0x10fb84
movl $0x3040, %r14d          # imm = 0x3040
movq 0x3070(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x11c7d7
movq 0x3070(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x11c93d
addq $0x3048, %r14           # imm = 0x3048
decq %r12
jne 0x10fd2d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x343b3
callq 0x34425
callq 0x343ec
callq 0x344d0
callq 0x34497
callq 0x3437a
callq 0x3445e