// File: schneebergerlab[P]GameteBinning/asPollinator_1.0.cpp
// Function: find_bed_v2(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, bool*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*)
bool find_bed_v2(string poPat, string pmflag, int pollenid, bool* out, vector<string>* bedregions)
{
    /*
      PPuPPMMuMMuuuMMPuuuPuuMuM
      =>
      PPuPP:1:5
           MMuMMuuuMM:6:15
                     PuuuPuu:16:22
                            MuM:23:25
    */
    if(poPat.size()==0) return false; // should never happen
    //
    size_t posp = poPat.find("P");
    size_t posm = poPat.find("M");
    //
    if(posp==std::string::npos && posm==std::string::npos)
    {
        // only "U"
        *out = false;
    }else
    if(posp==std::string::npos && posm!=std::string::npos)
    {
        // only "M"
        std::stringstream ss;
        ss.str("");        
        ss << "M:" << "1:" << poPat.size(); // real position index now
        (*bedregions).push_back(ss.str());
        *out = true;
    }else
    if(posp!=std::string::npos && posm==std::string::npos)
    {
        // only "P"
        std::stringstream ss;
        ss.str("");               
        ss << "P:" << "1:" << poPat.size(); // real position index now
        (*bedregions).push_back(ss.str());      
        *out = true;
    }else
    {
        // "P&M&u"
        
        *out = true;
    }
    //   
    return true;
}

// Assembly:
subq $0x438, %rsp            # imm = 0x438
movq %rdi, 0x40(%rsp)
movq %rdi, 0x428(%rsp)
movq %rsi, 0x420(%rsp)
movl %edx, 0x41c(%rsp)
movq %rcx, 0x410(%rsp)
movq %r8, 0x408(%rsp)
callq 0x3250
cmpq $0x0, %rax
jne 0x168ab
movb $0x0, 0x437(%rsp)
jmp 0x16c88
movq 0x40(%rsp), %rdi
leaq 0x15263(%rip), %rsi     # 0x2bb1a
xorl %eax, %eax
movl %eax, %edx
callq 0x35e0
movq 0x40(%rsp), %rdi
movq %rax, 0x400(%rsp)
leaq 0x1525f(%rip), %rsi     # 0x2bb33
xorl %eax, %eax
movl %eax, %edx
callq 0x35e0
movq %rax, 0x3f8(%rsp)
cmpq $-0x1, 0x400(%rsp)
jne 0x1690b
cmpq $-0x1, 0x3f8(%rsp)
jne 0x1690b
movq 0x410(%rsp), %rax
movb $0x0, (%rax)
jmp 0x16c80
cmpq $-0x1, 0x400(%rsp)
jne 0x16ad1
cmpq $-0x1, 0x3f8(%rsp)
je 0x16ad1
leaq 0x270(%rsp), %rdi
callq 0x3260
leaq 0x24f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x3570
movq 0x38(%rsp), %rdx
leaq 0x1550d(%rip), %rsi     # 0x2be61
leaq 0x250(%rsp), %rdi
callq 0x185e0
jmp 0x16963
leaq 0x270(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x33d0
jmp 0x1697a
leaq 0x250(%rsp), %rdi
callq 0x31e0
leaq 0x24f(%rsp), %rdi
callq 0x3390
leaq 0x280(%rsp), %rdi
leaq 0x15134(%rip), %rsi     # 0x2bad7
callq 0x3320
movq %rax, 0x30(%rsp)
jmp 0x169af
movq 0x30(%rsp), %rdi
leaq 0x1511f(%rip), %rsi     # 0x2bada
callq 0x3320
movq %rax, 0x28(%rsp)
jmp 0x169c7
movq 0x40(%rsp), %rdi
callq 0x3250
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x30d0
jmp 0x169e0
movq 0x408(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x218(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x3310
jmp 0x16a04
movq 0x20(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x19d90
jmp 0x16a18
leaq 0x218(%rsp), %rdi
callq 0x31e0
movq 0x410(%rsp), %rax
movb $0x1, (%rax)
leaq 0x270(%rsp), %rdi
callq 0x3280
jmp 0x16c7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x16a79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x250(%rsp), %rdi
callq 0x31e0
leaq 0x24f(%rsp), %rdi
callq 0x3390
jmp 0x16abf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x16abf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x31e0
leaq 0x270(%rsp), %rdi
callq 0x3280
jmp 0x16c99
cmpq $-0x1, 0x400(%rsp)
je 0x16c71
cmpq $-0x1, 0x3f8(%rsp)
jne 0x16c71
leaq 0x90(%rsp), %rdi
callq 0x3260
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x3570
movq 0x18(%rsp), %rdx
leaq 0x1534a(%rip), %rsi     # 0x2be61
leaq 0x70(%rsp), %rdi
callq 0x185e0
jmp 0x16b23
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x33d0
jmp 0x16b37
leaq 0x70(%rsp), %rdi
callq 0x31e0
leaq 0x6f(%rsp), %rdi
callq 0x3390
leaq 0xa0(%rsp), %rdi
leaq 0x14f83(%rip), %rsi     # 0x2badd
callq 0x3320
movq %rax, 0x10(%rsp)
jmp 0x16b66
movq 0x10(%rsp), %rdi
leaq 0x14f68(%rip), %rsi     # 0x2bada
callq 0x3320
movq %rax, 0x8(%rsp)
jmp 0x16b7e
movq 0x40(%rsp), %rdi
callq 0x3250
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x30d0
jmp 0x16b97
movq 0x408(%rsp), %rax
movq %rax, (%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x3310
jmp 0x16bb7
movq (%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x19d90
jmp 0x16bc7
leaq 0x48(%rsp), %rdi
callq 0x31e0
movq 0x410(%rsp), %rax
movb $0x1, (%rax)
leaq 0x90(%rsp), %rdi
callq 0x3280
jmp 0x16c7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x16c22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x31e0
leaq 0x6f(%rsp), %rdi
callq 0x3390
jmp 0x16c62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x16c62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x31e0
leaq 0x90(%rsp), %rdi
callq 0x3280
jmp 0x16c99
movq 0x410(%rsp), %rax
movb $0x1, (%rax)
jmp 0x16c7e
jmp 0x16c80
movb $0x1, 0x437(%rsp)
movb 0x437(%rsp), %al
andb $0x1, %al
addq $0x438, %rsp            # imm = 0x438
retq
movq 0x240(%rsp), %rdi
callq 0x3560
nopw %cs:(%rax,%rax)