// File: schneebergerlab[P]GameteBinning/asPollinator_1.0.cpp
// Function: order_linked_contigs(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, BIPAT, 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, BIPAT>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool order_linked_contigs(map<string, BIPAT> contigPollenGTSeq, string tmpfolder)
{
    /*  contigPollenGTSeq:
	   PMPPMPPPMMPPPPM tig00000013_pilon left  sequence
	   PPPPMPPPMMPPPPM tig00000013_pilon right sequence
	   //
   	   PPPMMPPMPMPPUMM tig00000026_pilon ...
   	   PPPMMPPMPMPMUMM tig00000026_pilon ...  	  
   	   // 
	......
    */
    map<string, int> collected_edge; // if a->b edge exists, then ignore b->a edge
    // prepare dot output file
    string dotinfo = tmpfolder + "/s3_genotype_contig_GT_ordered_LGlike.dot\0"; // 
    ofstream dotofp;
    dotofp.open(dotinfo.c_str(), ios::out);
    if(!dotofp.good())
    {
        cout   << "   Error: cannot open file " << dotinfo << endl;
        return false;
    } 
    dotofp << "/* this graph is translated from similarity of genotype sequences of contigs */" << endl;
    dotofp << "digraph\tGraph_1 {" << endl;
    //
    map<string, BIPAT>::iterator ctgitr;
    map<string, BIPAT>::iterator ctgitr_end;
    ctgitr     = contigPollenGTSeq.begin();
    ctgitr_end = contigPollenGTSeq.end();
    while(ctgitr != ctgitr_end)
    {
        string this_contig_ID = (*ctgitr).first;
        string this_contig_GT = (*ctgitr).second.rightPat; // out vertex
        //
        CTGLG contigBestLods;
        contigBestLods.lod[0] = -1000; // best
        contigBestLods.lod[1] = -1000; // second-best
        contigBestLods.edge1  = "";
        contigBestLods.edge2  = "";
        // second level traverse of contigPollenGTSeq;
        map<string, BIPAT>::iterator ctgitr2;
        map<string, BIPAT>::iterator ctgitr2_end;
        ctgitr2     = contigPollenGTSeq.begin();
        ctgitr2_end = contigPollenGTSeq.end();
        while(ctgitr2 != ctgitr2_end)
        {
            string tmp2_contig_ID = (*ctgitr2).first;
            string tmp2_contig_GT = (*ctgitr2).second.leftPat; // in vertex
            int effectiveMkrNum   = 0;
            effectiveMkrNum      += std::count(tmp2_contig_GT.begin(), tmp2_contig_GT.end(), 'P');
            effectiveMkrNum      += std::count(tmp2_contig_GT.begin(), tmp2_contig_GT.end(), 'M');            
            // IF NEXT CONTIG DOES NOT HAVE ENOUGH PATERNAL/MATERNAL INFORMATION, SKIP IT 
            if(effectiveMkrNum < tmp2_contig_GT.size()/3)
            {
                 ctgitr2 ++;
                 continue;                 
            }
            //
            if(tmp2_contig_ID.compare(this_contig_ID) != 0)
            {
                // reversed edge not in collected list
                string edge1 = this_contig_ID + "->" + tmp2_contig_ID;
                string edge2 = this_contig_ID + "->" + tmp2_contig_ID + "_rev";
                if(collected_edge.find(edge1) == collected_edge.end() &&
                   collected_edge.find(edge2) == collected_edge.end() )
                {
                    /*
                    // original
                    int score1 = 0;
                    if(!get_match_score(this_contig_GT,        tmp2_contig_GT,       &score1) ) return false;
                    // reversed
                    string tmp2_contig_GT_reversed = "";
                    if(!reverse_contig_GT(tmp2_contig_GT, &tmp2_contig_GT_reversed) )           return false;
                    int score2 = 0;
                    if(!get_match_score(this_contig_GT,    tmp2_contig_GT_reversed,  &score2) ) return false;
                    // output as dot
                    if(score1 >= score2)
                    {
                        if(score1 >= this_contig_GT.size()*0.90 )
                        {
                            // select original: 	100052 -> 358538 [color=aquamarine, penwidth=1, arrowsize=1, label=45];
                            dotofp << "\t"   << this_contig_ID 
                                   << " -> " << tmp2_contig_ID
                                   << " "    << "[color=black, penwidth=1, arrowsize=1, label=" << score1 << "];"    
                                   << endl;
                            // collect edge
                            collected_edge.insert(std::pair<string, int>(this_contig_ID + "->" + tmp2_contig_ID, 1));       
                        }                    
                    }else
                    {
                        if(score2 >= this_contig_GT.size()*0.90 )
                        {                
                            // select reversed    
                            dotofp << "\t"   << this_contig_ID 
                                   << " -> " << tmp2_contig_ID << "_rev"
                                   << " "    << "[color=red, penwidth=1, arrowsize=1, label=" << score2 << "];"
                                   << endl;  
                            // collect edge
                            collected_edge.insert(std::pair<string, int>(this_contig_ID + "->" + tmp2_contig_ID + "_rev", 1));                                                               
                        }
                    }
                    */
                    double this_lod = calculate_lod(this_contig_GT, tmp2_contig_GT);
                    /*
                    if(this_lod>=40)
                    {
                        // select original: 	100052 -> 358538 [color=aquamarine, penwidth=1, arrowsize=1, label=45];
                        dotofp << "\t"   << this_contig_ID 
                               << " -> " << tmp2_contig_ID
                               << " "    << "[color=red, penwidth=1, arrowsize=1, label=" << this_lod << "];"    
                               << endl;
                        // collect edge
                        collected_edge.insert(std::pair<string, int>(this_contig_ID + "->" + tmp2_contig_ID, 1));                               
                    }
                    */
                    if(this_lod > contigBestLods.lod[0]) // best
                    {
                        contigBestLods.lod[0] = this_lod;
                        std::stringstream sstmp;
                        sstmp.str("");
                        sstmp << "\t"   << this_contig_ID 
                              << " -> " << tmp2_contig_ID
                              << " "    << "[color=red, penwidth=1, arrowsize=1, label=" << this_lod << "];";
                        contigBestLods.edge1  = sstmp.str();
                        // collect edge
                        collected_edge.insert(std::pair<string, int>(this_contig_ID + "->" + tmp2_contig_ID, 1));                                                       
                    }else
                    if(this_lod > contigBestLods.lod[1]) // second-best
                    {
                        //// contigBestLods.lod[1] = this_lod;
                        //// std::stringstream sstmp;
                        //// sstmp.str("");
                        //// sstmp << "\t"   << this_contig_ID 
                        ////      << " -> " << tmp2_contig_ID
                        ////      << " "    << "[color=red, penwidth=1, arrowsize=1, label=" << this_lod << "];";
                        //// contigBestLods.edge2  = sstmp.str(); 
                        //// // collect edge                        
                        //// collected_edge.insert(std::pair<string, int>(this_contig_ID + "->" + tmp2_contig_ID, 1));
                    } else;
                }
            }        
            ctgitr2 ++;
        }
        //
        if(contigBestLods.lod[0] > 0) // best
        {
            dotofp << contigBestLods.edge1 << endl;
        }
        if(contigBestLods.lod[1] > 0) // second-best
        {
            //// dotofp << contigBestLods.edge2 << endl;         
        }
        //
        ctgitr ++;
    }
    // end of dot file
    dotofp << "}" << endl;
    dotofp.close();
    return true;
}

