// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-diffcov.c
// Function: dc_sortsuffixesonthislevel
static void dc_sortsuffixesonthislevel(GtDifferencecover *dcov,
                                       GtUword blisbl,
                                       GtUword width)
{
  GtUword idx, rangestart, startpos;

  gt_assert(dcov != NULL);
  if (dcov->itvinfo == NULL)
  {
    dcov->itvinfo = gt_malloc(sizeof (*dcov->itvinfo) *
                              dcov->allocateditvinfo);
  }
  if (dcov->firstwithnewdepth.blisbl == blisbl &&
      dcov->firstwithnewdepth.width == width)
  {
    dcov->currentdepth = dcov->firstwithnewdepth.depth;
  }
  gt_assert(dcov->allocateditvinfo >= width);
  /*
  printf("new interval of width "GT_WU"\n",width);
  */
  for (idx=0; idx<width; idx++)
  {
    startpos = dc_suffixptrget(dcov,blisbl+idx);
    dcov->itvinfo[idx].suffixstart = startpos;
    dcov->itvinfo[idx].key
      = dc_inversesuftab_get(dcov,startpos + dcov->currentdepth);
  }
  qsort(dcov->itvinfo,(size_t) width,sizeof (*dcov->itvinfo),dc_compareitv);
  for (idx=0; idx<width; idx++)
  {
    dc_suffixptrset(dcov,blisbl+idx,dcov->itvinfo[idx].suffixstart);
  }
  rangestart = 0;
  for (idx=1UL; idx<width; idx++)
  {
    if (dcov->itvinfo[idx-1].key != dcov->itvinfo[idx].key)
    {
      if (rangestart + 1 < idx)
      {
        dc_processunsortedrange(dcov,
                                blisbl + rangestart,
                                idx - rangestart,
                                GT_MULT2(dcov->currentdepth));
        if (dcov->samplelcpvalues != NULL)
        {
          dc_setlcpvaluesofrunsortedrange(dcov->samplelcpvalues,
                                          blisbl + rangestart,
                                          idx - rangestart,
                                          GT_MULT2(dcov->currentdepth));
        }
        dc_anchorleftmost(dcov, blisbl + rangestart, idx - rangestart);
      } else
      {
        GtUword currentsuftabentry
          = dc_suffixptrget(dcov,blisbl+rangestart);

        gt_assert(rangestart + 1 == idx);
        dc_inversesuftab_set(dcov,currentsuftabentry,
                             blisbl+rangestart);
      }
      if (dcov->samplelcpvalues != NULL)
      {
        gt_lcptab_update(dcov->samplelcpvalues,
                         0,blisbl + idx,dcov->currentdepth);
      }
      rangestart = idx;
    }
  }
  if (rangestart + 1 < width)
  {
    dc_processunsortedrange(dcov,
                            blisbl + rangestart,
                            width - rangestart,
                            GT_MULT2(dcov->currentdepth));
    if (dcov->samplelcpvalues != NULL)
    {
      dc_setlcpvaluesofrunsortedrange(dcov->samplelcpvalues,
                                      blisbl + rangestart,
                                      width - rangestart,
                                      GT_MULT2(dcov->currentdepth));
    }
    dc_anchorleftmost(dcov, blisbl + rangestart, width - rangestart);
  } else
  {
    GtUword currentsuftabentry
      = dc_suffixptrget(dcov,blisbl+rangestart);
    dc_inversesuftab_set(dcov,currentsuftabentry,blisbl+rangestart);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %r14
movq 0x108(%rdi), %rax
testq %rax, %rax
jne 0x1eb891
movq 0xa0(%r14), %rdi
shlq $0x4, %rdi
leaq 0x1cb0b0(%rip), %rsi    # 0x3b6930
movl $0x3e6, %edx            # imm = 0x3E6
callq 0x104226
movq %rax, 0x108(%r14)
cmpq %rbp, 0xc8(%r14)
jne 0x1eb8b1
cmpq %r13, 0xd0(%r14)
jne 0x1eb8b1
movq 0xf0(%r14), %rcx
movq %rcx, 0xb8(%r14)
cmpq %r13, 0xa0(%r14)
jb 0x1ebbc2
testq %r13, %r13
movq %r13, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
je 0x1ebaf3
xorl %ebx, %ebx
xorl %r15d, %r15d
leaq (%r15,%rbp), %r12
movq 0x148(%r14), %rdi
callq 0x1fc7d3
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x1fc965
movq 0x108(%r14), %rcx
movq %rax, 0x8(%rcx,%rbx)
addq 0xb8(%r14), %rax
movq %r14, %rdi
movq %rax, %rsi
callq 0x1ea08e
movq 0x108(%r14), %rdi
movq %rax, (%rdi,%rbx)
incq %r15
addq $0x10, %rbx
cmpq %r15, %r13
jne 0x1eb8d6
leaq 0x294(%rip), %rcx       # 0x1ebbc7
movl $0x10, %edx
movq %r13, %rsi
callq 0x17f60
movl $0x8, %ebx
xorl %r15d, %r15d
leaq (%r15,%rbp), %r12
movq 0x108(%r14), %rax
movq 0x148(%r14), %rdi
movq (%rax,%rbx), %r13
callq 0x1fc7d3
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
movq 0x10(%rsp), %r12
callq 0x1fc9e1
incq %r15
addq $0x10, %rbx
cmpq %r15, %r12
jne 0x1eb948
cmpq $0x1, %r12
je 0x1ebb0a
leaq -0x1(%r12), %rbp
movq 0x8(%rsp), %rax
leaq 0x1(%rax), %r15
movl $0x1, %r13d
movl $0x10, %r12d
xorl %eax, %eax
movq 0x108(%r14), %rcx
movq -0x10(%rcx,%r12), %rdx
cmpq (%rcx,%r12), %rdx
je 0x1ebade
leaq 0x1(%rax), %rbx
movq 0x8(%rsp), %rcx
addq %rax, %rcx
movq %rcx, (%rsp)
cmpq %r13, %rbx
jae 0x1eba2b
movq %r13, %rbx
subq %rax, %rbx
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %r14, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1ebbdb
movq 0x128(%r14), %rdi
testq %rdi, %rdi
je 0x1eba1a
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1ebe83
movq %r14, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1ebf09
jmp 0x1eba61
movq 0x148(%r14), %rdi
callq 0x1fc7d3
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq (%rsp), %rdx
callq 0x1fc965
cmpq %rbx, %r13
jne 0x1ebbbd
movq %r14, %rdi
movq %rax, %rsi
movq (%rsp), %rdx
callq 0x1eb788
movq 0x128(%r14), %rdx
movq %r13, %rax
testq %rdx, %rdx
je 0x1ebade
movq 0x8(%rdx), %rax
testq %rax, %rax
je 0x1ebbb3
movq 0x20(%rdx), %rcx
addq %r15, %rcx
cmpq 0x10(%rdx), %rcx
jae 0x1ebbb3
movq 0xb8(%r14), %rsi
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x1ebab2
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
shrq %cl, %r8
shrq $0x6, %rcx
orq %r8, (%rdi,%rcx,8)
movq %rsi, %rcx
shrq $0x20, %rcx
jne 0x1ebbb8
movq 0x20(%rdx), %rcx
leaq (%rax,%rcx,4), %rax
movl %esi, (%rax,%r15,4)
movq %r13, %rax
cmpq $0xff, %rsi
jb 0x1ebade
incq 0x18(%rdx)
movq %r13, %rax
incq %r13
incq %r15
addq $0x10, %r12
decq %rbp
jne 0x1eb9ae
jmp 0x1ebb0c
leaq 0xcd(%rip), %rcx        # 0x1ebbc7
movl $0x10, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x17f60
xorl %eax, %eax
leaq 0x1(%rax), %rcx
movq 0x8(%rsp), %rbx
addq %rax, %rbx
movq 0x10(%rsp), %r15
cmpq %r15, %rcx
jae 0x1ebb7a
subq %rax, %r15
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1ebbdb
movq 0x128(%r14), %rdi
testq %rdi, %rdi
je 0x1ebb5e
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1ebe83
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ebf09
movq 0x148(%r14), %rdi
callq 0x1fc7d3
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1fc965
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1eb788
callq 0x78491
callq 0x7845a
callq 0x78421
callq 0x784c8