// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movq %r9, 0x58(%rsp)
movq %rcx, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movq %rsi, %r13
movq %rdi, 0x20(%rsp)
testq %rdi, %rdi
movq %r8, 0x28(%rsp)
jne 0x1f6d53
movq %r8, %rbx
movq %r8, %rdi
callq 0x10af48
leaq 0x1(%rbx), %rdi
movl %eax, %esi
callq 0xe7fd8
movq %rax, 0x20(%rsp)
movq %rax, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0xe8138
movq %r13, %rdi
callq 0xef27f
xorb $0x1, %al
cmpq $0x0, 0x10(%rsp)
sete %cl
orb %al, %cl
jne 0x1f6d53
xorl %ebx, %ebx
movq 0x58(%rsp), %rax
movq (%rax,%rbx,8), %r15
testq %r15, %r15
je 0x1f6d49
leaq -0x1(%r15), %rsi
movq %r13, %rdi
movl 0xc(%rsp), %edx
callq 0xec1f8
cmpb $-0x2, %al
jb 0x1f6d49
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xe8138
incq %rbx
cmpq %rbx, 0x10(%rsp)
jne 0x1f6d17
movq %r13, %rdi
callq 0xef27f
testb %al, %al
movq %r13, 0x40(%rsp)
je 0x1f6f88
movq %r13, %rdi
callq 0xf0c37
movq %rax, %r15
movl 0xc(%rsp), %ebx
andl $-0x3, %ebx
xorl %esi, %esi
cmpl $0x1, %ebx
setne %sil
movq %r13, %rdi
callq 0xef3d9
movq %rax, %r12
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xef451
testb %al, %al
je 0x1f6e42
xorl %r14d, %r14d
leaq 0x30(%rsp), %r13
leaq 0x1ca4b8(%rip), %rbp    # 0x3c126a
movq $0x0, 0x18(%rsp)
cmpl $0x1, %ebx
jne 0x1f6dcd
movq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0xfac92
movq 0x10(%rsp), %rax
cmpq %rax, 0x38(%rsp)
jae 0x1f6de7
testq %r15, %r15
je 0x1f73f8
decq %r15
jmp 0x1f6e2d
cmpq $0x0, 0x18(%rsp)
jne 0x1f6e09
leaq (,%r15,8), %rdi
movq %rbp, %rsi
movl $0x12d, %edx            # imm = 0x12D
callq 0x1092b2
movq %rax, 0x18(%rsp)
cmpq %r15, %r14
jae 0x1f73fd
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0xe80ec
movq 0x18(%rsp), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0xef451
testb %al, %al
jne 0x1f6dbb
jmp 0x1f6e4b
movq $0x0, 0x18(%rsp)
xorl %ebp, %ebp
cmpl $0x1, %ebx
setne %bpl
movq %r12, %rdi
callq 0xefa48
movq 0x40(%rsp), %rdi
movl %ebp, %esi
callq 0xef3d9
movq %rax, %r15
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xef451
movq 0x10(%rsp), %r13
testb %al, %al
je 0x1f6f5a
xorl %r14d, %r14d
movq 0x10(%rsp), %rbp
cmpl $0x1, %ebx
jne 0x1f6ea1
movq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xfac92
movq 0x38(%rsp), %rsi
cmpq 0x28(%rsp), %rsi
ja 0x1f73ee
movq 0x30(%rsp), %r12
leaq -0x1(%rsi), %rax
cmpq %rax, %r12
jae 0x1f6ef4
cmpq 0x28(%rsp), %rbp
jae 0x1f73da
leaq 0x1(%rbp), %r13
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xe8138
incq %r12
movq 0x38(%rsp), %rsi
leaq -0x1(%rsi), %rax
movq %r13, %rbp
cmpq %rax, %r12
jb 0x1f6ebf
jmp 0x1f6ef7
movq %rbp, %r13
cmpq 0x28(%rsp), %r13
jae 0x1f73f3
cmpq 0x10(%rsp), %rsi
jae 0x1f6f26
movq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0xe80ec
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xe8138
jmp 0x1f6f3f
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rdx
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0xe8138
incq %r14
incq %r13
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0xef451
movq %r13, %rbp
testb %al, %al
jne 0x1f6e8d
leaq 0x1ca309(%rip), %rsi    # 0x3c126a
movq 0x18(%rsp), %rdi
movl $0x16c, %edx            # imm = 0x16C
callq 0x109670
cmpq 0x28(%rsp), %r13
jne 0x1f7411
movq %r15, %rdi
callq 0xefa48
movq 0x40(%rsp), %r13
cmpq $0x0, 0x10(%rsp)
je 0x1f740c
movq %r13, %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3713
movl %eax, %ebx
movl %eax, %r14d
leaq (,%r14,8), %rdi
leaq 0x1ca2b2(%rip), %rsi    # 0x3c126a
movl $0xd9, %edx
callq 0x1092b2
movq %rax, %rbp
movq $0x0, (%rax)
cmpl $0x2, %ebx
jb 0x1f700f
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 %r13, %rdi
callq 0xf02fa
addq (%rbp,%r12,8), %rax
movq %rax, 0x8(%rbp,%r12,8)
incq %r12
decb %r15b
cmpq %r12, %r14
jne 0x1f6fe1
movq 0x10(%rsp), %r15
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r14, %r12
movq 0x58(%rsp), %rax
movq (%rax,%rbx,8), %rsi
movq %rbx, %r14
testq %rsi, %rsi
je 0x1f7071
decq %rsi
movq %r13, %rdi
movl 0xc(%rsp), %edx
callq 0xec1f8
cmpb $-0x3, %al
ja 0x1f706e
movzbl %al, %r14d
movq (%rbp,%r14,8), %rsi
cmpq 0x10(%rsp), %rsi
jae 0x1f73e4
movq 0x20(%rsp), %rdi
movq %rbx, %rdx
callq 0xe8138
incq (%rbp,%r14,8)
movq %r12, %r14
incq %rbx
cmpq %rbx, %r15
jne 0x1f7021
movq %r13, %rdi
callq 0xef27f
testb %al, %al
je 0x1f7152
movl 0xc(%rsp), %r15d
andl $-0x3, %r15d
xorl %esi, %esi
cmpl $0x1, %r15d
setne %sil
movq %r13, %rdi
callq 0xef3d9
movq %rax, %rbx
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xef451
testb %al, %al
je 0x1f7159
movq 0x10(%rsp), %r13
cmpl $0x1, %r15d
jne 0x1f70d6
movq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xfac92
movq 0x30(%rsp), %rsi
cmpq 0x38(%rsp), %rsi
jae 0x1f73e9
movq 0x10(%rsp), %r12
testq %rsi, %rsi
je 0x1f712e
decq %rsi
movq 0x40(%rsp), %rdi
movl 0xc(%rsp), %edx
callq 0xec1f8
cmpb $-0x3, %al
ja 0x1f712b
movzbl %al, %r12d
movq (%rbp,%r12,8), %rsi
cmpq 0x10(%rsp), %rsi
jae 0x1f7407
movq 0x20(%rsp), %rdi
movq %r13, %rdx
callq 0xe8138
incq (%rbp,%r12,8)
movq %r14, %r12
addq 0x38(%rsp), %r13
subq 0x30(%rsp), %r13
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0xef451
movq %r12, %r14
testb %al, %al
jne 0x1f70c1
jmp 0x1f715c
movq %r14, 0x48(%rsp)
jmp 0x1f71a3
movq %r14, %r12
movq %r12, 0x48(%rsp)
cmpl $0x1, %r15d
je 0x1f7176
movq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0xf0c82
jmp 0x1f7183
movq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0xf0c7a
testq %rax, %rax
je 0x1f719b
movq 0x28(%rsp), %rdx
leaq -0x1(%rdx), %rsi
movq 0x20(%rsp), %rdi
callq 0xe8138
movq %rbx, %rdi
callq 0xefa48
movq 0x28(%rsp), %r15
leaq 0x1ca0bb(%rip), %rsi    # 0x3c126a
movq %rbp, %rdi
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x109670
movq %r13, %rdi
movl 0xc(%rsp), %r14d
movl %r14d, %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, 0x60(%rsp)
movq %rax, %rdi
callq 0xec7be
movl %eax, %r12d
movq %r13, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0xed76d
movq %rax, 0x50(%rsp)
testq %r15, %r15
movq 0x48(%rsp), %r14
je 0x1f73af
movq %r15, %rdx
leaq -0x1(%r15), %rax
movq %rax, 0x88(%rsp)
xorl %ecx, %ecx
xorl %eax, %eax
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r15, 0x68(%rsp)
xorl %r15d, %r15d
cmpq 0x88(%rsp), %rcx
jae 0x1f724b
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %rdx, %rbp
movq %r13, 0x18(%rsp)
movq %rcx, %r13
callq 0xe80ec
movq %r13, %rcx
movq 0x18(%rsp), %r13
movq %rbp, %rdx
testq %r14, %r14
je 0x1f73a0
leaq -0x1(%r14), %rsi
cmpq 0x10(%rsp), %rsi
jae 0x1f73a0
movq %r14, 0x48(%rsp)
movq %rcx, 0x80(%rsp)
leaq (%rbx,%rcx), %r14
cmpq %rdx, %r14
movq %rax, 0x78(%rsp)
jae 0x1f736e
movq 0x58(%rsp), %rax
movq 0x48(%rsp), %rcx
movq -0x8(%rax,%rcx,8), %rax
movq %rax, 0x90(%rsp)
movq %r13, 0x18(%rsp)
movq 0x90(%rsp), %rax
leaq (%rbx,%rax), %r13
cmpq %rdx, %r13
jae 0x1f7369
movq %rbx, 0x70(%rsp)
cmpq %r15, %r14
jb 0x1f73df
movq %rdx, %rbp
movq 0x60(%rsp), %rbx
jbe 0x1f72e1
incq %r15
movq %rbx, %rdi
callq 0xec7be
cmpq %r14, %r15
jb 0x1f72cb
movl %eax, %r12d
movq %r14, %r15
cmpb $-0x3, %r12b
ja 0x1f7361
movq 0x68(%rsp), %rax
cmpq %rax, %r13
jb 0x1f72fa
leaq 0x1(%rax), %rbx
cmpq %rbx, %r13
jbe 0x1f7346
movq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movl 0xc(%rsp), %edx
movq %r13, %rcx
callq 0xed48e
movq %r13, %rbx
movq %rbp, %rdi
callq 0xec7be
movl %eax, %r13d
movq %rbx, 0x68(%rsp)
movq 0x28(%rsp), %rdx
cmpb %r13b, %r12b
movq 0x70(%rsp), %rbx
jne 0x1f736e
incq %rbx
incq %r14
cmpq %rdx, %r14
jb 0x1f7299
jmp 0x1f736e
movq 0x50(%rsp), %rbp
je 0x1f7316
cmpq %rax, %r13
movq 0x28(%rsp), %rdx
movq 0x18(%rsp), %r13
je 0x1f732b
jmp 0x1f7402
movq %rbp, %rdx
movq 0x70(%rsp), %rbx
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rdx, %r14
movq %rbx, %rdx
callq 0xe8138
movq %r14, %rdx
subq $0x1, %rbx
movl $0x0, %eax
cmovbq %rax, %rbx
movq 0x80(%rsp), %rcx
movq 0x78(%rsp), %rax
incq %rcx
movq %rax, %r14
cmpq %rdx, %rcx
jne 0x1f721e
movq 0x60(%rsp), %rdi
callq 0xed7bf
movq 0x50(%rsp), %rdi
callq 0xed7bf
movq 0x20(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7aa60
callq 0x7abef
callq 0x7ab0b
callq 0x7ab44
callq 0x7ac61
callq 0x7aa99
callq 0x7ac9a
callq 0x7aa27
callq 0x7abb6
callq 0x7ab7d
callq 0x7ac28
callq 0x7aad2