// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/sfx-shortreadsort.c
// Function: gt_shortreadsort_firstcodes_sort
void gt_shortreadsort_firstcodes_sort(GtShortreadsortresult *srsresult,
                                      GtShortreadsortworkinfo *srsw,
                                      const GtSeqnumrelpos *snrp,
                                      const GtEncseq *encseq,
                                      const GtSpmsuftab *spmsuftab,
                                      GtUword subbucketleft,
                                      GtUword width,
                                      GtUword depth,
                                      GtUword maxdepth)
{
  GtUword idx, pos, seqnum, relpos, seqnum_relpos;
  gt_assert(maxdepth == 0 || maxdepth > depth);

  srsw->tbereservoir.nextfreeGtTwobitencoding = 0;
  for (idx = 0; idx < width; idx++)
  {
    if (gt_spmsuftab_usebitsforpositions(spmsuftab))
    {
      pos = gt_spmsuftab_get(spmsuftab,subbucketleft + idx);
      seqnum = gt_encseq_seqnum(encseq,pos);
      relpos = pos - gt_encseq_seqstartpos(encseq,seqnum);
      srsw->shortreadsorttable[idx].suffixrepresentation
        = gt_seqnumrelpos_encode(snrp, seqnum, relpos);
    } else
    {
      seqnum_relpos = gt_spmsuftab_get(spmsuftab,subbucketleft + idx);
      seqnum = gt_seqnumrelpos_decode_seqnum(snrp,seqnum_relpos);
      relpos = gt_seqnumrelpos_decode_relpos(snrp,seqnum_relpos);
      srsw->shortreadsorttable[idx].suffixrepresentation = seqnum_relpos;
    }
    srsw->shortreadsorttable[idx].tbeidx
      = (uint32_t) srsw->tbereservoir.nextfreeGtTwobitencoding;
    srsw->shortreadsorttable[idx].unitsnotspecial
      = gt_encseq_relpos_extract2bitencvector(&srsw->tbereservoir,
                                              encseq,
                                              seqnum,
                                              relpos + depth,
                                              (maxdepth > 0) ?
                                              maxdepth - depth : 0);
  }
  srsw->sumofstoredvalues += srsw->tbereservoir.nextfreeGtTwobitencoding;
  QSORTNAME(gt_inlinedarr_qsort_r) (6UL, false, width, srsw, depth,
                                    subbucketleft);
  for (idx = 0; idx < width; idx++)
  {
    srsw->seqnum_relpos_bucket[idx]
      = srsw->shortreadsorttable[idx].suffixrepresentation;
  }
  srsresult->suftab_bucket = srsw->seqnum_relpos_bucket;
  srsresult->lcptab_bucket = srsw->mediumsizelcpvalues;
}

// Assembly:
subq $0x88, %rsp
movq 0xa0(%rsp), %rax
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rax
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
cmpq $0x0, 0xa0(%rsp)
je 0x2dcf15
movq 0xa0(%rsp), %rax
cmpq 0x98(%rsp), %rax
ja 0x2dcf15
movq 0x35f0bc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x239125(%rip), %rsi    # 0x516013
leaq 0x2b0154(%rip), %rdx    # 0x58d049
leaq 0x2b016f(%rip), %rcx    # 0x58d06b
leaq 0x2b00c4(%rip), %r8     # 0x58cfc7
movl $0x2b9, %r9d            # imm = 0x2B9
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2dcf17
movq 0x78(%rsp), %rax
movq $0x0, 0x30(%rax)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x90(%rsp), %rax
jae 0x2dd0fe
movq 0x60(%rsp), %rdi
callq 0x2eed70
testb $0x1, %al
jne 0x2dcf53
jmp 0x2dcfd9
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq 0x50(%rsp), %rsi
callq 0x2dd1c0
movq %rax, 0x48(%rsp)
movq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xb03a0
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0xb0530
movq %rax, %rcx
movq 0x28(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x70(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x2b1270
movq %rax, %rcx
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0x2dd036
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq 0x50(%rsp), %rsi
callq 0x2dd1c0
movq %rax, 0x30(%rsp)
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x2b1230
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x2b1250
movq %rax, 0x38(%rsp)
movq 0x30(%rsp), %rcx
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x78(%rsp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq 0x78(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
addq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0xa0(%rsp)
jbe 0x2dd0ad
movq 0xa0(%rsp), %rax
subq 0x98(%rsp), %rax
movq %rax, (%rsp)
jmp 0x2dd0b5
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0x2dd0b5
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq (%rsp), %r8
callq 0xb3cb0
movl %eax, %ecx
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2dcf2d
movq 0x78(%rsp), %rax
movq 0x30(%rax), %rcx
movq 0x78(%rsp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x90(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x98(%rsp), %r8
movq 0x58(%rsp), %r9
movl $0x6, %edi
xorl %esi, %esi
callq 0x2daf10
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x90(%rsp), %rax
jae 0x2dd18b
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x50(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2dd143
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x80(%rsp), %rax
movq %rcx, (%rax)
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0x8(%rax)
addq $0x88, %rsp
retq
nopl (%rax)