// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-linlcp.c
// Function: gt_ENCSEQ_lcp9_manzini
GtCompactUlongStore *gt_ENCSEQ_lcp9_manzini(GtCompactUlongStore *spacefortab,
                                            const GtEncseq *encseq,
                                            GtReadmode readmode,
                                            GtUword partwidth,
                                            GtUword totallength,
                                            const ESASuffixptr *suftab)
{
  GtUword pos, previousstart, nextfillpos = 0, fillpos, lcpvalue = 0,
                previouscc1pos, previouscc2pos;
  GtCompactUlongStore *lcptab, *ranknext, *rightposinverse;
  GtUchar cc1, cc2;
  GtEncseqReader *esr1, *esr2;

  if (spacefortab == NULL)
  {
    unsigned int bitsperentry = gt_determinebitspervalue(totallength);
    rightposinverse = ranknext
                    = gt_compact_ulong_store_new(totallength+1, bitsperentry);
    gt_compact_ulong_store_update(ranknext, totallength, totallength);
    gt_ENCSEQ_set_relevant_from_inversetab(rightposinverse, encseq, readmode,
                                           suftab, partwidth);
  } else
  {
    rightposinverse = ranknext = spacefortab;
  }
  gt_ENCSEQ_inversesuffixarray2specialranknext(rightposinverse, ranknext,
                                               encseq,
                                               readmode,
                                               partwidth,
                                               totallength);
  fillpos = gt_ENCSEQ_sa2ranknext(ranknext, encseq, readmode, partwidth,
                                  totallength, suftab);
  lcptab = ranknext;
  /* now ranknext and lcptab point to the same memory area. After reading
     ranknext at position fillpos, the same cell is used for storing
     the determined lcp-value */
  /* exploit the fact, that pos + lcpvalue is monotone */
  esr1 = gt_encseq_create_reader_with_readmode(encseq, readmode,0);
  cc1 = gt_encseq_reader_next_encoded_char(esr1);
  previouscc1pos = 0;
  esr2 = gt_encseq_create_reader_with_readmode(encseq, readmode, 0);
  previouscc2pos = totallength;
  cc2 = 0;
  for (pos = 0; pos < totallength; pos++)
  {
    if (pos < totallength - 1)
    {
      nextfillpos = gt_compact_ulong_store_get(ranknext, fillpos);
    }
    if (fillpos > 0 && fillpos - 1 < partwidth)
    {
      previousstart = ESASUFFIXPTRGET(suftab, fillpos-1);
      while (pos+lcpvalue < totallength &&
             previousstart+lcpvalue < totallength)
      {
        gt_assert(pos + lcpvalue >= previouscc1pos);
        while (previouscc1pos < pos + lcpvalue)
        {
          previouscc1pos++;
          cc1 = gt_encseq_reader_next_encoded_char(esr1);
        }
        if (GT_ISSPECIAL(cc1))
        {
          break;
        }
        if (previousstart+lcpvalue < previouscc2pos ||
            previousstart+lcpvalue > previouscc2pos+1)
        {
          previouscc2pos = previousstart+lcpvalue;
          gt_encseq_reader_reinit_with_readmode(esr2, encseq, readmode,
                                                previouscc2pos);
          cc2 = gt_encseq_reader_next_encoded_char(esr2);
        } else
        {
          if (previousstart+lcpvalue == previouscc2pos+1)
          {
            previouscc2pos++;
            cc2 = gt_encseq_reader_next_encoded_char(esr2);
          } else
          {
            gt_assert(previousstart+lcpvalue == previouscc2pos);
          }
        }
        if (cc1 != cc2)
        {
          break;
        }
        lcpvalue++;
      }
      gt_compact_ulong_store_update(lcptab, fillpos, lcpvalue);
      if (lcpvalue > 0)
      {
        lcpvalue--;
      }
    }
    fillpos = nextfillpos;
  }
  gt_encseq_reader_delete(esr1);
  gt_encseq_reader_delete(esr2);
  return lcptab;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, 0x50(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, 0xc(%rsp)
movq %rsi, %r12
movq %rdi, 0x18(%rsp)
testq %rdi, %rdi
jne 0x1ed5b6
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x105e91
leaq 0x1(%rbx), %rdi
movl %eax, %esi
callq 0xe3b18
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0xe3c78
movq %r12, %rdi
callq 0xeacd6
xorb $0x1, %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x1ed5b6
xorl %ebx, %ebx
movq 0x50(%rsp), %rax
movq (%rax,%rbx,8), %r14
testq %r14, %r14
je 0x1ed5ae
leaq -0x1(%r14), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xe7bbc
cmpb $-0x2, %al
jb 0x1ed5ae
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe3c78
incq %rbx
cmpq %rbx, %r15
jne 0x1ed57c
movq %r12, %rdi
callq 0xeacd6
testb %al, %al
movq %r15, 0x20(%rsp)
movq %r12, 0x30(%rsp)
je 0x1ed7db
movq %r12, %rdi
callq 0xec63b
movq %rax, %r15
movl 0xc(%rsp), %ebp
andl $-0x3, %ebp
xorl %esi, %esi
cmpl $0x1, %ebp
setne %sil
movq %r12, %rdi
callq 0xeae2c
movq %rax, %r12
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0xeae9a
testb %al, %al
je 0x1ed692
xorl %r14d, %r14d
leaq 0x38(%rsp), %r13
xorl %ebx, %ebx
cmpl $0x1, %ebp
jne 0x1ed627
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xf6579
movq 0x20(%rsp), %rax
cmpq %rax, 0x40(%rsp)
jae 0x1ed641
testq %r15, %r15
je 0x1edc24
decq %r15
jmp 0x1ed681
testq %rbx, %rbx
jne 0x1ed662
leaq (,%r15,8), %rdi
leaq 0x1ca5bc(%rip), %rsi    # 0x3b7c11
movl $0x12d, %edx            # imm = 0x12D
callq 0x104226
movq %rax, %rbx
cmpq %r15, %r14
jae 0x1edc29
movq 0x40(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0xe3c2c
movq %rax, (%rbx,%r14,8)
incq %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0xeae9a
testb %al, %al
jne 0x1ed615
jmp 0x1ed694
xorl %ebx, %ebx
xorl %r14d, %r14d
cmpl $0x1, %ebp
setne %r14b
movq %r12, %rdi
callq 0xeb455
movq 0x30(%rsp), %rdi
movl %r14d, %esi
callq 0xeae2c
leaq 0x38(%rsp), %rsi
movq %rax, 0x28(%rsp)
movq %rax, %rdi
callq 0xeae9a
movq 0x20(%rsp), %r13
testb %al, %al
je 0x1ed7a8
xorl %r12d, %r12d
movq 0x20(%rsp), %r14
cmpl $0x1, %ebp
jne 0x1ed6ee
movq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xf6579
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rcx
cmpq %rcx, %rsi
ja 0x1edc1a
movq 0x38(%rsp), %r15
leaq -0x1(%rsi), %rax
cmpq %rax, %r15
jae 0x1ed747
cmpq %rcx, %r14
jae 0x1edc06
leaq 0x1(%r14), %r13
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xe3c78
incq %r15
movq 0x40(%rsp), %rsi
leaq -0x1(%rsi), %rax
movq %r13, %r14
cmpq %rax, %r15
movq 0x10(%rsp), %rcx
jb 0x1ed70f
jmp 0x1ed74a
movq %r14, %r13
cmpq %rcx, %r13
jae 0x1edc1f
cmpq 0x20(%rsp), %rsi
jae 0x1ed777
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0xe3c2c
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xe3c78
jmp 0x1ed78b
movq (%rbx,%r12,8), %rdx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xe3c78
incq %r12
incq %r13
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xeae9a
movq %r13, %r14
testb %al, %al
jne 0x1ed6da
leaq 0x1ca462(%rip), %rsi    # 0x3b7c11
movq %rbx, %rdi
movl $0x16c, %edx            # imm = 0x16C
callq 0x1045eb
cmpq 0x10(%rsp), %r13
jne 0x1edc3d
movq 0x28(%rsp), %rdi
callq 0xeb455
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
testq %r15, %r15
je 0x1edc38
movq %r12, %rdi
callq 0xebcd9
movq %rax, %rdi
callq 0xd11be
movl %eax, %ebx
movl %eax, %r14d
leaq (,%r14,8), %rdi
leaq 0x1ca409(%rip), %rsi    # 0x3b7c11
movl $0xd9, %edx
callq 0x104226
movq %rax, %r13
movq $0x0, (%rax)
cmpl $0x2, %ebx
jb 0x1ed862
movq %r12, %rbp
movl 0xc(%rsp), %ebx
andl $-0x2, %ebx
decq %r14
movb $0x3, %r15b
xorl %r12d, %r12d
cmpl $0x2, %ebx
movzbl %r15b, %r15d
movl %r12d, %eax
cmovel %r15d, %eax
movzbl %al, %esi
movq %rbp, %rdi
callq 0xebcf9
addq (%r13,%r12,8), %rax
movq %rax, 0x8(%r13,%r12,8)
incq %r12
decb %r15b
cmpq %r12, %r14
jne 0x1ed834
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x20(%rsp), %rbp
movq 0x50(%rsp), %r12
movq %r14, %r15
movq (%r12,%rbx,8), %rsi
movq %rbx, %r14
testq %rsi, %rsi
je 0x1ed8bc
decq %rsi
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %edx
callq 0xe7bbc
cmpb $-0x3, %al
ja 0x1ed8b9
movzbl %al, %r14d
movq (%r13,%r14,8), %rsi
cmpq %rbp, %rsi
jae 0x1edc10
movq 0x18(%rsp), %rdi
movq %rbx, %rdx
callq 0xe3c78
incq (%r13,%r14,8)
movq %r15, %r14
incq %rbx
cmpq %rbx, %rbp
jne 0x1ed871
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0xeacd6
testb %al, %al
je 0x1ed9b3
movq %r13, 0x28(%rsp)
movl 0xc(%rsp), %r15d
andl $-0x3, %r15d
xorl %esi, %esi
cmpl $0x1, %r15d
setne %sil
movq %rbx, %rdi
callq 0xeae2c
movq %rax, %rbx
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0xeae9a
testb %al, %al
je 0x1ed9bb
movq %rbp, %r13
cmpl $0x1, %r15d
jne 0x1ed929
movq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xf6579
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
jae 0x1edc15
movq %rbp, %r12
testq %rsi, %rsi
je 0x1ed98f
decq %rsi
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %edx
callq 0xe7bbc
cmpb $-0x3, %al
ja 0x1ed98c
movq %rbp, %rcx
movzbl %al, %r12d
movq 0x28(%rsp), %rbp
movq (%rbp,%r12,8), %rsi
cmpq %rcx, %rsi
jae 0x1edc33
movq 0x18(%rsp), %rdi
movq %r13, %rdx
callq 0xe3c78
incq (%rbp,%r12,8)
movq %r14, %r12
movq 0x20(%rsp), %rbp
jmp 0x1ed98f
movq %r14, %r12
addq 0x40(%rsp), %r13
subq 0x38(%rsp), %r13
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
callq 0xeae9a
movq %r12, %r14
testb %al, %al
jne 0x1ed914
jmp 0x1ed9be
movq %r14, %r12
movq %rbx, %r15
jmp 0x1eda05
movq %r14, %r12
cmpl $0x1, %r15d
movq 0x28(%rsp), %r13
je 0x1ed9d8
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0xec686
jmp 0x1ed9e5
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0xec67e
testq %rax, %rax
je 0x1ed9fd
movq 0x10(%rsp), %rdx
leaq -0x1(%rdx), %rsi
movq 0x18(%rsp), %rdi
callq 0xe3c78
movq %rbx, %rdi
callq 0xeb455
leaq 0x1ca205(%rip), %rsi    # 0x3b7c11
movq %r13, %rdi
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x1045eb
movq %r15, %rdi
movl 0xc(%rsp), %r14d
movl %r14d, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, %rbp
movq %rax, %rdi
callq 0xe8186
movl %eax, %ebx
movq %r15, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, 0x58(%rsp)
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x1edbdd
movq %r12, %r14
leaq -0x1(%rcx), %rdi
xorl %r15d, %r15d
xorl %eax, %eax
movq $0x0, 0x48(%rsp)
xorl %r12d, %r12d
movq %rcx, 0x28(%rsp)
xorl %r13d, %r13d
movq %rdi, 0x68(%rsp)
cmpq %rdi, %r15
jae 0x1eda99
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xe3c2c
movq 0x68(%rsp), %rdi
movq 0x10(%rsp), %rcx
testq %r14, %r14
je 0x1edbce
leaq -0x1(%r14), %rsi
cmpq 0x20(%rsp), %rsi
jae 0x1edbce
movq %r14, 0x60(%rsp)
movq %r15, 0x78(%rsp)
addq %r12, %r15
cmpq %rcx, %r15
movq %rax, 0x70(%rsp)
jae 0x1edb91
movq 0x50(%rsp), %rax
movq 0x60(%rsp), %rdx
movq -0x8(%rax,%rdx,8), %rax
movq %rax, 0x80(%rsp)
movq 0x48(%rsp), %rax
movq 0x80(%rsp), %rdx
leaq (%r12,%rdx), %r14
cmpq %rcx, %r14
jae 0x1edb96
movq %rax, 0x48(%rsp)
cmpq %r13, %r15
jb 0x1edc0b
jbe 0x1edb22
incq %r13
movq %rbp, %rdi
callq 0xe8186
cmpq %r15, %r13
jb 0x1edb0d
movl %eax, %ebx
movq %r15, %r13
cmpb $-0x3, %bl
ja 0x1edb91
movq 0x28(%rsp), %rcx
cmpq %rcx, %r14
movq 0x58(%rsp), %rdi
jb 0x1edb3f
leaq 0x1(%rcx), %rax
cmpq %rax, %r14
jbe 0x1edb7b
movq 0x30(%rsp), %rsi
movl 0xc(%rsp), %edx
movq %r14, %rcx
callq 0xe8eed
movq 0x58(%rsp), %rdi
callq 0xe8186
movq %r14, 0x28(%rsp)
movq 0x10(%rsp), %rcx
cmpb %al, %bl
jne 0x1edb96
incq %r12
incq %r15
movl %ebx, %eax
cmpq %rcx, %r15
jb 0x1edae8
jmp 0x1edb96
je 0x1edb55
cmpq %rcx, %r14
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %rax
je 0x1edb64
jmp 0x1edc2e
movq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x18(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
callq 0xe3c78
movq 0x10(%rsp), %rcx
subq $0x1, %r12
movl $0x0, %eax
cmovbq %rax, %r12
movq 0x68(%rsp), %rdi
movq 0x78(%rsp), %r15
movq 0x70(%rsp), %rax
incq %r15
movq %rax, %r14
cmpq %rcx, %r15
jne 0x1eda7d
movq %rbp, %rdi
callq 0xe9204
movq 0x58(%rsp), %rdi
callq 0xe9204
movq 0x18(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x78d61
callq 0x78ef0
callq 0x78e0c
callq 0x78e45
callq 0x78f62
callq 0x78d9a
callq 0x78f9b
callq 0x78d28
callq 0x78eb7
callq 0x78e7e
callq 0x78f29
callq 0x78dd3