// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %r9, %rbx
movq %r8, 0x40(%rsp)
movl %ecx, 0x1c(%rsp)
movq %rdx, %rcx
movq %rsi, 0x38(%rsp)
movq %rdi, %r14
movq 0x98(%rsp), %rbp
movq 0x90(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %r13
movq 0x80(%rsp), %r12
xorl %esi, %esi
movq %r13, %rdx
callq 0x1a78e1
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1af79b
andq $0x0, 0x30(%r14)
leaq 0x20(%r14), %rcx
movq %rcx, 0x30(%rsp)
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x8(%rax)
je 0x1a7bfb
xorl %ebx, %ebx
movq %r13, %r15
subq $0x1, %r15
jb 0x1a7c5f
xorl %r9d, %r9d
testq %rbp, %rbp
setne %r9b
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rbx), %rax
movq (%r14), %rcx
movq %rax, (%rcx,%rbx,2)
movl 0x30(%r14), %edx
movl %edx, 0x8(%rcx,%rbx,2)
movq 0x20(%rsp), %rcx
leaq (%rax,%rcx), %r8
addq %rbp, %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0x76a3d
movq (%r14), %rcx
movl %eax, 0xc(%rcx,%rbx,2)
addq $0x8, %rbx
jmp 0x1a7b96
xorl %ebx, %ebx
movq %r13, %r15
subq $0x1, %r15
jb 0x1a7c5f
xorl %r9d, %r9d
testq %rbp, %rbp
setne %r9b
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbx), %eax
movq (%r14), %rcx
movq %rax, (%rcx,%rbx,4)
movl 0x30(%r14), %edx
movl %edx, 0x8(%rcx,%rbx,4)
movq 0x20(%rsp), %rcx
leaq (%rax,%rcx), %r8
addq %rbp, %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0x76a3d
movq (%r14), %rcx
movl %eax, 0xc(%rcx,%rbx,4)
addq $0x4, %rbx
jmp 0x1a7c00
movq %r13, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rcx
callq 0x1a7d04
movq 0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1a7cb8
xorl %ebx, %ebx
movq 0x28(%rsp), %r15
subq $0x1, %r13
jb 0x1a7cee
movq (%r14), %rax
movq (%rax,%rbx,2), %rax
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, (%rcx,%rbx)
testq %rax, %rax
jne 0x1a7caf
movq %r15, %rdi
movq %r12, %rsi
callq 0x1af681
addq $0x8, %rbx
incq %r12
jmp 0x1a7c85
xorl %ebx, %ebx
movq 0x28(%rsp), %r15
subq $0x1, %r13
jb 0x1a7cee
movq (%r14), %rax
movl (%rax,%rbx,4), %eax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movl %eax, (%rcx,%rbx)
testl %eax, %eax
jne 0x1a7ce5
movq %r15, %rdi
movq %r12, %rsi
callq 0x1af681
addq $0x4, %rbx
incq %r12
jmp 0x1a7cbf
movq %r15, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1af869