// File: schneebergerlab[P]DrLink/postprocess_bpPrediction.cpp
// Function: postprocess_bpPrediction(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>>)
bool postprocess_bpPrediction(multimap<string, multimap<unsigned long, BPINFO> > rawbpmap, string finalbpfile)
{
    multimap<string, multimap<unsigned long, BPINFO> > tmpmap = rawbpmap;
    // output final clusters
    fstream finfp;
    finfp.open(finalbpfile.c_str(), ios::out);
    if(!finfp.good())
    {
        cout << "   Error: cannot open file " << finalbpfile 
             << " for collecting final break point predictions. " << endl;
        return false;
    }    
    finfp << "#chr\t"
          << "left_pos\t"
          << "right_pos\t"
          << "score\t"
          << "left_alleles\t"
          << "right_alleles\t"
          << "barcode\t"
          << "molecule_len\t"
          << "left_span\t"
          << "right_span\t"
          << "Max_interval_size\t"
          << "Min_interval_size\t"
          << "support\n";
    int groupNum = 0;
    // this function overlaps predicted breakpoints
    multimap<string, multimap<unsigned long, BPINFO> >::iterator chritr;
    multimap<string, multimap<unsigned long, BPINFO> >::iterator chritr_end;
    chritr = rawbpmap.begin();
    chritr_end = rawbpmap.end();
    while(chritr != chritr_end)
    {
        multimap<unsigned long, BPINFO> tmp;
        tmp = (*chritr).second;
        multimap<unsigned long, BPINFO>::iterator litr;
        multimap<unsigned long, BPINFO>::iterator litr_end;
        litr = tmp.begin();
        litr_end = tmp.end();
        // get first break point of current chr
        vector<string>        targcluster;
        vector<string>        targchr;
        vector<unsigned long> targleftp;
        vector<unsigned long> targrightp;
        vector<unsigned long> targrightMax;
        vector<unsigned long> targrightMin;
        vector<unsigned long> targleftMax;
        vector<unsigned long> targleftMin;
        vector<double>        targscore;
        vector<string>        targorder;
        targchr.push_back(((*litr).second).chr);
        targcluster.push_back(((*litr).second).bpline);
        targleftp.push_back(((*litr).second).leftp);
        targrightp.push_back(((*litr).second).rightp);
        targscore.push_back(((*litr).second).score);
        targorder.push_back(((*litr).second).order);        
        targrightMax.push_back(((*litr).second).rightp);
        targrightMin.push_back(((*litr).second).rightp);
        targleftMax.push_back(((*litr).second).leftp);
        targleftMin.push_back(((*litr).second).leftp);
        // next break point
        litr ++;
        while(litr != litr_end)
        {
            // processing here
            unsigned long ileftp  = ((*litr).second).leftp;
            unsigned long irightp = ((*litr).second).rightp; 
            string        iorder  = ((*litr).second).order;     
            
            bool grouped = false;
            for(int vi = 0; vi < targcluster.size(); vi ++)
            {
                if(iorder.compare(targorder[vi])==0 && ileftp < targrightMin[vi])
                {
                    targcluster[vi] += "\n#"+ ( (*litr).second ).bpline;
                    // right max
                    if(irightp > targrightMax[vi])
                    {
                        targrightMax[vi] = irightp;
                    }
                    // right min
                    if(irightp < targrightMin[vi])
                    {
                        targrightMin[vi] = irightp;
                    }
                    // left max
                    if(ileftp > targleftMax[vi])
                    {
                        targleftMax[vi] = ileftp;
                    }  
                    // left min
                    if(ileftp < targleftMin[vi])
                    {
                        targleftMin[vi] = ileftp;
                    }     
                    // sum of score
                    targscore[vi] += ( (*litr).second ).score;                      
                    //
                    grouped = true;
                }
            }
            if(!grouped)
            {
                targchr.push_back(((*litr).second).chr);
                targcluster.push_back(((*litr).second).bpline);
                targleftp.push_back(((*litr).second).leftp);
                targrightp.push_back(((*litr).second).rightp);
                targscore.push_back(((*litr).second).score);
                targorder.push_back(((*litr).second).order);        
                targrightMax.push_back(((*litr).second).rightp);
                targrightMin.push_back(((*litr).second).rightp);
                targleftMax.push_back(((*litr).second).leftp);
                targleftMin.push_back(((*litr).second).leftp);
            }
            
            litr ++;
        }
        // output current chr
        for(int vi = 0; vi < targcluster.size(); vi ++)
        {
            int support = std::count(targcluster[vi].begin(), targcluster[vi].end(), '#') + 1;
            // using intersection (targleftMin, targrightMax) of overlapped predictions as final interval
            finfp << "#." << ++groupNum         << "\n" 
                  << targchr[vi]                << "\t" 
                  << targleftMax[vi]            << "\t" 
                  << targrightMin[vi]           << "\t" << fixed << std::setprecision(2) 
                  << targscore[vi]/support      << "\t"
                  << targorder[vi].substr(0, 1) << "\t" 
                  << targorder[vi].substr(1, 1) << "\tBC\tmLen\tLspan\tRspan\t"
                  << targrightMax[vi] - targleftMin[vi] << "\t"
                  << targrightMin[vi] - targleftMax[vi] << "\t"
                  << support                            << "\tInterSec" << endl;
            // details of predictions      
            finfp << "#" << targcluster[vi] << endl;
            // using union (targleftMax, targrightMin) of overlapped predictions as final interval (backup)
            finfp << "##" 
                  << targchr[vi]                << "\t" 
                  << targleftMin[vi]            << "\t" 
                  << targrightMax[vi]           << "\t" << fixed << std::setprecision(2)                   
                  << targscore[vi]/support      << "\t"
                  << targorder[vi].substr(0, 1) << "\t" 
                  << targorder[vi].substr(1, 1) << "\tBC\tmLen\tLspan\tRspan\t"
                  << targrightMax[vi] - targleftMin[vi] << "\t"
                  << targrightMin[vi] - targleftMax[vi] << "\t"
                  << support                            << "\tUnion\n#" << endl;
        }
        // clear current chr
        targcluster.clear();
        targleftp.clear();
        targrightp.clear();
        targorder.clear();
        targrightMax.clear();
        targrightMin.clear();
        targleftMax.clear();
        
        chritr ++;
    }
    finfp.close();  
    return true;
}

