// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_sfxmap.c
// Function: gt_sfxmap_esa
static int gt_sfxmap_esa(const Sfxmapoptions *arguments, GtLogger *logger,
                         GtError *err)
{
  bool haserr = false;
  Suffixarray suffixarray;
  unsigned int demand = 0;

  gt_error_check(err);
  if (arguments->inputtis || arguments->delspranges > 0 || arguments->inputsuf)
  {
    demand |= SARR_ESQTAB;
  }
  if (arguments->inputdes)
  {
    demand |= SARR_DESTAB;
  }
  if (arguments->inputsds)
  {
    demand |= SARR_SDSTAB;
  }
  if (arguments->inputsuf)
  {
    demand |= SARR_SUFTAB;
  }
  if (arguments->inputlcp)
  {
    demand |= SARR_LCPTAB;
  }
  if (arguments->inputbwt)
  {
    demand |= SARR_BWTTAB;
  }
  if (arguments->inputbck)
  {
    demand |= SARR_BCKTAB;
  }
  if (arguments->inputssp)
  {
    demand |= SARR_SSPTAB;
  }
  if ((arguments->usestream
         ? streamsuffixarray
         : gt_mapsuffixarray)(&suffixarray,
                              demand,
                              gt_str_get(arguments->esaindexname),
                              logger,
                              err) != 0)
  {
    haserr = true;
  }
  if (!haserr && suffixarray.encseq != NULL)
  {
    if (arguments->delspranges > 0)
    {
      gt_sfxmap_deletethespranges(suffixarray.encseq,arguments->delspranges);
    } else
    {
      GtUword totallength = gt_encseq_total_length(suffixarray.encseq);
      if (!haserr && arguments->inputsuf && !arguments->usestream)
      {
        if (suffixarray.numberofallsortedsuffixes != totallength + 1 ||
            arguments->bfcheck)
        {
          Sequentialsuffixarrayreader *ssar;

          if (arguments->inputlcp)
          {
            ssar = gt_newSequentialsuffixarrayreaderfromfile(
                                          gt_str_get(arguments->esaindexname),
                                          SARR_LCPTAB | SARR_ESQTAB,
                                          true,
                                          logger,
                                          err);
          } else
          {
            ssar = NULL;
          }
          gt_logger_log(logger, __func__);
          if (gt_sfxmap_checkentiresuftab(__FILE__,
                                   __LINE__,
                                   suffixarray.encseq,
                                   suffixarray.readmode,
                                   suffixarray.suftab,
                                   suffixarray.numberofallsortedsuffixes,
                                   arguments->wholeleafcheck,
                                   ssar,
                                   false, /* specialsareequal  */
                                   false,  /* specialsareequalatdepth0 */
                                   0,
                                   err) != 0)
          {
            fprintf(stderr,"%s\n",__func__);
            exit(GT_EXIT_PROGRAMMING_ERROR);
          }
          if (ssar != NULL)
          {
            gt_freeSequentialsuffixarrayreader(&ssar);
          }
        } else
        {
          if (suffixarray.numberofallsortedsuffixes == totallength + 1)
          {
            gt_suftab_lightweightcheck(sfx_accesschar_encseq,
                                       sfx_charcount_encseq,
                                       suffixarray.encseq,
                                       suffixarray.readmode,
                                       totallength,
                                       gt_encseq_alphabetnumofchars(
                                                 suffixarray.encseq),
                                       suffixarray.suftab,
                                       sizeof suffixarray.suftab,
                                       logger);
            if (arguments->inputlcp)
            {
              if (gt_lcptab_lightweightcheck(
                                      gt_str_get(arguments->esaindexname),
                                      suffixarray.encseq,
                                      suffixarray.readmode,
                                      suffixarray.suftab,
                                      logger,err) != 0)
              {
                haserr = true;
              }
            }
          }
        }
        if (!haserr)
        {
          gt_logger_log(logger, "okay");
        }
      }
      if (!haserr && arguments->inputbwt)
      {
        GtUword bwtdifferentconsecutive = 0, idx;
        GT_UNUSED GtUword longest;

        gt_assert(suffixarray.longest.defined);
        longest = suffixarray.longest.valueunsignedlong;
        if (!haserr && arguments->inputsuf && !arguments->usestream)
        {
          gt_assert(suffixarray.numberofallsortedsuffixes == totallength+1);
          gt_assert(longest < totallength);
          gt_assert(suffixarray.suftab != NULL);
          gt_assert(ESASUFFIXPTRGET(suffixarray.suftab,longest) == 0);
        }
        if (!arguments->usestream)
        {
          for (idx = (GtUword) 1; idx<totallength; idx++)
          {
            if (suffixarray.bwttab[idx-1] != suffixarray.bwttab[idx] ||
                GT_ISSPECIAL(suffixarray.bwttab[idx]))
            {
              bwtdifferentconsecutive++;
            }
          }
        } else
        {
          GtUchar prevcc;

          if (gt_readnextfromstream_GtUchar(&prevcc,&suffixarray.bwttabstream)
              == 1)
          {
            GtUchar cc;
            while (gt_readnextfromstream_GtUchar(&cc,&suffixarray.bwttabstream)
                   == 1)
            {
              if (prevcc != cc || GT_ISSPECIAL(cc))
              {
                bwtdifferentconsecutive++;
              }
            }
          }
        }
        gt_logger_log(logger,"bwtdifferentconsecutive="GT_WU" (%.4f)",
               bwtdifferentconsecutive,
               (double) bwtdifferentconsecutive/totallength);
      }
    }
  }
  if (!haserr && arguments->inputdes && arguments->inputsds)
  {
    gt_logger_log(logger, "checkallsequencedescriptions");
    gt_encseq_check_descriptions(suffixarray.encseq);
  }
  gt_freesuffixarray(&suffixarray);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, 0x1a8(%rsp)
movq %rsi, 0x1a0(%rsp)
movq %rdx, 0x198(%rsp)
movb $0x0, 0x197(%rsp)
movl $0x0, 0x8c(%rsp)
cmpq $0x0, 0x198(%rsp)
je 0x6a5f9
movq 0x198(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x6a5c1
jmp 0x6a5f9
movq 0x5d19d8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4aba41(%rip), %rsi    # 0x516013
leaq 0x4abbe6(%rip), %rdx    # 0x5161bf
leaq 0x4c075e(%rip), %rcx    # 0x52ad3e
leaq 0x4c0003(%rip), %r8     # 0x52a5ea
movl $0x29f, %r9d            # imm = 0x29F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6a5fb
movq 0x1a8(%rsp), %rax
testb $0x1, 0x5(%rax)
jne 0x6a626
movq 0x1a8(%rsp), %rax
cmpq $0x0, 0x18(%rax)
ja 0x6a626
movq 0x1a8(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x6a637
movl 0x8c(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0x7(%rax)
je 0x6a656
movl 0x8c(%rsp), %eax
orl $0x10, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0x8(%rax)
je 0x6a675
movl 0x8c(%rsp), %eax
orl $0x20, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x6a694
movl 0x8c(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0xa(%rax)
je 0x6a6b3
movl 0x8c(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0x9(%rax)
je 0x6a6d2
movl 0x8c(%rsp), %eax
orl $0x8, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0xb(%rax)
je 0x6a6f1
movl 0x8c(%rsp), %eax
orl $0x40, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
testb $0x1, 0xc(%rax)
je 0x6a712
movl 0x8c(%rsp), %eax
orl $0x80, %eax
movl %eax, 0x8c(%rsp)
movq 0x1a8(%rsp), %rax
movb (%rax), %dl
leaq 0x1c96dd(%rip), %rax    # 0x233e00
leaq 0x1c8dd6(%rip), %rcx    # 0x233500
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x50(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movq 0x1a8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movl 0x4c(%rsp), %esi
movq %rax, %rdx
movq 0x50(%rsp), %rax
movq 0x1a0(%rsp), %rcx
movq 0x198(%rsp), %r8
leaq 0x90(%rsp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0x6a785
movb $0x1, 0x197(%rsp)
testb $0x1, 0x197(%rsp)
jne 0x6adbf
cmpq $0x0, 0x90(%rsp)
je 0x6adbf
movq 0x1a8(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jbe 0x6a7cf
movq 0x90(%rsp), %rdi
movq 0x1a8(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x6bf80
jmp 0x6adbd
movq 0x90(%rsp), %rdi
callq 0xa9d00
movq %rax, 0x80(%rsp)
testb $0x1, 0x197(%rsp)
jne 0x6aa80
movq 0x1a8(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x6aa80
movq 0x1a8(%rsp), %rax
testb $0x1, (%rax)
jne 0x6aa80
movq 0xe0(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6a840
movq 0x1a8(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x6a968
movq 0x1a8(%rsp), %rax
testb $0x1, 0xa(%rax)
je 0x6a888
movq 0x1a8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
movq 0x1a0(%rsp), %rcx
movq 0x198(%rsp), %r8
movl $0x5, %esi
movl $0x1, %edx
callq 0x23b3e0
movq %rax, 0x78(%rsp)
jmp 0x6a891
movq $0x0, 0x78(%rsp)
movq 0x1a0(%rsp), %rdi
leaq 0x4c049e(%rip), %rsi    # 0x52ad3e
movb $0x0, %al
callq 0xe7cd0
movq 0x90(%rsp), %rdx
movl 0xd8(%rsp), %ecx
movq 0xe8(%rsp), %r8
movq 0xe0(%rsp), %r9
movq 0x1a8(%rsp), %rax
movb 0x11(%rax), %r11b
movq 0x78(%rsp), %r10
movq 0x198(%rsp), %rax
leaq 0x4bfd04(%rip), %rdi    # 0x52a5ea
movl $0x2e7, %esi            # imm = 0x2E7
xorl %ebx, %ebx
xorl %ebx, %ebx
andb $0x1, %r11b
movzbl %r11b, %r11d
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x6c100
cmpl $0x0, %eax
je 0x6a951
movq 0x5d1671(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4bc5b3(%rip), %rsi    # 0x526eec
leaq 0x4c03fe(%rip), %rdx    # 0x52ad3e
movb $0x0, %al
callq 0x199f0
movl $0x2, %edi
callq 0x19890
cmpq $0x0, 0x78(%rsp)
je 0x6a963
leaq 0x78(%rsp), %rdi
callq 0x23b5e0
jmp 0x6aa5e
movq 0xe0(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6aa5c
movq 0x90(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0xd8(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x90(%rsp), %rdi
callq 0xb0e80
movq 0x30(%rsp), %rdx
movl 0x3c(%rsp), %ecx
movq 0x40(%rsp), %r8
movl %eax, %r9d
movq 0xe8(%rsp), %r10
movq 0x1a0(%rsp), %rax
leaq 0x13a1(%rip), %rdi      # 0x6bd80
leaq -0x1be6(%rip), %rsi     # 0x68e00
movq %r10, (%rsp)
movq $0x8, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x2c96c0
movq 0x1a8(%rsp), %rax
testb $0x1, 0xa(%rax)
je 0x6aa5a
movq 0x1a8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
movq 0x90(%rsp), %rsi
movl 0xd8(%rsp), %edx
movq 0xe8(%rsp), %rcx
movq 0x1a0(%rsp), %r8
movq 0x198(%rsp), %r9
callq 0x2c91c0
cmpl $0x0, %eax
je 0x6aa58
movb $0x1, 0x197(%rsp)
jmp 0x6aa5a
jmp 0x6aa5c
jmp 0x6aa5e
testb $0x1, 0x197(%rsp)
jne 0x6aa7e
movq 0x1a0(%rsp), %rdi
leaq 0x4b7c9c(%rip), %rsi    # 0x522713
movb $0x0, %al
callq 0xe7cd0
jmp 0x6aa80
testb $0x1, 0x197(%rsp)
jne 0x6adbb
movq 0x1a8(%rsp), %rax
testb $0x1, 0x9(%rax)
je 0x6adbb
movq $0x0, 0x70(%rsp)
testb $0x1, 0xc8(%rsp)
jne 0x6aaeb
movq 0x5d14e6(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ab54f(%rip), %rsi    # 0x516013
leaq 0x4c0281(%rip), %rdx    # 0x52ad4c
leaq 0x4c026c(%rip), %rcx    # 0x52ad3e
leaq 0x4bfb11(%rip), %r8     # 0x52a5ea
movl $0x320, %r9d            # imm = 0x320
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6aaed
movq 0xd0(%rsp), %rax
movq %rax, 0x60(%rsp)
testb $0x1, 0x197(%rsp)
jne 0x6ac64
movq 0x1a8(%rsp), %rax
testb $0x1, 0x6(%rax)
je 0x6ac64
movq 0x1a8(%rsp), %rax
testb $0x1, (%rax)
jne 0x6ac64
jmp 0x6ab2d
movq 0xe0(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x6ab7e
movq 0x5d1453(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ab4bc(%rip), %rsi    # 0x516013
leaq 0x4c020a(%rip), %rdx    # 0x52ad68
leaq 0x4c01d9(%rip), %rcx    # 0x52ad3e
leaq 0x4bfa7e(%rip), %r8     # 0x52a5ea
movl $0x324, %r9d            # imm = 0x324
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6ab80
jmp 0x6ab82
movq 0x60(%rsp), %rax
cmpq 0x80(%rsp), %rax
jb 0x6abc9
movq 0x5d1408(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ab471(%rip), %rsi    # 0x516013
leaq 0x4c01f6(%rip), %rdx    # 0x52ad9f
leaq 0x4c018e(%rip), %rcx    # 0x52ad3e
leaq 0x4bfa33(%rip), %r8     # 0x52a5ea
movl $0x325, %r9d            # imm = 0x325
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6abcb
jmp 0x6abcd
cmpq $0x0, 0xe8(%rsp)
jne 0x6ac10
movq 0x5d13c1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ab42a(%rip), %rsi    # 0x516013
leaq 0x4c01c5(%rip), %rdx    # 0x52adb5
leaq 0x4c0147(%rip), %rcx    # 0x52ad3e
leaq 0x4bf9ec(%rip), %r8     # 0x52a5ea
movl $0x326, %r9d            # imm = 0x326
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6ac12
jmp 0x6ac14
movq 0xe8(%rsp), %rax
movq 0x60(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x6ac60
movq 0x5d1371(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ab3da(%rip), %rsi    # 0x516013
leaq 0x4c0190(%rip), %rdx    # 0x52add0
leaq 0x4c00f7(%rip), %rcx    # 0x52ad3e
leaq 0x4bf99c(%rip), %r8     # 0x52a5ea
movl $0x327, %r9d            # imm = 0x327
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6ac62
jmp 0x6ac64
movq 0x1a8(%rsp), %rax
testb $0x1, (%rax)
jne 0x6aced
movq $0x1, 0x68(%rsp)
movq 0x68(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0x6aceb
movq 0x100(%rsp), %rax
movq 0x68(%rsp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %eax
movq 0x100(%rsp), %rcx
movq 0x68(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x6accb
movq 0x100(%rsp), %rax
movq 0x68(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xfe, %eax
jl 0x6acd9
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x6acdb
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x6ac7a
jmp 0x6ad59
leaq 0x90(%rsp), %rsi
addq $0xb8, %rsi
leaq 0x5f(%rsp), %rdi
callq 0x6bdb0
cmpl $0x1, %eax
jne 0x6ad57
jmp 0x6ad0d
leaq 0x90(%rsp), %rsi
addq $0xb8, %rsi
leaq 0x5e(%rsp), %rdi
callq 0x6bdb0
cmpl $0x1, %eax
jne 0x6ad55
movzbl 0x5f(%rsp), %eax
movzbl 0x5e(%rsp), %ecx
cmpl %ecx, %eax
jne 0x6ad45
movzbl 0x5e(%rsp), %eax
cmpl $0xfe, %eax
jl 0x6ad53
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x6ad0d
jmp 0x6ad57
jmp 0x6ad59
movq 0x1a0(%rsp), %rdi
movq 0x70(%rsp), %rdx
movq %rdx, %xmm0
movaps 0x4adbbe(%rip), %xmm3   # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x4adbc2(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x80(%rsp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0x4c004d(%rip), %rsi    # 0x52ae01
movb $0x1, %al
callq 0xe7cd0
jmp 0x6adbd
jmp 0x6adbf
testb $0x1, 0x197(%rsp)
jne 0x6ae08
movq 0x1a8(%rsp), %rax
testb $0x1, 0x7(%rax)
je 0x6ae08
movq 0x1a8(%rsp), %rax
testb $0x1, 0x8(%rax)
je 0x6ae08
movq 0x1a0(%rsp), %rdi
leaq 0x4c0030(%rip), %rsi    # 0x52ae24
movb $0x0, %al
callq 0xe7cd0
movq 0x90(%rsp), %rdi
callq 0xb1fe0
leaq 0x90(%rsp), %rdi
callq 0x233320
movb 0x197(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
retq
nopw %cs:(%rax,%rax)