// File: /workspace/github_c_makefile_star2_O2/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 0xa0d2b
movq %rdi, %rbx
testq %rdi, %rdi
je 0xa0d57
movq %rdx, %r14
movq %rsi, %r15
leaq 0x39857a(%rip), %rax    # 0x438dc8
movl (%rax), %r12d
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq (%rsi), %rsi
testl %eax, %eax
je 0xa0889
cmpl $0x2, %eax
je 0xa087c
cmpl $0x1, %eax
jne 0xa0896
pushq $0x38
popq %rcx
movl %r14d, %edx
callq 0xa117f
jmp 0xa08a0
pushq $0x78
popq %rcx
movl %r14d, %edx
callq 0xa198d
jmp 0xa08a0
pushq $0x38
popq %rcx
movl %r14d, %edx
callq 0xa15b1
jmp 0xa08a0
movl %r14d, %edx
xorl %ecx, %ecx
callq 0xa1e13
andq $0x0, 0x10(%rbx)
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rsi
movq (%r15), %rdx
testl %eax, %eax
je 0xa08dd
cmpl $0x2, %eax
je 0xa08d0
cmpl $0x1, %eax
jne 0xa08ea
pushq $0x38
popq %rcx
movq %rbx, %rdi
callq 0xa22a3
jmp 0xa08f4
pushq $0x78
popq %rcx
movq %rbx, %rdi
callq 0xa2669
jmp 0xa08f4
pushq $0x38
popq %rcx
movq %rbx, %rdi
callq 0xa2498
jmp 0xa08f4
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa2878
cmpl $0x1, %r12d
je 0xa0903
movq 0x10(%rbx), %rcx
cmpq %r12, %rcx
jae 0xa0940
movl 0x3050(%rbx), %eax
movq 0x3038(%rbx), %rdi
movq %rbx, %rsi
addq $0x18, %rsp
testl %eax, %eax
je 0xa0c79
cmpl $0x2, %eax
je 0xa0c6a
cmpl $0x1, %eax
jne 0xa0c88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2b01
cmpq $0x100, %rcx            # imm = 0x100
ja 0xa0d88
pushq $0x1
popq %rax
xorl %edx, %edx
cmpq %rcx, %rdx
jae 0xa0979
movq 0x3028(%rbx), %rcx
movq 0x3060(%rbx), %rsi
movl (%rcx,%rax,8), %ecx
movq %rcx, (%rsi,%rdx,8)
incq %rdx
movq 0x10(%rbx), %rcx
addq $0x3, %rax
jmp 0xa0952
testq %r12, %r12
je 0xa0db9
movq 0x3060(%rbx), %rsi
movq 0x3068(%rbx), %rdi
movq (%rsi), %rdx
pushq $0x1
popq %rax
cmpq %rcx, %rax
jae 0xa09b0
addq -0x8(%rsi,%rax,8), %rdx
movq (%rsi,%rax,8), %r8
movq %rdx, (%rsi,%rax,8)
incq %rax
movq %r8, %rdx
jmp 0xa0996
movq %r14, %rax
xorl %edx, %edx
divq %r12
xorl %r8d, %r8d
leal -0x1(%r12), %r9d
leaq (%rsi,%rcx,8), %r10
addq $-0x8, %r10
decq %rcx
xorl %r11d, %r11d
xorl %r14d, %r14d
movq %r12, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
cmpq %r12, %r11
je 0xa0a96
addq %rax, %r14
subl $0x1, %edx
cmovbl %r8d, %edx
sbbq $-0x1, %r14
cmpq %r9, %r11
jne 0xa0a00
movq %rcx, (%rdi,%r9,8)
jmp 0xa0a8e
testq %r11, %r11
je 0xa0a0f
movq -0x8(%rdi,%r11,8), %r8
incq %r8
jmp 0xa0a12
xorl %r8d, %r8d
leaq (%rsi,%r8,8), %r8
movq %r8, %r13
movq %r10, %rbp
movq %r10, %r15
cmpq %rbp, %r13
ja 0xa0a69
movq %rbp, %r12
subq %r13, %r12
sarq $0x4, %r12
leaq (,%r12,8), %r12
addq %r13, %r12
cmpq %r8, %r12
jb 0xa0c97
cmpq %r10, %r12
ja 0xa0c97
movq (%r12), %rdi
cmpq %r14, %rdi
je 0xa0a73
ja 0xa0a5f
addq $0x8, %r12
movq %r12, %r13
jmp 0xa0a1f
leaq -0x8(%r12), %rbp
movq %r12, %r15
jmp 0xa0a1f
cmpq %rsi, %r15
jae 0xa0a76
jmp 0xa0cfd
movq %r12, %r15
subq %rsi, %r15
sarq $0x3, %r15
movq 0x10(%rsp), %rdi
movq %r15, (%rdi,%r11,8)
movq 0x8(%rsp), %r12
xorl %r8d, %r8d
incq %r11
jmp 0xa09db
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpq 0x8(%rsp), %r13
je 0xa0c19
movq 0x3070(%rbx), %rsi
imulq $0x3048, %r13, %r14     # imm = 0x3048
andq $0x0, 0x10(%rsi,%r14)
movq 0x3068(%rbx), %rax
movq (%rax,%r13,8), %r15
leaq (%rsi,%r14), %rax
cmpq %r15, %rbp
ja 0xa0be2
movq 0x10(%rax), %rcx
cmpq (%rax), %rcx
jne 0xa0b8d
cmpq 0x18(%rax), %rcx
jne 0xa0ae9
xorl %edi, %edi
jmp 0xa0af0
movq 0x3028(%rax), %rdi
addq 0x20(%rax), %rcx
imulq $0x18, %rcx, %rsi
leaq 0x26e2e9(%rip), %rdx    # 0x30ede8
movl $0x2c7, %ecx            # imm = 0x2C7
callq 0x93472
movq 0x3070(%rbx), %rsi
movq %rax, 0x3028(%rsi,%r14)
movq (%rsi,%r14), %rcx
cmpq 0x18(%rsi,%r14), %rcx
jne 0xa0b3d
addq %r14, %rsi
addq $0x28, %rsi
imulq $0x18, %rcx, %rdx
movq %rax, %rdi
callq 0x17630
movq 0x3070(%rbx), %rsi
cmpq $0x0, 0x3030(%rsi,%r14)
je 0xa0b7f
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x20(%rsi,%r14), %rax
cmpq %rax, %r15
jae 0xa0b84
addq %r14, %rsi
imulq $0x18, (%rsi), %rdi
addq 0x3028(%rsi), %rdi
addq %r12, %rdi
callq *0x3030(%rsi)
incq %r15
movq 0x3070(%rbx), %rsi
addq $0x18, %r12
jmp 0xa0b4e
movq 0x20(%rsi,%r14), %rax
addq %rax, (%rsi,%r14)
movq 0x10(%rsi,%r14), %rcx
movq 0x3028(%rsi,%r14), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rsi,%r14)
imulq $0x18, %rcx, %rcx
movq 0x3028(%rbx), %rdx
imulq $0x18, %rbp, %rsi
movq 0x10(%rdx,%rsi), %rdi
movq %rdi, 0x10(%rax,%rcx)
movups (%rdx,%rsi), %xmm0
movups %xmm0, (%rax,%rcx)
movq 0x3070(%rbx), %rsi
movq 0x10(%rsi,%r14), %rax
cmpq %rax, 0x8(%rsi,%r14)
jae 0xa0bda
leaq (%rsi,%r14), %rcx
movq %rax, 0x8(%rcx)
incq %rbp
jmp 0xa0aba
leaq 0x20bf(%rip), %rdi      # 0xa2ca8
movq %rax, %rsi
xorl %edx, %edx
callq 0xaeee8
movq 0x3070(%rbx), %rcx
movq %rax, 0x3040(%rcx,%r14)
testq %rax, %rax
je 0xa0ccf
incq %r15
incq %r13
movq %r15, %rbp
jmp 0xa0a9b
imulq $0x3048, 0x8(%rsp), %r14 # imm = 0x3048
xorl %r15d, %r15d
cmpq %r15, %r14
je 0xa0c5b
movq 0x3070(%rbx), %rax
movq 0x3040(%rax,%r15), %rdi
callq 0xaefdb
movq 0x3070(%rbx), %rax
movq 0x3040(%rax,%r15), %rdi
callq 0xaf45e
addq $0x3048, %r15           # imm = 0x3048
jmp 0xa0c25
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 0xa2bd1
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2b69
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2c39
movq 0x3972ca(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x24436b(%rip), %rsi    # 0x2e5013
leaq 0x26e5c8(%rip), %rdx    # 0x30f277
leaq 0x26e5f6(%rip), %rcx    # 0x30f2ac
leaq 0x26e12b(%rip), %r8     # 0x30ede8
movl $0xa4, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x397292(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x244333(%rip), %rsi    # 0x2e5013
leaq 0x26e34a(%rip), %rdx    # 0x30f031
leaq 0x26e301(%rip), %rcx    # 0x30efef
leaq 0x26e0f3(%rip), %r8     # 0x30ede8
movl $0x2cd, %r9d            # imm = 0x2CD
jmp 0xa0cc3
movq 0x397264(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x244305(%rip), %rsi    # 0x2e5013
leaq 0x26e5b4(%rip), %rdx    # 0x30f2c9
leaq 0x26e590(%rip), %rcx    # 0x30f2ac
leaq 0x26e0c5(%rip), %r8     # 0x30ede8
movl $0xb2, %r9d
jmp 0xa0cc3
movq 0x397236(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x26e210(%rip), %rsi    # 0x30ef4c
leaq 0x26e0a5(%rip), %rdx    # 0x30ede8
movl $0x25d, %ecx            # imm = 0x25D
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0
movq 0x39720a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2442ab(%rip), %rsi    # 0x2e5013
leaq 0x26e26a(%rip), %rdx    # 0x30efd9
leaq 0x26e279(%rip), %rcx    # 0x30efef
leaq 0x26e06b(%rip), %r8     # 0x30ede8
movl $0x260, %r9d            # imm = 0x260
jmp 0xa0cc3
movq 0x3971d9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x24427a(%rip), %rsi    # 0x2e5013
leaq 0x26e264(%rip), %rdx    # 0x30f004
leaq 0x26e248(%rip), %rcx    # 0x30efef
leaq 0x26e03a(%rip), %r8     # 0x30ede8
movl $0x2b9, %r9d            # imm = 0x2B9
jmp 0xa0cc3
movq 0x3971a8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x244249(%rip), %rsi    # 0x2e5013
leaq 0x2a594d(%rip), %rdx    # 0x34671e
leaq 0x26e487(%rip), %rcx    # 0x30f25f
leaq 0x26e009(%rip), %r8     # 0x30ede8
movl $0xbf, %r9d
jmp 0xa0cc3