// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/tools/gt_sfxmap.c
// Function: gt_sfxmap_checkentiresuftab
static int gt_sfxmap_checkentiresuftab(const char *filename,
                                int line,
                                const GtEncseq *encseq,
                                GtReadmode readmode,
                                const ESASuffixptr *suftab,
                                GtUword numberofsuffixes,
                                bool wholeleafcheck,
                                Sequentialsuffixarrayreader *ssar,
                                GT_UNUSED bool specialsareequal,
                                GT_UNUSED bool specialsareequalatdepth0,
                                GtUword depth,
                                GT_UNUSED GtError *err)
{
  GtUword idx, maxlcp,
                currentlcp = 0,
                countbitsset = 0,
                wholeleafcount = 0,
                totallength = gt_encseq_total_length(encseq);
  int cmp;
  GtEncseqReader *esr1, *esr2;
  bool haserr = false;
  GtBitsequence *startposoccurs;
  GtEncseqReader *esr;
  /*
#define MAXDIST 100
  GtUword countdist[MAXDIST+1] = {0};
  */

  gt_error_check(err);
  gt_assert(!specialsareequal || specialsareequalatdepth0);
  if (numberofsuffixes == 0)
  {
    return 0;
  }
  GT_INITBITTAB(startposoccurs,totallength+1);
  esr = gt_encseq_create_reader_with_readmode(encseq,readmode,0);
  for (idx = 0; idx < numberofsuffixes; idx++)
  {
    GtUword position = ESASUFFIXPTRGET(suftab,idx);
    if (GT_ISIBITSET(startposoccurs,position))
    {
      fprintf(stderr,"ERROR: suffix with startpos "GT_WU" already occurs\n",
              ESASUFFIXPTRGET(suftab,idx));
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    GT_SETIBIT(startposoccurs,position);
    countbitsset++;
    if (wholeleafcheck)
    {
      if (position == 0 || gt_encseq_position_is_separator(encseq,
                                                           position - 1,
                                                           readmode))
      {
        /*printf("whole "GT_WU"\n",position);*/
        wholeleafcount++;
      }
    }
  }
  gt_encseq_reader_delete(esr);
  gt_free(startposoccurs);
  if (wholeleafcheck)
  {
    GtUword expectednumofwholeleaves
      = gt_sfxmap_determinenumberofwholeleaves(encseq,readmode);
    if (wholeleafcount != expectednumofwholeleaves)
    {
      fprintf(stderr,
              "wholeleafcount="GT_WU" != "GT_WU"=expectednumofwholeleaves\n",
              wholeleafcount,expectednumofwholeleaves);
      exit(EXIT_FAILURE);
    }
  }
  if (numberofsuffixes == totallength + 1 && countbitsset != numberofsuffixes)
  {
    fprintf(stderr,"ERROR: not all bits are set\n");
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  esr1 = gt_encseq_create_reader_with_readmode(encseq, readmode, 0);
  esr2 = gt_encseq_create_reader_with_readmode(encseq, readmode, 0);
  gt_assert(numberofsuffixes > 0);
  gt_assert(ESASUFFIXPTRGET(suftab,0) < totallength);
  for (idx = 1UL; !haserr && idx < numberofsuffixes; idx++)
  {
    if (idx < totallength)
    {
      gt_assert(ESASUFFIXPTRGET(suftab,idx) < totallength);
      cmp = gt_sfxmap_comparefullsuffixes(encseq,
                                          readmode,
                                          &maxlcp,
                                          ESASUFFIXPTRGET(suftab,idx-1),
                                          ESASUFFIXPTRGET(suftab,idx),
                                          esr1,
                                          esr2);
      if (cmp >= 0)
      {
        gt_sfxmap_showcomparisonfailureESA(filename,
                                 line,
                                 __func__,
                                 encseq,
                                 readmode,
                                 suftab,
                                 depth,
                                 idx-1,
                                 idx,
                                 cmp,
                                 maxlcp);
        haserr = true;
        break;
      }
    } else
    {
      maxlcp = 0;
      if (numberofsuffixes == totallength+1)
      {
        gt_assert(ESASUFFIXPTRGET(suftab,idx) == totallength);
      }
    }
    if (ssar != NULL)
    {
      SSAR_NEXTSEQUENTIALLCPTABVALUE(currentlcp,ssar);
      if (maxlcp != currentlcp)
      {
        fprintf(stderr,""GT_WU": startpos="GT_WU", firstchar=%u, "
                "startpos="GT_WU",firstchar=%u",
                idx,
                ESASUFFIXPTRGET(suftab,idx-1),
                (unsigned int)
                gt_encseq_get_encoded_char(encseq,
                                           ESASUFFIXPTRGET(suftab,idx-1),
                                           readmode),
                ESASUFFIXPTRGET(suftab,idx),
                (ESASUFFIXPTRGET(suftab,idx) < totallength)
                   ? (unsigned int) gt_encseq_get_encoded_char(encseq,
                                                     ESASUFFIXPTRGET(suftab,
                                                                     idx),
                                                     readmode)
                   : GT_SEPARATOR);
        fprintf(stderr,", maxlcp(bruteforce) = "GT_WU" != "GT_WU"(fast)\n",
                          maxlcp, currentlcp);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
    }
  }
  gt_encseq_reader_delete(esr1);
  gt_encseq_reader_delete(esr2);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, 0x28(%rsp)
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %rbx
movl %esi, 0x10(%rsp)
movq 0xc0(%rsp), %r15
movq %rdi, 0x18(%rsp)
callq 0xe7b9c
movq %rax, %r14
testq %r15, %r15
je 0xc77fd
movq %r15, %rdi
callq 0xfcc32
testb %al, %al
jne 0xc7e28
testq %r12, %r12
je 0xc7c48
movq %r12, 0x58(%rsp)
movq %rbx, 0x20(%rsp)
leaq 0x1(%r14), %rcx
movq %r14, 0x50(%rsp)
shrq $0x6, %r14
movq %rcx, 0x68(%rsp)
cmpq $0x40, %rcx
leaq 0x8(,%r14,8), %rax
movl $0x8, %ebx
cmovaeq %rax, %rbx
leaq 0x291c96(%rip), %rdx    # 0x3594d4
xorl %r12d, %r12d
xorl %edi, %edi
movq %rbx, %rsi
movl $0x219, %ecx            # imm = 0x219
callq 0x104461
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, %r15
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
xorl %ebx, %ebx
movq 0x20(%rsp), %rax
movq (%rax,%r12,8), %rcx
movq %rcx, %rax
shrq $0x6, %rax
movq (%r14,%rax,8), %rdx
movq %r13, %rsi
shrq %cl, %rsi
testq %rdx, %rsi
jne 0xc7d73
orq %rdx, %rsi
movq %rsi, (%r14,%rax,8)
testb %bpl, %bpl
je 0xc78ce
testq %rcx, %rcx
je 0xc78cb
decq %rcx
movq 0x18(%rsp), %rdi
movq %rcx, %rsi
movl 0x10(%rsp), %edx
callq 0xe811c
testb %al, %al
je 0xc78ce
incq %rbx
incq %r12
cmpq %r12, 0x58(%rsp)
jne 0xc787f
movq %r15, %rdi
callq 0xe9204
leaq 0x291bed(%rip), %rsi    # 0x3594d4
movq %r14, %rdi
movl $0x232, %edx            # imm = 0x232
callq 0x1045eb
testb %bpl, %bpl
movq 0x20(%rsp), %r13
je 0xc7965
xorl %r14d, %r14d
movq 0x18(%rsp), %r12
movq %r12, %rdi
movl 0x10(%rsp), %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, %r15
movq %r12, %rdi
callq 0xe7b9c
testq %rax, %rax
je 0xc7954
movq %rax, %r12
movb $0x1, %bpl
xorl %r14d, %r14d
movq %r15, %rdi
callq 0xe8186
cmpb $-0x1, %al
sete %cl
setne %dl
cmpb $-0x2, %al
setne %al
andb %bpl, %dl
andb %al, %dl
movzbl %dl, %eax
addq %rax, %r14
movl %ecx, %ebp
decq %r12
jne 0xc792d
movq %r15, %rdi
callq 0xe9204
cmpq %r14, %rbx
jne 0xc7e37
xorl %ebx, %ebx
movq 0x18(%rsp), %r14
movq %r14, %rdi
movl 0x10(%rsp), %ebp
movl %ebp, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, %r12
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rcx
cmpq %rcx, (%r13)
jae 0xc7e2d
movq 0x58(%rsp), %rdx
cmpq $0x1, %rdx
je 0xc7c34
testq %r12, %r12
setne %al
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
setne %dil
andb %al, %dil
movb %dil, 0x16(%rsp)
movq %r12, %rax
orq %rsi, %rax
sete 0x15(%rsp)
cmpq $0x3, %rdx
movl $0x2, %eax
cmovaeq %rdx, %rax
movq %rax, 0x70(%rsp)
movl $0x1, %edx
movq %r12, 0x38(%rsp)
cmpq %rcx, %rdx
movq %rdx, 0x48(%rsp)
jae 0xc7a52
movq (%r13,%rdx,8), %rax
movq %rax, 0x40(%rsp)
cmpq %rcx, %rax
jae 0xc7e19
movq -0x8(%r13,%rdx,8), %rbp
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xe7b9c
movq %rax, %r13
cmpb $0x0, 0x16(%rsp)
je 0xc7a76
movq %r12, %rdi
movq %r15, %rsi
movl 0x10(%rsp), %ebx
movl %ebx, %edx
movq %rbp, %rcx
callq 0xe8eed
movq 0x30(%rsp), %rdi
movq %r15, %rsi
movl %ebx, %edx
movq 0x40(%rsp), %rcx
callq 0xe8eed
jmp 0xc7a81
movq 0x68(%rsp), %rax
cmpq 0x58(%rsp), %rax
movq 0x28(%rsp), %rax
jne 0xc7a6e
cmpq %rcx, (%r13,%rdx,8)
jne 0xc7e1e
xorl %r15d, %r15d
jmp 0xc7b52
cmpb $0x0, 0x15(%rsp)
je 0xc7e23
movq 0x48(%rsp), %rax
decq %rax
movq %rax, 0x60(%rsp)
xorl %r15d, %r15d
movq %rbp, %r14
addq %r15, %rbp
movq 0x40(%rsp), %rax
leaq (%rax,%r15), %rbx
cmpq %r13, %rbp
movq 0x30(%rsp), %rdi
jae 0xc7ab9
testq %r12, %r12
je 0xc7ac6
movq %r12, %rdi
callq 0xe8186
jmp 0xc7ad7
movl $0xff, %r12d
cmpq %r13, %rbx
jb 0xc7ae5
jmp 0xc7b3a
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
movl 0x10(%rsp), %edx
callq 0xe7bbc
cmpq %r13, %rbx
jae 0xc7b36
movzbl %al, %r12d
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xc7af1
callq 0xe8186
jmp 0xc7b02
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl 0x10(%rsp), %edx
callq 0xe7bbc
cmpl $0xfd, %r12d
ja 0xc7b2d
cmpb $-0x3, %al
ja 0xc7b43
movzbl %al, %eax
cmpl %eax, %r12d
jb 0xc7b43
movq 0x38(%rsp), %r12
ja 0xc7c5e
incq %r15
movq %r14, %rbp
jmp 0xc7a91
cmpb $-0x2, %al
jae 0xc7b3a
jmp 0xc7c5e
cmpb $-0x3, %al
jbe 0xc7b43
cmpq %rbx, %rbp
jae 0xc7d5b
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rax
movq 0x38(%rsp), %r12
testq %rax, %rax
je 0xc7c1a
movq 0x28(%rsp), %rdi
cmpb $0x1, 0x40(%rdi)
jne 0xc7bbe
movq (%rdi), %rsi
movl $0xd0, %eax
addq %rax, %rsi
leaq 0x17(%rsp), %rdi
callq 0xc76d0
testl %eax, %eax
je 0xc7c32
movzbl 0x17(%rsp), %r14d
cmpq $0xff, %r14
jne 0xc7c11
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movl $0xe8, %eax
addq %rax, %rsi
leaq 0x78(%rsp), %rdi
callq 0xc773d
testl %eax, %eax
je 0xc7d2f
movq 0x80(%rsp), %r14
jmp 0xc7c11
movq 0x20(%rdi), %rax
cmpq 0x10(%rdi), %rax
jae 0xc7c32
movq (%rdi), %rcx
movq 0x60(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rdi)
movzbl (%rdx,%rax), %r14d
cmpq $0xff, %r14
jne 0xc7c11
movq 0x68(%rcx), %rcx
movq 0x28(%rsp), %rdi
movq 0x28(%rdi), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
cmpq %rax, (%rcx,%rsi)
jne 0xc7e32
addq %rsi, %rcx
incq %rdx
movq %rdx, 0x28(%rdi)
movq 0x8(%rcx), %r14
cmpq %r14, %r15
jne 0xc7d7b
movq 0x48(%rsp), %rdx
incq %rdx
cmpq 0x70(%rsp), %rdx
movq 0x50(%rsp), %rcx
jne 0xc79ef
xorl %ebx, %ebx
movq %r12, %rdi
callq 0xe9204
movq 0x30(%rsp), %rdi
callq 0xe9204
jmp 0xc7c4a
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x40(%rsp)
movq 0x20(%rsp), %r12
movq 0x3f130e(%rip), %rbx    # 0x4b8f80
movq (%rbx), %rdi
leaq 0x292272(%rip), %rsi    # 0x359eee
leaq 0x291851(%rip), %rdx    # 0x3594d4
movl $0x2e7, %ecx            # imm = 0x2E7
xorl %eax, %eax
callq 0x17ab0
movq (%rbx), %rdi
movq 0x48(%rsp), %r14
movq -0x8(%r12,%r14,8), %r9
leaq 0x292267(%rip), %rsi    # 0x359f0a
leaq 0x2920a8(%rip), %rdx    # 0x359d52
movq 0x60(%rsp), %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x17ab0
movq (%rbx), %rdi
movq -0x8(%r12,%r14,8), %rcx
movq 0x18(%rsp), %r13
movq %r13, %rsi
movl 0x10(%rsp), %ebp
movl %ebp, %edx
xorl %r8d, %r8d
callq 0xed8f5
movq (%rbx), %rcx
leaq 0x29223d(%rip), %rdi    # 0x359f1e
movl $0x3, %esi
movl $0x1, %edx
callq 0x17fa0
movq (%rbx), %rdi
movq (%r12,%r14,8), %rcx
movq %r13, %rsi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0xed8f5
movq (%rbx), %rdi
movq (%r12,%r14,8), %rdx
leaq 0x292210(%rip), %rsi    # 0x359f22
movl 0x40(%rsp), %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x17ab0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x38(%rsp), %r12
jmp 0xc7c34
leaq 0x291e0f(%rip), %rsi    # 0x359b45
leaq 0x291797(%rip), %rdx    # 0x3594d4
movq 0xc0(%rsp), %rdi
movl $0x26e, %ecx            # imm = 0x26E
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xc7c34
seta %al
setbe %cl
movzbl %cl, %ecx
addq %rcx, %r15
movzbl %al, %eax
movl %eax, 0x40(%rsp)
jmp 0xc7c66
movq %rcx, %rdi
callq 0x1fd7a
movq 0x3f11fe(%rip), %rax    # 0x4b8f80
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %r12
movq -0x8(%r13,%r12,8), %rbx
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl 0x10(%rsp), %edx
callq 0xe7bbc
movl %eax, %ebp
movq (%r13,%r12,8), %r13
movl $0xff, %eax
cmpq 0x50(%rsp), %r13
jae 0xc7dcc
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movl 0x10(%rsp), %edx
callq 0xe7bbc
movzbl %al, %eax
movzbl %bpl, %r8d
movl %eax, (%rsp)
leaq 0x292075(%rip), %rsi    # 0x359e4f
movq 0x30(%rsp), %rdi
movq 0x48(%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r9
xorl %eax, %eax
callq 0x17ab0
movq 0x3f1188(%rip), %rax    # 0x4b8f80
movq (%rax), %rdi
leaq 0x292088(%rip), %rsi    # 0x359e8a
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x17ab0
movl $0x2, %edi
callq 0x17940
callq 0x1fe37
callq 0x1fdfe
callq 0x1fe70
callq 0x1fd41
callq 0x1fdc5
callq 0x1fea9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1fd9e