// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/myersapm.c
// Function: gt_edistmyersbitvectorAPM
void gt_edistmyersbitvectorAPM(Myersonlineresources *mor,
                               const GtUchar *pattern,
                               GtUword patternlength,
                               GtUword maxdistance)
{
  GtUword Pv = ~0UL,
                Mv = 0UL,
                Eq,
                Xv,
                Xh,
                Ph,
                Mh,
                score;
  const GtUword Ebit = 1UL << (patternlength-1);
  GtUchar cc;
  GtUword pos;
  const GtReadmode readmode = GT_READMODE_REVERSE;
  GtIdxMatch match;

  gt_initeqsvectorrev(mor->eqsvectorrev,
                   (GtUword) mor->alphasize,
                   pattern,patternlength);
  score = patternlength;
  gt_encseq_reader_reinit_with_readmode(mor->esr, mor->encseq, readmode, 0);
  match.dbabsolute = NULL;
  match.dbsubstring = NULL;
  match.querystartpos = 0;
  match.querylen = patternlength;
  match.alignment = NULL;
  for (pos = 0; pos < mor->totallength; pos++)
  {
    cc = gt_encseq_reader_next_encoded_char(mor->esr);
    if (cc == (GtUchar) GT_SEPARATOR)
    {
      Pv = ~0UL;
      Mv = 0UL;
      score = patternlength;
    } else
    {
      if (cc == (GtUchar) GT_WILDCARD)
      {
        Eq = 0;
      } else
      {
        Eq = mor->eqsvectorrev[(GtUword) cc];   /*  6 */
      }
      Xv = Eq | Mv;                                   /*  7 */
      Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;              /*  8 */

      Ph = Mv | ~ (Xh | Pv);                          /*  9 */
      Mh = Pv & Xh;                                   /* 10 */

      if (Ph & Ebit)
      {
        score++;
      } else
      {
        if (Mh & Ebit)
        {
          gt_assert(score > 0);
          score--;
        }
      }

      Ph <<= 1;                                       /* 15 */
      Pv = (Mh << 1) | ~ (Xv | Ph);                   /* 17 */
      Mv = Ph & Xv;                                   /* 18 */
      if (score <= maxdistance)
      {
        GtUword dbstartpos = GT_REVERSEPOS(mor->totallength,pos);
        Definedunsignedlong matchlength;

        if (maxdistance > 0)
        {
          matchlength = gt_forwardprefixmatch(mor->encseq,
                                           mor->alphasize,
                                           dbstartpos,
                                           mor->nowildcards,
                                           mor->eqsvector,
                                           pattern,
                                           patternlength,
                                           maxdistance);
        } else
        {
          matchlength.defined = true;
          matchlength.valueunsignedlong = patternlength;
        }
        gt_assert(matchlength.defined || mor->nowildcards);
        if (matchlength.defined)
        {
          match.dbstartpos = dbstartpos;
          match.dblen = (GtUword) matchlength.valueunsignedlong;
          match.distance = score;
          mor->processmatch(mor->processmatchinfo,&match);
        }
      }
    }
  }
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rcx, 0xe8(%rsp)
movq $-0x1, 0xe0(%rsp)
movq $0x0, 0xd8(%rsp)
movq 0xf0(%rsp), %rcx
subq $0x1, %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, 0xa0(%rsp)
movl $0x1, 0x8c(%rsp)
movq 0x100(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x100(%rsp), %rax
movl 0x28(%rax), %eax
movl %eax, %esi
movq 0xf8(%rsp), %rdx
movq 0xf0(%rsp), %rcx
callq 0x4d1e90
movq 0xf0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x100(%rsp), %rax
movq (%rax), %rdi
movq 0x100(%rsp), %rax
movq 0x8(%rax), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0xabdb0
movb $0x0, 0x40(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq 0x100(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x4d3fff
movq 0x100(%rsp), %rax
movq (%rax), %rdi
callq 0xaae30
movb %al, 0x9f(%rsp)
movzbl 0x9f(%rsp), %eax
cmpl $0xff, %eax
jne 0x4d3cc2
movq $-0x1, 0xe0(%rsp)
movq $0x0, 0xd8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0xa8(%rsp)
jmp 0x4d3fe4
movzbl 0x9f(%rsp), %eax
cmpl $0xfe, %eax
jne 0x4d3cdf
movq $0x0, 0xd0(%rsp)
jmp 0x4d3cff
movq 0x100(%rsp), %rax
movq 0x18(%rax), %rax
movzbl 0x9f(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
orq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rax
andq 0xe0(%rsp), %rax
addq 0xe0(%rsp), %rax
xorq 0xe0(%rsp), %rax
orq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xd8(%rsp), %rax
movq 0xc0(%rsp), %rcx
orq 0xe0(%rsp), %rcx
xorq $-0x1, %rcx
orq %rcx, %rax
movq %rax, 0xb8(%rsp)
movq 0xe0(%rsp), %rax
andq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb8(%rsp), %rax
andq 0xa0(%rsp), %rax
cmpq $0x0, %rax
je 0x4d3db2
movq 0xa8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa8(%rsp)
jmp 0x4d3e25
movq 0xb0(%rsp), %rax
andq 0xa0(%rsp), %rax
cmpq $0x0, %rax
je 0x4d3e23
jmp 0x4d3dca
cmpq $0x0, 0xa8(%rsp)
ja 0x4d3e0d
movq 0x1681c4(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4222d(%rip), %rsi     # 0x516013
leaq 0x947cc(%rip), %rdx     # 0x5685b9
leaq 0xe6067(%rip), %rcx     # 0x5b9e5b
leaq 0xe6030(%rip), %r8      # 0x5b9e2b
movl $0x86, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4d3e0f
movq 0xa8(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0xa8(%rsp)
jmp 0x4d3e25
movq 0xb8(%rsp), %rax
shlq %rax
movq %rax, 0xb8(%rsp)
movq 0xb0(%rsp), %rax
shlq %rax
movq 0xc8(%rsp), %rcx
orq 0xb8(%rsp), %rcx
xorq $-0x1, %rcx
orq %rcx, %rax
movq %rax, 0xe0(%rsp)
movq 0xb8(%rsp), %rax
andq 0xc8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xa8(%rsp), %rax
cmpq 0xe8(%rsp), %rax
ja 0x4d3fe2
movq 0x100(%rsp), %rax
movq 0x10(%rax), %rax
subq $0x1, %rax
subq 0x90(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0xe8(%rsp)
jbe 0x4d3f36
movq 0x100(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x100(%rsp), %rax
movl 0x28(%rax), %esi
movq 0x38(%rsp), %rdx
movq 0x100(%rsp), %rax
movb 0x2c(%rax), %cl
movq 0x100(%rsp), %rax
movq 0x20(%rax), %r8
movq 0xf8(%rsp), %r9
movq 0xf0(%rsp), %r10
movq 0xe8(%rsp), %rax
andb $0x1, %cl
movzbl %cl, %ecx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x4a4590
movb %al, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x4d3f48
movb $0x1, 0x28(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x4d3f4a
testb $0x1, 0x28(%rsp)
jne 0x4d3f97
movq 0x100(%rsp), %rax
testb $0x1, 0x2c(%rax)
jne 0x4d3f97
movq 0x16803a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x420a3(%rip), %rsi     # 0x516013
leaq 0xe5efe(%rip), %rdx     # 0x5b9e75
leaq 0xe5edd(%rip), %rcx     # 0x5b9e5b
leaq 0xe5ea6(%rip), %r8      # 0x5b9e2b
movl $0xa2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4d3f99
testb $0x1, 0x28(%rsp)
je 0x4d3fe0
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x100(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x100(%rsp), %rcx
movq 0x38(%rcx), %rdi
leaq 0x40(%rsp), %rsi
callq *%rax
jmp 0x4d3fe2
jmp 0x4d3fe4
jmp 0x4d3fe6
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x4d3c55
addq $0x108, %rsp            # imm = 0x108
retq
nopw (%rax,%rax)