// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-shortreadsort.c
// Function: gt_shortreadsort_sssp_sort
void gt_shortreadsort_sssp_sort(GtShortreadsortworkinfo *srsw,
                                const GtEncseq *encseq,
                                GtUword maxremain,
                                GtReadmode readmode,
                                GtEncseqReader *esr,
                                GtSuffixsortspace *sssp,
                                GtUword subbucketleft,
                                GtUword width,
                                GtUword depth,
                                GtUword maxdepth)
{
  GtUword idx, pos;
  GtSuffixsortspace_exportptr *exportptr;

  gt_shortreadsort_resize(srsw, false, width, maxremain);
  exportptr = gt_suffixsortspace_exportptr(sssp, subbucketleft);
  srsw->tbereservoir.nextfreeGtTwobitencoding = 0;
  if (exportptr->ulongtabsectionptr != NULL)
  {
    for (idx = 0; idx < width; idx++)
    {
      pos = exportptr->ulongtabsectionptr[idx];
      srsw->shortreadsorttable[idx].suffixrepresentation = pos;
      srsw->shortreadsorttable[idx].tbeidx
        = (uint32_t) srsw->tbereservoir.nextfreeGtTwobitencoding;
      srsw->shortreadsorttable[idx].unitsnotspecial
        = gt_encseq_extract2bitencvector(&srsw->tbereservoir,
                                         encseq,
                                         esr,
                                         readmode,
                                         pos+depth,
                                         maxdepth > 0 ? true : false,
                                         pos + maxdepth);
    }
  } else
  {
    for (idx = 0; idx < width; idx++)
    {
      pos = (GtUword) exportptr->uinttabsectionptr[idx];
      srsw->shortreadsorttable[idx].suffixrepresentation = pos;
      srsw->shortreadsorttable[idx].tbeidx
        = (uint32_t) srsw->tbereservoir.nextfreeGtTwobitencoding;
      srsw->shortreadsorttable[idx].unitsnotspecial
        = gt_encseq_extract2bitencvector(&srsw->tbereservoir,
                                         encseq,
                                         esr,
                                         readmode,
                                         pos+depth,
                                         maxdepth > 0 ? true : false,
                                         pos + maxdepth);
    }
  }
  QSORTNAME(gt_inlinedarr_qsort_r) (6UL, false, width, srsw, depth,
                                    subbucketleft);
  if (exportptr->ulongtabsectionptr != NULL)
  {
    for (idx = 0; idx < width; idx++)
    {
      exportptr->ulongtabsectionptr[idx]
        = srsw->shortreadsorttable[idx].suffixrepresentation;
      if (exportptr->ulongtabsectionptr[idx] == 0)
      {
        gt_suffixsortspace_updatelongest(sssp,subbucketleft + idx);
      }
    }
  } else
  {
    for (idx = 0; idx < width; idx++)
    {
      exportptr->uinttabsectionptr[idx]
        = (uint32_t) srsw->shortreadsorttable[idx].suffixrepresentation;
      if (exportptr->uinttabsectionptr[idx] == 0)
      {
        gt_suffixsortspace_updatelongest(sssp,subbucketleft + idx);
      }
    }
  }
  gt_suffixsortspace_export_done(sssp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %rbx
movq %r8, 0x38(%rsp)
movl %ecx, 0x14(%rsp)
movq %rdx, %rcx
movq %rsi, 0x30(%rsp)
movq %rdi, %r14
movq 0xa8(%rsp), %rbp
movq 0xa0(%rsp), %r15
movq 0x98(%rsp), %r13
movq 0x90(%rsp), %r12
xorl %esi, %esi
movq %r13, %rdx
callq 0x1f52ee
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
movq %r12, 0x50(%rsp)
movq %r12, %rsi
callq 0x1fc8da
leaq 0x20(%r14), %rcx
movq %rcx, 0x48(%rsp)
movq $0x0, 0x30(%r14)
cmpq $0x0, 0x8(%rax)
movq %rbp, 0x18(%rsp)
movq %rax, 0x28(%rsp)
movq %r13, 0x20(%rsp)
movq %r14, 0x8(%rsp)
je 0x1f5602
testq %r13, %r13
movq 0x38(%rsp), %r13
movl 0x14(%rsp), %r14d
movq %r15, %rdx
movq 0x30(%rsp), %r12
je 0x1f568f
movq 0x8(%rsp), %rax
movq (%rax), %r8
xorl %ebx, %ebx
movq 0x20(%rsp), %r15
xorl %r9d, %r9d
testq %rbp, %rbp
setne %r9b
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rbx), %rax
movq %rax, (%r8,%rbx,2)
movq 0x8(%rsp), %rdi
movl 0x30(%rdi), %edi
movl %edi, 0x8(%r8,%rbx,2)
movq %rdx, %rbp
leaq (%rax,%rdx), %r8
addq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movl %r14d, %ecx
callq 0xecc72
movq %rbp, %rdx
movq 0x18(%rsp), %rbp
movq 0x8(%rsp), %rdi
movq (%rdi), %r8
movl %eax, 0xc(%r8,%rbx,2)
addq $0x8, %rbx
decq %r15
jne 0x1f5594
jmp 0x1f568f
testq %r13, %r13
movq 0x38(%rsp), %r14
movl 0x14(%rsp), %r12d
movq %r15, %rdx
movq 0x30(%rsp), %r13
je 0x1f568f
movq 0x8(%rsp), %rax
movq (%rax), %rdi
xorl %ebx, %ebx
movq 0x20(%rsp), %r15
xorl %r9d, %r9d
testq %rbp, %rbp
setne %r9b
movq 0x28(%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbx), %eax
movq %rax, (%rdi,%rbx,4)
movq 0x8(%rsp), %r8
movl 0x30(%r8), %r8d
movl %r8d, 0x8(%rdi,%rbx,4)
movq %rdx, %rbp
leaq (%rax,%rdx), %r8
addq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0xecc72
movq %rbp, %rdx
movq 0x18(%rsp), %rbp
movq 0x8(%rsp), %rdi
movq (%rdi), %rdi
movl %eax, 0xc(%rdi,%rbx,4)
addq $0x4, %rbx
decq %r15
jne 0x1f5628
movq 0x20(%rsp), %r13
movq %r13, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
movq 0x50(%rsp), %r12
movq %r12, %rcx
callq 0x1f573b
movq 0x28(%rsp), %rbp
cmpq $0x0, 0x8(%rbp)
je 0x1f56f1
testq %r13, %r13
movq 0x40(%rsp), %r15
je 0x1f5725
xorl %ebx, %ebx
movq (%r14), %rax
movq (%rax,%rbx,2), %rax
movq 0x8(%rbp), %rcx
movq %rax, (%rcx,%rbx)
testq %rax, %rax
jne 0x1f56e3
movq %r15, %rdi
movq %r12, %rsi
callq 0x1fc820
incq %r12
addq $0x8, %rbx
decq %r13
jne 0x1f56c4
jmp 0x1f5725
testq %r13, %r13
movq 0x40(%rsp), %r15
je 0x1f5725
xorl %ebx, %ebx
movq (%r14), %rax
movl (%rax,%rbx,4), %eax
movq (%rbp), %rcx
movl %eax, (%rcx,%rbx)
testl %eax, %eax
jne 0x1f5719
movq %r15, %rdi
movq %r12, %rsi
callq 0x1fc820
incq %r12
addq $0x4, %rbx
decq %r13
jne 0x1f56fd
movq %r15, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fc94f