// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/alignment.c
// Function: gt_alignment_eval_generic
GtUword gt_alignment_eval_generic(bool mapped,bool downcase,
                                  const GtAlignment *alignment)
{
  GtUword i, j, idx_u = 0, idx_v = 0, sumcost = 0, meoplen;
  GtMultieop meop;

  gt_assert(alignment != NULL && (!mapped || !downcase));
#ifndef NDEBUG
  gt_assert(gt_alignment_is_valid(alignment));
#endif

  meoplen = gt_multieoplist_get_num_entries(alignment->eops);
  for (i = meoplen; i > 0; i--) {
    meop = gt_multieoplist_get_entry(alignment->eops, i - 1);
    switch (meop.type) {
      case Mismatch:
        sumcost += meop.steps;
        idx_u += meop.steps;
        idx_v += meop.steps;
        break;
      case Match:
      case Replacement:
        for (j = 0; j < meop.steps; j++) {
          GtUchar a = alignment->u[idx_u],
                  b = alignment->v[idx_v];
          if (mapped)
          {
            if (GT_ISSPECIAL(a) || GT_ISSPECIAL(b) || a != b)
            {
              sumcost++;
            }
          } else
          {
            if (downcase)
            {
              a = tolower((int) a);
              b = tolower((int) b);
            }
            if (a != b)
            {
              sumcost++;
            }
          }
          idx_u++;
          idx_v++;
        }
        break;
      case Deletion:
        sumcost += meop.steps;
        idx_u += meop.steps;
        break;
      case Insertion:
        sumcost += meop.steps;
        idx_v += meop.steps;
        break;
    }
  }
  return sumcost;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebp
movl %esi, 0x14(%rsp)
testb %sil, %bpl
jne 0x126f42
movq %rdx, %rbx
testq %rdx, %rdx
je 0x126f42
movq %rbx, %rdi
callq 0x126f4c
testb %al, %al
je 0x126f47
movq 0x30(%rbx), %rdi
callq 0x169f71
testq %rax, %rax
je 0x126f2d
movq %rax, %r14
movq $0x0, (%rsp)
leaq 0x257055(%rip), %r15    # 0x37de6c
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %rbx, 0x18(%rsp)
movl %ebp, 0x10(%rsp)
movq 0x30(%rbx), %rdi
decq %r14
movq %r14, %rsi
callq 0x169f76
cmpl $0x4, %eax
ja 0x126f22
movq %rdx, %r13
movl %eax, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
testq %r13, %r13
je 0x126f22
movq %r14, 0x28(%rsp)
movq (%rsp), %r14
leaq (%r14,%r13), %rax
movq %rax, 0x20(%rsp)
addq 0x20(%rbx), %r14
movq 0x28(%rbx), %rdi
addq 0x8(%rsp), %rdi
xorl %r15d, %r15d
movq %r14, (%rsp)
movq %rdi, 0x30(%rsp)
movb (%r14,%r15), %bl
movb (%rdi,%r15), %al
testb %bpl, %bpl
je 0x126eac
cmpb $-0x2, %bl
setae %cl
cmpb $-0x2, %al
setae %sil
orb %cl, %sil
cmpb %al, %bl
setne %al
orb %sil, %al
jmp 0x126ed9
cmpb $0x0, 0x14(%rsp)
je 0x126ed4
movzbl %bl, %edi
movzbl %al, %ebp
callq 0x17ae0
movl %eax, %ebx
movl %ebp, %edi
movl 0x10(%rsp), %ebp
movq (%rsp), %r14
callq 0x17ae0
movq 0x30(%rsp), %rdi
cmpb %al, %bl
setne %al
movzbl %al, %eax
addq %rax, %r12
incq %r15
cmpq %r15, %r13
jne 0x126e86
addq %r13, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %r14
leaq 0x256f66(%rip), %r15    # 0x37de6c
jmp 0x126f22
addq %r13, %r12
jmp 0x126f14
addq %r13, %r12
addq %r13, (%rsp)
addq %r13, 0x8(%rsp)
jmp 0x126f22
addq %r13, %r12
addq %r13, (%rsp)
testq %r14, %r14
jne 0x126e2c
jmp 0x126f30
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3aa6b
callq 0x3aa32