// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/dual-pivot-qsort.c
// Function: gt_rec_dual_pivot_quicksort_fast
void gt_rec_dual_pivot_quicksort_fast(GtUword *input,GtUword lowindex,
                                      GtUword highindex)
{
  if (lowindex >= highindex)
  {
    return;
  } else
  {
    GtUword len = highindex - lowindex + 1;

    if (len <= 6UL)
    {
      gt_dual_insertion_sort(input,lowindex,highindex);
    } else
    {
      GtUword idx, lt, gt, pivot1, pivot2;

      gt_dual_pivots_get(&pivot1,&pivot2,input,lowindex,highindex);
      gt_assert(pivot1 <= pivot2);
      lt = lowindex + 1;
      gt_assert(highindex > 0);
      gt = highindex - 1;
      for (idx = lowindex + 1; idx <= gt; idx++)
      {
        GtUword currentvalue = input[idx];

        if (currentvalue < pivot1)
        {
          input[idx] = input[lt];
          input[lt++] = currentvalue;
        } else
        {
          if (currentvalue >= pivot2)
          {
            while (input[gt] > pivot2 && idx < gt)
            {
              gt--;
            }
            if (input[gt] < pivot1)
            {
              input[idx] = input[lt];
              input[lt++] = input[gt];
            } else
            {
              input[idx] = input[gt];
            }
            input[gt] = currentvalue;
            gt--;
          }
        }
      }
      gt_assert(lt > 0);
      lt--;
      gt++;
      input[lowindex] = input[lt];
      input[lt] = pivot1;
      input[highindex] = input[gt];
      input[gt] = pivot2;
      if (lt >= 1UL)
      {
        gt_rec_dual_pivot_quicksort_fast(input, lowindex, lt - 1);
      }
      gt_rec_dual_pivot_quicksort_fast(input, lt, gt);
      gt_rec_dual_pivot_quicksort_fast(input, gt + 1, highindex);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpq %rdx, %rsi
jae 0xe6bfa
movq %rdx, %rbx
movq %rdi, %r14
leaq -0x1(%rdx), %r12
leaq 0x8(%rdi), %r13
movq %rbx, %rcx
subq %rsi, %rcx
incq %rcx
cmpq $0x6, %rcx
jbe 0xe6bc8
movq %rcx, %rax
shrq $0x3, %rax
movq %rcx, %rdi
shrq $0x6, %rdi
addq %rax, %rdi
leaq (%rsi,%rbx), %rax
shrq %rax
movq %rax, 0x48(%rsp)
cmpq %rdi, %rax
jbe 0xe6c0e
leaq 0x1(%rdi), %r8
leaq (%rdi,%rax), %rdx
incq %rdx
subq %r8, %rax
movq %rax, 0x40(%rsp)
leaq (%rdi,%rdx), %r8
incq %r8
notq %rdi
xorl %r9d, %r9d
cmpq $0x8, %rcx
sete %r9b
addq %rdi, %r9
addq %rax, %r9
movq %r9, 0x38(%rsp)
movq %rdx, 0x50(%rsp)
movq %r8, 0x58(%rsp)
movl $0x1, %ecx
movq 0x30(%rsp,%rcx,8), %rdi
cmpq %rsi, %rdi
jb 0xe6c09
cmpq %rbx, %rdi
ja 0xe6c09
movq (%r14,%rdi,8), %rdi
movq %rdi, -0x8(%rsp,%rcx,8)
incq %rcx
cmpq $0x6, %rcx
jne 0xe6a60
movl $0x1, %ecx
xorl %edi, %edi
movq (%rsp,%rcx,8), %r8
movq %rdi, %r9
movq (%rsp,%r9,8), %r10
cmpq %r8, %r10
jbe 0xe6aaf
movq %r10, 0x8(%rsp,%r9,8)
movq %r8, (%rsp,%r9,8)
addq $-0x1, %r9
jb 0xe6a97
incq %rcx
incq %rdi
cmpq $0x5, %rcx
jne 0xe6a90
movl $0x1, %ecx
movq -0x8(%rsp,%rcx,8), %rdi
movq 0x30(%rsp,%rcx,8), %r8
movq %rdi, (%r14,%r8,8)
incq %rcx
cmpq $0x6, %rcx
jne 0xe6ac0
movq (%r14,%rax,8), %rcx
movq (%r14,%rdx,8), %rax
movq %rcx, (%r14,%rsi,8)
movq %rax, (%r14,%rbx,8)
cmpq %rax, %rcx
ja 0xe6c13
leaq 0x1(%rsi), %rdi
movq %r12, %rbp
cmpq %r12, %rdi
jbe 0xe6b01
movq %rdi, %rdx
jmp 0xe6b77
movq %rdi, %rdx
movq (%r14,%rdi,8), %r8
cmpq %rcx, %r8
jae 0xe6b20
leaq (%r14,%rdx,8), %r9
movq (%r9), %r10
movq %r10, (%r14,%rdi,8)
incq %rdx
movq %r8, (%r9)
jmp 0xe6b25
cmpq %rax, %r8
jae 0xe6b2f
incq %rdi
cmpq %rbp, %rdi
jbe 0xe6b04
jmp 0xe6b6e
leaq (,%rbp,8), %r9
addq %r13, %r9
movq %rbp, %r11
movq -0x8(%r9), %r10
addq $-0x8, %r9
decq %rbp
cmpq %r11, %rdi
jae 0xe6b52
cmpq %rax, %r10
ja 0xe6b3a
cmpq %rcx, %r10
jae 0xe6b68
movq (%r14,%rdx,8), %r10
movq %r10, (%r14,%rdi,8)
movq (%r9), %r10
movq %r10, (%r14,%rdx,8)
jmp 0xe6b18
movq %r10, (%r14,%rdi,8)
jmp 0xe6b1b
testq %rdx, %rdx
je 0xe6c18
movq %rdx, %r15
movq -0x8(%r14,%rdx,8), %rdi
movq %rdi, (%r14,%rsi,8)
movq %rcx, -0x8(%r14,%rdx,8)
movq 0x8(%r14,%rbp,8), %rcx
movq %rcx, (%r14,%rbx,8)
movq %rax, 0x8(%r14,%rbp,8)
decq %r15
je 0xe6ba7
addq $-0x2, %rdx
movq %r14, %rdi
callq 0xe69c0
leaq 0x1(%rbp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xe69c0
addq $0x2, %rbp
movq %rbp, %rsi
cmpq %rbx, %rbp
jb 0xe69e5
jmp 0xe6bfa
leaq 0x1(%rsi), %rax
cmpq %rsi, %rax
jbe 0xe6bf2
movq (%r14,%rax,8), %rcx
movq %rax, %rdx
movq -0x8(%r14,%rdx,8), %rdi
cmpq %rcx, %rdi
jbe 0xe6bf2
movq %rdi, (%r14,%rdx,8)
decq %rdx
movq %rcx, (%r14,%rdx,8)
cmpq %rsi, %rdx
ja 0xe6bd8
incq %rax
cmpq %rbx, %rax
jbe 0xe6bcc
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x27065
callq 0x26fbc
callq 0x2702c
callq 0x26ff3