// File: /workspace/github_c_makefile_star2_O1/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 %rbx
movl %ecx, %eax
movq 0x10(%rsi), %rcx
movq 0x10(%rdi), %r8
leaq 0x1(%r8), %rdx
cmpq %rdx, %rcx
je 0x311ccb
cmpq %r8, %rcx
jne 0x311bfc
cmpq $0x0, 0x8(%rdi)
je 0x311cd0
cmpb $-0x2, %al
jne 0x311c05
xorl %r10d, %r10d
jmp 0x311c10
movq 0x20(%rdi), %r8
movzbl %al, %eax
movq (%r8,%rax,8), %r10
movq (%rsi), %r8
movq 0x8(%rsi), %rax
movq %r8, %r11
andq %r10, %r11
addq %r8, %r11
xorq %r8, %r11
orq %r10, %r11
movq %r11, %r9
orq %r8, %r9
notq %r9
orq %rax, %r9
orq %r10, %rax
andq %r8, %r11
leaq 0x1(,%r9,2), %rbx
leaq (%r11,%r11), %r9
movq %rbx, %r8
orq %rax, %r8
notq %r8
orq %r9, %r8
movq %r8, (%rsi)
andq %rbx, %rax
movl $0x1, %r9d
shlq %cl, %r9
movq %rax, 0x8(%rsi)
andq %r9, %r10
andq %r9, %r11
orq %r10, %r11
jne 0x311cb3
testq %r9, %rbx
je 0x311cbd
testq %rcx, %rcx
je 0x311cb9
movq 0x18(%rdi), %r11
leaq 0x1(%r11), %r10
movl $0x1, %edi
subq %rcx, %rdi
shrq %r9
testq %r8, %r9
je 0x311c9a
decq %r10
cmpq %r11, %r10
ja 0x311ca8
jmp 0x311cbf
movq %r9, %rcx
andq %rax, %rcx
cmpq $0x1, %rcx
sbbq $-0x1, %r10
incq %rdi
cmpq $0x1, %rdi
jne 0x311c88
jmp 0x311cb9
incq %rcx
movq %rcx, %rdx
movq %rdx, 0x10(%rsi)
popq %rbx
retq
movq %r10, 0x18(%rsi)
negq %rdi
movq %rdi, %rdx
jmp 0x311cb9
callq 0x90c30
callq 0x90bf7
nopl (%rax)