// File: /workspace/github_cpp_makefile_star2_O2/schneebergerlab[P]DrLink/insert_raw_bp.cpp
// Function: insert_raw_bp(std::multimap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::multimap<unsigned long, BPINFO, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, 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, std::multimap<unsigned long, BPINFO, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, BPINFO>>>>>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long, unsigned long, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool insert_raw_bp(multimap<string, multimap<unsigned long, BPINFO> >* rawbpmap,
                   string        chr,
                   unsigned long leftp,
                   unsigned long rightp,
                   double        score,
                   string        order,
                   string        bpline)
{
    /*  
      struct BPINFO
      {
          string         chr;
          unsigned long  leftp;
          unsigned long  rightp;
          unsigned long  leftMax;
          unsigned long  rightMin;
          double         score;
          string         order; // allele transition order, either "12" or "21"
          string         bpline;// raw bp info line
          string         ovline;// bp info line overlapping with the above, the smaller interval used as a representative
      };    
    */
    BPINFO tmpbp;
    tmpbp.chr      = chr;
    tmpbp.leftp    = leftp;
    tmpbp.rightp   = rightp;
    tmpbp.leftMax  = 0;
    tmpbp.rightMin = 0;
    tmpbp.bpline   = bpline;
    tmpbp.ovline   = "";
    tmpbp.score    = score;
    tmpbp.order    = order;
    //
    multimap<string, multimap<unsigned long, BPINFO> >::iterator chritr;
    chritr = (*rawbpmap).find(chr);
    if(chritr == (*rawbpmap).end())
    {
        // initialize map with new item of chr
        multimap<unsigned long, BPINFO> tmp;
        tmp.insert(std::pair<unsigned long, BPINFO>(leftp, tmpbp));
        //
        (*rawbpmap).insert(std::pair<string, multimap<unsigned long, BPINFO> >(chr, tmp));   
    } 
    else
    {
        // update map of chr
        ((*chritr).second).insert(std::pair<unsigned long, BPINFO>(leftp, tmpbp));
    }
    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %r9, %r13
movq %r8, %r12
movsd %xmm0, 0x8(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rcx, %rbp
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdx, %r15
movq %rsi, %r14
movb %cl, (%rax)
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %rbx
movb %cl, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x40(%rsp), %rdi
callq 0x41e0
leaq 0xa8(%rsp), %rdi
movq %r15, -0x48(%rdi)
movq %rbp, -0x40(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%rdi)
movq %r13, %rsi
callq 0x41e0
leaq 0xc8(%rsp), %rdi
leaq 0x766e(%rip), %rsi      # 0x2db1a
callq 0x45e0
leaq 0x88(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
movsd %xmm0, -0x8(%rdi)
movq %r12, %rsi
callq 0x41e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x26668
movq %rax, %r12
leaq 0x8(%rbx), %rax
cmpq %rax, %r12
je 0x2651d
leaq 0xf0(%rsp), %r14
movq %r15, -0x8(%r14)
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x16512
addq $0x40, %r12
leaq 0xe8(%rsp), %rsi
movq %r12, %rdi
callq 0x266de
movq %r14, %rdi
callq 0x165c8
jmp 0x265a7
leaq 0x18(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0xf0(%rsp), %r12
movq %r15, -0x8(%r12)
leaq 0x40(%rsp), %rsi
movq %r12, %rdi
callq 0x16512
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x266de
movq %r12, %rdi
callq 0x165c8
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x2661c
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x267f2
leaq 0xe8(%rsp), %rdi
callq 0x26652
leaq 0x10(%rsp), %rdi
callq 0x16624
leaq 0x40(%rsp), %rdi
callq 0x165c8
movb $0x1, %al
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x26652
jmp 0x265e9
jmp 0x265e6
movq %rax, %rbx
movq %r12, %rdi
callq 0x165c8
jmp 0x265e9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x16624
jmp 0x26609
movq %rax, %rbx
movq %r14, %rdi
callq 0x165c8
jmp 0x26609
jmp 0x26606
jmp 0x26606
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x165c8
movq %rbx, %rdi
callq 0x45a0
nop