// File: /workspace/github_c_makefile_star2_O1/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 0x321d0b
cmpq %r14, %r12
setbe 0x27(%rsp)
ja 0x1b5f3a
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 0x1b5d39
leaq 0x1(%r12), %rsi
movq 0x78(%rsp), %rdi
movq %rdx, %r12
callq 0x321d0b
movq %r12, %rdx
movq %rax, %rcx
movq %rax, %r12
cmpq %rax, %rbp
jb 0x1b5d4d
jmp 0x1b5f86
movq 0xe0(%rsp), %rax
movq %rax, %r12
cmpq %rax, %rbp
jae 0x1b5f90
subq %rbp, %r12
addq %r12, %rdx
cmpq 0x8(%r15), %rdx
ja 0x1b5f7c
cmpq $0x2, %r12
jb 0x1b5f04
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 0x1ffcde
cmpb $0x0, 0x110(%rsp)
je 0x1b5ea9
movq 0x58(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r14, %rdi
callq 0xec1d8
movq %rax, %rbp
testb $0x1, %r13b
je 0x1b5def
cmpq %rbx, %rbp
jbe 0x1b5f95
xorl %r15d, %r15d
movq %rbx, %r14
movq 0x88(%rsp), %rax
movq (%rax,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1ec4a3
movq %rax, %rbx
cmpq %rbp, %r15
setb %al
andb %r13b, %al
cmpb $0x1, %al
jne 0x1b5e7b
cmpq %rbp, %rbx
jae 0x1b5f6d
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 0xf2285
testl %eax, %eax
jg 0x1b5f72
testq %r15, %r15
je 0x1b5e7b
movq 0x80(%rsp), %rax
movzwl (%rax,%r15,2), %eax
cmpq %rax, 0x90(%rsp)
jne 0x1b5f77
incq %r15
movb $0x1, %r13b
cmpq %r15, %r12
jne 0x1b5df2
movq 0x58(%rsp), %rax
movq -0x8(%rax,%r12,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1ec4a3
movq %rax, %rbx
movb $0x1, %r13b
movq 0x68(%rsp), %r15
movq 0xf8(%rsp), %r10
testq %r10, %r10
movq 0xd8(%rsp), %r14
je 0x1b5f11
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 0x1b5f20
jmp 0x1b5f3a
cmpq $0x1, %r12
movq 0x30(%rsp), %r12
je 0x1b5f20
jmp 0x1b5f8b
movq 0x30(%rsp), %r12
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
cmpq $-0x1, %rcx
je 0x1b5f81
incq %r12
movq %rcx, %rbp
cmpq %r14, %r12
setbe 0x27(%rsp)
jbe 0x1b5d0a
movq 0x100(%rsp), %rax
testq %rax, %rax
je 0x1b5f51
movq 0x108(%rsp), %rdi
callq *%rax
movzbl 0x27(%rsp), %eax
andl $0x1, %eax
negl %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x65b45
callq 0x65b7e
callq 0x65bb7
callq 0x65c62
callq 0x65bf0
callq 0x65ad3
callq 0x65b0c
callq 0x65a9a
callq 0x65c29