// File: /workspace/github_c_makefile_star2_O1/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
cmpq $0x0, 0x108(%rdi)
jne 0x1f505f
movq 0xa0(%r14), %rdi
shlq $0x4, %rdi
leaq 0x1caf02(%rip), %rsi    # 0x3bff50
movl $0x3e6, %edx            # imm = 0x3E6
callq 0x1092b2
movq %rax, 0x108(%r14)
cmpq %rbp, 0xc8(%r14)
jne 0x1f507f
cmpq %r13, 0xd0(%r14)
jne 0x1f507f
movq 0xf0(%r14), %rax
movq %rax, 0xb8(%r14)
cmpq %r13, 0xa0(%r14)
jb 0x1f5380
testq %r13, %r13
je 0x1f50eb
xorl %ebx, %ebx
movq %rbp, %r12
movq %r13, %r15
movq 0x148(%r14), %rdi
callq 0x205ed1
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x206063
movq 0x108(%r14), %rcx
movq %rax, 0x8(%rcx,%rbx)
addq 0xb8(%r14), %rax
movq %r14, %rdi
movq %rax, %rsi
callq 0x1f37b3
movq 0x108(%r14), %rcx
movq %rax, (%rcx,%rbx)
addq $0x10, %rbx
incq %r12
decq %r15
jne 0x1f5099
movq 0x108(%r14), %rdi
leaq 0x28c(%rip), %rcx       # 0x1f5385
movl $0x10, %edx
movq %r13, %rsi
callq 0x17f60
movq %r13, 0x8(%rsp)
testq %r13, %r13
je 0x1f5154
movl $0x8, %ebx
movq %rbp, %r12
movq 0x8(%rsp), %r15
movq 0x108(%r14), %rax
movq 0x148(%r14), %rdi
movq (%rax,%rbx), %r13
callq 0x205ed1
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x2060df
incq %r12
addq $0x10, %rbx
decq %r15
jne 0x1f511d
movq %rbp, 0x10(%rsp)
movq 0x8(%rsp), %rax
cmpq $0x2, %rax
jb 0x1f52c8
leaq -0x1(%rax), %rbp
movq 0x10(%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 0x1f52b3
leaq 0x1(%rax), %rbx
movq 0x10(%rsp), %rcx
addq %rax, %rcx
movq %rcx, (%rsp)
cmpq %r13, %rbx
jae 0x1f5200
movq %r13, %rbx
subq %rax, %rbx
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %r14, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1f5399
movq 0x128(%r14), %rdi
testq %rdi, %rdi
je 0x1f51ef
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1f5664
movq %r14, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x1f56e9
jmp 0x1f5236
movq 0x148(%r14), %rdi
callq 0x205ed1
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq (%rsp), %rdx
callq 0x206063
cmpq %rbx, %r13
jne 0x1f537b
movq %r14, %rdi
movq %rax, %rsi
movq (%rsp), %rdx
callq 0x1f4f58
movq 0x128(%r14), %rdx
movq %r13, %rax
testq %rdx, %rdx
je 0x1f52b3
movq 0x8(%rdx), %rax
testq %rax, %rax
je 0x1f5371
movq 0x20(%rdx), %rcx
addq %r15, %rcx
cmpq 0x10(%rdx), %rcx
jae 0x1f5371
movq 0xb8(%r14), %rsi
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x1f5287
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
shrq %cl, %r8
shrq $0x6, %rcx
orq %r8, (%rdi,%rcx,8)
movq %rsi, %rcx
shrq $0x20, %rcx
jne 0x1f5376
movq 0x20(%rdx), %rcx
leaq (%rax,%rcx,4), %rax
movl %esi, (%rax,%r15,4)
movq %r13, %rax
cmpq $0xff, %rsi
jb 0x1f52b3
incq 0x18(%rdx)
movq %r13, %rax
incq %r13
incq %r15
addq $0x10, %r12
decq %rbp
jne 0x1f5183
jmp 0x1f52ca
xorl %eax, %eax
leaq 0x1(%rax), %rcx
movq 0x10(%rsp), %rbx
addq %rax, %rbx
movq 0x8(%rsp), %r15
cmpq %r15, %rcx
jae 0x1f5338
subq %rax, %r15
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1f5399
movq 0x128(%r14), %rdi
testq %rdi, %rdi
je 0x1f531c
movq 0xb8(%r14), %rcx
addq %rcx, %rcx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1f5664
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 0x1f56e9
movq 0x148(%r14), %rdi
callq 0x205ed1
movq 0x148(%r14), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x206063
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 0x1f4f58
callq 0x7a11e
callq 0x7a0e7
callq 0x7a0ae
callq 0x7a155