// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movq %r8, 0x30(%rsp)
movq %rcx, 0x50(%rsp)
movl %edx, 0x64(%rsp)
movq %rdi, 0xa0(%rsp)
cmpq $0x0, 0xf0(%rsp)
je 0x1cacd9
movq %r9, %r15
movq %rsi, %r14
movq 0x100(%rsp), %r12
movq 0xf8(%rsp), %rbx
movq %r9, %rdi
movq %rbx, %rsi
callq 0x32ed21
movq %rbx, %rcx
xorl %ebx, %ebx
cmpq %r12, %rcx
ja 0x1cac70
movq %rax, %rdi
movq %r15, 0x98(%rsp)
movq %r14, 0x48(%rsp)
movl 0x118(%rsp), %eax
movl $0x20, %edx
subl %eax, %edx
movq %rdx, 0x88(%rsp)
movl %eax, %eax
addq $-0x20, %rax
movq %rax, 0x80(%rsp)
movq $-0x1, %rax
movq $0x0, 0x40(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x68(%rsp)
xorl %r15d, %r15d
movq %rcx, %rbp
movq 0x50(%rsp), %r8
movq %rdi, %rbx
cmpq %r12, %rbp
jae 0x1ca8d1
leaq 0x1(%rbp), %rsi
movq 0x98(%rsp), %rdi
movq %r8, %r14
callq 0x32ed21
movq %r14, %r8
movq 0xf8(%rsp), %rcx
movq %rax, %r14
movq %rax, %rdi
cmpq %rax, %rbx
jbe 0x1ca8e8
jmp 0x1cacbb
movq 0x108(%rsp), %rdx
movq %rdx, %r14
movq %rax, %rdi
cmpq %rdx, %rbx
ja 0x1cacb6
subq %rbx, %r14
addq %r14, %r15
movq 0x8(%r8), %rax
cmpq %rax, %r15
ja 0x1cacac
cmpq $0x2, %r14
jb 0x1ca952
cmpq %rcx, %rbp
jbe 0x1caa69
movq 0xf0(%rsp), %rax
movq (%rax,%rbp,8), %rcx
xorq -0x8(%rax,%rbp,8), %rcx
movq %rcx, %rax
shrq $0x3e, %rax
jne 0x1caa6d
movabsq $-0x4000000000000000, %rdx # imm = 0xC000000000000000
xorl %eax, %eax
incq %rax
cmpq $0x4, %rdx
jb 0x1caa6f
shrq $0x2, %rdx
movq %rdx, %rsi
andq %rcx, %rsi
je 0x1ca934
jmp 0x1caa6f
cmpq $0x0, 0x120(%rsp)
je 0x1cac4c
cmpq $0x1, %r14
jne 0x1cac4c
movq %rbp, 0x58(%rsp)
subq (%r8), %rbx
jb 0x1cacd4
cmpq %rax, %rbx
jae 0x1caccf
movq %r15, %rbp
movq %rdi, %r15
movq 0x20(%r8), %rdi
movq %rbx, %rsi
movq %r8, %rbx
callq 0xe80ec
movq %rax, 0x38(%rsp)
movw $0x0, 0x2e(%rsp)
movq %rbx, %rdi
callq 0x2083a2
testb %al, %al
je 0x1ca9f4
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0xefc48
movq %rax, %rbx
movq 0x38(%rsp), %r14
movq %r12, %rdi
movq 0x100(%rsp), %r12
movq %rax, %rsi
callq 0xefce0
subq %rax, %r14
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1ec4d0
movq %rax, 0x38(%rsp)
movq 0x140(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, %r8d
movq 0x130(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x2e(%rsp), %rcx
movl 0x110(%rsp), %r9d
movq 0x120(%rsp), %rax
callq *%rax
movq 0x40(%rsp), %rcx
movzbl %cl, %ecx
testl %eax, %eax
movl $0x1, %eax
cmovnel %eax, %ecx
movq %rcx, 0x40(%rsp)
movq 0xf8(%rsp), %rcx
movq %r15, %rdi
movq %rbp, %r15
movq 0x58(%rsp), %rbp
movq 0x50(%rsp), %r8
je 0x1cac4c
jmp 0x1cac66
xorl %eax, %eax
jmp 0x1caa85
xorl %eax, %eax
cmpq 0x88(%rsp), %rax
jb 0x1cacc5
addq 0x80(%rsp), %rax
movq %rdi, 0xa8(%rsp)
cmpq $0x20, %rax
jae 0x1cacc0
movl 0x110(%rsp), %ecx
movq %rcx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %r14, (%rsp)
leaq 0x70(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq %r8, %r12
movq %rbx, %r9
callq 0x1ffcde
cmpb $0x0, 0x138(%rsp)
je 0x1cabdb
movq %rbp, 0x58(%rsp)
movq %r15, 0x90(%rsp)
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x48(%rsp), %rdi
callq 0xec1d8
movq %rax, %rbx
testb $0x1, %r13b
movq 0x68(%rsp), %rax
je 0x1cab1c
cmpq %rax, %rbx
jbe 0x1cacca
xorl %ebp, %ebp
movq %rax, %r12
movq (%r15,%rbp,8), %rsi
movq 0x30(%rsp), %rdi
callq 0x1ec4a3
cmpq %rbx, %rbp
setb %cl
andb %r13b, %cl
cmpb $0x1, %cl
jne 0x1cab9c
cmpq %rbx, %rax
jae 0x1cac9d
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %rax, %r13
movq %rax, 0x8(%rsp)
movq %r12, (%rsp)
movq 0x48(%rsp), %rdi
movl 0x64(%rsp), %esi
leaq 0x38(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf2285
testl %eax, %eax
jg 0x1caca2
testq %rbp, %rbp
movq %r13, %rax
je 0x1cab9c
movq 0xb0(%rsp), %rcx
movzwl (%rcx,%rbp,2), %ecx
cmpq %rcx, 0x38(%rsp)
jne 0x1caca7
incq %rbp
movb $0x1, %r13b
cmpq %rbp, %r14
jne 0x1cab1e
movq 0x70(%rsp), %rax
movq -0x8(%rax,%r14,8), %rsi
movq 0x30(%rsp), %rdi
callq 0x1ec4a3
movq %rax, 0x68(%rsp)
movb $0x1, %r13b
movq 0x50(%rsp), %rbx
movq 0x90(%rsp), %r15
movq 0x58(%rsp), %rbp
jmp 0x1cabde
movq %r12, %rbx
movq 0x120(%rsp), %r10
testq %r10, %r10
movq 0x100(%rsp), %r12
je 0x1cac33
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rcx
movq 0x140(%rsp), %rax
movq %rax, (%rsp)
movq 0x130(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq %r14, %r8
movl 0x110(%rsp), %r9d
callq *%r10
testl %eax, %eax
je 0x1cac33
movb $0x1, %al
movq %rax, 0x40(%rsp)
xorl %eax, %eax
jmp 0x1cac35
movb $0x1, %al
testb %al, %al
movq 0xf8(%rsp), %rcx
movq 0xa8(%rsp), %rdi
movq %rbx, %r8
je 0x1cac66
cmpq %r12, %rcx
je 0x1cac57
cmpq $-0x1, %rdi
je 0x1cacb1
incq %rbp
movq %rdi, %rax
cmpq %r12, %rbp
jbe 0x1ca89a
movq 0x40(%rsp), %rax
andb $0x1, %al
movzbl %al, %ebx
movq 0x128(%rsp), %rax
testq %rax, %rax
je 0x1cac87
movq 0x130(%rsp), %rdi
callq *%rax
negl %ebx
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6a6f9
callq 0x6a732
callq 0x6a76b
callq 0x6a84f
callq 0x6a7a4
callq 0x6a619
callq 0x6a888
callq 0x6a6c0
callq 0x6a816
callq 0x6a7dd
callq 0x6a652
callq 0x6a689
callq 0x6a8c1