// Assembly:
subq $0x7b8, %rsp            # imm = 0x7B8
movq %rsi, %rax
movq %rdi, %rsi
movq %rsi, 0x2c0(%rsp)
movq %rax, 0x2c8(%rsp)
movq %rsi, 0x7a8(%rsp)
movq %rax, 0x7a0(%rsp)
leaq 0x770(%rsp), %rdi
callq 0x2dde0
leaq 0x560(%rsp), %rdi
callq 0x5530
jmp 0x62509
movq 0x2c8(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x560(%rsp), %rdi
movl $0x10, %edx
callq 0x53f0
jmp 0x6252d
movq 0x560(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x560(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x2bf(%rsp)
jmp 0x6254f
movb 0x2bf(%rsp), %al
testb $0x1, %al
jne 0x6261a
jmp 0x62560
movq 0x22a61(%rip), %rdi     # 0x84fc8
leaq 0x45e8(%rip), %rsi      # 0x66b56
callq 0x5460
movq %rax, 0x2b0(%rsp)
jmp 0x6257d
movq 0x2c8(%rsp), %rsi
movq 0x2b0(%rsp), %rdi
callq 0x53e0
movq %rax, 0x2a8(%rsp)
jmp 0x6259c
movq 0x2a8(%rsp), %rdi
leaq 0x8a1d(%rip), %rsi      # 0x6afc8
callq 0x5460
movq %rax, 0x2a0(%rsp)
jmp 0x625ba
movq 0x2a0(%rsp), %rdi
movq 0x229e7(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x625d0
movb $0x0, 0x7b7(%rsp)
movl $0x1, 0x550(%rsp)
jmp 0x63bd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63c0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63bfd
leaq 0x570(%rsp), %rdi
leaq 0x55ff(%rip), %rsi      # 0x67c28
callq 0x5460
movq %rax, 0x298(%rsp)
jmp 0x62638
movq 0x298(%rsp), %rdi
leaq 0x55e7(%rip), %rsi      # 0x67c2e
callq 0x5460
movq %rax, 0x290(%rsp)
jmp 0x62656
movq 0x290(%rsp), %rdi
leaq 0x55d3(%rip), %rsi      # 0x67c38
callq 0x5460
movq %rax, 0x288(%rsp)
jmp 0x62674
movq 0x288(%rsp), %rdi
leaq 0x55c0(%rip), %rsi      # 0x67c43
callq 0x5460
movq %rax, 0x280(%rsp)
jmp 0x62692
movq 0x280(%rsp), %rdi
leaq 0x55a9(%rip), %rsi      # 0x67c4a
callq 0x5460
movq %rax, 0x278(%rsp)
jmp 0x626b0
movq 0x278(%rsp), %rdi
leaq 0x5599(%rip), %rsi      # 0x67c58
callq 0x5460
movq %rax, 0x270(%rsp)
jmp 0x626ce
movq 0x270(%rsp), %rdi
leaq 0x558a(%rip), %rsi      # 0x67c67
callq 0x5460
movq %rax, 0x268(%rsp)
jmp 0x626ec
movq 0x268(%rsp), %rdi
leaq 0x88fd(%rip), %rsi      # 0x6aff8
callq 0x5460
movq %rax, 0x260(%rsp)
jmp 0x6270a
movq 0x260(%rsp), %rdi
leaq 0x5565(%rip), %rsi      # 0x67c7e
callq 0x5460
movq %rax, 0x258(%rsp)
jmp 0x62728
movq 0x258(%rsp), %rdi
leaq 0x5552(%rip), %rsi      # 0x67c89
callq 0x5460
movq %rax, 0x250(%rsp)
jmp 0x62746
movq 0x250(%rsp), %rdi
leaq 0x88b1(%rip), %rsi      # 0x6b006
callq 0x5460
movq %rax, 0x248(%rsp)
jmp 0x62764
movq 0x248(%rsp), %rdi
leaq 0x88a6(%rip), %rsi      # 0x6b019
callq 0x5460
movq %rax, 0x240(%rsp)
jmp 0x62782
movq 0x240(%rsp), %rdi
leaq 0x889b(%rip), %rsi      # 0x6b02c
callq 0x5460
jmp 0x62798
movl $0x0, 0x54c(%rsp)
leaq 0x540(%rsp), %rdi
callq 0x615e0
leaq 0x538(%rsp), %rdi
callq 0x615e0
movq 0x2c0(%rsp), %rdi
callq 0x63c30
movq 0x2c0(%rsp), %rdi
movq %rax, 0x530(%rsp)
movq 0x530(%rsp), %rax
movq %rax, 0x540(%rsp)
callq 0x61650
movq %rax, 0x528(%rsp)
movq 0x528(%rsp), %rax
movq %rax, 0x538(%rsp)
leaq 0x540(%rsp), %rdi
leaq 0x538(%rsp), %rsi
callq 0x63c60
testb $0x1, %al
jne 0x62825
jmp 0x63bb0
leaq 0x4f8(%rsp), %rdi
movq %rdi, 0x238(%rsp)
callq 0x61680
leaq 0x540(%rsp), %rdi
callq 0x617f0
movq 0x238(%rsp), %rdi
movq %rax, %rsi
addq $0x20, %rsi
callq 0x63c80
jmp 0x6285d
leaq 0x4f0(%rsp), %rdi
movq %rdi, 0x228(%rsp)
callq 0x63cb0
leaq 0x4e8(%rsp), %rdi
callq 0x63cb0
leaq 0x4f8(%rsp), %rdi
movq %rdi, 0x220(%rsp)
callq 0x63cd0
movq 0x220(%rsp), %rdi
movq %rax, 0x4e0(%rsp)
movq 0x4e0(%rsp), %rax
movq %rax, 0x4f0(%rsp)
callq 0x63d00
movq %rax, 0x4d8(%rsp)
movq 0x4d8(%rsp), %rax
movq %rax, 0x4e8(%rsp)
leaq 0x4c0(%rsp), %rdi
callq 0x2e460
leaq 0x4a8(%rsp), %rdi
movq %rdi, 0x230(%rsp)
callq 0x2e460
leaq 0x490(%rsp), %rdi
callq 0x2e080
leaq 0x478(%rsp), %rdi
callq 0x2e080
leaq 0x460(%rsp), %rdi
callq 0x2e080
leaq 0x448(%rsp), %rdi
callq 0x2e080
leaq 0x430(%rsp), %rdi
callq 0x2e080
leaq 0x418(%rsp), %rdi
callq 0x2e080
leaq 0x400(%rsp), %rdi
callq 0x455d0
leaq 0x3e8(%rsp), %rdi
callq 0x2e460
movq 0x228(%rsp), %rdi
callq 0x63d30
movq 0x230(%rsp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x609a0
jmp 0x6297e
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x70, %rsi
leaq 0x4c0(%rsp), %rdi
callq 0x609a0
jmp 0x629a1
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x490(%rsp), %rdi
callq 0x2e100
jmp 0x629c4
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x478(%rsp), %rdi
callq 0x2e100
jmp 0x629e7
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x48, %rsi
leaq 0x400(%rsp), %rdi
callq 0x455e0
jmp 0x62a0a
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x609a0
jmp 0x62a2d
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e100
jmp 0x62a50
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e100
jmp 0x62a73
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e100
jmp 0x62a96
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e100
jmp 0x62ab9
leaq 0x4f0(%rsp), %rdi
xorl %esi, %esi
callq 0x63d50
movq %rax, 0x3e0(%rsp)
leaq 0x4f0(%rsp), %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x63d90
testb $0x1, %al
jne 0x62aee
jmp 0x63079
leaq 0x4f0(%rsp), %rdi
movq %rdi, 0x218(%rsp)
callq 0x63d30
movq 0x218(%rsp), %rdi
movq 0x28(%rax), %rax
movq %rax, 0x3d8(%rsp)
callq 0x63d30
movq 0x218(%rsp), %rdi
movq 0x30(%rax), %rax
movq %rax, 0x3d0(%rsp)
callq 0x63d30
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x3b0(%rsp), %rdi
callq 0x51f0
jmp 0x62b4b
movb $0x0, 0x3af(%rsp)
movl $0x0, 0x3a8(%rsp)
movslq 0x3a8(%rsp), %rax
movq %rax, 0x210(%rsp)
leaq 0x4c0(%rsp), %rdi
callq 0xfbb0
movq %rax, %rcx
movq 0x210(%rsp), %rax
cmpq %rcx, %rax
jae 0x62ed0
movslq 0x3a8(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
leaq 0x3b0(%rsp), %rdi
callq 0x5040
movl %eax, 0x20c(%rsp)
jmp 0x62bbd
movl 0x20c(%rsp), %eax
cmpl $0x0, %eax
jne 0x62eb8
movq 0x3d8(%rsp), %rax
movq %rax, 0x200(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq %rax, %rcx
movq 0x200(%rsp), %rax
cmpq (%rcx), %rax
jae 0x62eb8
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rdx
addq $0x70, %rdx
leaq 0x8440(%rip), %rsi      # 0x6b061
leaq 0x388(%rsp), %rdi
callq 0x63db0
jmp 0x62c30
movslq 0x3a8(%rsp), %rsi
leaq 0x4c0(%rsp), %rdi
callq 0x88f0
movq %rax, %rdi
leaq 0x388(%rsp), %rsi
callq 0x5590
jmp 0x62c57
leaq 0x388(%rsp), %rdi
callq 0x58b8
movq 0x3d0(%rsp), %rax
movq %rax, 0x1f8(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e190
movq %rax, %rcx
movq 0x1f8(%rsp), %rax
cmpq (%rcx), %rax
jbe 0x62d40
movq 0x3d0(%rsp), %rax
movq %rax, 0x1f0(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e190
movq 0x1f0(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x62d40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63ba1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63b1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63067
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
leaq 0x388(%rsp), %rdi
callq 0x58b8
jmp 0x63067
movq 0x3d0(%rsp), %rax
movq %rax, 0x1e8(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq %rax, %rcx
movq 0x1e8(%rsp), %rax
cmpq (%rcx), %rax
jae 0x62da5
movq 0x3d0(%rsp), %rax
movq %rax, 0x1e0(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq 0x1e0(%rsp), %rcx
movq %rcx, (%rax)
movq 0x3d8(%rsp), %rax
movq %rax, 0x1d8(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e190
movq %rax, %rcx
movq 0x1d8(%rsp), %rax
cmpq (%rcx), %rax
jbe 0x62e0a
movq 0x3d8(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e190
movq 0x1d0(%rsp), %rcx
movq %rcx, (%rax)
movq 0x3d8(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e190
movq %rax, %rcx
movq 0x1c8(%rsp), %rax
cmpq (%rcx), %rax
jae 0x62e6f
movq 0x3d8(%rsp), %rax
movq %rax, 0x1c0(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e190
movq 0x1c0(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movsd 0x48(%rax), %xmm0
movsd %xmm0, 0x1b8(%rsp)
movslq 0x3a8(%rsp), %rsi
leaq 0x400(%rsp), %rdi
callq 0x45740
movsd 0x1b8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movb $0x1, 0x3af(%rsp)
jmp 0x62eba
movl 0x3a8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3a8(%rsp)
jmp 0x62b5e
testb $0x1, 0x3af(%rsp)
jne 0x6303e
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x8, %rsi
leaq 0x4a8(%rsp), %rdi
callq 0x609a0
jmp 0x62f01
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x70, %rsi
leaq 0x4c0(%rsp), %rdi
callq 0x609a0
jmp 0x62f24
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x490(%rsp), %rdi
callq 0x2e100
jmp 0x62f47
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x478(%rsp), %rdi
callq 0x2e100
jmp 0x62f6a
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x48, %rsi
leaq 0x400(%rsp), %rdi
callq 0x455e0
jmp 0x62f8d
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x50, %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x609a0
jmp 0x62fb0
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e100
jmp 0x62fd3
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x30, %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e100
jmp 0x62ff6
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e100
jmp 0x63019
leaq 0x4f0(%rsp), %rdi
callq 0x63d30
movq %rax, %rsi
addq $0x28, %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e100
jmp 0x6303c
jmp 0x6303e
leaq 0x4f0(%rsp), %rdi
xorl %esi, %esi
callq 0x63d50
movq %rax, 0x380(%rsp)
leaq 0x3b0(%rsp), %rdi
callq 0x58b8
jmp 0x62ad0
leaq 0x3b0(%rsp), %rdi
callq 0x58b8
jmp 0x63b1f
movl $0x0, 0x37c(%rsp)
movslq 0x37c(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x4c0(%rsp), %rdi
callq 0xfbb0
movq %rax, %rcx
movq 0x1b0(%rsp), %rax
cmpq %rcx, %rax
jae 0x63a19
movslq 0x37c(%rsp), %rsi
leaq 0x4c0(%rsp), %rdi
movq %rdi, 0x1a0(%rsp)
callq 0x88f0
movq %rax, %rdi
callq 0x53c0
movq 0x1a0(%rsp), %rdi
movq %rax, 0x370(%rsp)
movslq 0x37c(%rsp), %rsi
callq 0x88f0
movq %rax, %rdi
callq 0x5280
movq %rax, 0x368(%rsp)
movb $0x23, 0x367(%rsp)
movq 0x370(%rsp), %rdi
movq 0x368(%rsp), %rsi
leaq 0x367(%rsp), %rdx
callq 0x2db90
movq %rax, 0x1a8(%rsp)
jmp 0x63136
movq 0x1a8(%rsp), %rax
incl %eax
movl %eax, 0x378(%rsp)
leaq 0x570(%rsp), %rdi
leaq 0x7edf(%rip), %rsi      # 0x6b035
callq 0x5460
movq %rax, 0x198(%rsp)
jmp 0x63165
movq 0x198(%rsp), %rdi
movl 0x54c(%rsp), %esi
incl %esi
movl %esi, 0x54c(%rsp)
callq 0x5790
movq %rax, 0x190(%rsp)
jmp 0x6318c
movq 0x190(%rsp), %rdi
leaq 0x6d97(%rip), %rsi      # 0x69f32
callq 0x5460
movq %rax, 0x188(%rsp)
jmp 0x631aa
movslq 0x37c(%rsp), %rsi
leaq 0x4a8(%rsp), %rdi
callq 0x88f0
movq 0x188(%rsp), %rdi
movq %rax, %rsi
callq 0x53e0
movq %rax, 0x180(%rsp)
jmp 0x631d9
movq 0x180(%rsp), %rdi
leaq 0x79ab(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x178(%rsp)
jmp 0x631f7
movslq 0x37c(%rsp), %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e190
movq 0x178(%rsp), %rdi
movq (%rax), %rsi
callq 0x50f0
movq %rax, 0x170(%rsp)
jmp 0x63226
movq 0x170(%rsp), %rdi
leaq 0x795e(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x168(%rsp)
jmp 0x63244
movslq 0x37c(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq 0x168(%rsp), %rdi
movq (%rax), %rsi
callq 0x50f0
movq %rax, 0x160(%rsp)
jmp 0x63273
movq 0x160(%rsp), %rdi
leaq 0x7911(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x158(%rsp)
jmp 0x63291
movq 0x158(%rsp), %rdi
leaq -0x531b0(%rip), %rsi    # 0x100f0
callq 0x5180
movq %rax, 0x150(%rsp)
jmp 0x632af
movl $0x2, %edi
callq 0x100d0
movl %eax, 0x14c(%rsp)
jmp 0x632c2
movq 0x150(%rsp), %rdi
movl 0x14c(%rsp), %eax
movl %eax, 0x360(%rsp)
movl 0x360(%rsp), %esi
callq 0x56d0
movq %rax, 0x140(%rsp)
jmp 0x632ee
movslq 0x37c(%rsp), %rsi
leaq 0x400(%rsp), %rdi
callq 0x45740
movq 0x140(%rsp), %rdi
movsd (%rax), %xmm0
cvtsi2sdl 0x378(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x5830
movq %rax, 0x138(%rsp)
jmp 0x6332b
movq 0x138(%rsp), %rdi
leaq 0x7859(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x130(%rsp)
jmp 0x63349
movslq 0x37c(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0x340(%rsp), %rdi
movl $0x1, %ecx
callq 0x5490
jmp 0x63379
movq 0x130(%rsp), %rdi
leaq 0x340(%rsp), %rsi
callq 0x53e0
movq %rax, 0x128(%rsp)
jmp 0x63398
movq 0x128(%rsp), %rdi
leaq 0x77ec(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x120(%rsp)
jmp 0x633b6
movslq 0x37c(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
leaq 0x320(%rsp), %rdi
movl $0x1, %ecx
movq %rcx, %rdx
callq 0x5490
jmp 0x633e5
movq 0x120(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x53e0
movq %rax, 0x118(%rsp)
jmp 0x63404
movq 0x118(%rsp), %rdi
leaq 0x7c25(%rip), %rsi      # 0x6b038
callq 0x5460
movq %rax, 0x110(%rsp)
jmp 0x63422
movslq 0x37c(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e190
movq (%rax), %rax
movq %rax, 0x100(%rsp)
movslq 0x37c(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e190
movq 0x100(%rsp), %rsi
movq 0x110(%rsp), %rdi
movq (%rax), %rax
subq %rax, %rsi
callq 0x50f0
movq %rax, 0x108(%rsp)
jmp 0x6347c
movq 0x108(%rsp), %rdi
leaq 0x7708(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0xf8(%rsp)
jmp 0x6349a
movslq 0x37c(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq (%rax), %rax
movq %rax, 0xe8(%rsp)
movslq 0x37c(%rsp), %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e190
movq 0xe8(%rsp), %rsi
movq 0xf8(%rsp), %rdi
movq (%rax), %rax
subq %rax, %rsi
callq 0x50f0
movq %rax, 0xf0(%rsp)
jmp 0x634f4
movq 0xf0(%rsp), %rdi
leaq 0x7690(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0xe0(%rsp)
jmp 0x63512
movq 0xe0(%rsp), %rdi
movl 0x378(%rsp), %esi
callq 0x5790
movq %rax, 0xd8(%rsp)
jmp 0x63530
movq 0xd8(%rsp), %rdi
leaq 0x7b0f(%rip), %rsi      # 0x6b04e
callq 0x5460
movq %rax, 0xd0(%rsp)
jmp 0x6354e
movq 0xd0(%rsp), %rdi
movq 0x21a53(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x63564
leaq 0x320(%rsp), %rdi
callq 0x58b8
leaq 0x340(%rsp), %rdi
callq 0x58b8
leaq 0x570(%rsp), %rdi
leaq 0x7ad5(%rip), %rsi      # 0x6b062
callq 0x5460
movq %rax, 0xc8(%rsp)
jmp 0x6359c
movslq 0x37c(%rsp), %rsi
leaq 0x4c0(%rsp), %rdi
callq 0x88f0
movq 0xc8(%rsp), %rdi
movq %rax, %rsi
callq 0x53e0
movq %rax, 0xc0(%rsp)
jmp 0x635cb
movq 0xc0(%rsp), %rdi
movq 0x219d6(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x635e1
leaq 0x570(%rsp), %rdi
leaq 0x7a68(%rip), %rsi      # 0x6b058
callq 0x5460
movq %rax, 0xb8(%rsp)
jmp 0x635ff
movslq 0x37c(%rsp), %rsi
leaq 0x4a8(%rsp), %rdi
callq 0x88f0
movq 0xb8(%rsp), %rdi
movq %rax, %rsi
callq 0x53e0
movq %rax, 0xb0(%rsp)
jmp 0x6362e
movq 0xb0(%rsp), %rdi
leaq 0x7556(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0xa8(%rsp)
jmp 0x6364c
movslq 0x37c(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e190
movq 0xa8(%rsp), %rdi
movq (%rax), %rsi
callq 0x50f0
movq %rax, 0xa0(%rsp)
jmp 0x6367b
movq 0xa0(%rsp), %rdi
leaq 0x7509(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x98(%rsp)
jmp 0x63699
movslq 0x37c(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e190
movq 0x98(%rsp), %rdi
movq (%rax), %rsi
callq 0x50f0
movq %rax, 0x90(%rsp)
jmp 0x636c8
movq 0x90(%rsp), %rdi
leaq 0x74bc(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x88(%rsp)
jmp 0x636e6
movq 0x88(%rsp), %rdi
leaq -0x53605(%rip), %rsi    # 0x100f0
callq 0x5180
movq %rax, 0x80(%rsp)
jmp 0x63704
movl $0x2, %edi
callq 0x100d0
movl %eax, 0x7c(%rsp)
jmp 0x63714
movq 0x80(%rsp), %rdi
movl 0x7c(%rsp), %eax
movl %eax, 0x31c(%rsp)
movl 0x31c(%rsp), %esi
callq 0x56d0
movq %rax, 0x70(%rsp)
jmp 0x6373a
movslq 0x37c(%rsp), %rsi
leaq 0x400(%rsp), %rdi
callq 0x45740
movq 0x70(%rsp), %rdi
movsd (%rax), %xmm0
cvtsi2sdl 0x378(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x5830
movq %rax, 0x68(%rsp)
jmp 0x63771
movq 0x68(%rsp), %rdi
leaq 0x7416(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x60(%rsp)
jmp 0x63789
movslq 0x37c(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0x2f8(%rsp), %rdi
movl $0x1, %ecx
callq 0x5490
jmp 0x637b9
movq 0x60(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x53e0
movq %rax, 0x58(%rsp)
jmp 0x637d2
movq 0x58(%rsp), %rdi
leaq 0x73b5(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x50(%rsp)
jmp 0x637ea
movslq 0x37c(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x88f0
movq %rax, %rsi
leaq 0x2d8(%rsp), %rdi
movl $0x1, %ecx
movq %rcx, %rdx
callq 0x5490
jmp 0x63819
movq 0x50(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x53e0
movq %rax, 0x48(%rsp)
jmp 0x63832
movq 0x48(%rsp), %rdi
leaq 0x77fa(%rip), %rsi      # 0x6b038
callq 0x5460
movq %rax, 0x40(%rsp)
jmp 0x6384a
movslq 0x37c(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2e190
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movslq 0x37c(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x2e190
movq 0x30(%rsp), %rsi
movq 0x40(%rsp), %rdi
movq (%rax), %rax
subq %rax, %rsi
callq 0x50f0
movq %rax, 0x38(%rsp)
jmp 0x63898
movq 0x38(%rsp), %rdi
leaq 0x72ef(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x28(%rsp)
jmp 0x638b0
movslq 0x37c(%rsp), %rsi
leaq 0x448(%rsp), %rdi
callq 0x2e190
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movslq 0x37c(%rsp), %rsi
leaq 0x430(%rsp), %rdi
callq 0x2e190
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %rdi
movq (%rax), %rax
subq %rax, %rsi
callq 0x50f0
movq %rax, 0x20(%rsp)
jmp 0x638fe
movq 0x20(%rsp), %rdi
leaq 0x7289(%rip), %rsi      # 0x6ab93
callq 0x5460
movq %rax, 0x10(%rsp)
jmp 0x63916
movq 0x10(%rsp), %rdi
movl 0x378(%rsp), %esi
callq 0x5790
movq %rax, 0x8(%rsp)
jmp 0x6392e
movq 0x8(%rsp), %rdi
leaq 0x7721(%rip), %rsi      # 0x6b05b
callq 0x5460
movq %rax, (%rsp)
jmp 0x63945
movq (%rsp), %rdi
movq 0x21660(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x63957
leaq 0x2d8(%rsp), %rdi
callq 0x58b8
leaq 0x2f8(%rsp), %rdi
callq 0x58b8
movl 0x37c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x37c(%rsp)
jmp 0x63084
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x639be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
leaq 0x320(%rsp), %rdi
callq 0x58b8
leaq 0x340(%rsp), %rdi
callq 0x58b8
jmp 0x63b1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
jmp 0x63a07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x558(%rsp)
movl %eax, 0x554(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x58b8
leaq 0x2f8(%rsp), %rdi
callq 0x58b8
jmp 0x63b1f
leaq 0x4c0(%rsp), %rdi
callq 0x2e310
leaq 0x490(%rsp), %rdi
callq 0x63ee0
leaq 0x478(%rsp), %rdi
callq 0x63ee0
leaq 0x3e8(%rsp), %rdi
callq 0x2e310
leaq 0x460(%rsp), %rdi
callq 0x63ee0
leaq 0x448(%rsp), %rdi
callq 0x63ee0
leaq 0x430(%rsp), %rdi
callq 0x63ee0
leaq 0x540(%rsp), %rdi
xorl %esi, %esi
callq 0x63f00
movq %rax, 0x2d0(%rsp)
leaq 0x3e8(%rsp), %rdi
callq 0x8910
leaq 0x400(%rsp), %rdi
callq 0x45760
leaq 0x418(%rsp), %rdi
callq 0x2e1d0
leaq 0x430(%rsp), %rdi
callq 0x2e1d0
leaq 0x448(%rsp), %rdi
callq 0x2e1d0
leaq 0x460(%rsp), %rdi
callq 0x2e1d0
leaq 0x478(%rsp), %rdi
callq 0x2e1d0
leaq 0x490(%rsp), %rdi
callq 0x2e1d0
leaq 0x4a8(%rsp), %rdi
callq 0x8910
leaq 0x4c0(%rsp), %rdi
callq 0x8910
leaq 0x4f8(%rsp), %rdi
callq 0x31e50
jmp 0x62807
leaq 0x3e8(%rsp), %rdi
callq 0x8910
leaq 0x400(%rsp), %rdi
callq 0x45760
leaq 0x418(%rsp), %rdi
callq 0x2e1d0
leaq 0x430(%rsp), %rdi
callq 0x2e1d0
leaq 0x448(%rsp), %rdi
callq 0x2e1d0
leaq 0x460(%rsp), %rdi
callq 0x2e1d0
leaq 0x478(%rsp), %rdi
callq 0x2e1d0
leaq 0x490(%rsp), %rdi
callq 0x2e1d0
leaq 0x4a8(%rsp), %rdi
callq 0x8910
leaq 0x4c0(%rsp), %rdi
callq 0x8910
leaq 0x4f8(%rsp), %rdi
callq 0x31e50
jmp 0x63bfd
leaq 0x560(%rsp), %rdi
callq 0x5080
jmp 0x63bbf
movb $0x1, 0x7b7(%rsp)
movl $0x1, 0x550(%rsp)
leaq 0x560(%rsp), %rdi
callq 0x50e0
leaq 0x770(%rsp), %rdi
callq 0x2de10
movb 0x7b7(%rsp), %al
andb $0x1, %al
addq $0x7b8, %rsp            # imm = 0x7B8
retq
leaq 0x560(%rsp), %rdi
callq 0x50e0
leaq 0x770(%rsp), %rdi
callq 0x2de10
movq 0x558(%rsp), %rdi
callq 0x57b0
nopw %cs:(%rax,%rax)
nop