// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-specialsrank.c
// Function: gt_newSpecialsRankLookup
SpecialsRankLookup *
gt_newSpecialsRankLookup(const GtEncseq *encseq, GtReadmode readmode,
                         unsigned sampleIntervalLog2)
{
  struct specialsRankLookup *ranker;
  GtUword seqLastPos, seqLen;
  GtUword sampleInterval = ((GtUword)1) << sampleIntervalLog2;
  gt_assert(encseq);
  gt_assert(sampleIntervalLog2 < sizeof (GtUword) * CHAR_BIT);
  seqLastPos = gt_encseq_total_length(encseq);
  seqLen = seqLastPos + 1;
  if (gt_encseq_has_specialranges(encseq))
  {
    /* this sequence has some special characters */
    struct specialsRankTable *rankTable;
    GtSpecialrangeiterator *sri;
    GtUword *sample, *maxSample, sum = 0, pos = 0, nextSamplePos;
    GtRange range = { 0, 0 };
    ranker = allocSpecialsRankTable(encseq, seqLen, sampleIntervalLog2,
                                    readmode);
    rankTable = &ranker->implementationData.sampleTable;
    sri = gt_specialrangeiterator_new(encseq, !GT_ISDIRREVERSE(readmode));
    sample = rankTable->rankSumSamples;
    maxSample = sample + rankTable->numSamples;
    *sample++ = sum;
    nextSamplePos = sampleInterval;
    nextRange(&range, sri, readmode, seqLastPos);
    while (sample < maxSample)
    {
      while (pos < nextSamplePos)
      {
        pos = GT_MIN(GT_MAX(pos, range.start), nextSamplePos);
        sum += GT_MIN(range.end - pos, nextSamplePos - pos);
        pos = GT_MIN(range.end, nextSamplePos);
        if (pos < nextSamplePos)
        {
          nextRange(&range, sri, readmode, seqLastPos);
        }
      }
      *sample++ = sum;
      nextSamplePos += sampleInterval;
    }
    gt_specialrangeiterator_delete(sri);
    sri = NULL;
  }
  else
  {
    /* While there is no special characters in this sequence, there
     * is of course the terminator */
    ranker = allocEmptySpecialsRankLookup(encseq, seqLastPos);
  }
  return ranker;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movl %esi, 0xac(%rsp)
movl %edx, 0xa8(%rsp)
movl 0xa8(%rsp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, 0x88(%rsp)
cmpq $0x0, 0xb0(%rsp)
jne 0x22c7c9
movq 0x40f808(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e9871(%rip), %rsi    # 0x516013
leaq 0x32d1cd(%rip), %rdx    # 0x559976
leaq 0x349a41(%rip), %rcx    # 0x5761f1
leaq 0x349a53(%rip), %r8     # 0x57620a
movl $0x67, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22c7cb
jmp 0x22c7cd
movl 0xa8(%rsp), %eax
cmpq $0x40, %rax
jb 0x22c812
movq 0x40f7bf(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e9828(%rip), %rsi    # 0x516013
leaq 0x349a35(%rip), %rdx    # 0x576227
leaq 0x3499f8(%rip), %rcx    # 0x5761f1
leaq 0x349a0a(%rip), %r8     # 0x57620a
movl $0x68, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22c814
movq 0xb0(%rsp), %rdi
callq 0xa9d00
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0xb0(%rsp), %rdi
callq 0xaf360
testb $0x1, %al
jne 0x22c853
jmp 0x22cae8
movq $0x0, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x19360
movq 0xb0(%rsp), %rdi
movq 0x90(%rsp), %rsi
movl 0xa8(%rsp), %edx
movl 0xac(%rsp), %ecx
callq 0x22cb20
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x80(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x30(%rsp)
movb $0x1, %al
cmpl $0x1, 0xac(%rsp)
movb %al, 0x3f(%rsp)
je 0x22c8e1
cmpl $0x3, 0xac(%rsp)
sete %al
movb %al, 0x3f(%rsp)
movq 0x30(%rsp), %rdi
movb 0x3f(%rsp), %al
xorb $-0x1, %al
movzbl %al, %esi
andl $0x1, %esi
callq 0xaf650
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, (%rax)
movq 0x88(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x78(%rsp), %rsi
movl 0xac(%rsp), %edx
movq 0x98(%rsp), %rcx
leaq 0x40(%rsp), %rdi
callq 0x22cc40
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x22cad3
jmp 0x22c980
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x22caa3
movq 0x58(%rsp), %rax
cmpq 0x40(%rsp), %rax
jbe 0x22c9a8
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x22c9b2
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x22c9ec
movq 0x58(%rsp), %rax
cmpq 0x40(%rsp), %rax
jbe 0x22c9d6
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x22c9e0
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x22c9f6
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x48(%rsp), %rax
subq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
subq 0x58(%rsp), %rcx
cmpq %rcx, %rax
jae 0x22ca2a
movq 0x48(%rsp), %rax
subq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x22ca39
movq 0x50(%rsp), %rax
subq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x22ca60
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x22ca6a
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x22ca9e
movq 0x78(%rsp), %rsi
movl 0xac(%rsp), %edx
movq 0x98(%rsp), %rcx
leaq 0x40(%rsp), %rdi
callq 0x22cc40
jmp 0x22c980
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, (%rax)
movq 0x88(%rsp), %rax
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x22c96e
movq 0x78(%rsp), %rdi
callq 0xafc80
movq $0x0, 0x78(%rsp)
jmp 0x22cb05
movq 0xb0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x22ccf0
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)