// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/alignment.c
// Function: gt_alignment_eval_generic_with_affine_score
static GtWord gt_alignment_eval_generic_with_affine_score(
                                               bool mapped,
                                               bool downcase,
                                               const GtUchar *characters,
                                               const GtAlignment *alignment,
                                               const GtScoreMatrix *scorematrix,
                                               GtWord matchscore,
                                               GtWord mismatchscore,
                                               GtWord gap_opening,
                                               GtWord gap_extension)
{
  GtUword i, j, idx_u = 0, idx_v = 0, meoplen;
  GtWord sumscore = 0;
  GtMultieop meop;
  AlignmentEoptype next_meop_type = Insertion + 1;

  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
            {
              if (GT_ISSPECIAL(a) || GT_ISSPECIAL(b) ||
                  characters[a] != characters[b])
              {
                sumscore += mismatchscore;
              }
              else
                sumscore += matchscore;
            }
          } else
          {
            if (downcase)
            {
              a = tolower((int) a);
              b = tolower((int) b);
            }
            sumscore += (a != b) ? mismatchscore : matchscore;
          }
          idx_u++;
          idx_v++;
        }
        break;
      case Deletion:
        if (i < meoplen && next_meop_type == Deletion)
        {
          sumscore += gap_extension * meop.steps;
        } else
        {
          sumscore += gap_extension * meop.steps + gap_opening;
        }
        idx_u += meop.steps;
        break;
      case Insertion:
         if (i < meoplen && next_meop_type == Insertion)
        {
          sumscore += gap_extension * meop.steps;
        } else
        {
          sumscore += gap_extension * meop.steps + gap_opening;
        }
        idx_v += meop.steps;
        break;
    }
    next_meop_type = meop.type;
  }
  return sumscore;
}

// Assembly:
subq $0xa8, %rsp
movb %sil, %al
movb %dil, %sil
movq 0xc0(%rsp), %rdi
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rdi
andb $0x1, %sil
movb %sil, 0x9f(%rsp)
andb $0x1, %al
movb %al, 0x9e(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movq %r9, 0x78(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x48(%rsp)
movl $0x5, 0x2c(%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x12afb9
testb $0x1, 0x9f(%rsp)
je 0x12aff1
testb $0x1, 0x9e(%rsp)
je 0x12aff1
movq 0x510fe0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3eb049(%rip), %rsi    # 0x516013
leaq 0x41c0b2(%rip), %rdx    # 0x547083
leaq 0x41c334(%rip), %rcx    # 0x54730c
leaq 0x41be69(%rip), %r8     # 0x546e48
movl $0x184, %r9d            # imm = 0x184
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x12aff3
movq 0x88(%rsp), %rdi
callq 0x12a1b0
cmpq $0x0, %rax
jne 0x12b017
movq $0x0, 0xa0(%rsp)
jmp 0x12b34a
jmp 0x12b019
movq 0x88(%rsp), %rdi
callq 0x12a910
testb $0x1, %al
jne 0x12b062
movq 0x510f6f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3eafd8(%rip), %rsi    # 0x516013
leaq 0x41c087(%rip), %rdx    # 0x5470c9
leaq 0x41c2c3(%rip), %rcx    # 0x54730c
leaq 0x41bdf8(%rip), %r8     # 0x546e48
movl $0x188, %r9d            # imm = 0x188
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x12b064
movq 0x88(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x1b0390
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
jbe 0x12b33d
movq 0x88(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x70(%rsp), %rsi
decq %rsi
callq 0x1b03a0
movl %eax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movups 0x18(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x10(%rsp)
subl $0x3, %eax
jb 0x12b0ec
jmp 0x12b0cb
movl 0x10(%rsp), %eax
subl $0x3, %eax
je 0x12b268
jmp 0x12b0da
movl 0x10(%rsp), %eax
subl $0x4, %eax
je 0x12b2c6
jmp 0x12b322
movq $0x0, 0x68(%rsp)
movq 0x68(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x12b263
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x60(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0x17(%rsp)
movq 0x88(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x58(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0x16(%rsp)
testb $0x1, 0x9f(%rsp)
je 0x12b1d8
cmpq $0x0, 0x80(%rsp)
je 0x12b173
movq 0x80(%rsp), %rdi
movzbl 0x17(%rsp), %esi
movzbl 0x16(%rsp), %edx
callq 0x10f680
cltq
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x12b1d6
movzbl 0x17(%rsp), %eax
cmpl $0xfe, %eax
jge 0x12b1b1
movzbl 0x16(%rsp), %eax
cmpl $0xfe, %eax
jge 0x12b1b1
movq 0x90(%rsp), %rax
movzbl 0x17(%rsp), %ecx
movzbl (%rax,%rcx), %eax
movq 0x90(%rsp), %rcx
movzbl 0x16(%rsp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x12b1c5
movq 0xb0(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x12b1d4
movq 0x78(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x12b1d6
jmp 0x12b234
testb $0x1, 0x9e(%rsp)
je 0x12b1fe
movzbl 0x17(%rsp), %edi
callq 0x19a20
movb %al, 0x17(%rsp)
movzbl 0x16(%rsp), %edi
callq 0x19a20
movb %al, 0x16(%rsp)
movzbl 0x17(%rsp), %eax
movzbl 0x16(%rsp), %ecx
cmpl %ecx, %eax
je 0x12b21b
movq 0xb0(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x12b225
movq 0x78(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x12b0f5
jmp 0x12b322
movq 0x70(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x12b295
cmpl $0x3, 0x2c(%rsp)
jne 0x12b295
movq 0xc0(%rsp), %rax
imulq 0x38(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x12b2b5
movq 0xc0(%rsp), %rax
imulq 0x38(%rsp), %rax
addq 0xb8(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x12b322
movq 0x70(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0x12b2f3
cmpl $0x4, 0x2c(%rsp)
jne 0x12b2f3
movq 0xc0(%rsp), %rax
imulq 0x38(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x12b313
movq 0xc0(%rsp), %rax
imulq 0x38(%rsp), %rax
addq 0xb8(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x70(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x12b084
movq 0x48(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $0xa8, %rsp
retq
nopw (%rax,%rax)