// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/sfx-linlcp.c
// Function: gt_ENCSEQ_sa2ranknext
static GtUword gt_ENCSEQ_sa2ranknext(GtCompactUlongStore *ranknext,
                                     const GtEncseq *encseq,
                                     GtReadmode readmode,
                                     GtUword partwidth,
                                     GtUword totallength,
                                     const ESASuffixptr *suftab)
{
  GtUword idx, pos, longest = 0, *occless;

  gt_assert(partwidth > 0);
  occless = gt_ENCSEQ_compute_occless_tab(encseq, readmode);
  /* now inveresuftab is not used any more, and thus the
     ranknext array (which points to ranknext can savely be stored */
  for (idx=0; idx < partwidth; idx++)
  {
    pos = ESASUFFIXPTRGET(suftab, idx);
    if (pos > 0)
    {
      GtUchar cc = gt_encseq_get_encoded_char(encseq, pos-1, readmode);
      if (GT_ISNOTSPECIAL(cc))
      {
        gt_assert(occless[cc] < partwidth);
        gt_compact_ulong_store_update(ranknext, occless[cc], idx);
        occless[cc]++;
      }
    } else
    {
      longest = idx;
    }
  }
  if (gt_encseq_has_specialranges(encseq))
  {
    GtSpecialrangeiterator *sri;
    GtRange range;
    GtUword specialidx;

    sri = gt_specialrangeiterator_new(encseq,
                                      GT_ISDIRREVERSE(readmode) ? false : true);
    gt_assert(partwidth > 0); /* otherwise all lcps would be 0 */
    specialidx = partwidth;
    while (gt_specialrangeiterator_next(sri, &range))
    {
      if (GT_ISDIRREVERSE(readmode))
      {
        gt_range_reverse(totallength, &range);
      }
      gt_assert(range.start < range.end);
      if (range.start > 0)
      {
        GtUchar cc = gt_encseq_get_encoded_char(encseq, range.start-1,
                                                readmode);
        if (GT_ISNOTSPECIAL(cc))
        {
          gt_assert(occless[cc] < partwidth);
          gt_compact_ulong_store_update(ranknext, occless[cc], specialidx);
          occless[cc]++;
        }
      } else
      {
        longest = partwidth;
      }
      specialidx += range.end - range.start;
    }
    if ((GT_ISDIRREVERSE(readmode) &&
         gt_encseq_lengthofspecialprefix(encseq) > 0) ||
        (!GT_ISDIRREVERSE(readmode) &&
         gt_encseq_lengthofspecialsuffix(encseq) > 0))
    {
      gt_compact_ulong_store_update(ranknext, totallength-1, totallength);
    }
    gt_specialrangeiterator_delete(sri);
  }
  gt_free(occless);
  return longest;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl %edx, 0x74(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x0, 0x68(%rsp)
ja 0x2c8e10
movq 0x3731c1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24d22a(%rip), %rsi    # 0x516013
leaq 0x2c201a(%rip), %rdx    # 0x58ae0a
leaq 0x2c2021(%rip), %rcx    # 0x58ae18
leaq 0x2c1d84(%rip), %r8     # 0x58ab82
movl $0x17b, %r9d            # imm = 0x17B
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2c8e12
movq 0x78(%rsp), %rdi
movl 0x74(%rsp), %esi
callq 0x2c95d0
movq %rax, 0x38(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x2c8f30
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jbe 0x2c8f11
movq 0x78(%rsp), %rdi
movq 0x48(%rsp), %rsi
subq $0x1, %rsi
movl 0x74(%rsp), %edx
callq 0xa9da0
movb %al, 0x37(%rsp)
movzbl 0x37(%rsp), %eax
cmpl $0xfe, %eax
jge 0x2c8f0f
jmp 0x2c8e8a
movq 0x38(%rsp), %rax
movzbl 0x37(%rsp), %ecx
movq (%rax,%rcx,8), %rax
cmpq 0x68(%rsp), %rax
jb 0x2c8ed7
movq 0x3730fa(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24d163(%rip), %rsi    # 0x516013
leaq 0x2c1f77(%rip), %rdx    # 0x58ae2e
leaq 0x2c1f5a(%rip), %rcx    # 0x58ae18
leaq 0x2c1cbd(%rip), %r8     # 0x58ab82
movl $0x187, %r9d            # imm = 0x187
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2c8ed9
movq 0x80(%rsp), %rdi
movq 0x38(%rsp), %rax
movzbl 0x37(%rsp), %ecx
movq (%rax,%rcx,8), %rsi
movq 0x50(%rsp), %rdx
callq 0xa21f0
movq 0x38(%rsp), %rax
movzbl 0x37(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2c8f1b
movq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x2c8f1d
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2c8e2e
movq 0x78(%rsp), %rdi
callq 0xaf360
testb $0x1, %al
jne 0x2c8f43
jmp 0x2c919d
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
movb $0x1, %al
cmpl $0x1, 0x74(%rsp)
movb %al, 0xe(%rsp)
je 0x2c8f65
cmpl $0x3, 0x74(%rsp)
sete %al
movb %al, 0xe(%rsp)
movq (%rsp), %rdi
movb 0xe(%rsp), %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
movzbl %al, %esi
andl $0x1, %esi
callq 0xaf650
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x68(%rsp)
ja 0x2c8fd0
movq 0x373001(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24d06a(%rip), %rsi    # 0x516013
leaq 0x2c1e5a(%rip), %rdx    # 0x58ae0a
leaq 0x2c1e61(%rip), %rcx    # 0x58ae18
leaq 0x2c1bc4(%rip), %r8     # 0x58ab82
movl $0x198, %r9d            # imm = 0x198
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2c8fd2
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xaf770
testb $0x1, %al
jne 0x2c8ff4
jmp 0x2c913c
cmpl $0x1, 0x74(%rsp)
je 0x2c9002
cmpl $0x3, 0x74(%rsp)
jne 0x2c9011
movq 0x60(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xc2f20
jmp 0x2c9013
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
jb 0x2c9057
movq 0x372f7a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24cfe3(%rip), %rsi    # 0x516013
leaq 0x2c1e0f(%rip), %rdx    # 0x58ae46
leaq 0x2c1dda(%rip), %rcx    # 0x58ae18
leaq 0x2c1b3d(%rip), %r8     # 0x58ab82
movl $0x1a0, %r9d            # imm = 0x1A0
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2c9059
cmpq $0x0, 0x18(%rsp)
jbe 0x2c9119
movq 0x78(%rsp), %rdi
movq 0x18(%rsp), %rsi
subq $0x1, %rsi
movl 0x74(%rsp), %edx
callq 0xa9da0
movb %al, 0xf(%rsp)
movzbl 0xf(%rsp), %eax
cmpl $0xfe, %eax
jge 0x2c9117
jmp 0x2c9092
movq 0x38(%rsp), %rax
movzbl 0xf(%rsp), %ecx
movq (%rax,%rcx,8), %rax
cmpq 0x68(%rsp), %rax
jb 0x2c90df
movq 0x372ef2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x24cf5b(%rip), %rsi    # 0x516013
leaq 0x2c1d6f(%rip), %rdx    # 0x58ae2e
leaq 0x2c1d52(%rip), %rcx    # 0x58ae18
leaq 0x2c1ab5(%rip), %r8     # 0x58ab82
movl $0x1a7, %r9d            # imm = 0x1A7
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2c90e1
movq 0x80(%rsp), %rdi
movq 0x38(%rsp), %rax
movzbl 0xf(%rsp), %ecx
movq (%rax,%rcx,8), %rsi
movq 0x10(%rsp), %rdx
callq 0xa21f0
movq 0x38(%rsp), %rax
movzbl 0xf(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2c9123
movq 0x68(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x20(%rsp), %rax
subq 0x18(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x2c8fdc
cmpl $0x1, 0x74(%rsp)
je 0x2c914a
cmpl $0x3, 0x74(%rsp)
jne 0x2c915a
movq 0x78(%rsp), %rdi
callq 0xb2840
cmpq $0x0, %rax
ja 0x2c9178
cmpl $0x1, 0x74(%rsp)
je 0x2c9193
cmpl $0x3, 0x74(%rsp)
je 0x2c9193
movq 0x78(%rsp), %rdi
callq 0xb2860
cmpq $0x0, %rax
jbe 0x2c9193
movq 0x80(%rsp), %rdi
movq 0x60(%rsp), %rsi
subq $0x1, %rsi
movq 0x60(%rsp), %rdx
callq 0xa21f0
movq 0x28(%rsp), %rdi
callq 0xafc80
movq 0x38(%rsp), %rdi
leaq 0x2c19d9(%rip), %rsi    # 0x58ab82
movl $0x1ba, %edx            # imm = 0x1BA
callq 0xe88c0
movq 0x40(%rsp), %rax
addq $0x88, %rsp
retq