// File: /workspace/github_c_makefile_star2_O0/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 %rbx
subq $0xd0, %rsp
movq 0x130(%rsp), %rax
movb 0x128(%rsp), %al
movq 0x120(%rsp), %r10
movq 0x118(%rsp), %r10
movq 0x110(%rsp), %r10
movl 0x108(%rsp), %r10d
movl 0x100(%rsp), %r10d
movq 0xf8(%rsp), %r10
movq 0xf0(%rsp), %r10
movq 0xe8(%rsp), %r10
movq 0xe0(%rsp), %r10
movq %rdi, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movl %edx, 0xbc(%rsp)
movq %rcx, 0xb0(%rsp)
movq %r8, 0xa8(%rsp)
movq %r9, 0xa0(%rsp)
andb $0x1, %al
movb %al, 0x9f(%rsp)
movq $-0x1, 0x88(%rsp)
movq $0x0, 0x70(%rsp)
movq $0x0, 0x68(%rsp)
movb $0x0, 0x57(%rsp)
movb $0x0, 0x56(%rsp)
cmpq $0x0, 0xe0(%rsp)
jne 0x274292
movq 0x3c7d3f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1da8(%rip), %rsi    # 0x516013
leaq 0x30a946(%rip), %rdx    # 0x57ebb8
leaq 0x30b175(%rip), %rcx    # 0x57f3ee
leaq 0x30a855(%rip), %r8     # 0x57ead5
movl $0x1e6, %r9d            # imm = 0x1E6
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x274294
movq 0xa0(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x4dbbd0
movq %rax, 0x90(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
cmpq 0xf0(%rsp), %rax
ja 0x2747fd
movq 0x80(%rsp), %rax
cmpq 0xf0(%rsp), %rax
jae 0x274371
movq 0xa0(%rsp), %rdi
movq 0x80(%rsp), %rsi
addq $0x1, %rsi
callq 0x4dbbd0
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rax
cmpq 0x88(%rsp), %rax
jbe 0x274358
movq 0x3c7c79(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1ce2(%rip), %rsi    # 0x516013
leaq 0x30b0d3(%rip), %rdx    # 0x57f40b
leaq 0x30b0af(%rip), %rcx    # 0x57f3ee
leaq 0x30a78f(%rip), %r8     # 0x57ead5
movl $0x1ed, %r9d            # imm = 0x1ED
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x27435a
movq 0x88(%rsp), %rax
subq 0x90(%rsp), %rax
movq %rax, 0x78(%rsp)
jmp 0x2743d4
jmp 0x274373
movq 0xf8(%rsp), %rax
cmpq 0x90(%rsp), %rax
jae 0x2743bd
movq 0x3c7c14(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1c7d(%rip), %rsi    # 0x516013
leaq 0x30b07e(%rip), %rdx    # 0x57f41b
leaq 0x30b04a(%rip), %rcx    # 0x57f3ee
leaq 0x30a72a(%rip), %r8     # 0x57ead5
movl $0x1f1, %r9d            # imm = 0x1F1
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2743bf
movq 0xf8(%rsp), %rax
subq 0x90(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
addq 0x70(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0xb0(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x27442e
movq 0x3c7ba3(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1c0c(%rip), %rsi    # 0x516013
leaq 0x304818(%rip), %rdx    # 0x578c26
leaq 0x30afd9(%rip), %rcx    # 0x57f3ee
leaq 0x30a6b9(%rip), %r8     # 0x57ead5
movl $0x1f5, %r9d            # imm = 0x1F5
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x274430
cmpq $0x2, 0x78(%rsp)
jb 0x27467a
movq $0x0, 0x48(%rsp)
movq 0x80(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jbe 0x2744ff
movq 0xe0(%rsp), %rax
movq 0x80(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdi
movq 0xe0(%rsp), %rax
movq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x274ca0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movl $0x20, %ecx
subl 0x108(%rsp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x2744e1
movq 0x3c7af0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1b59(%rip), %rsi    # 0x516013
leaq 0x30af70(%rip), %rdx    # 0x57f431
leaq 0x30af26(%rip), %rcx    # 0x57f3ee
leaq 0x30a606(%rip), %r8     # 0x57ead5
movl $0x1fe, %r9d            # imm = 0x1FE
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2744e3
movl 0x108(%rsp), %eax
movl $0x20, %ecx
subq %rax, %rcx
movq 0x48(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x48(%rsp)
jmp 0x274501
cmpq $0x20, 0x48(%rsp)
jb 0x274541
movq 0x3c7a90(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1af9(%rip), %rsi    # 0x516013
leaq 0x30af49(%rip), %rdx    # 0x57f46a
leaq 0x30aec6(%rip), %rcx    # 0x57f3ee
leaq 0x30a5a6(%rip), %r8     # 0x57ead5
movl $0x201, %r9d            # imm = 0x201
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x274543
movq 0xc8(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0xc0(%rsp), %rcx
movq 0xb0(%rsp), %r8
movq 0x90(%rsp), %r9
movq 0x78(%rsp), %r11
movq 0x48(%rsp), %r10
movl 0x100(%rsp), %eax
leaq 0x58(%rsp), %rdi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x2dce80
testb $0x1, 0x9f(%rsp)
je 0x27461c
movq 0xc0(%rsp), %rdi
movl 0xbc(%rsp), %esi
movq 0x68(%rsp), %r8
movb 0x57(%rsp), %r9b
movq 0x58(%rsp), %rbx
movq 0xa8(%rsp), %r11
movq 0x60(%rsp), %r10
movq 0x78(%rsp), %rax
xorl %ecx, %ecx
andb $0x1, %r9b
movq %rcx, %rdx
movzbl %r9b, %r9d
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x274d30
movb $0x1, 0x57(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x58(%rsp), %rax
movq 0x78(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2b11d0
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x110(%rsp)
je 0x274675
movq 0x110(%rsp), %rax
movq 0x120(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x78(%rsp), %r8
movl 0x100(%rsp), %r9d
movq 0x130(%rsp), %r10
movq %r10, (%rsp)
callq *%rax
cmpl $0x0, %eax
je 0x274673
movb $0x1, 0x56(%rsp)
jmp 0x2747fd
jmp 0x274675
jmp 0x27477b
cmpq $0x1, 0x78(%rsp)
jne 0x274779
cmpq $0x0, 0x110(%rsp)
je 0x274777
movq 0xb0(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x274fa0
movq %rax, 0x40(%rsp)
movw $0x0, 0x3e(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x2eed70
testb $0x1, %al
jne 0x2746c9
jmp 0x274728
movq 0xc0(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0xb03a0
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xc0(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xb0530
movq %rax, %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0xa8(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x2b1270
movq %rax, 0x40(%rsp)
movq 0x110(%rsp), %rax
movq 0x120(%rsp), %rdi
movq 0xa8(%rsp), %rdx
movl 0x100(%rsp), %r9d
movq 0x130(%rsp), %r10
leaq 0x40(%rsp), %rsi
leaq 0x3e(%rsp), %rcx
movl $0x1, %r8d
movq %r10, (%rsp)
callq *%rax
cmpl $0x0, %eax
je 0x274775
movb $0x1, 0x56(%rsp)
jmp 0x2747fd
jmp 0x274777
jmp 0x274779
jmp 0x27477b
jmp 0x27477d
movq 0xe8(%rsp), %rax
cmpq 0xf0(%rsp), %rax
je 0x2747d2
cmpq $-0x1, 0x88(%rsp)
jne 0x2747d2
movq 0x3c77ff(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2a1868(%rip), %rsi    # 0x516013
leaq 0x30acde(%rip), %rdx    # 0x57f490
leaq 0x30ac35(%rip), %rcx    # 0x57f3ee
leaq 0x30a315(%rip), %r8     # 0x57ead5
movl $0x23c, %r9d            # imm = 0x23C
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2747d4
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
jmp 0x2742c1
cmpq $0x0, 0x118(%rsp)
je 0x27481a
movq 0x118(%rsp), %rax
movq 0x120(%rsp), %rdi
callq *%rax
movb 0x56(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0xd0, %rsp
popq %rbx
retq
nopw %cs:(%rax,%rax)