// File: schneebergerlab[P]GameteBinning/asPollinator_1.0.cpp
// Function: get_similarty(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, unsigned long*, unsigned long*)
bool get_similarty(string         matGT, 
                   string         patGT, 
                   string         pollenGT,
                   string*        pattern,                   
                   unsigned long* matscore, 
                   unsigned long* patscore)
{
    /*
      mat       : GATCCAGATGA
      pat       : AGCTTCATCAG
      pollenGT  : GANNCAGATGA
      =>        
      pattern =   MMuuMMMMMMM
      matscore= 9 (number of matched positions)
      patscore= 0 
    */
    if (matGT.size() != patGT.size()    || 
        matGT.size() != pollenGT.size() ||
        patGT.size() != pollenGT.size() ) 
    {
        cout << "   Error: sequences of pollen and haplotype initials are with different lengths. " << endl;
        return false;
    }
    //
    for(unsigned long ii=0; ii<matGT.size(); ii++)
    {
        if(matGT[ii]==pollenGT[ii])
        {
            (*matscore) += 1;
            (*pattern)  += "M";
        }else
        if(patGT[ii]==pollenGT[ii])
        {
            (*patscore) += 1;
            (*pattern)  += "P";
        }else
        {
            (*pattern)  += "u"; // undetermined/unclear
        }
    }
    //
    return true;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movq %r9, 0x50(%rsp)
callq 0x3250
movq 0x38(%rsp), %rdi
movq %rax, 0x40(%rsp)
callq 0x3250
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jne 0x18341
movq 0x28(%rsp), %rdi
callq 0x3250
movq 0x30(%rsp), %rdi
movq %rax, 0x20(%rsp)
callq 0x3250
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jne 0x18341
movq 0x38(%rsp), %rdi
callq 0x3250
movq 0x30(%rsp), %rdi
movq %rax, 0x18(%rsp)
callq 0x3250
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
je 0x18370
movq 0x20c90(%rip), %rdi     # 0x38fd8
leaq 0x139bb(%rip), %rsi     # 0x2bd0a
callq 0x3320
movq %rax, %rdi
movq 0x20c6a(%rip), %rsi     # 0x38fc8
callq 0x3370
movb $0x0, 0x87(%rsp)
jmp 0x18478
movq $0x0, 0x48(%rsp)
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x3250
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x18470
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x35f0
movq 0x30(%rsp), %rdi
movsbl (%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x48(%rsp), %rsi
callq 0x35f0
movq %rax, %rcx
movl 0xc(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x183f3
movq 0x58(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq 0x60(%rsp), %rdi
leaq 0x13747(%rip), %rsi     # 0x2bb33
callq 0x3300
jmp 0x1845b
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x35f0
movq 0x30(%rsp), %rdi
movsbl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x48(%rsp), %rsi
callq 0x35f0
movq %rax, %rcx
movl 0x8(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x18448
movq 0x50(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq 0x60(%rsp), %rdi
leaq 0x136d9(%rip), %rsi     # 0x2bb1a
callq 0x3300
jmp 0x18459
movq 0x60(%rsp), %rdi
leaq 0x135f7(%rip), %rsi     # 0x2ba4b
callq 0x3300
jmp 0x1845b
jmp 0x1845d
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x18379
movb $0x1, 0x87(%rsp)
movb 0x87(%rsp), %al
andb $0x1, %al
addq $0x88, %rsp
retq
nopl (%rax)