// Assembly:
subq $0x828, %rsp            # imm = 0x828
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xe8(%rsp)
movq %rdi, 0x818(%rsp)
movq %rsi, 0x810(%rsp)
leaq 0x7e0(%rsp), %rdi
callq 0x1a040
movq 0xe8(%rsp), %rsi
leaq 0x16b37(%rip), %rdx     # 0x2c5ca
leaq 0x7c0(%rsp), %rdi
callq 0x186d0
jmp 0x15aa2
leaq 0x5b0(%rsp), %rdi
callq 0x3530
jmp 0x15ab1
leaq 0x7c0(%rsp), %rdi
callq 0x3150
movq %rax, %rsi
leaq 0x5b0(%rsp), %rdi
movl $0x10, %edx
callq 0x3070
jmp 0x15ad5
movq 0x5b0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x5b0(%rsp,%rax), %rdi
callq 0x3520
movb %al, 0xdf(%rsp)
jmp 0x15af7
movb 0xdf(%rsp), %al
testb $0x1, %al
jne 0x15bbd
jmp 0x15b08
movq 0x234c9(%rip), %rdi     # 0x38fd8
leaq 0x159a2(%rip), %rsi     # 0x2b4b8
callq 0x3320
movq %rax, 0xd0(%rsp)
jmp 0x15b25
movq 0xd0(%rsp), %rdi
leaq 0x7c0(%rsp), %rsi
callq 0x32e0
movq %rax, 0xc8(%rsp)
jmp 0x15b44
movq 0xc8(%rsp), %rdi
movq 0x23475(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0x15b5a
movb $0x0, 0x827(%rsp)
movl $0x1, 0x5ac(%rsp)
jmp 0x167f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x16846
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x16839
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x1682c
leaq 0x1632b(%rip), %rsi     # 0x2beef
leaq 0x5b0(%rsp), %rdi
callq 0x3320
movq %rax, 0xc0(%rsp)
jmp 0x15bdb
movq 0xc0(%rsp), %rdi
movq 0x233de(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0x15bf1
leaq 0x16347(%rip), %rsi     # 0x2bf3f
leaq 0x5b0(%rsp), %rdi
callq 0x3320
movq %rax, 0xb8(%rsp)
jmp 0x15c0f
movq 0xb8(%rsp), %rdi
movq 0x233aa(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0x15c25
leaq 0x5a0(%rsp), %rdi
callq 0x1a6f0
leaq 0x598(%rsp), %rdi
callq 0x1a6f0
movq 0xe0(%rsp), %rdi
callq 0x1a710
movq 0xe0(%rsp), %rdi
movq %rax, 0x590(%rsp)
movq 0x590(%rsp), %rax
movq %rax, 0x5a0(%rsp)
callq 0x1a740
movq %rax, 0x588(%rsp)
movq 0x588(%rsp), %rax
movq %rax, 0x598(%rsp)
leaq 0x5a0(%rsp), %rdi
leaq 0x598(%rsp), %rsi
callq 0x1a770
testb $0x1, %al
jne 0x15ca7
jmp 0x167a6
leaq 0x5a0(%rsp), %rdi
callq 0x1a790
movq %rax, %rsi
leaq 0x568(%rsp), %rdi
callq 0x3160
jmp 0x15cc6
leaq 0x5a0(%rsp), %rdi
callq 0x1a790
movq %rax, %rsi
addq $0x40, %rsi
leaq 0x548(%rsp), %rdi
callq 0x3160
jmp 0x15ce9
leaq 0x4f8(%rsp), %rdi
callq 0x1a7b0
movabsq $-0x3f70c00000000000, %rax # imm = 0xC08F400000000000
movq %rax, 0x4f8(%rsp)
movq %rax, 0x500(%rsp)
leaq 0x508(%rsp), %rdi
leaq 0x16142(%rip), %rsi     # 0x2be61
callq 0x3440
jmp 0x15d26
leaq 0x528(%rsp), %rdi
leaq 0x1612c(%rip), %rsi     # 0x2be61
callq 0x3440
jmp 0x15d3c
leaq 0x4f0(%rsp), %rdi
callq 0x1a6f0
leaq 0x4e8(%rsp), %rdi
callq 0x1a6f0
movq 0xe0(%rsp), %rdi
callq 0x1a710
movq 0xe0(%rsp), %rdi
movq %rax, 0x4e0(%rsp)
movq 0x4e0(%rsp), %rax
movq %rax, 0x4f0(%rsp)
callq 0x1a740
movq %rax, 0x4d8(%rsp)
movq 0x4d8(%rsp), %rax
movq %rax, 0x4e8(%rsp)
leaq 0x4f0(%rsp), %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x1a770
testb $0x1, %al
jne 0x15dbe
jmp 0x166e0
leaq 0x4f0(%rsp), %rdi
callq 0x1a790
movq %rax, %rsi
leaq 0x4b8(%rsp), %rdi
callq 0x3160
jmp 0x15ddd
leaq 0x4f0(%rsp), %rdi
callq 0x1a790
movq %rax, %rsi
addq $0x20, %rsi
leaq 0x498(%rsp), %rdi
callq 0x3160
jmp 0x15e00
movl $0x0, 0x494(%rsp)
leaq 0x498(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x32c0
movq 0xa8(%rsp), %rdi
movq %rax, 0x488(%rsp)
callq 0x31c0
movq %rax, 0x480(%rsp)
movb $0x50, 0x47f(%rsp)
movq 0x488(%rsp), %rdi
movq 0x480(%rsp), %rsi
leaq 0x47f(%rsp), %rdx
callq 0x19520
movq %rax, 0xb0(%rsp)
jmp 0x15e6c
movq 0xb0(%rsp), %rcx
movl 0x494(%rsp), %eax
addl %ecx, %eax
movl %eax, 0x494(%rsp)
leaq 0x498(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x32c0
movq 0x98(%rsp), %rdi
movq %rax, 0x470(%rsp)
callq 0x31c0
movq %rax, 0x468(%rsp)
movb $0x4d, 0x467(%rsp)
movq 0x470(%rsp), %rdi
movq 0x468(%rsp), %rsi
leaq 0x467(%rsp), %rdx
callq 0x19520
movq %rax, 0xa0(%rsp)
jmp 0x15ee5
movq 0xa0(%rsp), %rcx
movslq 0x494(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x494(%rsp)
movslq 0x494(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x498(%rsp), %rdi
callq 0x3250
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x90(%rsp), %rax
cmpq %rcx, %rax
jae 0x15fc5
leaq 0x4f0(%rsp), %rdi
xorl %esi, %esi
callq 0x1a7e0
movq %rax, 0x458(%rsp)
movl $0x4, 0x5ac(%rsp)
jmp 0x16690
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x16794
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x1677a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x166ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x166c1
leaq 0x4b8(%rsp), %rdi
leaq 0x568(%rsp), %rsi
callq 0x3040
movl %eax, 0x8c(%rsp)
jmp 0x15fe3
movl 0x8c(%rsp), %eax
cmpl $0x0, %eax
je 0x1666e
leaq 0x15f57(%rip), %rdx     # 0x2bf51
leaq 0x418(%rsp), %rdi
leaq 0x568(%rsp), %rsi
callq 0x186d0
jmp 0x16011
leaq 0x438(%rsp), %rdi
leaq 0x418(%rsp), %rsi
leaq 0x4b8(%rsp), %rdx
callq 0x1a820
jmp 0x16030
leaq 0x418(%rsp), %rdi
callq 0x31e0
leaq 0x15f0d(%rip), %rdx     # 0x2bf51
leaq 0x3b8(%rsp), %rdi
leaq 0x568(%rsp), %rsi
callq 0x186d0
jmp 0x1605b
leaq 0x3d8(%rsp), %rdi
leaq 0x3b8(%rsp), %rsi
leaq 0x4b8(%rsp), %rdx
callq 0x1a820
jmp 0x1607a
leaq 0x15ed3(%rip), %rdx     # 0x2bf54
leaq 0x3f8(%rsp), %rdi
leaq 0x3d8(%rsp), %rsi
callq 0x18760
jmp 0x16098
leaq 0x3d8(%rsp), %rdi
callq 0x31e0
leaq 0x3b8(%rsp), %rdi
callq 0x31e0
leaq 0x7e0(%rsp), %rdi
leaq 0x438(%rsp), %rsi
callq 0x1a070
movq %rax, 0x80(%rsp)
jmp 0x160d1
movq 0x80(%rsp), %rax
movq %rax, 0x3b0(%rsp)
leaq 0x7e0(%rsp), %rdi
callq 0x1a0c0
movq %rax, 0x3a8(%rsp)
leaq 0x3b0(%rsp), %rdi
leaq 0x3a8(%rsp), %rsi
callq 0x1a870
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7f(%rsp)
jne 0x1611a
jmp 0x16171
leaq 0x7e0(%rsp), %rdi
leaq 0x3f8(%rsp), %rsi
callq 0x1a070
movq %rax, 0x70(%rsp)
jmp 0x16136
movq 0x70(%rsp), %rax
movq %rax, 0x3a0(%rsp)
leaq 0x7e0(%rsp), %rdi
callq 0x1a0c0
movq %rax, 0x398(%rsp)
leaq 0x3a0(%rsp), %rdi
leaq 0x398(%rsp), %rsi
callq 0x1a870
movb %al, 0x7f(%rsp)
movb 0x7f(%rsp), %al
testb $0x1, %al
jne 0x1617e
jmp 0x16636
leaq 0x370(%rsp), %rdi
leaq 0x548(%rsp), %rsi
callq 0x3160
jmp 0x16195
leaq 0x350(%rsp), %rdi
leaq 0x498(%rsp), %rsi
callq 0x3160
jmp 0x161ac
leaq 0x370(%rsp), %rdi
leaq 0x350(%rsp), %rsi
callq 0x17db0
movsd %xmm0, 0x68(%rsp)
jmp 0x161c9
leaq 0x350(%rsp), %rdi
callq 0x31e0
leaq 0x370(%rsp), %rdi
callq 0x31e0
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x390(%rsp)
movsd 0x390(%rsp), %xmm0
ucomisd 0x4f8(%rsp), %xmm0
jbe 0x1661a
movsd 0x390(%rsp), %xmm0
movsd %xmm0, 0x4f8(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x3260
jmp 0x1622b
leaq 0x1a7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x3570
movq 0x60(%rsp), %rdx
leaq 0x15c18(%rip), %rsi     # 0x2be61
leaq 0x1a8(%rsp), %rdi
callq 0x185e0
jmp 0x16258
leaq 0x1c8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x33d0
jmp 0x1626f
leaq 0x1a8(%rsp), %rdi
callq 0x31e0
leaq 0x1a7(%rsp), %rdi
callq 0x3390
leaq 0x1d8(%rsp), %rdi
leaq 0x15bc8(%rip), %rsi     # 0x2be60
callq 0x3320
movq %rax, 0x58(%rsp)
jmp 0x162a4
movq 0x58(%rsp), %rdi
leaq 0x568(%rsp), %rsi
callq 0x32e0
movq %rax, 0x50(%rsp)
jmp 0x162bd
movq 0x50(%rsp), %rdi
leaq 0x15c90(%rip), %rsi     # 0x2bf59
callq 0x3320
movq %rax, 0x48(%rsp)
jmp 0x162d5
movq 0x48(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
callq 0x32e0
movq %rax, 0x40(%rsp)
jmp 0x162ee
movq 0x40(%rsp), %rdi
leaq 0x158d0(%rip), %rsi     # 0x2bbca
callq 0x3320
movq %rax, 0x38(%rsp)
jmp 0x16306
movq 0x38(%rsp), %rdi
leaq 0x15c4c(%rip), %rsi     # 0x2bf5e
callq 0x3320
movq %rax, 0x30(%rsp)
jmp 0x1631e
movq 0x30(%rsp), %rdi
movsd 0x390(%rsp), %xmm0
callq 0x35a0
movq %rax, 0x28(%rsp)
jmp 0x16338
movq 0x28(%rsp), %rdi
leaq 0x15c46(%rip), %rsi     # 0x2bf8a
callq 0x3320
jmp 0x1634b
leaq 0x180(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x3310
jmp 0x16362
leaq 0x508(%rsp), %rdi
leaq 0x180(%rsp), %rsi
movq %rsi, 0x20(%rsp)
callq 0x33f0
movq 0x20(%rsp), %rdi
callq 0x31e0
leaq 0x15bc4(%rip), %rdx     # 0x2bf51
leaq 0x118(%rsp), %rdi
leaq 0x568(%rsp), %rsi
callq 0x186d0
jmp 0x163a4
leaq 0x138(%rsp), %rdi
leaq 0x118(%rsp), %rsi
leaq 0x4b8(%rsp), %rdx
callq 0x1a820
jmp 0x163c3
movl $0x1, 0x114(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x138(%rsp), %rsi
leaq 0x114(%rsp), %rdx
callq 0x1a890
jmp 0x163ed
leaq 0x7e0(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x1a110
movb %dl, 0x17(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x1640d
movb 0x17(%rsp), %al
movq 0x18(%rsp), %rcx
movq %rcx, 0x100(%rsp)
movb %al, 0x108(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x1a1a0
leaq 0x138(%rsp), %rdi
callq 0x31e0
leaq 0x118(%rsp), %rdi
callq 0x31e0
leaq 0x1c8(%rsp), %rdi
callq 0x3280
jmp 0x16634
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x31e0
jmp 0x166c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x1665f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x164d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
leaq 0x3d8(%rsp), %rdi
callq 0x31e0
leaq 0x3b8(%rsp), %rdi
callq 0x31e0
jmp 0x1665f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x16652
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x16536
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
leaq 0x350(%rsp), %rdi
callq 0x31e0
leaq 0x370(%rsp), %rdi
callq 0x31e0
jmp 0x16652
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x1657f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x31e0
leaq 0x1a7(%rsp), %rdi
callq 0x3390
jmp 0x1660b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x1660b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x165fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
jmp 0x165f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x7b8(%rsp)
movl %eax, 0x7b4(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x1a1a0
leaq 0x138(%rsp), %rdi
callq 0x31e0
leaq 0x118(%rsp), %rdi
callq 0x31e0
leaq 0x1c8(%rsp), %rdi
callq 0x3280
jmp 0x16652
movsd 0x390(%rsp), %xmm0
ucomisd 0x500(%rsp), %xmm0
jbe 0x16630
jmp 0x16632
jmp 0x16632
jmp 0x16634
jmp 0x16636
leaq 0x3f8(%rsp), %rdi
callq 0x31e0
leaq 0x438(%rsp), %rdi
callq 0x31e0
jmp 0x1666e
leaq 0x3f8(%rsp), %rdi
callq 0x31e0
leaq 0x438(%rsp), %rdi
callq 0x31e0
jmp 0x166c1
leaq 0x4f0(%rsp), %rdi
xorl %esi, %esi
callq 0x1a7e0
movq %rax, 0xf8(%rsp)
movl $0x0, 0x5ac(%rsp)
leaq 0x498(%rsp), %rdi
callq 0x31e0
leaq 0x4b8(%rsp), %rdi
callq 0x31e0
movl 0x5ac(%rsp), %eax
testl %eax, %eax
je 0x166bc
jmp 0x166b7
jmp 0x15da0
jmp 0x15da0
leaq 0x498(%rsp), %rdi
callq 0x31e0
leaq 0x4b8(%rsp), %rdi
callq 0x31e0
jmp 0x1677a
movsd 0x4f8(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x16723
leaq 0x508(%rsp), %rsi
leaq 0x5b0(%rsp), %rdi
callq 0x32e0
movq %rax, 0x8(%rsp)
jmp 0x1670e
movq 0x8(%rsp), %rdi
movq 0x228ae(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0x16721
jmp 0x16723
movsd 0x500(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x16737
jmp 0x16737
leaq 0x5a0(%rsp), %rdi
xorl %esi, %esi
callq 0x1a7e0
movq %rax, 0xf0(%rsp)
leaq 0x4f8(%rsp), %rdi
callq 0x1a8d0
leaq 0x548(%rsp), %rdi
callq 0x31e0
leaq 0x568(%rsp), %rdi
callq 0x31e0
jmp 0x15c89
leaq 0x4f8(%rsp), %rdi
callq 0x1a8d0
leaq 0x548(%rsp), %rdi
callq 0x31e0
leaq 0x568(%rsp), %rdi
callq 0x31e0
jmp 0x1682c
leaq 0x157e0(%rip), %rsi     # 0x2bf8d
leaq 0x5b0(%rsp), %rdi
callq 0x3320
movq %rax, (%rsp)
jmp 0x167c0
movq (%rsp), %rdi
movq 0x227fd(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0x167d2
leaq 0x5b0(%rsp), %rdi
callq 0x3460
jmp 0x167e1
movb $0x1, 0x827(%rsp)
movl $0x1, 0x5ac(%rsp)
leaq 0x5b0(%rsp), %rdi
callq 0x3480
leaq 0x7c0(%rsp), %rdi
callq 0x31e0
leaq 0x7e0(%rsp), %rdi
callq 0x1a220
movb 0x827(%rsp), %al
andb $0x1, %al
addq $0x828, %rsp            # imm = 0x828
retq
leaq 0x5b0(%rsp), %rdi
callq 0x3480
leaq 0x7c0(%rsp), %rdi
callq 0x31e0
leaq 0x7e0(%rsp), %rdi
callq 0x1a220
movq 0x7b8(%rsp), %rdi
callq 0x3560