// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq %rbx, %rcx
subq %rsi, %rcx
jbe 0xeb184
incq %rcx
cmpq $0x6, %rcx
jbe 0xeb150
movq %rcx, %rax
shrq $0x3, %rax
movq %rcx, %rdi
shrq $0x6, %rdi
addq %rax, %rdi
leaq (%rbx,%rsi), %rax
shrq %rax
movq %rax, 0x48(%rsp)
cmpq %rdi, %rax
jbe 0xeb195
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 0xeb190
cmpq %rbx, %rdi
ja 0xeb190
movq (%r14,%rdi,8), %rdi
movq %rdi, -0x8(%rsp,%rcx,8)
incq %rcx
cmpq $0x6, %rcx
jne 0xeaff2
movl $0x1, %ecx
movl $0x8, %edi
movq %rdi, %r8
movq -0x8(%rsp,%r8), %r9
movq (%rsp,%r8), %r10
cmpq %r10, %r9
jbe 0xeb045
movq %r9, (%rsp,%r8)
movq %r10, -0x8(%rsp,%r8)
addq $-0x8, %r8
jne 0xeb028
incq %rcx
addq $0x8, %rdi
cmpq $0x5, %rcx
jne 0xeb025
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 0xeb057
movq (%r14,%rax,8), %rcx
movq (%r14,%rdx,8), %rax
movq %rcx, (%r14,%rsi,8)
movq %rax, (%r14,%rbx,8)
cmpq %rax, %rcx
ja 0xeb19f
leaq 0x1(%rsi), %rdi
leaq -0x1(%rbx), %r12
cmpq %r12, %rdi
jbe 0xeb099
movq %rdi, %rdx
jmp 0xeb0fb
movq %rdi, %rdx
movq (%r14,%rdi,8), %r8
cmpq %rcx, %r8
jae 0xeb0b6
movq (%r14,%rdx,8), %r9
movq %r9, (%r14,%rdi,8)
movq %r8, (%r14,%rdx,8)
incq %rdx
jmp 0xeb0f3
cmpq %rax, %r8
jb 0xeb0f3
movq %r12, %r10
movq (%r14,%r12,8), %r9
decq %r12
cmpq %r10, %rdi
jae 0xeb0cf
cmpq %rax, %r9
ja 0xeb0bb
cmpq %rcx, %r9
jae 0xeb0ea
movq (%r14,%rdx,8), %r9
movq %r9, (%r14,%rdi,8)
movq 0x8(%r14,%r12,8), %r9
movq %r9, (%r14,%rdx,8)
incq %rdx
jmp 0xeb0ee
movq %r9, (%r14,%rdi,8)
movq %r8, 0x8(%r14,%r12,8)
incq %rdi
cmpq %r12, %rdi
jbe 0xeb09c
testq %rdx, %rdx
je 0xeb19a
movq %rdx, %r15
movq -0x8(%r14,%rdx,8), %rdi
movq %rdi, (%r14,%rsi,8)
movq %rcx, -0x8(%r14,%rdx,8)
movq 0x8(%r14,%r12,8), %rcx
movq %rcx, (%r14,%rbx,8)
movq %rax, 0x8(%r14,%r12,8)
decq %r15
je 0xeb134
addq $-0x2, %rdx
movq %r14, %rdi
callq 0xeaf60
leaq 0x1(%r12), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xeaf60
addq $0x2, %r12
movq %r12, %rsi
jmp 0xeaf71
leaq 0x1(%rsi), %rax
cmpq %rbx, %rax
ja 0xeb184
cmpq %rsi, %rax
jbe 0xeb17f
movq %rax, %rcx
movq -0x8(%r14,%rcx,8), %rdi
movq (%r14,%rcx,8), %rdx
cmpq %rdx, %rdi
jbe 0xeb17f
movq %rdi, (%r14,%rcx,8)
decq %rcx
movq %rdx, (%r14,%rcx,8)
cmpq %rsi, %rcx
ja 0xeb161
incq %rax
jmp 0xeb154
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x275b5
callq 0x2750c
callq 0x27543
callq 0x2757c