// File: schneebergerlab[P]DrLink/find_intersection.cpp
// Function: get_CO(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::multimap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, BPINFO, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, BPINFO>>>*)
bool get_CO(string cofile, multimap<string, BPINFO>* aco)
{
    cout << "   Info: reading raw bp info from file " << cofile << endl;
    ifstream ifp;
    ifp.open(cofile.c_str(), ios::in);
    if(!ifp.is_open())
    {
        cout << "   Error: cannot open file " << cofile << endl;
        return false;
    } 
    while(ifp.good())
    {
        string line("");
        getline(ifp, line);
        if(line.size()==0 || line[0]=='#') continue;
        vector<string> lineinfo = split_string(line, '\t');
        // at least with: 0.chr  1.left_pos  2.right_pos  3.score  4.left_alleles  5.right_alleles  6.barcode
        if(lineinfo.size() < 7) continue; 
        //
        BPINFO tmpbp;
        tmpbp.chr      = lineinfo[0];
        tmpbp.leftp    = strtoul(lineinfo[1].c_str(), NULL, 0);
        tmpbp.rightp   = strtoul(lineinfo[2].c_str(), NULL, 0);
        tmpbp.leftMax  = 0;
        tmpbp.rightMin = 0;
        tmpbp.bpline   = line;
        tmpbp.ovline   = "";
        tmpbp.score    = atof(lineinfo[3].c_str());
        tmpbp.order    = check_allele_order(lineinfo[4], lineinfo[5]);        
        // chr#bc#order
        string key = lineinfo[0] + "#" + lineinfo[6];              
        (*aco).insert(std::pair<string, BPINFO>(key, tmpbp));
    }
    ifp.close();  
    cout << "   Info: " << (*aco).size() << " bp info collected." << endl; 
    return true;
}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
movq %rdi, 0x88(%rsp)
movq %rdi, 0x518(%rsp)
movq %rsi, 0x510(%rsp)
movq 0x47ae2(%rip), %rdi     # 0x84fc8
leaq 0x2cabf(%rip), %rsi     # 0x69fac
callq 0x5460
movq 0x88(%rsp), %rsi
movq %rax, %rdi
callq 0x53e0
movq %rax, %rdi
movq 0x47aa4(%rip), %rsi     # 0x84fb0
callq 0x54b0
leaq 0x308(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x5500
movq 0x88(%rsp), %rdi
callq 0x51d0
movq 0x90(%rsp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x52c0
jmp 0x3d54a
leaq 0x308(%rsp), %rdi
callq 0x56f0
movb %al, 0x87(%rsp)
jmp 0x3d560
movb 0x87(%rsp), %al
testb $0x1, %al
jne 0x3d5e4
jmp 0x3d56d
movq 0x47a54(%rip), %rdi     # 0x84fc8
leaq 0x295db(%rip), %rsi     # 0x66b56
callq 0x5460
movq %rax, 0x78(%rsp)
jmp 0x3d587
movq 0x88(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x53e0
movq %rax, 0x70(%rsp)
jmp 0x3d5a0
movq 0x70(%rsp), %rdi
movq 0x47a04(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x3d5b3
movb $0x0, 0x527(%rsp)
movl $0x1, 0x2f8(%rsp)
jmp 0x3db79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x3db97
jmp 0x3d5e6
movq 0x308(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x308(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x6f(%rsp)
jmp 0x3d605
movb 0x6f(%rsp), %al
testb $0x1, %al
jne 0x3d612
jmp 0x3daf3
leaq 0x2d7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x57c0
movq 0x60(%rsp), %rdx
leaq 0x2d564(%rip), %rsi     # 0x6ab94
leaq 0x2d8(%rsp), %rdi
callq 0x6880
jmp 0x3d63f
leaq 0x2d7(%rsp), %rdi
callq 0x54d0
leaq 0x308(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x50c0
jmp 0x3d663
leaq 0x2d8(%rsp), %rdi
callq 0x5310
cmpq $0x0, %rax
je 0x3d69b
xorl %eax, %eax
movl %eax, %esi
leaq 0x2d8(%rsp), %rdi
callq 0x5880
movq %rax, 0x58(%rsp)
jmp 0x3d68e
movq 0x58(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x3d6ea
movl $0x2, 0x2f8(%rsp)
jmp 0x3d9dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x2d7(%rsp), %rdi
callq 0x54d0
jmp 0x3db97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x3dae1
movb $0x9, 0x2b7(%rsp)
leaq 0x2b8(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
leaq 0x2b7(%rsp), %rdx
callq 0x60790
jmp 0x3d711
leaq 0x2b8(%rsp), %rdi
callq 0xfbb0
cmpq $0x7, %rax
jae 0x3d734
movl $0x2, 0x2f8(%rsp)
jmp 0x3d9d0
leaq 0x208(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x3e0f0
xorl %eax, %eax
movl %eax, %esi
leaq 0x2b8(%rsp), %rdi
callq 0x88f0
movq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x5050
jmp 0x3d766
leaq 0x2b8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movl $0x1, %esi
callq 0x88f0
movq %rax, %rdi
callq 0x51d0
movq %rax, %rdi
xorl %edx, %edx
movl %edx, 0x4c(%rsp)
movl %edx, %esi
movq %rsi, 0x40(%rsp)
callq 0x5160
movq 0x38(%rsp), %rdi
movq %rax, 0x228(%rsp)
movl $0x2, %esi
callq 0x88f0
movq %rax, %rdi
callq 0x51d0
movq 0x40(%rsp), %rsi
movl 0x4c(%rsp), %edx
movq %rax, %rdi
callq 0x5160
movq %rax, 0x230(%rsp)
movq $0x0, 0x238(%rsp)
movq $0x0, 0x240(%rsp)
leaq 0x270(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x5050
jmp 0x3d801
leaq 0x290(%rsp), %rdi
leaq 0x2d384(%rip), %rsi     # 0x6ab94
callq 0x55d0
jmp 0x3d817
leaq 0x2b8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movl $0x3, %esi
callq 0x88f0
movq %rax, %rdi
callq 0x51d0
movq %rax, %rdi
callq 0x5570
movq 0x30(%rsp), %rdi
movsd %xmm0, 0x248(%rsp)
movl $0x4, %esi
callq 0x88f0
movq %rax, %rsi
leaq 0x1c8(%rsp), %rdi
callq 0x51f0
jmp 0x3d868
leaq 0x2b8(%rsp), %rdi
movl $0x5, %esi
callq 0x88f0
movq %rax, %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x51f0
jmp 0x3d88c
leaq 0x1e8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0x603c0
jmp 0x3d8ab
leaq 0x250(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
movq %rsi, 0x28(%rsp)
callq 0x5550
movq 0x28(%rsp), %rdi
callq 0x58b8
leaq 0x1a8(%rsp), %rdi
callq 0x58b8
leaq 0x1c8(%rsp), %rdi
callq 0x58b8
xorl %eax, %eax
movl %eax, %esi
leaq 0x2b8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
leaq 0x2d75e(%rip), %rdx     # 0x6b062
leaq 0x168(%rsp), %rdi
callq 0xfae0
jmp 0x3d913
leaq 0x2b8(%rsp), %rdi
movl $0x6, %esi
callq 0x88f0
movq %rax, %rdx
leaq 0x188(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0xfbf0
jmp 0x3d93f
leaq 0x168(%rsp), %rdi
callq 0x58b8
movq 0x510(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x188(%rsp), %rsi
leaq 0x208(%rsp), %rdx
callq 0x3e170
jmp 0x3d978
movq 0x20(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x3e140
movq %rax, 0x18(%rsp)
jmp 0x3d991
movq 0x18(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x3e1e0
leaq 0x188(%rsp), %rdi
callq 0x58b8
leaq 0x208(%rsp), %rdi
callq 0x31c80
movl $0x0, 0x2f8(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0x8910
leaq 0x2d8(%rsp), %rdi
callq 0x58b8
movl 0x2f8(%rsp), %eax
testl %eax, %eax
je 0x3d9fc
jmp 0x3d9f7
jmp 0x3d5e6
jmp 0x3d5e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x3dac7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x3da51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x58b8
leaq 0x1c8(%rsp), %rdi
callq 0x58b8
jmp 0x3dac7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x58b8
jmp 0x3dac7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x3daba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x3e1e0
leaq 0x188(%rsp), %rdi
callq 0x58b8
leaq 0x208(%rsp), %rdi
callq 0x31c80
leaq 0x2b8(%rsp), %rdi
callq 0x8910
leaq 0x2d8(%rsp), %rdi
callq 0x58b8
jmp 0x3db97
leaq 0x308(%rsp), %rdi
callq 0x50d0
jmp 0x3db02
movq 0x474bf(%rip), %rdi     # 0x84fc8
leaq 0x29396(%rip), %rsi     # 0x66ea6
callq 0x5460
movq %rax, 0x10(%rsp)
jmp 0x3db1c
movq 0x510(%rsp), %rdi
callq 0x3e210
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x50f0
movq %rax, 0x8(%rsp)
jmp 0x3db3d
movq 0x8(%rsp), %rdi
leaq 0x2c48b(%rip), %rsi     # 0x69fd4
callq 0x5460
movq %rax, (%rsp)
jmp 0x3db54
movq (%rsp), %rdi
movq 0x47451(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x3db66
movb $0x1, 0x527(%rsp)
movl $0x1, 0x2f8(%rsp)
leaq 0x308(%rsp), %rdi
callq 0x5100
movb 0x527(%rsp), %al
andb $0x1, %al
addq $0x528, %rsp            # imm = 0x528
retq
leaq 0x308(%rsp), %rdi
callq 0x5100
movq 0x300(%rsp), %rdi
callq 0x57b0
nopw %cs:(%rax,%rax)