// File: /workspace/github_cpp_makefile_star2_O2/schneebergerlab[P]GameteBinning/asPollinator_1.0.cpp
// Function: get_crossover(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string get_crossover(string poPat, string pmflag)
{
    /*
       not used after 20191101
       poPat  : 'P'/'M' pattern at markers along a contig: PPuPPMMuMMuuuMMMuuuuuMMuM
       pmflag : 'P' or 'M' to indicate cluster of current contig       
    */
    //
    // initialization
    string pmstring = "";
    //    
    string poPatbk = poPat;
    poPat.erase(std::remove(poPat.begin(), poPat.end(), 'u'), poPat.end()); // remove non-effective marekers with value: 'u'
    if(poPat.size()==0) 
    {
        pmstring = "UU";
        return pmstring;
    }
    //
    if(pmflag.compare("P") == 0)
    {
        // get count of 'M' in the beginning of poPat: to check whether it is MP-type pattern
        int Mcnt = 0;
        int Pcnt = 0;
        for(int li=0; li<poPat.size(); li++)
        {
            if(poPat.substr(li, 1).compare("M")==0)
            {
                Mcnt ++;
            }
            if(poPat.substr(li, 1).compare("P")==0)
            {
                Pcnt ++;
            }
            //            
            if(poPat.substr(li, 1).compare("P")==0 &&
               li >= poPat.size()/4) // caution on 1/4 cutoff
            {
                // only check the 1st 1/4 letters
                break;
            }
        }
        // first bit of pmstring
        if( poPat.substr(0, 1).compare("M")==0 && 
            Pcnt<Mcnt                          &&
           (Mcnt>=5 || ( poPat.size()<5 && Mcnt>0 && Mcnt>=poPat.size()/2) ) )// caution on 5   cutoff
        {
            pmstring += "M";
        }else
        {
            pmstring += "P";
        }
        // get count of 'M' in the end of poPat: to check whether it is PM-type pattern
        Mcnt = 0;
        Pcnt = 0;        
        for(int li=poPat.size()-1; li>=0; li--)
        {
            if(poPat.substr(li, 1).compare("M")==0)
            {
                Mcnt ++;
            }
            if(poPat.substr(li, 1).compare("P")==0)
            {
                Pcnt ++;
            } 
            if(poPat.substr(li, 1).compare("P")==0 &&
               li <= poPat.size()*3/4) // caution on 3/4 cutoff
            {
                // only check the last 1/4 letters
                break;
            }
        }
        // second bit of pmstring         
        if(poPat.substr(poPat.size()-1, 1).compare("M")==0 && 
           Pcnt<Mcnt                                       &&           
           ( Mcnt>=5 || (poPat.size()<5 && Mcnt>0 && Mcnt>=poPat.size()/2) ) ) // caution on 5   cutoff
        {
            pmstring += "M";
        }else
        {
            pmstring += "P";
        }     
        //
        cout << "   Check2rm: " << poPatbk << " ---- determined as " << pmstring << " for pollen in cluster P" << endl;
    }
    //
    if(pmflag.compare("M") == 0)
    {
        // get count of 'P' in the beginning of poPat: to check whether it is xM-type pattern
        int Pcnt = 0;
        int Mcnt = 0;
        for(int li=0; li<poPat.size(); li++)
        {
            if(poPat.substr(li, 1).compare("P")==0)
            {
                Pcnt ++;
            }
            if(poPat.substr(li, 1).compare("M")==0)
            {
                Mcnt ++;
            }
            if(poPat.substr(li, 1).compare("M")==0 &&
               li >= poPat.size()/4) // caution on 1/4 cutoff
            {
                // only check the 1st 1/4 letters
                break;
            }
        }
        // first bit of pmstring: if number of markers too small, the left-most must be "P" to determine it as "P"
        if(poPat.substr(0, 1).compare("P")==0 && 
           Mcnt<Pcnt                          &&                      
           ( Pcnt>=5 || ( poPat.size()<5 && Pcnt>0 && Pcnt>=poPat.size()/2) ) )// caution on 5   cutoff
        {
            pmstring += "P";
        }else
        {
            pmstring += "M";
        }
        // get count of 'P' in the end of poPat: to check whether it is xP-type pattern
        Pcnt = 0;
        Mcnt = 0;        
        for(int li=poPat.size()-1; li>=0; li--)
        {
            if(poPat.substr(li, 1).compare("P")==0)
            {
                Pcnt ++;
            }
            if(poPat.substr(li, 1).compare("M")==0)
            {
                Mcnt ++;
            }            
            if(poPat.substr(li, 1).compare("M")==0 &&
               li <= poPat.size()*3/4) // caution on 3/4 cutoff
            {
                // only check the last 1/4 letters
                break;
            }
        }  
        // second bit of pmstring: if number of markers too small, the right-most must be "P" to determine it as "P"
        if(poPat.substr(poPat.size()-1, 1).compare("P")==0 && 
           Mcnt<Pcnt                                       &&        
           ( Pcnt>=5 || (poPat.size()<5 && Pcnt>0 && Pcnt>=poPat.size()/2) ) )// caution on 5   cutoff
        {
            pmstring += "P";
        }else
        {
            pmstring += "M";
        }
        //
        cout << "   Check2rm: " << poPatbk << " ---- determined as " << pmstring << " for pollen in cluster M" << endl;
    }
    //
    return pmstring;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x6a43(%rip), %rsi      # 0x13ec7
leaq 0x58(%rsp), %rdx
movq %rdi, 0x28(%rsp)
callq 0xe174
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x3300
movq (%r14), %rdi
movq 0x8(%r14), %rsi
addq %rdi, %rsi
leaq 0x30(%rsp), %rdx
movb $0x75, (%rdx)
callq 0x10e57
movq (%r14), %rdx
addq 0x8(%r14), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x3090
cmpq $0x0, 0x8(%r14)
je 0xd5ea
leaq 0x66a7(%rip), %rsi      # 0x13b82
movq %rbx, %rdi
callq 0x30c0
testl %eax, %eax
movq %r14, 0x8(%rsp)
jne 0xd89f
movq %rbx, 0x50(%rsp)
xorl %ebx, %ebx
leaq 0x30(%rsp), %r13
pushq $0x1
popq %r12
xorl %ebp, %ebp
movl $0x0, 0x20(%rsp)
cmpq %rbx, 0x8(%r14)
jbe 0xd600
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x3290
movq %r13, %rdi
leaq 0x666c(%rip), %rsi      # 0x13b9b
callq 0x30c0
movl %eax, %r15d
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %r15d
adcl $0x0, %ebp
movl %ebp, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x3290
movq %r12, %rbp
movq %r13, %rdi
leaq 0x661a(%rip), %rsi      # 0x13b82
callq 0x30c0
movl %eax, %r15d
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %r15d
adcl $0x0, 0x20(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %r15
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x3290
movq %rbp, %r12
movq %r13, %rdi
leaq 0x65e0(%rip), %rsi      # 0x13b82
callq 0x30c0
testl %eax, %eax
je 0xd5bc
movq %r13, %rdi
callq 0x3120
movl 0x10(%rsp), %ebp
movq %r15, %rbx
jmp 0xd5e2
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
shrq $0x2, %r14
movq %r13, %rdi
callq 0x3120
movq %r15, %rbx
cmpq %r15, %r14
movq 0x8(%rsp), %r14
movl 0x10(%rsp), %ebp
jbe 0xd600
incq %rbx
jmp 0xd50a
leaq 0x64c4(%rip), %rsi      # 0x13ab5
movq 0x28(%rsp), %rdi
callq 0x3440
jmp 0xdc30
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
xorl %edx, %edx
callq 0x3290
leaq 0x6582(%rip), %rbx      # 0x13b9b
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x30c0
testl %eax, %eax
jne 0xd67f
cmpl %ebp, 0x20(%rsp)
jge 0xd67f
cmpl $0x4, %ebp
jle 0xd649
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
movq %rbx, %rsi
jmp 0xd695
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
cmpq $0x4, %r14
ja 0xd67f
testl %ebp, %ebp
jle 0xd67f
movl %ebp, %r15d
shrq %r14
leaq 0x30(%rsp), %rdi
callq 0x3120
cmpq %r15, %r14
leaq 0x650c(%rip), %rsi      # 0x13b82
movq 0x8(%rsp), %r14
jbe 0xd644
jmp 0xd695
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
leaq 0x64ed(%rip), %rsi      # 0x13b82
movq 0x28(%rsp), %rdi
callq 0x3430
movl 0x8(%r14), %r15d
decq %r15
movl $0x0, 0x20(%rsp)
leaq 0x30(%rsp), %rbx
pushq $0x1
popq %r14
leaq 0x64c4(%rip), %r12      # 0x13b82
movl $0x0, 0x1c(%rsp)
testl %r15d, %r15d
js 0xd7a4
movq %r15, 0x10(%rsp)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq %rbx, %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x3290
movq %rbx, %rdi
leaq 0x64a0(%rip), %rsi      # 0x13b9b
callq 0x30c0
movq %rbx, %rbp
movl %eax, %ebx
movq %rbp, %rdi
callq 0x3120
cmpl $0x1, %ebx
movq %rbp, %rbx
adcl $0x0, 0x20(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x3290
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30c0
movl %eax, %ebx
movq %rbp, %rdi
callq 0x3120
cmpl $0x1, %ebx
movq %rbp, %rbx
adcl $0x0, 0x1c(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %r13
movq %r14, %rcx
callq 0x3290
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30c0
testl %eax, %eax
je 0xd776
movq %rbx, %rdi
callq 0x3120
jmp 0xd794
movq 0x8(%rsp), %rax
imulq $0x3, 0x8(%rax), %rbx
shrq $0x2, %rbx
movq %rbp, %rdi
callq 0x3120
cmpq %r15, %rbx
movq %rbp, %rbx
jae 0xd7a4
movq 0x10(%rsp), %r15
decq %r15
movq %r13, %r14
jmp 0xd6c6
movq 0x8(%rsp), %rsi
movq 0x8(%rsi), %rdx
decq %rdx
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rcx
callq 0x3290
movl 0x20(%rsp), %r13d
leaq 0x63d2(%rip), %rbx      # 0x13b9b
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x30c0
testl %eax, %eax
jne 0xd828
cmpl %r13d, 0x1c(%rsp)
jge 0xd828
cmpl $0x4, %r13d
jle 0xd7f8
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
jmp 0xd83a
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
cmpq $0x4, %r14
ja 0xd828
testl %r13d, %r13d
jle 0xd828
movl %r13d, %r15d
shrq %r14
leaq 0x30(%rsp), %rdi
callq 0x3120
cmpq %r15, %r14
movq 0x8(%rsp), %r14
ja 0xd837
jmp 0xd83a
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
movq %r12, %rbx
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x3430
movq 0x50(%rsp), %rbx
movq 0xe785(%rip), %rdi      # 0x1bfd8
leaq 0x62ee(%rip), %rsi      # 0x13b48
callq 0x3260
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x3240
leaq 0x62e3(%rip), %rsi      # 0x13b56
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x3240
leaq 0x62dc(%rip), %rsi      # 0x13b6b
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x3140
leaq 0x62f5(%rip), %rsi      # 0x13b9b
movq %rbx, %rdi
callq 0x30c0
testl %eax, %eax
jne 0xdc30
xorl %ebx, %ebx
pushq $0x1
popq %r12
leaq 0x62d8(%rip), %rbp      # 0x13b9b
movl $0x0, 0x10(%rsp)
movl $0x0, 0x20(%rsp)
cmpq %rbx, 0x8(%r14)
jbe 0xd9a1
movq %rbp, %r15
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x3290
movq %r13, %rdi
leaq 0x6282(%rip), %rsi      # 0x13b82
callq 0x30c0
movl %eax, %ebp
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %ebp
adcl $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x3290
movq %r13, %rdi
movq %r15, %rbp
movq %r15, %rsi
callq 0x30c0
movl %eax, %r15d
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %r15d
adcl $0x0, 0x20(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %r15
movq %r12, %rcx
callq 0x3290
movq %r13, %rdi
movq %rbp, %rsi
callq 0x30c0
testl %eax, %eax
je 0xd977
movq %r13, %rdi
callq 0x3120
jmp 0xd996
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
shrq $0x2, %r14
movq %r13, %rdi
callq 0x3120
cmpq %rbx, %r14
movq 0x8(%rsp), %r14
jbe 0xd9a1
incq %rbx
movq %r15, %r12
jmp 0xd8d3
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
xorl %edx, %edx
callq 0x3290
leaq 0x61c8(%rip), %rbx      # 0x13b82
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x30c0
testl %eax, %eax
jne 0xda24
movl 0x20(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0xda24
cmpl $0x4, 0x10(%rsp)
jle 0xd9f0
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
movq %rbx, %rbp
jmp 0xda33
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
cmpq $0x4, %r14
ja 0xda24
cmpl $0x0, 0x10(%rsp)
jle 0xda24
movl 0x10(%rsp), %r15d
shrq %r14
leaq 0x30(%rsp), %rdi
callq 0x3120
cmpq %r15, %r14
movq 0x8(%rsp), %r14
jbe 0xd9eb
jmp 0xda33
leaq 0x30(%rsp), %rdi
callq 0x3120
movq 0x8(%rsp), %r14
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x3430
movl 0x8(%r14), %ebp
decq %rbp
xorl %r15d, %r15d
leaq 0x30(%rsp), %rbx
pushq $0x1
popq %r12
movl $0x0, 0x1c(%rsp)
testl %ebp, %ebp
js 0xdb4c
movq %rbp, 0x20(%rsp)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq %rbx, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x3290
movq %rbx, %rdi
leaq 0x60f4(%rip), %rsi      # 0x13b82
callq 0x30c0
movq %rbx, %r13
movl %eax, %ebx
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %ebx
movq %r13, %rbx
adcl $0x0, %r15d
movl %r15d, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x3290
movq %rbx, %rdi
leaq 0x60d1(%rip), %r15      # 0x13b9b
movq %r15, %rsi
callq 0x30c0
movl %eax, %ebx
movq %r13, %rdi
callq 0x3120
cmpl $0x1, %ebx
movq %r13, %rbx
adcl $0x0, 0x1c(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r12, %r14
movq %r12, %rcx
callq 0x3290
movq %rbx, %rdi
movq %r15, %rsi
callq 0x30c0
testl %eax, %eax
je 0xdb19
movq %rbx, %rdi
callq 0x3120
movl 0x10(%rsp), %r15d
jmp 0xdb3c
movq 0x8(%rsp), %rax
imulq $0x3, 0x8(%rax), %rbx
shrq $0x2, %rbx
movq %r13, %rdi
callq 0x3120
cmpq %rbp, %rbx
movq %r13, %rbx
movl 0x10(%rsp), %r15d
jae 0xdb4c
movq 0x20(%rsp), %rbp
decq %rbp
movq %r14, %r12
jmp 0xda5b
movq 0x8(%rsp), %r14
movq 0x8(%r14), %rdx
decq %rdx
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x3290
leaq 0x6013(%rip), %rbx      # 0x13b82
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x30c0
testl %eax, %eax
jne 0xdbbf
cmpl %r15d, 0x1c(%rsp)
jge 0xdbbf
cmpl $0x4, %r15d
jle 0xdb99
leaq 0x30(%rsp), %rdi
callq 0x3120
jmp 0xdbd0
movq 0x8(%r14), %r14
cmpq $0x4, %r14
ja 0xdbbf
testl %r15d, %r15d
jle 0xdbbf
movl %r15d, %r15d
shrq %r14
leaq 0x30(%rsp), %rdi
callq 0x3120
cmpq %r15, %r14
ja 0xdbc9
jmp 0xdbd0
leaq 0x30(%rsp), %rdi
callq 0x3120
leaq 0x5fcb(%rip), %rbx      # 0x13b9b
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x3430
movq 0xe3f4(%rip), %rdi      # 0x1bfd8
leaq 0x5f5d(%rip), %rsi      # 0x13b48
callq 0x3260
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x3240
leaq 0x5f52(%rip), %rsi      # 0x13b56
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
movq 0x28(%rsp), %rsi
callq 0x3240
leaq 0x5f64(%rip), %rsi      # 0x13b84
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x3140
leaq 0x58(%rsp), %rdi
callq 0x3120
movq 0x28(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
movq %rax, %rbx
jmp 0xdc88
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
jmp 0xdc7b
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3120
movq 0x28(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3410