// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movl %ecx, %eax
movq 0x10(%r8), %rcx
movq 0x10(%rdi), %r9
leaq 0x1(%r9), %rdx
cmpq %rdx, %rcx
je 0x2a6521
cmpq %r9, %rcx
jne 0x2a643e
cmpq $0x0, 0x8(%rdi)
je 0x2a654f
cmpb $-0x2, %al
je 0x2a645a
movzbl %al, %eax
cmpl $0xff, %eax
je 0x2a657d
movq 0x20(%rdi), %r9
movq (%r9,%rax,8), %rbx
jmp 0x2a645c
xorl %ebx, %ebx
movq (%r8), %r9
movq 0x8(%r8), %rax
movq %r9, %r14
andq %rbx, %r14
addq %r9, %r14
xorq %r9, %r14
orq %rbx, %r14
movq %r14, %r10
orq %r9, %r10
notq %r10
orq %rax, %r10
orq %rbx, %rax
andq %r9, %r14
leaq 0x1(,%r10,2), %r15
leaq (%r14,%r14), %r10
movq %r15, %r9
orq %rax, %r9
notq %r9
orq %r10, %r9
movq %r9, (%rsi)
andq %r15, %rax
pushq $0x1
popq %r10
movq %r10, %r11
shlq %cl, %r11
movq %rax, 0x8(%rsi)
andq %r11, %rbx
andq %r11, %r14
orq %rbx, %r14
jne 0x2a6503
testq %r11, %r15
je 0x2a6506
movq 0x18(%rdi), %rdi
movq %rdx, 0x10(%rsi)
movq 0x10(%r8), %rdx
testq %rdx, %rdx
je 0x2a6512
leaq 0x1(%rdi), %rcx
subq %rdx, %r10
shrq %r11
testq %r9, %r11
je 0x2a64ea
decq %rcx
cmpq %rdi, %rcx
ja 0x2a64f8
jmp 0x2a6518
movq %r11, %rdx
andq %rax, %rdx
cmpq $0x1, %rdx
sbbq $-0x1, %rcx
incq %r10
cmpq $0x1, %r10
jne 0x2a64d8
jmp 0x2a6512
incq %rcx
movq %rcx, 0x10(%rsi)
movq 0x18(%r8), %rcx
movq %rcx, 0x18(%rsi)
popq %rbx
popq %r14
popq %r15
retq
negq %r10
movq %r10, 0x10(%rsi)
jmp 0x2a650e
movq 0x191a40(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3eae1(%rip), %rsi     # 0x2e5013
leaq 0xda42e(%rip), %rdx     # 0x380967
leaq 0xda446(%rip), %rcx     # 0x380986
leaq 0xda3a1(%rip), %r8      # 0x3808e8
movl $0x118, %r9d            # imm = 0x118
jmp 0x2a65a9
movq 0x191a12(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3eab3(%rip), %rsi     # 0x2e5013
leaq 0xda434(%rip), %rdx     # 0x38099b
leaq 0xda418(%rip), %rcx     # 0x380986
leaq 0xda373(%rip), %r8      # 0x3808e8
movl $0x119, %r9d            # imm = 0x119
jmp 0x2a65a9
movq 0x1919e4(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3ea85(%rip), %rsi     # 0x2e5013
leaq 0x57ff2(%rip), %rdx     # 0x2fe587
leaq 0xda3ea(%rip), %rcx     # 0x380986
leaq 0xda345(%rip), %r8      # 0x3808e8
movl $0x11a, %r9d            # imm = 0x11A
xorl %eax, %eax
callq 0x17a50
callq 0x17390