// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/sfx-lwcheck.c
// Function: gt_suftab_lightweightcheck
void gt_suftab_lightweightcheck(LW_accesschar accesschar,
                                LW_charcount charcount,
                                const void *encseq,
                                GtReadmode readmode,
                                GtUword totallength,
                                unsigned int numofchars,
                                const void *suftab,
                                size_t unitsize,
                                GtLogger *logger)
{
  GtUword idx, countbitsset = 0, previouspos = 0,
                firstspecial = totallength, rangestart = 0;
  unsigned int charidx, rangeidx = 0, numofranges;
  GtBitsequence *startposoccurs;
  GtUchar previouscc = 0;
  GtRangewithchar *rangestore;
  const bool skcheck = true;

#ifdef _WIN32
  gt_assert(unitsize == (size_t) 4);
#else
  gt_assert(unitsize == (size_t) 4 || unitsize == (size_t) 8);
#endif
  GT_INITBITTAB(startposoccurs, totallength+1);
  rangestore = gt_malloc(sizeof(*rangestore) * numofchars);
  for (idx = 0; idx < totallength; idx++)
  {
    GtUword position = GEN_ESASUFFIXPTRGET(suftab, idx);
    GtUchar cc;

    if (GT_ISIBITSET(startposoccurs, position))
    {
      fprintf(stderr, "ERROR: suffix with startpos "GT_WU" already occurs\n",
              GEN_ESASUFFIXPTRGET(suftab, idx));
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    GT_SETIBIT(startposoccurs, position);
    countbitsset++;
    cc = accesschar(encseq,position,readmode);
    if (idx > 0)
    {
      if (GT_ISSPECIAL(cc))
      {
        if (firstspecial == totallength)
        {
          firstspecial = idx;
          gt_assert(rangeidx < numofchars);
          rangestore[rangeidx].start = rangestart;
          rangestore[rangeidx].end = idx-1;
          rangestore[rangeidx++].firstchar = previouscc;
        }
        if (GT_ISSPECIAL(previouscc))
        {
          if (previouspos > position)
          {
            fprintf(stderr, "incorrect order: " GT_WU " = " GT_WU "=SPECIAL > "
                    "SPECIAL="GT_WU"  = "GT_WU"\n",
                    idx-1, position, previouspos, idx);
            exit(GT_EXIT_PROGRAMMING_ERROR);
          }
        }
      } else
      {
        if (GT_ISSPECIAL(previouscc))
        {
          fprintf(stderr, "incorrect order: "GT_WU"="GT_WU"=SPECIAL > "
                  "%u="GT_WU"="GT_WU"\n", idx-1, position, (unsigned int) cc,
                  previouspos, idx);
          exit(GT_EXIT_PROGRAMMING_ERROR);
        } else
        {
          if (previouscc > cc)
          {
            fprintf(stderr, "incorrect order: "GT_WU" = "GT_WU"=%u > "
                    "%u="GT_WU"="GT_WU"\n", idx-1, position, (unsigned int)
                    previouscc, (unsigned int) cc, previouspos, idx);
            exit(GT_EXIT_PROGRAMMING_ERROR);
          } else
          {
            if (previouscc < cc)
            {
              gt_assert(rangeidx < numofchars);
              rangestore[rangeidx].start = rangestart;
              rangestore[rangeidx].end = idx-1;
              rangestore[rangeidx++].firstchar = previouscc;
              rangestart = idx;
            }
          }
        }
      }
    } else
    {
      if (GT_ISSPECIAL(cc))
      {
        firstspecial = 0;
      }
    }
    previouscc = cc;
    previouspos = position;
  }
  if (countbitsset != totallength)
  {
    fprintf(stderr, "ERROR: only "GT_WU" of "GT_WU" suffixes occur\n",
            countbitsset, totallength);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_free(startposoccurs);
  if (firstspecial == totallength)
  {
    gt_assert(firstspecial > 0 && rangeidx < numofchars);
    rangestore[rangeidx].start = rangestart;
    rangestore[rangeidx].end = firstspecial-1;
    rangestore[rangeidx++].firstchar = previouscc;
  }
  numofranges = rangeidx;
  for (charidx = 0, rangeidx = 0; charidx < numofchars; charidx++)
  {
    GtUword count;
    GtUchar thisidx = GT_ISDIRCOMPLEMENT(readmode)
                        ? (GtUchar) GT_COMPLEMENTBASE(charidx)
                        : (GtUchar) charidx;

    count = charcount(encseq,thisidx);
    if (count != 0)
    {
      gt_assert(rangeidx < numofranges &&
                rangestore[rangeidx].firstchar == (GtUchar) charidx);
      gt_assert(rangestore[rangeidx].end - rangestore[rangeidx].start + 1
                == count);
      rangeidx++;
    }
  }
  gt_logger_log(logger, "suftab-check, first phase done");
  if (skcheck)
  {
    gt_suftab_sk_suffixorder(totallength,
                             numofchars,
                             suftab,
                             unitsize,
                             rangestore,
                             numofranges);
    gt_logger_log(logger, "suftab-check, second phase (sk-method) done");
  } else
  {
    gt_suftab_bk_suffixorder(accesschar,
                             encseq,
                             readmode,
                             totallength,
                             numofchars,
                             suftab,
                             unitsize,
                             rangestore,
                             numofranges);
    gt_logger_log(logger, "suftab-check, second phase (bk-method) done");
  }
  gt_free(rangestore);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r9d, 0xc(%rsp)
movq %r8, %r15
movl %ecx, 0x40(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdi, 0x78(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xc8(%rsp), %rbx
movq 0xc0(%rsp), %r12
cmpq $0x4, %rbx
je 0x19e83d
cmpq $0x8, %rbx
jne 0x19ee4d
leaq 0x1(%r15), %rax
movq %r15, %rcx
shrq $0x6, %rcx
cmpq $0x40, %rax
leaq 0x8(,%rcx,8), %rax
pushq $0x8
popq %r14
cmovaeq %rax, %r14
leaq 0x1b9b36(%rip), %r13    # 0x358399
xorl %edi, %edi
movq %r14, %rsi
movq %r13, %rdx
movl $0xcc, %ecx
callq 0x93472
movq %rax, %rbp
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x17380
movl 0xc(%rsp), %eax
movq %rax, 0x68(%rsp)
imulq $0x18, %rax, %rdi
movq %r13, %rsi
movl $0xcd, %edx
callq 0x93160
movq %rbp, %rdi
movq %rax, 0x18(%rsp)
movq %r15, %rax
negq %rax
movq %rax, 0x80(%rsp)
xorl %eax, %eax
xorl %edx, %edx
movq $0x0, 0x20(%rsp)
movq %r15, 0x10(%rsp)
xorl %ebp, %ebp
xorl %r9d, %r9d
movq %r9, %r11
movl %edx, 0x8(%rsp)
addq $-0x2, %r11
movq %rbp, %r8
movl %eax, %r14d
movq 0x80(%rsp), %rax
addq %r11, %rax
movl %edx, %r13d
cmpq $-0x2, %rax
je 0x19ea98
movq %r13, 0x60(%rsp)
cmpq $0x4, %rbx
jne 0x19e907
movl 0x8(%r12,%r11,4), %ecx
jmp 0x19e90c
movq 0x10(%r12,%r11,8), %rcx
movq %r11, 0x38(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, %rax
shrq $0x6, %rax
movq (%rdi,%rax,8), %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
shrq %cl, %rsi
testq %rdx, %rsi
jne 0x19ecfd
orq %rdx, %rsi
movq %rdi, %r13
movq %rsi, (%rdi,%rax,8)
movq 0x30(%rsp), %rdi
movq %rcx, %rbp
movq %rcx, %rsi
movl 0x40(%rsp), %edx
callq *0x78(%rsp)
movq 0x38(%rsp), %r11
cmpq $-0x2, %r11
je 0x19e993
cmpb $-0x2, %al
movq 0x18(%rsp), %rsi
movl 0x8(%rsp), %edx
jae 0x19e9b8
cmpb $-0x2, %r14b
jae 0x19ed20
cmpb %al, %r14b
ja 0x19ed54
movq %r13, %rdi
incq %r11
movq %rbp, %r8
cmpb %al, %r14b
jae 0x19e8da
jmp 0x19ea08
cmpb $-0x2, %al
movl $0x0, %ecx
movq 0x10(%rsp), %rdx
cmovaeq %rcx, %rdx
movq %rdx, 0x10(%rsp)
addq $0x3, %r11
movl 0x8(%rsp), %edx
movq %r13, %rdi
jmp 0x19e8d3
cmpq %r15, 0x10(%rsp)
movq %r13, %rdi
jne 0x19ea49
cmpl 0xc(%rsp), %edx
movq 0x28(%rsp), %r8
jae 0x19eeaf
movl %edx, %r10d
leaq 0x2(%r11), %rdx
movq %rdx, 0x10(%rsp)
imulq $0x18, 0x60(%rsp), %r9
movq 0x20(%rsp), %rdx
movq %rdx, (%rsi,%r9)
leaq 0x1(%r11), %rdx
movq %rdx, 0x8(%rsi,%r9)
incl %r10d
movl %r10d, 0x8(%rsp)
movb %r14b, 0x10(%rsi,%r9)
jmp 0x19ea4e
cmpl 0xc(%rsp), %edx
jae 0x19ee1c
movl %edx, %r8d
imulq $0x18, 0x60(%rsp), %r9
movq 0x20(%rsp), %rdx
movq %rdx, (%rsi,%r9)
leaq 0x1(%r11), %rdx
movq %r11, 0x8(%rsi,%r9)
addq $0x2, %r11
incl %r8d
movb %r14b, 0x10(%rsi,%r9)
movq %rdx, 0x20(%rsp)
movq %r11, %r9
movl %r8d, %edx
jmp 0x19e8cc
movq 0x28(%rsp), %r8
leaq 0x3(%r11), %r9
cmpb $-0x2, %r14b
setb %dl
cmpq %rbp, %r8
setbe %sil
orb %dl, %sil
movl 0x8(%rsp), %edx
jne 0x19e8cc
movq 0x2994f4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1(%r11), %rdx
addq $0x2, %r11
leaq 0x1b992b(%rip), %rsi    # 0x3583b1
movq %rbp, %rcx
movq %r11, %r9
xorl %eax, %eax
callq 0x17a50
jmp 0x19ecc4
leaq 0x1b98fa(%rip), %rsi    # 0x358399
movl $0x11f, %edx            # imm = 0x11F
callq 0x936f9
cmpq %r15, 0x10(%rsp)
jne 0x19eaed
testq %r15, %r15
movq 0x18(%rsp), %rdx
movl 0x8(%rsp), %esi
je 0x19ee7e
cmpl 0xc(%rsp), %esi
jae 0x19ee7e
imulq $0x18, %r13, %rax
movq 0x20(%rsp), %rcx
movq %rcx, (%rdx,%rax)
leaq -0x1(%r15), %rcx
movq %rcx, 0x8(%rdx,%rax)
incl %esi
movl %esi, 0x8(%rsp)
movb %r14b, 0x10(%rdx,%rax)
andl $-0x2, 0x40(%rsp)
xorl %ebp, %ebp
pushq $0x3
popq %r14
xorl %r13d, %r13d
cmpl %r13d, 0xc(%rsp)
je 0x19eb5f
cmpl $0x2, 0x40(%rsp)
movl %r13d, %eax
cmovel %r14d, %eax
movzbl %al, %esi
movq 0x30(%rsp), %rdi
callq *0x70(%rsp)
testq %rax, %rax
je 0x19eb57
cmpl 0x8(%rsp), %ebp
movq 0x18(%rsp), %rdx
jae 0x19eccc
movl %ebp, %ecx
imulq $0x18, %rcx, %rcx
cmpb 0x10(%rdx,%rcx), %r13b
jne 0x19eccc
addq %rdx, %rcx
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
incq %rdx
cmpq %rax, %rdx
jne 0x19ed8c
incl %ebp
incl %r13d
decl %r14d
jmp 0x19eafb
leaq 0x1b999a(%rip), %rsi    # 0x358500
xorl %r14d, %r14d
movq 0x58(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
movl 0x8(%rsp), %eax
xorl %esi, %esi
cmpq %rax, %r14
je 0x19ec09
imulq $0x18, %r14, %rcx
movq 0x18(%rsp), %rdx
movq (%rdx,%rcx), %rdi
movq 0x8(%rdx,%rcx), %r8
xorl %ecx, %ecx
cmpq %r8, %rdi
ja 0x19ec01
cmpq $0x4, %rbx
jne 0x19eba9
movl (%r12,%rdi,4), %edx
jmp 0x19ebad
movq (%r12,%rdi,8), %rdx
incq %rdx
cmpq %r15, %rdx
ja 0x19ebfc
leaq (%r12,%rcx,4), %r10
leaq (%r12,%rcx,8), %r11
xorl %r9d, %r9d
leaq (%rcx,%r9), %r13
cmpq %r15, %r13
ja 0x19eca9
cmpq $0x4, %rbx
jne 0x19ebd9
movl (%r10,%r9,4), %ebp
jmp 0x19ebdd
movq (%r11,%r9,8), %rbp
cmpq %rdx, %rbp
je 0x19ebe7
incq %r9
jmp 0x19ebc0
incq %r13
je 0x19eca9
addq %r9, %rsi
incq %rsi
addq %r9, %rcx
incq %rcx
incq %rdi
jmp 0x19eb98
incq %r14
jmp 0x19eb7b
movq %rsi, %xmm3
movq 0x148cca(%rip), %xmm1   # 0x2e78e0
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movapd 0x148cce(%rip), %xmm2   # 0x2e78f0
subpd %xmm2, %xmm3
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd %xmm3, %xmm0
movq %r15, %xmm3
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm1
unpckhpd %xmm3, %xmm1            # xmm1 = xmm1[1],xmm3[1]
addsd %xmm3, %xmm1
divsd %xmm1, %xmm0
cvtsi2sdq 0x68(%rsp), %xmm1
movapd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x30(%rsp)
callq 0x955a7
testl %eax, %eax
jg 0x19ede1
leaq 0x1b98a9(%rip), %rsi    # 0x35851f
movq 0x58(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
leaq 0x1b9710(%rip), %rsi    # 0x358399
movq 0x18(%rsp), %rdi
movl $0x150, %edx            # imm = 0x150
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x936f9
movq 0x2992b8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1b9891(%rip), %rsi    # 0x35854b
movq %r15, %r8
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0
movq 0x299295(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x146336(%rip), %rsi    # 0x2e5013
leaq 0x1b978b(%rip), %rdx    # 0x35846f
leaq 0x1b9693(%rip), %rcx    # 0x35837e
leaq 0x1b96a7(%rip), %r8     # 0x358399
movl $0x133, %r9d            # imm = 0x133
jmp 0x19edb8
movq 0x299264(%rip), %rax    # 0x437f68
movq (%rax), %rdi
cmpq $0x4, %rbx
jne 0x19edc4
movq 0x38(%rsp), %rax
movl 0x8(%r12,%rax,4), %edx
jmp 0x19edce
movzbl %al, %r8d
movq 0x29923d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1(%r11), %rdx
addq $0x2, %r11
subq $0x8, %rsp
leaq 0x1b96a9(%rip), %rsi    # 0x3583ea
movq %rbp, %rcx
movq 0x30(%rsp), %r9
xorl %eax, %eax
pushq %r11
callq 0x17a50
jmp 0x19ed85
movzbl %al, %r9d
movzbl %r14b, %r8d
movq 0x299205(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1(%r11), %rdx
addq $0x2, %r11
leaq 0x1b96a4(%rip), %rsi    # 0x358419
movq %rbp, %rcx
xorl %eax, %eax
pushq %r11
pushq 0x30(%rsp)
callq 0x17a50
popq %rcx
popq %rdx
jmp 0x19ecc4
movq 0x2991d5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x146276(%rip), %rsi    # 0x2e5013
leaq 0x1b9719(%rip), %rdx    # 0x3584bd
leaq 0x1b95d3(%rip), %rcx    # 0x35837e
leaq 0x1b95e7(%rip), %r8     # 0x358399
movl $0x135, %r9d            # imm = 0x135
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x38(%rsp), %rax
movq 0x10(%r12,%rax,8), %rdx
leaq 0x15af71(%rip), %rsi    # 0x2f9d46
xorl %eax, %eax
callq 0x17a50
jmp 0x19ecc4
movq 0x299180(%rip), %rax    # 0x437f68
movq (%rax), %rbx
movaps 0x40(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
callq 0x955a7
leaq 0x1b9779(%rip), %rsi    # 0x35857b
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movl 0xc(%rsp), %edx
movl %eax, %ecx
movb $0x1, %al
callq 0x17a50
jmp 0x19ecc4
movq 0x299145(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1461e6(%rip), %rsi    # 0x2e5013
leaq 0x1b9625(%rip), %rdx    # 0x358459
leaq 0x1b9543(%rip), %rcx    # 0x35837e
leaq 0x1b9557(%rip), %r8     # 0x358399
movl $0x106, %r9d            # imm = 0x106
jmp 0x19edb8
movq 0x299114(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1461b5(%rip), %rsi    # 0x2e5013
leaq 0x1b94e8(%rip), %rdx    # 0x35834d
leaq 0x1b9512(%rip), %rcx    # 0x35837e
leaq 0x1b9526(%rip), %r8     # 0x358399
movl $0xca, %r9d
jmp 0x19edb8
movq 0x2990e3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x146184(%rip), %rsi    # 0x2e5013
leaq 0x1b95af(%rip), %rdx    # 0x358445
leaq 0x1b94e1(%rip), %rcx    # 0x35837e
leaq 0x1b94f5(%rip), %r8     # 0x358399
movl $0x122, %r9d            # imm = 0x122
jmp 0x19edb8
movq 0x2990b2(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x146153(%rip), %rsi    # 0x2e5013
leaq 0x1b9592(%rip), %rdx    # 0x358459
leaq 0x1b94b0(%rip), %rcx    # 0x35837e
leaq 0x1b94c4(%rip), %r8     # 0x358399
movl $0xe3, %r9d
jmp 0x19edb8