// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/firstcodes.c
// Function: gt_firstcodes_sortremaining
static int gt_firstcodes_sortremaining(GtShortreadsortworkinfo *srsw,
                                       const GtEncseq *encseq,
                                       GtReadmode readmode,
                                       const GtSpmsuftab *spmsuftab,
                                       const GtSeqnumrelpos *snrp,
                                       const GtFirstcodestab *fct,
                                       GtUword minindex,
                                       GtUword maxindex,
                                       GtUword sumofwidth,
                                       GtUword spaceforbucketprocessing,
                                       GtUword depth,
                                       GtFirstcodesintervalprocess itvprocess,
                                       GtFirstcodesintervalprocess_end
                                              itvprocess_end,
                                       void *itvprocessdata,
                                       bool withsuftabcheck,
                                       GtError *err)
{
  GtUword current,
                next = GT_UNDEF_UWORD,
                idx,
                width,
                GT_UNUSED sumwidth = 0,
                previoussuffix = 0;
  GtShortreadsortresult srsresult;
  bool previousdefined = false, haserr = false;

  current = gt_firstcodes_get_leftborder(fct,minindex);
  for (idx = minindex; idx <= maxindex; idx++)
  {
    if (idx < maxindex)
    {
      next = gt_firstcodes_get_leftborder(fct,idx+1);
      gt_assert(current < next);
      width = next - current;
    } else
    {
      gt_assert(sumofwidth > current);
      width = sumofwidth - current;
    }
    sumwidth += width;
    gt_assert(sumwidth <= spmsuftab->numofentries);
    if (width >= 2UL)
    {
      gt_shortreadsort_firstcodes_sort(&srsresult,
                                       srsw,
                                       snrp,
                                       encseq,
                                       spmsuftab,
                                       current,
                                       width,
                                       depth,
                                       0);
      if (withsuftabcheck)
      {
        gt_firstcodes_checksuftab_bucket(encseq,
                                         readmode,
                                         NULL,
                                         NULL,
                                         previoussuffix,
                                         previousdefined,
                                         srsresult.suftab_bucket,
                                         snrp,
                                         srsresult.lcptab_bucket,
                                         width);
        previousdefined = true;
        previoussuffix
          = gt_seqnumrelpos_decode_pos(snrp,srsresult.suftab_bucket[width-1]);
      }
      if (itvprocess != NULL)
      {
        if (itvprocess(itvprocessdata,
                       srsresult.suftab_bucket,
                       snrp,srsresult.lcptab_bucket,width,
                       spaceforbucketprocessing,err) != 0)
        {
          haserr = true;
          break;
        }
      }
    } else
    {
      gt_assert(width == 1UL);
    }
    gt_assert(next != GT_UNDEF_UWORD);
    current = next;
  }
  if (itvprocess_end != NULL)
  {
    itvprocess_end(itvprocessdata);
  }
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, %r15
movl %edx, 0x3c(%rsp)
movq %rsi, %rbx
movq %rdi, 0x70(%rsp)
movq 0xd8(%rsp), %r14
movq 0xd0(%rsp), %r12
movq %r9, 0x78(%rsp)
movq %r9, %rdi
movq %r12, %rsi
callq 0x317965
cmpq %r14, %r12
ja 0x1ad473
movq %rax, %rbp
movq %rbx, 0x50(%rsp)
movq $-0x1, %rcx
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %edx, %edx
movq %r15, 0x68(%rsp)
cmpq %r14, %r12
movq %r12, 0x30(%rsp)
jae 0x1ad277
leaq 0x1(%r12), %rsi
movq 0x78(%rsp), %rdi
movq %rdx, %r12
callq 0x317965
movq %r12, %rdx
movq %rax, %rcx
movq %rax, %r12
cmpq %rax, %rbp
jb 0x1ad28b
jmp 0x1ad4c0
movq 0xe0(%rsp), %rax
movq %rax, %r12
cmpq %rax, %rbp
jae 0x1ad4ca
subq %rbp, %r12
addq %r12, %rdx
cmpq 0x8(%r15), %rdx
ja 0x1ad4b6
cmpq $0x2, %r12
jb 0x1ad442
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x58(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x50(%rsp), %r14
movq %r14, %rcx
movq %r15, %r8
movq %rbp, %r9
callq 0x1f6559
cmpb $0x0, 0x110(%rsp)
je 0x1ad3e7
movq 0x58(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r14, %rdi
callq 0xe7b9c
movq %rax, %rbp
cmpq %rbx, %rax
setbe %al
testb %al, %r13b
jne 0x1ad4cf
xorl %r15d, %r15d
movq %rbx, %r14
movq 0x88(%rsp), %rax
movq (%rax,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1e2c13
movq %rax, %rbx
cmpq %rbp, %r15
setb %al
andb %r13b, %al
cmpb $0x1, %al
jne 0x1ad3b9
cmpq %rbp, %rbx
jae 0x1ad4a7
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq %r14, (%rsp)
movq 0x50(%rsp), %rdi
movl 0x3c(%rsp), %esi
leaq 0x90(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xedc49
testl %eax, %eax
jg 0x1ad4ac
testq %r15, %r15
je 0x1ad3b9
movq 0x80(%rsp), %rax
movzwl (%rax,%r15,2), %eax
cmpq %rax, 0x90(%rsp)
jne 0x1ad4b1
incq %r15
movb $0x1, %r13b
cmpq %r15, %r12
jne 0x1ad330
movq 0x58(%rsp), %rax
movq -0x8(%rax,%r12,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1e2c13
movq %rax, %rbx
movb $0x1, %r13b
movq 0x68(%rsp), %r15
movq 0xf8(%rsp), %r10
testq %r10, %r10
movq 0xd8(%rsp), %r14
je 0x1ad44f
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rcx
movq 0x118(%rsp), %rax
movq %rax, (%rsp)
movq 0x108(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq %r12, %r8
movq 0xe8(%rsp), %r9
callq *%r10
testl %eax, %eax
movq 0x30(%rsp), %r12
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
je 0x1ad45e
jmp 0x1ad4a0
cmpq $0x1, %r12
movq 0x30(%rsp), %r12
je 0x1ad45e
jmp 0x1ad4c5
movq 0x30(%rsp), %r12
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
cmpq $-0x1, %rcx
je 0x1ad4bb
incq %r12
movq %rcx, %rbp
cmpq %r14, %r12
jbe 0x1ad248
xorl %ebx, %ebx
movq 0x100(%rsp), %rax
testq %rax, %rax
je 0x1ad48c
movq 0x108(%rsp), %rdi
callq *%rax
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1ad475
callq 0x643bd
callq 0x643f6
callq 0x6442f
callq 0x644da
callq 0x64468
callq 0x6434b
callq 0x64384
callq 0x64312
callq 0x644a1