// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/seq.cpp
// Function: Seq_sp::Peptide::getSimilarity(Seq_sp::Peptide const&, Seq_sp::SubstMat const&, double, double) const
double Peptide::getSimilarity (const Peptide &other,
                               const SubstMat &mat,
                               double gapOpenCost,
                               double gapCost) const
{
  ASSERT (gapOpenCost >= 0.0);
  ASSERT (gapCost >= 0.0);
  ASSERT (sparse);
  ASSERT (other. sparse);
  ASSERT (seq. size () == other. seq. size ());
  
  double s = 0.0;
  char c1_prev = '\0';
  char c2_prev = '\0';
  FFOR (size_t, i, seq. size ())
  {
    const char c1 =        seq [i];
    const char c2 = other. seq [i];
    if (   c1 == '-' 
        && c2 == '-'
       )
      ;
    else if (   c1 == '-' 
             || c2 == '-'
            )
    {
      s -= gapCost;
      if (   (c1 == '-' && c1_prev != '-')
          || (c2 == '-' && c2_prev != '-')
         )
        s -= gapOpenCost;
    }
    else
      s += mat. sim [(size_t) c1] [(size_t) c2];
    c1_prev = c1;
    c2_prev = c2;
  }

  return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movsd %xmm1, 0x108(%rsp)
movsd %xmm0, 0x110(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0xc070
movsd 0x110(%rsp), %xmm2
andl $0x0, (%rax)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jb 0x50873
movsd 0x108(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x50947
cmpb $0x0, 0x48(%r15)
je 0x50a1b
cmpb $0x0, 0x48(%r14)
je 0x50aef
movq 0x30(%r15), %rax
cmpq 0x30(%r14), %rax
jne 0x50bc3
movq 0x28(%r15), %rcx
movq 0x28(%r14), %rdx
addq $0x8, %rbx
xorl %esi, %esi
xorl %r9d, %r9d
xorl %edi, %edi
cmpq %rdi, %rax
je 0x50865
movl %esi, %r10d
movb (%rcx,%rdi), %sil
movb (%rdx,%rdi), %r8b
movl %esi, %r11d
xorb $0x2d, %r11b
movl %r8d, %ebp
xorb $0x2d, %bpl
orb %r11b, %bpl
je 0x5085a
cmpb $0x2d, %r8b
sete %r11b
cmpb $0x2d, %sil
sete %bpl
orb %r11b, %bpl
cmpb $0x1, %bpl
jne 0x50845
cmpb $0x2d, %r8b
sete %r11b
cmpb $0x2d, %sil
sete %bpl
subsd %xmm1, %xmm0
cmpb $0x2d, %r10b
setne %r10b
cmpb $0x2d, %r9b
setne %r9b
testb %bpl, %r10b
jne 0x5083f
andb %r11b, %r9b
je 0x5085a
subsd %xmm2, %xmm0
jmp 0x5085a
movsbq %sil, %r9
movsbq %r8b, %r10
shlq $0xa, %r9
addq %rbx, %r9
addsd (%r9,%r10,8), %xmm0
incq %rdi
movl %r8d, %r9d
jmp 0x507d1
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0xc6d0
testl %eax, %eax
jne 0x50c97
leaq 0x1278b(%rip), %rsi     # 0x63012
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xdbbe
leaq 0x48(%rsp), %rdi
movl $0xe2e, %esi            # imm = 0xE2E
callq 0xe2d5
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xe26e
leaq 0xd90e(%rip), %rdx      # 0x5e1d1
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x1341e(%rip), %rsi     # 0x63cfd
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xdbbe
leaq 0xdfd7(%rip), %rdx      # 0x5e8cc
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe24f
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0xe26e
leaq 0x13437(%rip), %rdx     # 0x63d5c
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe24f
leaq 0xe8(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x50c97
leaq 0x126b7(%rip), %rsi     # 0x63012
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xdbbe
leaq 0x48(%rsp), %rdi
movl $0xe2f, %esi            # imm = 0xE2F
callq 0xe2d5
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xe26e
leaq 0xd83a(%rip), %rdx      # 0x5e1d1
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x1334a(%rip), %rsi     # 0x63cfd
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xdbbe
leaq 0xdf03(%rip), %rdx      # 0x5e8cc
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe24f
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0xe26e
leaq 0x13376(%rip), %rdx     # 0x63d6f
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe24f
leaq 0xe8(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x50c97
leaq 0x125e3(%rip), %rsi     # 0x63012
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xdbbe
leaq 0x48(%rsp), %rdi
movl $0xe30, %esi            # imm = 0xE30
callq 0xe2d5
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xe26e
leaq 0xd766(%rip), %rdx      # 0x5e1d1
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x13276(%rip), %rsi     # 0x63cfd
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xdbbe
leaq 0xde2f(%rip), %rdx      # 0x5e8cc
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe24f
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0xe26e
leaq 0x1358e(%rip), %rdx     # 0x6405b
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe24f
leaq 0xe8(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x50c97
leaq 0x1250f(%rip), %rsi     # 0x63012
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xdbbe
leaq 0x48(%rsp), %rdi
movl $0xe31, %esi            # imm = 0xE31
callq 0xe2d5
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xe26e
leaq 0xd692(%rip), %rdx      # 0x5e1d1
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x131a2(%rip), %rsi     # 0x63cfd
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xdbbe
leaq 0xdd5b(%rip), %rdx      # 0x5e8cc
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe24f
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0xe26e
leaq 0x131dd(%rip), %rdx     # 0x63d7e
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe24f
leaq 0xe8(%rsp), %rdi
callq 0x101d0
callq 0xc6d0
testl %eax, %eax
jne 0x50c97
leaq 0x1243b(%rip), %rsi     # 0x63012
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xdbbe
leaq 0x48(%rsp), %rdi
movl $0xe32, %esi            # imm = 0xE32
callq 0xe2d5
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xe26e
leaq 0xd5be(%rip), %rdx      # 0x5e1d1
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xe24f
leaq 0x130ce(%rip), %rsi     # 0x63cfd
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xdbbe
leaq 0xdc87(%rip), %rdx      # 0x5e8cc
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe24f
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0xe26e
leaq 0x13117(%rip), %rdx     # 0x63d8c
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xe24f
leaq 0xe8(%rsp), %rdi
callq 0x101d0
pushq $0x1
popq %rdi
callq 0xc6f0
jmp 0x50caf
jmp 0x50cc1
jmp 0x50caf
jmp 0x50cc1
jmp 0x50caf
jmp 0x50cc1
jmp 0x50caf
jmp 0x50cc1
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xcbe8
jmp 0x50cc4
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xcbe8
jmp 0x50cde
jmp 0x50cdb
jmp 0x50cdb
jmp 0x50cdb
jmp 0x50cdb
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xcbe8
jmp 0x50cf5
jmp 0x50cf2
jmp 0x50cf2
jmp 0x50cf2
jmp 0x50cf2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xcbe8
jmp 0x50d0c
jmp 0x50d09
jmp 0x50d09
jmp 0x50d09
jmp 0x50d09
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xcbe8
jmp 0x50d26
jmp 0x50d23
jmp 0x50d23
jmp 0x50d23
jmp 0x50d23
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xcbe8
jmp 0x50d40
jmp 0x50d3d
jmp 0x50d3d
jmp 0x50d3d
jmp 0x50d3d
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xcbe8
jmp 0x50d57
jmp 0x50d54
jmp 0x50d54
jmp 0x50d54
jmp 0x50d54
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xcbe8
jmp 0x50d6e
jmp 0x50d6b
jmp 0x50d6b
jmp 0x50d6b
jmp 0x50d6b
movq %rax, %rbx
movq %rbx, %rdi
callq 0xcaa0