// File: /workspace/github_c_makefile_star2_O1/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 $0xa8, %rsp
movq %r9, 0x30(%rsp)
movl %r8d, %r15d
movq %rcx, 0x38(%rsp)
movq %rdx, %rbx
movl %esi, 0x18(%rsp)
movq %rdi, %r14
movq 0xe0(%rsp), %r12
callq 0xec1d8
movq %rax, 0x28(%rsp)
testq %r12, %r12
je 0xc9979
movq %r12, %rdi
callq 0x101a9a
testb %al, %al
jne 0xca035
cmpq $0x0, 0x38(%rsp)
je 0xc9ead
movq %rbx, 0x48(%rsp)
movq 0x28(%rsp), %rax
leaq 0x1(%rax), %rcx
shrq $0x6, %rax
movq %rcx, 0x88(%rsp)
cmpq $0x40, %rcx
leaq 0x8(,%rax,8), %rax
movl $0x8, %ebx
cmovaeq %rax, %rbx
leaq 0x298b69(%rip), %rdx    # 0x362524
xorl %r13d, %r13d
xorl %edi, %edi
movq %rbx, %rsi
movl $0x219, %ecx            # imm = 0x219
callq 0x1094e6
movq %r14, %r12
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movq %r12, 0x20(%rsp)
movq %r12, %rdi
movl 0x18(%rsp), %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, %r12
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
xorl %ebx, %ebx
movq 0x48(%rsp), %rax
movq (%rax,%r13,8), %rcx
movq %rcx, %rax
shrq $0x6, %rax
movq (%r14,%rax,8), %rdx
movq %rbp, %rsi
shrq %cl, %rsi
testq %rdx, %rsi
jne 0xc9f82
orq %rdx, %rsi
movq %rsi, (%r14,%rax,8)
testb %r15b, %r15b
je 0xc9a51
testq %rcx, %rcx
je 0xc9a4e
decq %rcx
movq 0x20(%rsp), %rdi
movq %rcx, %rsi
movl 0x18(%rsp), %edx
callq 0xec754
testb %al, %al
je 0xc9a51
incq %rbx
incq %r13
cmpq %r13, 0x38(%rsp)
jne 0xc9a02
movq %r12, %rdi
callq 0xed7bf
leaq 0x298aba(%rip), %rsi    # 0x362524
movq %r14, %rdi
movl $0x232, %edx            # imm = 0x232
callq 0x109670
testb %r15b, %r15b
je 0xc9ae4
xorl %r14d, %r14d
movq 0x20(%rsp), %r12
movq %r12, %rdi
movl 0x18(%rsp), %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, %r15
movq %r12, %rdi
callq 0xec1d8
testq %rax, %rax
je 0xc9ad3
movq %rax, %r12
movb $0x1, %bpl
xorl %r14d, %r14d
movq %r15, %rdi
callq 0xec7be
cmpb $-0x1, %al
je 0xc9acb
testb $0x1, %bpl
je 0xc9ace
xorl %ecx, %ecx
cmpb $-0x2, %al
setne %cl
addq %rcx, %r14
xorl %ebp, %ebp
jmp 0xc9ace
movb $0x1, %bpl
decq %r12
jne 0xc9aab
movq %r15, %rdi
callq 0xed7bf
cmpq %r14, %rbx
jne 0xca044
xorl %ebx, %ebx
movq 0x20(%rsp), %r13
movq %r13, %rdi
movl 0x18(%rsp), %ebp
movl %ebp, %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, 0x58(%rsp)
movq %r13, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, 0x60(%rsp)
movq 0x48(%rsp), %r8
movq 0x28(%rsp), %r15
cmpq %r15, (%r8)
jae 0xca03a
cmpq $0x1, 0x38(%rsp)
je 0xc9e95
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
setne %al
movq 0x60(%rsp), %rdx
testq %rdx, %rdx
setne %sil
andb %al, %sil
movb %sil, 0x1f(%rsp)
movq %rcx, %rax
orq %rdx, %rax
sete 0x1e(%rsp)
movl $0x1, %r12d
movq $0x0, 0x40(%rsp)
movq $0x0, 0x68(%rsp)
movq 0x30(%rsp), %rax
cmpq %r15, %r12
movq %r12, 0x50(%rsp)
jae 0xc9bdb
movq (%r8,%r12,8), %rax
movq %rax, 0x78(%rsp)
cmpq %r15, %rax
jae 0xca026
movq -0x8(%r8,%r12,8), %r14
movq %r13, %rdi
callq 0xec1d8
movq %rax, 0x70(%rsp)
cmpb $0x0, 0x1f(%rsp)
movq 0x60(%rsp), %r15
je 0xc9bfb
movq 0x58(%rsp), %rdi
movq %r13, %rsi
movl 0x18(%rsp), %ebx
movl %ebx, %edx
movq %r14, %rcx
callq 0xed48e
movq %r15, %rdi
movq %r13, %rsi
movl %ebx, %edx
movq 0x78(%rsp), %rcx
callq 0xed48e
jmp 0xc9c06
movq 0x88(%rsp), %rcx
cmpq 0x38(%rsp), %rcx
jne 0xc9bf4
cmpq %r15, (%r8,%r12,8)
jne 0xca02b
xorl %ebp, %ebp
jmp 0xc9d42
cmpb $0x0, 0x1e(%rsp)
je 0xca030
leaq -0x1(%r12), %rax
movq %rax, 0x80(%rsp)
xorl %ebp, %ebp
movq 0x70(%rsp), %r13
movq %r14, 0x90(%rsp)
leaq (%r14,%rbp), %rbx
movl $0xff, %r15d
movl $0xff, %r14d
cmpq %r13, %rbx
jae 0xc9c5d
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xc9c48
callq 0xec7be
jmp 0xc9c59
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl 0x18(%rsp), %edx
callq 0xec1f8
movzbl %al, %r14d
movq 0x78(%rsp), %rax
leaq (%rax,%rbp), %r12
cmpq %r13, %r12
jae 0xc9c91
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xc9c7c
callq 0xec7be
jmp 0xc9c8d
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl 0x18(%rsp), %edx
callq 0xec1f8
movzbl %al, %r15d
cmpl $0xfe, %r14d
jae 0xc9cce
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $0xfd, %r15d
movq 0x50(%rsp), %r12
ja 0xc9cca
cmpl %r15d, %r14d
jb 0xc9cca
ja 0xc9cfd
incq %rbp
movq 0x90(%rsp), %r14
movq 0x70(%rsp), %r13
jmp 0xc9c22
xorl %eax, %eax
jmp 0xc9d05
movl $0x1, %r13d
movb $0x1, %al
cmpl $0xfe, %r15d
movq 0x48(%rsp), %r8
movq 0x20(%rsp), %r14
jb 0xc9d16
cmpq %r12, %rbx
movq 0x28(%rsp), %r15
jae 0xc9d1d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0xc9d2d
movl $0x1, %r13d
movb $0x1, %al
movq 0x48(%rsp), %r8
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0xc9d32
movq 0x28(%rsp), %r15
jmp 0xc9d2d
seta %cl
setbe %dl
movzbl %dl, %edx
addq %rdx, %rbp
movzbl %cl, %r13d
movq 0x50(%rsp), %r12
testb %al, %al
jne 0xc9ec3
movq 0x30(%rsp), %rax
movq %r14, %r13
testq %rax, %rax
je 0xc9e76
cmpb $0x1, 0x40(%rax)
jne 0xc9d96
movq %r8, %r14
movq (%rax), %rsi
movl $0xd0, %eax
addq %rax, %rsi
leaq 0x17(%rsp), %rdi
callq 0xc9842
testl %eax, %eax
je 0xc9dff
movzbl 0x17(%rsp), %eax
cmpq $0xff, %rax
je 0xc9e03
movq %r14, %r8
movb $0x1, %bl
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rax
jmp 0xc9e67
movq %rax, %rdi
movq 0x20(%rax), %rax
cmpq 0x10(%rdi), %rax
jae 0xc9df8
movq (%rdi), %rcx
movq 0x60(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rdi)
movzbl (%rdx,%rax), %edx
movb %dl, 0x17(%rsp)
movq %rdx, 0x40(%rsp)
cmpq $0xff, %rdx
jne 0xc9df4
movq 0x68(%rcx), %rcx
movq 0x28(%rdi), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
cmpq %rax, (%rcx,%rsi)
jne 0xca03f
addq %rsi, %rcx
incq %rdx
movq %rdx, 0x28(%rdi)
movq 0x8(%rcx), %rax
movq %rax, 0x40(%rsp)
movb $0x1, %bl
jmp 0xc9dfa
xorl %ebx, %ebx
movq %rdi, %rax
jmp 0xc9e67
xorl %ebx, %ebx
jmp 0xc9e5f
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movl $0xe8, %eax
addq %rax, %rsi
leaq 0x98(%rsp), %rdi
callq 0xc98b3
testl %eax, %eax
setne %bl
je 0xc9e36
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0xc9e5f
movq 0xe0(%rsp), %rdi
leaq 0x298d5d(%rip), %rsi    # 0x362ba2
leaq 0x2986d8(%rip), %rdx    # 0x362524
movl $0x26e, %ecx            # imm = 0x26E
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %al
movq %rax, 0x68(%rsp)
movq 0x30(%rsp), %rax
movq %r14, %r8
testb %bl, %bl
je 0xc9e8b
cmpq 0x40(%rsp), %rbp
jne 0xc9f8a
incq %r12
cmpq 0x38(%rsp), %r12
jae 0xc9e8b
testb $0x1, 0x68(%rsp)
je 0xc9b77
movq 0x68(%rsp), %rax
andb $0x1, %al
movzbl %al, %ebx
movq 0x58(%rsp), %rdi
callq 0xed7bf
movq 0x60(%rsp), %rdi
callq 0xed7bf
negl %ebx
jmp 0xc9eaf
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3fa0b6(%rip), %r15    # 0x4c3f80
movq (%r15), %rdi
leaq 0x299077(%rip), %rsi    # 0x362f4b
leaq 0x298649(%rip), %rdx    # 0x362524
movl $0x2e7, %ecx            # imm = 0x2E7
xorl %eax, %eax
movq %r8, %rbx
callq 0x17ab0
movq (%r15), %rdi
movq -0x8(%rbx,%r12,8), %r9
leaq 0x29906e(%rip), %rsi    # 0x362f67
leaq 0x298eaf(%rip), %rdx    # 0x362daf
movq 0x80(%rsp), %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x17ab0
movq (%r15), %rdi
movq -0x8(%rbx,%r12,8), %rcx
movq %r14, %rsi
movq %rbx, %r14
movl 0x18(%rsp), %ebx
movl %ebx, %edx
xorl %r8d, %r8d
callq 0xf1f39
movq (%r15), %rcx
leaq 0x299043(%rip), %rdi    # 0x362f7b
movl $0x3, %esi
movl $0x1, %edx
callq 0x17fa0
movq (%r15), %rdi
movq (%r14,%r12,8), %rcx
movq 0x20(%rsp), %rsi
movl %ebx, %edx
xorl %r8d, %r8d
callq 0xf1f39
movq (%r15), %rdi
movq (%r14,%r12,8), %rdx
leaq 0x299014(%rip), %rsi    # 0x362f7f
movl %r13d, %ecx
movq %rbp, %r8
xorl %eax, %eax
callq 0x17ab0
movl $0x1, %ebx
jmp 0xc9e95
movq %rcx, %rdi
callq 0x20176
movq %rbp, 0x38(%rsp)
movq %r13, %rdi
movq %r15, %r13
movq 0x3f9fe4(%rip), %rax    # 0x4c3f80
movq (%rax), %r15
movq -0x8(%r8,%r12,8), %rbx
movq %rbx, %rsi
movl 0x18(%rsp), %edx
movq %r8, %r14
callq 0xec1f8
movl %eax, %ebp
movq (%r14,%r12,8), %r12
movl $0xff, %eax
cmpq %r13, %r12
jae 0xc9fd7
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl 0x18(%rsp), %edx
callq 0xec1f8
movzbl %al, %eax
movzbl %bpl, %r8d
movl %eax, (%rsp)
leaq 0x298ec7(%rip), %rsi    # 0x362eac
movq %r15, %rdi
movq 0x50(%rsp), %rdx
movq %rbx, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x17ab0
movq 0x3f9f7f(%rip), %rax    # 0x4c3f80
movq (%rax), %rdi
leaq 0x298edc(%rip), %rsi    # 0x362ee7
movq 0x38(%rsp), %rdx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x17ab0
movl $0x2, %edi
callq 0x17940
callq 0x20233
callq 0x201fa
callq 0x2026c
callq 0x2013d
callq 0x201c1
callq 0x202a5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2019a