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

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

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

  Ph = (Ph << 1) | 1UL;
  outcol->Pv = (Mh << 1) | ~ (Xv | Ph);
  outcol->Mv = Ph & Xv;
  backmask = 1UL << incol->maxleqk;
  if (Eq & backmask || Mh & backmask)
  {
    outcol->maxleqk = incol->maxleqk + 1UL;
    outcol->lastdistvalue = incol->lastdistvalue;
  } else
  {
    if (Ph & backmask)
    {
      score = mti->maxdistance+1;
      outcol->maxleqk = UNDEFMAXLEQK;
      if (incol->maxleqk > 0)
      {
        for (idx = incol->maxleqk - 1, backmask >>= 1;
             /* Nothing */;
             backmask >>= 1)
        {
          if (outcol->Pv & backmask)
          {
            score--;
            if (score <= mti->maxdistance)
            {
              outcol->maxleqk = idx;
              outcol->lastdistvalue = score;
              break;
            }
          } else
          {
            if (outcol->Mv & backmask)
            {
              score++;
            }
          }
          if (idx > 0)
          {
            idx--;
          } else
          {
            break;
          }
        }
      }
    } else
    {
      outcol->maxleqk = incol->maxleqk;
      outcol->lastdistvalue = incol->lastdistvalue;
    }
  }
#ifdef SKDEBUG
  verifycolumnvalues(mti,outcol,currentdepth);
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %eax
movq 0x10(%r8), %rcx
movq 0x10(%rdi), %r9
leaq 0x1(%r9), %rdx
cmpq %rdx, %rcx
je 0x311bc5
cmpq %r9, %rcx
jne 0x311adb
cmpq $0x0, 0x8(%rdi)
je 0x311bca
cmpb $-0x2, %al
je 0x311af7
movzbl %al, %eax
cmpl $0xff, %eax
je 0x311bcf
movq 0x20(%rdi), %r9
movq (%r9,%rax,8), %r11
jmp 0x311afa
xorl %r11d, %r11d
movq (%r8), %r9
movq 0x8(%r8), %rax
movq %r9, %rbx
andq %r11, %rbx
addq %r9, %rbx
xorq %r9, %rbx
orq %r11, %rbx
movq %rbx, %r10
orq %r9, %r10
notq %r10
orq %rax, %r10
orq %r11, %rax
andq %r9, %rbx
leaq 0x1(,%r10,2), %r14
leaq (%rbx,%rbx), %r10
movq %r14, %r9
orq %rax, %r9
notq %r9
orq %r10, %r9
movq %r9, (%rsi)
andq %r14, %rax
movl $0x1, %r10d
shlq %cl, %r10
movq %rax, 0x8(%rsi)
andq %r10, %r11
andq %r10, %rbx
orq %r11, %rbx
jne 0x311ba5
testq %r10, %r14
je 0x311ba8
movq 0x18(%rdi), %rdi
movq %rdx, 0x10(%rsi)
movq 0x10(%r8), %r8
testq %r8, %r8
je 0x311bb4
leaq 0x1(%rdi), %rcx
movl $0x1, %edx
subq %r8, %rdx
shrq %r10
testq %r9, %r10
je 0x311b8c
decq %rcx
cmpq %rdi, %rcx
ja 0x311b9a
jmp 0x311bbc
movq %r10, %r8
andq %rax, %r8
cmpq $0x1, %r8
sbbq $-0x1, %rcx
incq %rdx
cmpq $0x1, %rdx
jne 0x311b7a
jmp 0x311bb4
incq %rcx
movq %rcx, 0x10(%rsi)
movq 0x18(%r8), %rcx
movq %rcx, 0x18(%rsi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
negq %rdx
movq %rdx, 0x10(%rsi)
jmp 0x311bb0
callq 0x90bbe
callq 0x90b85
callq 0x90b4c