// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/apmeoveridx.c
// Function: apme_inplacenextLimdfsstate
static void apme_inplacenextLimdfsstate(const Limdfsconstinfo *mt,
                                        DECLAREPTRDFSSTATE(aliascol),
                                        GT_UNUSED GtUword currentdepth,
                                        GtUchar currentchar)
{
  GtUword Eq = 0, Xv, Xh, Ph, Mh, /* as in Myers Paper */
                backmask,           /* only one bit is on */
                idx,                /* a counter */
                score;              /* current score */
  ApmeoveridxLimdfsstate *col = (ApmeoveridxLimdfsstate *) aliascol;
  const ApmeoveridxLimdfsconstinfo *mti =
                                        (const ApmeoveridxLimdfsconstinfo *) mt;

  gt_assert(col->maxleqk != UNDEFMAXLEQK);
  gt_assert(mti->maxintervalwidth > 0 || col->maxleqk != SUCCESSMAXLEQK);
  if (currentchar != (GtUchar) GT_WILDCARD)
  {
    Eq = mti->eqsvector[(GtUword) currentchar];
  }
  Xv = Eq | col->Mv;
  Xh = (((Eq & col->Pv) + col->Pv) ^ col->Pv) | Eq;

  Ph = col->Mv | ~ (Xh | col->Pv);
  Mh = col->Pv & Xh;

  Ph = (Ph << 1) | 1UL;
  col->Pv = (Mh << 1) | ~ (Xv | Ph);
  col->Mv = Ph & Xv;
  backmask = 1UL << col->maxleqk;
  if (Eq & backmask || Mh & backmask)
  {
    col->maxleqk++;
  } else
  {
    if (Ph & backmask)
    {
      GtUword tmpmaxleqk = UNDEFMAXLEQK;
      score = mti->maxdistance+1;
      if (col->maxleqk > 0)
      {
        for (idx = col->maxleqk - 1, backmask >>= 1;
             /* Nothing */;
             backmask >>= 1)
        {
          if (col->Pv & backmask)
          {
            score--;
            if (score <= mti->maxdistance)
            {
              tmpmaxleqk = idx;
              col->lastdistvalue = score;
              break;
            }
          } else
          {
            if (col->Mv & backmask)
            {
              score++;
            }
          }
          if (idx > 0)
          {
            idx--;
          } else
          {
            break;
          }
        }
      }
      col->maxleqk = tmpmaxleqk;
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %eax
movq 0x10(%rsi), %rcx
movq 0x10(%rdi), %r8
leaq 0x1(%r8), %rdx
cmpq %rdx, %rcx
je 0x2a66b1
cmpq %r8, %rcx
jne 0x2a65e0
cmpq $0x0, 0x8(%rdi)
je 0x2a66df
cmpb $-0x2, %al
jne 0x2a65e9
xorl %r11d, %r11d
jmp 0x2a65f4
movq 0x20(%rdi), %r8
movzbl %al, %eax
movq (%r8,%rax,8), %r11
movq (%rsi), %r8
movq 0x8(%rsi), %rax
movq %r8, %rbx
andq %r11, %rbx
addq %r8, %rbx
xorq %r8, %rbx
orq %r11, %rbx
movq %rbx, %r9
orq %r8, %r9
notq %r9
orq %rax, %r9
orq %r11, %rax
andq %r8, %rbx
leaq 0x1(,%r9,2), %r14
leaq (%rbx,%rbx), %r9
movq %r14, %r8
orq %rax, %r8
notq %r8
orq %r9, %r8
movq %r8, (%rsi)
andq %r14, %rax
pushq $0x1
popq %r9
movq %r9, %r10
shlq %cl, %r10
movq %rax, 0x8(%rsi)
andq %r10, %r11
andq %r10, %rbx
orq %r11, %rbx
jne 0x2a6693
testq %r10, %r14
je 0x2a669d
testq %rcx, %rcx
je 0x2a6699
movq 0x18(%rdi), %r11
leaq 0x1(%r11), %rdi
subq %rcx, %r9
shrq %r10
testq %r8, %r10
je 0x2a667a
decq %rdi
cmpq %r11, %rdi
ja 0x2a6688
jmp 0x2a66a5
movq %r10, %rcx
andq %rax, %rcx
cmpq $0x1, %rcx
sbbq $-0x1, %rdi
incq %r9
cmpq $0x1, %r9
jne 0x2a6668
jmp 0x2a6699
incq %rcx
movq %rcx, %rdx
movq %rdx, 0x10(%rsi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, 0x18(%rsi)
negq %r9
movq %r9, %rdx
jmp 0x2a6699
movq 0x1918b0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3e951(%rip), %rsi     # 0x2e5013
leaq 0xda2a0(%rip), %rdx     # 0x380969
leaq 0xda309(%rip), %rcx     # 0x3809d9
leaq 0xda211(%rip), %r8      # 0x3808e8
movl $0x16a, %r9d            # imm = 0x16A
jmp 0x2a670b
movq 0x191882(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3e923(%rip), %rsi     # 0x2e5013
leaq 0xda2fe(%rip), %rdx     # 0x3809f5
leaq 0xda2db(%rip), %rcx     # 0x3809d9
leaq 0xda1e3(%rip), %r8      # 0x3808e8
movl $0x16b, %r9d            # imm = 0x16B
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop