// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_sfxmap.c
// Function: gt_sfxmap_compressedesa
static int gt_sfxmap_compressedesa(const char *indexname,GtError *err)
{
  bool haserr = false;
  GtEncseq *encseq;
  GtEncseqLoader *encseq_loader = gt_encseq_loader_new();

  gt_error_check(err);
  encseq = gt_encseq_loader_load(encseq_loader,indexname, err);
  gt_encseq_loader_delete(encseq_loader);
  if (encseq == NULL)
  {
    haserr = true;
  }
  if (!haserr)
  {
    uint64_t writtenbits;
    uint8_t bitsperentry;
    GtUword numberofentries = 0;
    GtUword totallength = gt_encseq_total_length(encseq);
    FILE *fp;

    fp = gt_fa_fopen_with_suffix(indexname,GT_SUFTABSUFFIX_BYTECOMPRESSED,
                                 "rb",err);
    if (fp == NULL)
    {
      haserr = true;
    }
    if (!haserr)
    {
      if (fread(&writtenbits,sizeof writtenbits,(size_t) 1,fp)
          != (size_t) 1)
      {
        gt_error_set(err,"cannot read %d bytes from %s%s at offset 0",
                        (int) sizeof writtenbits,
                        indexname,GT_SUFTABSUFFIX_BYTECOMPRESSED);
        haserr = true;
      }
    }
    if (!haserr)
    {
      if (fread(&bitsperentry,sizeof bitsperentry,(size_t) 1,fp)
          != (size_t) 1)
      {
        gt_error_set(err,"cannot read %d bytes from %s%s at offset %d",
                        (int) sizeof bitsperentry,
                        indexname,GT_SUFTABSUFFIX_BYTECOMPRESSED,
                        (int) sizeof writtenbits);
        haserr = true;
      }
      gt_assert(writtenbits % bitsperentry == 0);
      numberofentries = (GtUword) (writtenbits/bitsperentry);
      gt_assert(numberofentries == totallength + 1);
    }
    if (!haserr)
    {
      uint64_t readvalue = 0;
      const unsigned int bitspervalue = 64U;
      unsigned int bits2add = (unsigned int) bitsperentry,
                   remainingbits = 0;
      GtUword bitbuffer = 0,
                    *suftabptr,
                    *suftab = gt_malloc(sizeof *suftab *
                                        (size_t) numberofentries);
#ifndef NDEBUG
      GtUword countentries = 0;
#endif

      suftabptr = suftab;
      while (true)
      {
        if (remainingbits == 0)
        {
          if (fread(&readvalue,sizeof readvalue,(size_t) 1,fp) != (size_t) 1)
          {
            break;
          }
          remainingbits = bitspervalue;
        } else
        {
          if (remainingbits >= (unsigned int) bits2add)
          {
            if (suftabptr >= suftab + numberofentries)
            {
              break;
            }
            bitbuffer |= ((GtUword) (readvalue) &
                         ((1UL << bits2add) - 1)) << (bitsperentry-bits2add);
            readvalue >>= bits2add;
            remainingbits -= bits2add;
            gt_assert(bitbuffer < (1UL << bitsperentry));
            *suftabptr++ = bitbuffer;
            bitbuffer = 0;
            bits2add = (unsigned int) bitsperentry;
#ifndef NDEBUG
            countentries++;
#endif
          } else
          {
            gt_assert(remainingbits < 64U);
            bitbuffer |= (readvalue & ((((uint64_t) 1) << remainingbits) - 1))
                         << (bitsperentry-bits2add);
            readvalue >>= remainingbits;
            bits2add -= remainingbits;
            remainingbits = 0;
          }
        }
      }
      gt_assert(countentries == numberofentries);
      gt_suftab_lightweightcheck(sfx_accesschar_encseq,
                                 sfx_charcount_encseq,
                                 encseq,
                                 GT_READMODE_FORWARD,
                                 totallength,
                                 gt_encseq_alphabetnumofchars(encseq),
                                 suftab,
                                 sizeof *suftab,
                                 NULL);
      gt_free(suftab);
    }
    gt_fa_fclose(fp);
  }
  gt_encseq_delete(encseq);
  return haserr ? -1 : 0;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movb $0x0, 0xa7(%rsp)
callq 0xb7a40
movq %rax, 0x90(%rsp)
cmpq $0x0, 0xa8(%rsp)
je 0x69bc2
movq 0xa8(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x69b8a
jmp 0x69bc2
movq 0x5d240f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ac478(%rip), %rsi    # 0x516013
leaq 0x4ac61d(%rip), %rdx    # 0x5161bf
leaq 0x4c0f88(%rip), %rcx    # 0x52ab31
leaq 0x4c0a3a(%rip), %r8     # 0x52a5ea
movl $0x35a, %r9d            # imm = 0x35A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x69bc4
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0xb7aa0
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rdi
callq 0xb7e50
cmpq $0x0, 0x98(%rsp)
jne 0x69c09
movb $0x1, 0xa7(%rsp)
testb $0x1, 0xa7(%rsp)
jne 0x6a137
movq $0x0, 0x78(%rsp)
movq 0x98(%rsp), %rdi
callq 0xa9d00
movq %rax, 0x70(%rsp)
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %r9
leaq 0x4c0f00(%rip), %rsi    # 0x52ab49
leaq 0x50e295(%rip), %rdx    # 0x577ee5
leaq 0x4c0993(%rip), %rcx    # 0x52a5ea
movl $0x36a, %r8d            # imm = 0x36A
callq 0xd92c0
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x68(%rsp)
jne 0x69c77
movb $0x1, 0xa7(%rsp)
testb $0x1, 0xa7(%rsp)
jne 0x69cd7
movq 0x68(%rsp), %rcx
leaq 0x88(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x19a70
cmpq $0x1, %rax
je 0x69cd5
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rcx
leaq 0x4c0e95(%rip), %rsi    # 0x52ab4f
movl $0x8, %edx
leaq 0x4c0e83(%rip), %r8     # 0x52ab49
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0xa7(%rsp)
jmp 0x69cd7
testb $0x1, 0xa7(%rsp)
jne 0x69dfd
movq 0x68(%rsp), %rcx
leaq 0x87(%rsp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x19a70
cmpq $0x1, %rax
je 0x69d3d
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rcx
leaq 0x4c0e5e(%rip), %rsi    # 0x52ab7a
movl $0x1, %edx
leaq 0x4c0e21(%rip), %r8     # 0x52ab49
movl $0x8, %r9d
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0xa7(%rsp)
jmp 0x69d3f
movq 0x88(%rsp), %rax
movzbl 0x87(%rsp), %ecx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
je 0x69d92
movq 0x5d223f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ac2a8(%rip), %rsi    # 0x516013
leaq 0x4c0e34(%rip), %rdx    # 0x52aba6
leaq 0x4c0db8(%rip), %rcx    # 0x52ab31
leaq 0x4c086a(%rip), %r8     # 0x52a5ea
movl $0x385, %r9d            # imm = 0x385
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x69d94
movq 0x88(%rsp), %rax
movzbl 0x87(%rsp), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x69df9
movq 0x5d21d8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ac241(%rip), %rsi    # 0x516013
leaq 0x4c0ded(%rip), %rdx    # 0x52abc6
leaq 0x4c0d51(%rip), %rcx    # 0x52ab31
leaq 0x4c0803(%rip), %r8     # 0x52a5ea
movl $0x387, %r9d            # imm = 0x387
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x69dfb
jmp 0x69dfd
testb $0x1, 0xa7(%rsp)
jne 0x6a12d
movq $0x0, 0x60(%rsp)
movl $0x40, 0x5c(%rsp)
movzbl 0x87(%rsp), %eax
movl %eax, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x78(%rsp), %rdi
shlq $0x3, %rdi
leaq 0x4c07a1(%rip), %rsi    # 0x52a5ea
movl $0x392, %edx            # imm = 0x392
callq 0xe80f0
movq %rax, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpl $0x0, 0x54(%rsp)
jne 0x69ea3
movq 0x68(%rsp), %rcx
leaq 0x60(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x19a70
cmpq $0x1, %rax
je 0x69e96
jmp 0x6a06b
movl $0x40, 0x54(%rsp)
jmp 0x6a066
movl 0x54(%rsp), %eax
cmpl 0x58(%rsp), %eax
jb 0x69fc2
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
movq 0x78(%rsp), %rdx
shlq $0x3, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jb 0x69ed1
jmp 0x6a06b
movq 0x60(%rsp), %rax
movl 0x58(%rsp), %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
andq %rcx, %rax
movzbl 0x87(%rsp), %ecx
subl 0x58(%rsp), %ecx
movl %ecx, %ecx
shlq %cl, %rax
orq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x58(%rsp), %ecx
movq 0x60(%rsp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, 0x60(%rsp)
movl 0x58(%rsp), %ecx
movl 0x54(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x54(%rsp)
movq 0x48(%rsp), %rax
movzbl 0x87(%rsp), %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
cmpq %rcx, %rax
jb 0x69f7f
movq 0x5d2052(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ac0bb(%rip), %rsi    # 0x516013
leaq 0x4c0c8a(%rip), %rdx    # 0x52abe9
leaq 0x4c0bcb(%rip), %rcx    # 0x52ab31
leaq 0x4c067d(%rip), %r8     # 0x52a5ea
movl $0x3ad, %r9d            # imm = 0x3AD
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x69f81
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x48(%rsp)
movzbl 0x87(%rsp), %eax
movl %eax, 0x58(%rsp)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x6a064
jmp 0x69fc4
cmpl $0x40, 0x54(%rsp)
jb 0x6a003
movq 0x5d1fce(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ac037(%rip), %rsi    # 0x516013
leaq 0x4c0c28(%rip), %rdx    # 0x52ac0b
leaq 0x4c0b47(%rip), %rcx    # 0x52ab31
leaq 0x4c05f9(%rip), %r8     # 0x52a5ea
movl $0x3b6, %r9d            # imm = 0x3B6
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6a005
movq 0x60(%rsp), %rax
movl 0x54(%rsp), %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
andq %rcx, %rax
movzbl 0x87(%rsp), %ecx
subl 0x58(%rsp), %ecx
movl %ecx, %ecx
shlq %cl, %rax
orq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x54(%rsp), %ecx
movq 0x60(%rsp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, 0x60(%rsp)
movl 0x54(%rsp), %ecx
movl 0x58(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
jmp 0x6a066
jmp 0x69e6b
jmp 0x6a06d
movq 0x30(%rsp), %rax
cmpq 0x78(%rsp), %rax
je 0x6a0b1
movq 0x5d1f20(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4abf89(%rip), %rsi    # 0x516013
leaq 0x4c0b8e(%rip), %rdx    # 0x52ac1f
leaq 0x4c0a99(%rip), %rcx    # 0x52ab31
leaq 0x4c054b(%rip), %r8     # 0x52a5ea
movl $0x3bf, %r9d            # imm = 0x3BF
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x6a0b3
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x98(%rsp), %rdi
callq 0xb0e80
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %r8
movl %eax, %r9d
movq 0x38(%rsp), %rax
leaq 0x1c90(%rip), %rdi      # 0x6bd80
leaq -0x12f7(%rip), %rsi     # 0x68e00
xorl %ecx, %ecx
xorl %r10d, %r10d
movq %rax, (%rsp)
movq $0x8, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x2c96c0
movq 0x38(%rsp), %rdi
leaq 0x4c04c7(%rip), %rsi    # 0x52a5ea
movl $0x3c9, %edx            # imm = 0x3C9
callq 0xe88c0
movq 0x68(%rsp), %rdi
callq 0xd9390
movq 0x98(%rsp), %rdi
callq 0xae070
movb 0xa7(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0xb8, %rsp
retq