// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/alignment.c
// Function: gt_alignment_eval_generic_with_score
static GtWord gt_alignment_eval_generic_with_score(bool mapped,
                                            bool downcase,
                                            const GtUchar *characters,
                                            const GtAlignment *alignment,
                                            const GtScoreMatrix *scorematrix,
                                            GtWord matchscore,
                                            GtWord mismatchscore,
                                            GtWord gapscore)
{
  GtUword i, j, idx_u = 0, idx_v = 0, meoplen;
  GtWord sumscore = 0;
  GtMultieop meop;

  gt_assert(alignment != NULL && (!mapped || !downcase));
  if (gt_alignment_get_length(alignment) == 0)
  {
    return 0;
  }
#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:
      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 (scorematrix != NULL)
            {
              sumscore += gt_score_matrix_get_score(scorematrix, a, b);
            } else
            {
              sumscore += (GT_ISSPECIAL(a) || GT_ISSPECIAL(b) ||
                           characters[a] != characters[b]) ? mismatchscore
                                                           : matchscore;
            }
          }
          else
          {
            if (downcase)
            {
              a = tolower((int) a);
              b = tolower((int) b);
            }
            sumscore += ((a != b) ? mismatchscore : matchscore);
          }
          idx_u++;
          idx_v++;
        }
        break;
      case Deletion:
        sumscore += gapscore * meop.steps;
        idx_u += meop.steps;
        break;
      case Insertion:
        sumscore += gapscore * meop.steps;
        idx_v += meop.steps;
        break;
    }
  }
  return sumscore;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x18(%rsp)
movq %r8, 0x30(%rsp)
movq %rdx, 0x20(%rsp)
movl %esi, 0x10(%rsp)
movl %edi, 0x14(%rsp)
testb %sil, %dil
jne 0x12136c
testq %rcx, %rcx
je 0x12136c
movq 0x30(%rcx), %rdi
movq %rcx, %rbx
callq 0x1620d5
testq %rax, %rax
je 0x121357
movq %rbx, %rdi
callq 0x121154
testb %al, %al
je 0x121371
movq %rbx, 0x8(%rsp)
movq 0x30(%rbx), %rdi
callq 0x162109
testq %rax, %rax
je 0x121357
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rdi
decq %rax
movq %rax, 0x28(%rsp)
movq %rax, %rsi
callq 0x16210e
movq %rdx, %rbp
cmpl $0x3, %eax
jae 0x121316
testq %rbp, %rbp
je 0x121342
movq 0x8(%rsp), %rdx
movq 0x20(%rdx), %rax
movq 0x28(%rdx), %rcx
movb (%rax,%r13), %r14b
movzbl %r14b, %esi
movb (%rcx,%r15), %al
movzbl %al, %ebx
cmpb $0x0, 0x14(%rsp)
je 0x1212b7
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1212f3
movl %ebx, %edx
callq 0x113add
movq 0x8(%rsp), %rdx
movslq %eax, %rcx
jmp 0x1212e3
cmpb $0x0, 0x10(%rsp)
je 0x1212d4
movl %esi, %edi
callq 0x17ae0
movl %eax, %r14d
movl %ebx, %edi
callq 0x17ae0
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rcx
cmpb %al, %r14b
je 0x1212e3
movq 0x70(%rsp), %rcx
addq %rcx, %r12
incq %r13
incq %r15
decq %rbp
jne 0x12127e
jmp 0x121347
movq 0x70(%rsp), %rcx
cmpb $-0x3, %r14b
ja 0x1212e3
cmpb $-0x3, %al
ja 0x1212e3
movq 0x20(%rsp), %rdi
movb (%rdi,%rsi), %al
movq 0x18(%rsp), %rcx
cmpb (%rdi,%rbx), %al
jne 0x1212de
jmp 0x1212e3
je 0x121333
cmpl $0x4, %eax
movq 0x8(%rsp), %rdx
jne 0x121347
movq %rbp, %rax
imulq 0x78(%rsp), %rax
addq %rax, %r12
addq %rbp, %r15
jmp 0x121347
movq %rbp, %rax
imulq 0x78(%rsp), %rax
addq %rax, %r12
addq %rbp, %r13
movq 0x8(%rsp), %rdx
movq 0x28(%rsp), %rax
testq %rax, %rax
jne 0x121250
jmp 0x12135a
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3a108
callq 0x3a0cf