// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/randomcodes.c
// Function: gt_randomcodes_sortremaining
static int gt_randomcodes_sortremaining(GtShortreadsortworkinfo *srsw,
                                       const GtEncseq *encseq,
                                       GtReadmode readmode,
                                       const GtSpmsuftab *spmsuftab,
                                       const GtSeqnumrelpos *snrp,
                                       const GtRandomcodestab *rct,
                                       const GtUword *allrandomcodes,
                                       GtUword minindex,
                                       GtUword maxindex,
                                       GtUword sumofwidth,
                                       unsigned int sortingdepth,
                                       unsigned int bucketkeysize,
                                       GtRandomcodesintervalprocess itvprocess,
                                       GtRandomcodesintervalprocess_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;

  gt_assert(allrandomcodes != NULL);
  current = gt_randomcodes_get_leftborder(rct, minindex);
  for (idx = minindex; idx <= maxindex; idx++)
  {
    if (idx < maxindex)
    {
      next = gt_randomcodes_get_leftborder(rct, 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)
    {
      GtUword lcpvalue = 0;
      if (idx > minindex)
      {
        lcpvalue = gt_randomcodes_codelcp(allrandomcodes[idx - 1],
            allrandomcodes[idx]);
        gt_assert(lcpvalue >=
            (GtUword)(GT_UNITSIN2BITENC - bucketkeysize));
        lcpvalue -= (GT_UNITSIN2BITENC - (GtUword) bucketkeysize);
      }
      gt_assert(lcpvalue < (GtUword)GT_UNITSIN2BITENC);
      gt_shortreadsort_firstcodes_sort(&srsresult,
                                       srsw,
                                       snrp,
                                       encseq,
                                       spmsuftab,
                                       current,
                                       width,
                                       lcpvalue,
                                       (GtUword)sortingdepth);
      if (withsuftabcheck)
      {
        gt_randomcodes_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,
                       sortingdepth, err) != 0)
        {
          haserr = true;
          break;
        }
      }
    }
    else if (width == 1UL)
    {
      if (itvprocess != NULL)
      {
        GtUword suftab_value = gt_spmsuftab_get(spmsuftab, current);
        const uint16_t lcptab_value = 0;
        if (gt_spmsuftab_usebitsforpositions(spmsuftab))
        {
          GtUword seqnum, relpos;
          seqnum = gt_encseq_seqnum(encseq, suftab_value);
          relpos = suftab_value - gt_encseq_seqstartpos(encseq, seqnum);
          suftab_value = gt_seqnumrelpos_encode(snrp, seqnum, relpos);
        }
        if (itvprocess(itvprocessdata, &suftab_value, snrp, &lcptab_value, 1UL,
                       sortingdepth, err) != 0)
        {
          haserr = true;
          break;
        }
      }
    }
    gt_assert((minindex == maxindex) || 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 $0xa8, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, 0x38(%rsp)
movl %edx, 0x5c(%rsp)
movq %rdi, 0x98(%rsp)
cmpq $0x0, 0xe0(%rsp)
je 0x1c1e8b
movq %r9, %r15
movq %rsi, %rbx
movq 0xf0(%rsp), %r12
movq 0xe8(%rsp), %r14
movq %r9, %rdi
movq %r14, %rsi
callq 0x32494e
cmpq %r12, %r14
ja 0x1c1e1b
movq %r14, %rcx
movq %rax, %rdi
movq %r15, 0x90(%rsp)
movq %rbx, 0x50(%rsp)
movl 0x108(%rsp), %eax
movl $0x20, %edx
subl %eax, %edx
movq %rdx, 0x80(%rsp)
movl %eax, %eax
addq $-0x20, %rax
movq %rax, 0x78(%rsp)
movq $-0x1, %rax
xorl %r13d, %r13d
movq $0x0, 0x48(%rsp)
xorl %r15d, %r15d
movq %r14, %rbp
movq 0x38(%rsp), %r8
movq %rdi, %rbx
cmpq %r12, %rbp
jae 0x1c1aa0
leaq 0x1(%rbp), %rsi
movq 0x90(%rsp), %rdi
movq %r8, %r14
callq 0x32494e
movq %r14, %r8
movq 0xe8(%rsp), %rcx
movq %rax, %r14
movq %rax, %rdi
cmpq %rax, %rbx
jbe 0x1c1ab7
jmp 0x1c1e68
movq 0xf8(%rsp), %rdx
movq %rdx, %r14
movq %rax, %rdi
cmpq %rdx, %rbx
ja 0x1c1e6d
subq %rbx, %r14
addq %r14, %r15
movq 0x8(%r8), %rax
cmpq %rax, %r15
ja 0x1c1e5e
cmpq $0x2, %r14
jb 0x1c1b26
cmpq %rcx, %rbp
movq %rdi, 0x60(%rsp)
jbe 0x1c1c28
movq 0xe0(%rsp), %rax
movq (%rax,%rbp,8), %rcx
xorq -0x8(%rax,%rbp,8), %rcx
movq %rcx, %rax
shrq $0x3e, %rax
jne 0x1c1c2c
movabsq $-0x4000000000000000, %rdx # imm = 0xC000000000000000
xorl %eax, %eax
incq %rax
cmpq $0x4, %rdx
jb 0x1c1c2e
shrq $0x2, %rdx
movq %rdx, %rsi
andq %rcx, %rsi
je 0x1c1b08
jmp 0x1c1c2e
cmpq $0x0, 0x110(%rsp)
je 0x1c1e01
cmpq $0x1, %r14
jne 0x1c1e01
movq %rbp, 0x40(%rsp)
subq (%r8), %rbx
jb 0x1c1e7c
cmpq %rax, %rbx
jae 0x1c1e77
movq %r15, %rbp
movq %rdi, %r15
movq 0x20(%r8), %rdi
movq %rbx, %rsi
movq %r8, %rbx
callq 0xe3c2c
movq %rax, 0x30(%rsp)
movw $0x0, 0x26(%rsp)
movq %rbx, %rdi
callq 0x1fec06
testb %al, %al
je 0x1c1bc8
movq 0x30(%rsp), %rsi
movq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0xeb655
movq %rax, %rbx
movq 0x30(%rsp), %r14
movq %r12, %rdi
movq 0xf0(%rsp), %r12
movq %rax, %rsi
callq 0xeb6ee
subq %rax, %r14
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1e2c40
movq %rax, 0x30(%rsp)
movq 0x130(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, %r8d
movq 0x120(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x26(%rsp), %rcx
movl 0x100(%rsp), %r9d
movq 0x110(%rsp), %rax
callq *%rax
testl %eax, %eax
movq 0xe8(%rsp), %rcx
movq %r15, %rdi
movq %rbp, %r15
movq 0x40(%rsp), %rbp
movq 0x38(%rsp), %r8
je 0x1c1e01
jmp 0x1c1e48
xorl %eax, %eax
jmp 0x1c1c4b
xorl %eax, %eax
cmpq 0x80(%rsp), %rax
jb 0x1c1e81
addq 0x78(%rsp), %rax
cmpq $0x20, %rax
jae 0x1c1e86
movl 0x100(%rsp), %ecx
movq %rcx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %r14, (%rsp)
leaq 0x68(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x50(%rsp), %r12
movq %r12, %rcx
movq %rbx, %r9
movq %r8, %rbx
callq 0x1f6559
cmpb $0x0, 0x128(%rsp)
je 0x1c1d8b
movq %rbp, 0x40(%rsp)
movq %r15, 0x88(%rsp)
movq 0x68(%rsp), %r15
movq 0x70(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %r12, %rdi
callq 0xe7b9c
movq %rax, %rbx
movq 0x48(%rsp), %rax
cmpq %rax, %rbx
setbe %cl
testb %cl, %r13b
jne 0x1c1e72
xorl %ebp, %ebp
movq %rax, %r12
movq (%r15,%rbp,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1e2c13
cmpq %rbx, %rbp
setb %cl
andb %r13b, %cl
cmpb $0x1, %cl
jne 0x1c1d51
cmpq %rbx, %rax
jae 0x1c1e4f
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %rax, %r13
movq %rax, 0x8(%rsp)
movq %r12, (%rsp)
movq 0x50(%rsp), %rdi
movl 0x5c(%rsp), %esi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xedc49
testl %eax, %eax
jg 0x1c1e54
testq %rbp, %rbp
movq %r13, %rax
je 0x1c1d51
movq 0xa0(%rsp), %rcx
movzwl (%rcx,%rbp,2), %ecx
cmpq %rcx, 0x30(%rsp)
jne 0x1c1e59
incq %rbp
movb $0x1, %r13b
cmpq %rbp, %r14
jne 0x1c1cd3
movq 0x68(%rsp), %rax
movq -0x8(%rax,%r14,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x1e2c13
movb $0x1, %r13b
movq 0x38(%rsp), %rbx
movq 0x88(%rsp), %r15
movq 0x40(%rsp), %rbp
jmp 0x1c1d90
movq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x110(%rsp), %r10
testq %r10, %r10
movq 0xf0(%rsp), %r12
je 0x1c1df1
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rcx
movq 0x130(%rsp), %rax
movq %rax, (%rsp)
movq 0x120(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq %r14, %r8
movl 0x100(%rsp), %r9d
callq *%r10
testl %eax, %eax
movq 0xe8(%rsp), %rcx
movq 0x60(%rsp), %rdi
movq %rbx, %r8
je 0x1c1e01
jmp 0x1c1e48
movq 0xe8(%rsp), %rcx
movq 0x60(%rsp), %rdi
movq %rbx, %r8
cmpq %r12, %rcx
je 0x1c1e0c
cmpq $-0x1, %rdi
je 0x1c1e63
incq %rbp
movq %rdi, %rax
cmpq %r12, %rbp
jbe 0x1c1a69
xorl %ebx, %ebx
movq 0x118(%rsp), %rax
testq %rax, %rax
je 0x1c1e34
movq 0x120(%rsp), %rdi
callq *%rax
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1c1e1d
callq 0x68e58
callq 0x68e91
callq 0x68eca
callq 0x68fae
callq 0x68f03
callq 0x68fe7
callq 0x68d78
callq 0x68f3c
callq 0x68db1
callq 0x68de8
callq 0x68f75
callq 0x68e1f
callq 0x69020