// File: readmapping[P]alfalfa/src/mapper.cpp
// Function: pairedMatch3(sparseSA const&, read_t&, read_t&, align_opt const&, paired_opt const&)
void pairedMatch3(const sparseSA& sa, read_t & mate1, read_t & mate2, const align_opt & alnOptions, const paired_opt & pairedOpt){
    int editDist1 = (int)(alnOptions.errorPercent*mate1.sequence.length())+1;
    int editDist2 = (int)(alnOptions.errorPercent*mate2.sequence.length())+1;
    //FIND CANDIDATE REGIONS FOR BOTH MATES
    vector<lis_t>  lisIntervals1;
    vector<lis_t>  lisIntervals2;
    if(alnOptions.print >= 3) cerr << "calculate LIS of both mates"  << endl;
    calculateCandRegions(sa, mate1, alnOptions, lisIntervals1, alnOptions.errorPercent);
    calculateCandRegions(sa, mate2, alnOptions, lisIntervals2, alnOptions.errorPercent);
    //FILTER LIS: ONLY THOSE THAT PAIR   
    vector<lis_t>  lisIntervals1Filtered;
    vector<lis_t>  lisIntervals2Filtered;
    if(alnOptions.print >= 3) cerr << "filter LIS of both mates using pairing"  << endl;
    for(size_t i = 0; i < lisIntervals1.size(); i++){
        for(size_t j = 0; j < lisIntervals2.size(); j++){
            if(!(lisIntervals1[i].extended && lisIntervals2[j].extended) && isConcordantLIS(lisIntervals1[i], lisIntervals2[j], editDist1, editDist2, pairedOpt, alnOptions.print)){
                if(!lisIntervals1[i].extended){
                    lisIntervals1Filtered.push_back(lisIntervals1[i]);
                    lisIntervals1[i].extended = true;
                }
                if(!lisIntervals2[j].extended){
                    lisIntervals2Filtered.push_back(lisIntervals2[j]);
                    lisIntervals2[j].extended = true;
                }
            }
        }
    }
    if(alnOptions.print >= 3) cerr << "number of paired LIS in mate1 " << lisIntervals1Filtered.size()  << endl;
    if(alnOptions.print >= 3) cerr << "number of paired LIS in mate2 " << lisIntervals2Filtered.size()  << endl;
    //RESCUE IF NO PAIRED LIS WERE FOUND
    if(lisIntervals1Filtered.empty() && lisIntervals2Filtered.empty()){
        if(alnOptions.print >= 2) cerr << "#EMPTYFILTEREDLIST"  << endl;
        pairedMatch1(sa, mate1, mate2, alnOptions, pairedOpt);
    }
    else{
        //FIND ALIGNMENTS FOR FILTERED LIST OF ALIGNMENTS
        //BE NICE AND GIVE THE OPTION OF LOWER MINSCORE
        int minScore1 = (int) (mate1.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*(editDist1*1.5));
        int minScore2 = (int) (mate2.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*(editDist2*1.5));
        processLisIntervals(sa, mate1, alnOptions, lisIntervals1Filtered, editDist1, alnOptions.maxAlnCount, 0, minScore1);
        processLisIntervals(sa, mate2, alnOptions, lisIntervals2Filtered, editDist2, alnOptions.maxAlnCount, 0, minScore2);
        if(alnOptions.print >= 3) cerr << "first  mate resulted in " << mate1.alignments.size() << " alignments" << endl;
        if(alnOptions.print >= 3) cerr << "second mate resulted in " << mate2.alignments.size() << " alignments" << endl;
        //RESCUE
        if(mate1.alignments.empty() && alnOptions.rescue){
            if(alnOptions.print >= 2) cerr << "#RESCUE" << endl;
            minScore1 = max(0,(int)(mate1.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*0.2*mate1.sequence.length()));
            processLisIntervals(sa, mate1, alnOptions, lisIntervals1Filtered, editDist1, alnOptions.maxAlnCount, 0, minScore1);
        }
        if(mate2.alignments.empty() && alnOptions.rescue){
            if(alnOptions.print >= 2) cerr << "#RESCUE" << endl;
            minScore2 = max(0,(int)(mate2.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*0.2*mate2.sequence.length()));
            processLisIntervals(sa, mate2, alnOptions, lisIntervals2Filtered, editDist2, alnOptions.maxAlnCount, 0, minScore2);
        }
        //TRY AND PAIR THE ALIGNMENTS
        int alnCount = 0;
        int maxPairedAlignments = alnOptions.alignmentCount+1;
        int alnCount1 = mate1.alignmentCount();
        int alnCount2 = mate2.alignmentCount();
        //ORDER ALIGNMENTS ACCORDING TO SCORE
        vector<alnScoreInfo_t> pairedOrder;
        pairedOrder.reserve(alnCount1+alnCount2);
        for(size_t i = 0; i < mate1.alignments.size(); i++)
            pairedOrder.push_back(alnScoreInfo_t(true, i,mate1.alignments[i]->alignmentScore ));
        for(size_t i = 0; i < mate2.alignments.size(); i++)
            pairedOrder.push_back(alnScoreInfo_t(false, i,mate2.alignments[i]->alignmentScore ));
        sort(pairedOrder.begin(),pairedOrder.end(),compAlnScorePaired);
        //TRY AND PAIR THE ALIGNMENTS
        if(alnCount1>0 && alnCount2>0){
            if(alnOptions.print >= 3) cerr << "search concordant alignments" << endl;
            pairAlignmentsOrdered(sa, mate1, mate2, alnOptions, pairedOpt, 
            pairedOrder, alnCount, maxPairedAlignments);
        }
        //FIND DISCORDANT ALIGNMENTS AMONGST HIGHEST SCORING UNPAIRED ALIGNMENTS
        int pairedAlignments = mate1.pairedAlignmentCount;
        if(alnOptions.print >= 2) cerr << "#CONCORDANTCOUNT " << pairedAlignments << endl;
        if(pairedOpt.discordant && alnCount < maxPairedAlignments){
            if(alnOptions.print >= 3) cerr << "search discordant alignments" << endl;
            calculateDiscordantAlignments(sa, mate1, mate2);
        }
        if(alnOptions.print >= 2) cerr << "#DISCORDANTCOUNT " << mate1.pairedAlignmentCount-pairedAlignments << endl;
    }
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdi, 0x320(%rsp)
movq %rsi, 0x318(%rsp)
movq %rdx, 0x310(%rsp)
movq %rcx, 0x308(%rsp)
movq %r8, 0x300(%rsp)
movq 0x308(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x1b8(%rsp)
movq 0x318(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movsd 0x1b8(%rsp), %xmm0
movq %rax, %xmm1
movaps 0x378f5(%rip), %xmm2    # 0x7db70
movaps %xmm2, 0x1c0(%rsp)
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x378f1(%rip), %xmm2    # 0x7db80
movaps %xmm2, 0x1d0(%rsp)
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
incl %eax
movl %eax, 0x2fc(%rsp)
movq 0x308(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x1e8(%rsp)
movq 0x310(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0x1c0(%rsp), %xmm3
movaps 0x1d0(%rsp), %xmm2
movsd 0x1e8(%rsp), %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
addl $0x1, %eax
movl %eax, 0x2f8(%rsp)
leaq 0x2e0(%rsp), %rdi
callq 0x4e460
leaq 0x2c8(%rsp), %rdi
callq 0x4e460
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x46397
movq 0x50ca0(%rip), %rdi     # 0x96ff0
leaq 0x380d2(%rip), %rsi     # 0x7e429
callq 0x8360
movq %rax, 0x1b0(%rsp)
jmp 0x46366
movq 0x1b0(%rsp), %rdi
movq 0x50c3b(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4637c
jmp 0x46397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x4731a
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x308(%rsp), %rdx
movsd 0x30(%rdx), %xmm0
leaq 0x2e0(%rsp), %rcx
callq 0x429c0
jmp 0x463c3
movq 0x320(%rsp), %rdi
movq 0x310(%rsp), %rsi
movq 0x308(%rsp), %rdx
movsd 0x30(%rdx), %xmm0
leaq 0x2c8(%rsp), %rcx
callq 0x429c0
jmp 0x463ef
leaq 0x2a0(%rsp), %rdi
callq 0x4e460
leaq 0x288(%rsp), %rdi
callq 0x4e460
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x46465
movq 0x50bd2(%rip), %rdi     # 0x96ff0
leaq 0x38020(%rip), %rsi     # 0x7e445
callq 0x8360
movq %rax, 0x1a8(%rsp)
jmp 0x46434
movq 0x1a8(%rsp), %rdi
movq 0x50b6d(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4644a
jmp 0x46465
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0x47300
movq $0x0, 0x280(%rsp)
movq 0x280(%rsp), %rax
movq %rax, 0x1a0(%rsp)
leaq 0x2e0(%rsp), %rdi
callq 0x4c4b0
movq %rax, %rcx
movq 0x1a0(%rsp), %rax
cmpq %rcx, %rax
jae 0x46684
movq $0x0, 0x278(%rsp)
movq 0x278(%rsp), %rax
movq %rax, 0x198(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0x4c4b0
movq %rax, %rcx
movq 0x198(%rsp), %rax
cmpq %rcx, %rax
jae 0x46669
movq 0x280(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
callq 0x4c850
testb $0x1, 0x18(%rax)
je 0x46519
movq 0x278(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
callq 0x4c850
testb $0x1, 0x18(%rax)
jne 0x4664e
movq 0x280(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
callq 0x4c850
movq %rax, 0x188(%rsp)
movq 0x278(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
callq 0x4c850
movq 0x188(%rsp), %rdi
movq %rax, %rsi
movl 0x2fc(%rsp), %edx
movl 0x2f8(%rsp), %ecx
movq 0x300(%rsp), %r8
movq 0x308(%rsp), %rax
movl 0x78(%rax), %r9d
callq 0x45c70
movb %al, 0x197(%rsp)
jmp 0x46586
movb 0x197(%rsp), %al
testb $0x1, %al
jne 0x46596
jmp 0x4664e
movq 0x280(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
callq 0x4c850
testb $0x1, 0x18(%rax)
jne 0x465f1
movq 0x280(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
callq 0x4c850
movq %rax, %rsi
leaq 0x2a0(%rsp), %rdi
callq 0x4e8d0
jmp 0x465d8
movq 0x280(%rsp), %rsi
leaq 0x2e0(%rsp), %rdi
callq 0x4c850
movb $0x1, 0x18(%rax)
movq 0x278(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
callq 0x4c850
testb $0x1, 0x18(%rax)
jne 0x4664c
movq 0x278(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
callq 0x4c850
movq %rax, %rsi
leaq 0x288(%rsp), %rdi
callq 0x4e8d0
jmp 0x46633
movq 0x278(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
callq 0x4c850
movb $0x1, 0x18(%rax)
jmp 0x4664e
jmp 0x46650
movq 0x278(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x278(%rsp)
jmp 0x464ae
jmp 0x4666b
movq 0x280(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x280(%rsp)
jmp 0x46471
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x466ee
movq 0x50957(%rip), %rdi     # 0x96ff0
leaq 0x37dcc(%rip), %rsi     # 0x7e46c
callq 0x8360
movq %rax, 0x180(%rsp)
jmp 0x466af
leaq 0x2a0(%rsp), %rdi
callq 0x4c4b0
movq 0x180(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x178(%rsp)
jmp 0x466d6
movq 0x178(%rsp), %rdi
movq 0x508cb(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x466ec
jmp 0x466ee
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x46758
movq 0x508ed(%rip), %rdi     # 0x96ff0
leaq 0x37d81(%rip), %rsi     # 0x7e48b
callq 0x8360
movq %rax, 0x170(%rsp)
jmp 0x46719
leaq 0x288(%rsp), %rdi
callq 0x4c4b0
movq 0x170(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x168(%rsp)
jmp 0x46740
movq 0x168(%rsp), %rdi
movq 0x50861(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x46756
jmp 0x46758
leaq 0x2a0(%rsp), %rdi
callq 0x4e470
testb $0x1, %al
jne 0x4676e
jmp 0x467f8
leaq 0x288(%rsp), %rdi
callq 0x4e470
testb $0x1, %al
jne 0x46781
jmp 0x467f8
movq 0x308(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x467c4
movq 0x5085a(%rip), %rdi     # 0x96ff0
leaq 0x37d0d(%rip), %rsi     # 0x7e4aa
callq 0x8360
movq %rax, 0x160(%rsp)
jmp 0x467ac
movq 0x160(%rsp), %rdi
movq 0x507f5(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x467c2
jmp 0x467c4
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x310(%rsp), %rdx
movq 0x308(%rsp), %rcx
movq 0x300(%rsp), %r8
callq 0x45380
jmp 0x467f3
jmp 0x472c4
movq 0x318(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movq %rax, %rdx
movq 0x308(%rsp), %rax
movslq (%rax), %rsi
movl %esi, %ecx
imulq %rsi, %rdx
movq %rdx, %xmm1
movaps 0x37347(%rip), %xmm0    # 0x7db70
movaps %xmm0, 0x130(%rsp)
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x37343(%rip), %xmm0    # 0x7db80
movaps %xmm0, 0x140(%rsp)
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl 0x2fc(%rsp), %xmm2
movsd 0x372f2(%rip), %xmm3    # 0x7db60
movsd %xmm3, 0x158(%rsp)
mulsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x274(%rsp)
movq 0x310(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0x130(%rsp), %xmm2
movaps 0x140(%rsp), %xmm0
movsd 0x158(%rsp), %xmm3
movq %rax, %rdx
movq 0x308(%rsp), %rax
movslq (%rax), %rsi
movl %esi, %ecx
imulq %rsi, %rdx
movq %rdx, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl 0x2f8(%rsp), %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x270(%rsp)
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x308(%rsp), %rdx
movl 0x2fc(%rsp), %r8d
movl 0x60(%rdx), %r9d
movl 0x274(%rsp), %ecx
movq %rsp, %rax
movl %ecx, 0x8(%rax)
movl $0x0, (%rax)
leaq 0x2a0(%rsp), %rcx
callq 0x41a60
jmp 0x46953
movq 0x320(%rsp), %rdi
movq 0x310(%rsp), %rsi
movq 0x308(%rsp), %rdx
movl 0x2f8(%rsp), %r8d
movl 0x60(%rdx), %r9d
movl 0x270(%rsp), %ecx
movq %rsp, %rax
movl %ecx, 0x8(%rax)
movl $0x0, (%rax)
leaq 0x288(%rsp), %rcx
callq 0x41a60
jmp 0x46999
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x46a2c
movq 0x5063e(%rip), %rdi     # 0x96ff0
leaq 0x37b04(%rip), %rsi     # 0x7e4bd
callq 0x8360
movq %rax, 0x128(%rsp)
jmp 0x469c8
movq 0x318(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq 0x128(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x120(%rsp)
jmp 0x469f6
movq 0x120(%rsp), %rdi
leaq 0x37ae2(%rip), %rsi     # 0x7e4e7
callq 0x8360
movq %rax, 0x118(%rsp)
jmp 0x46a14
movq 0x118(%rsp), %rdi
movq 0x5058d(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x46a2a
jmp 0x46a2c
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x46abf
movq 0x505ab(%rip), %rdi     # 0x96ff0
leaq 0x378d4(%rip), %rsi     # 0x7e320
callq 0x8360
movq %rax, 0x110(%rsp)
jmp 0x46a5b
movq 0x310(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq 0x110(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x108(%rsp)
jmp 0x46a89
movq 0x108(%rsp), %rdi
leaq 0x37a4f(%rip), %rsi     # 0x7e4e7
callq 0x8360
movq %rax, 0x100(%rsp)
jmp 0x46aa7
movq 0x100(%rsp), %rdi
movq 0x504fa(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x46abd
jmp 0x46abf
movq 0x318(%rsp), %rdi
addq $0xb0, %rdi
callq 0xbe60
testb $0x1, %al
jne 0x46adc
jmp 0x46c95
movq 0x308(%rsp), %rax
testb $0x1, 0x71(%rax)
je 0x46c95
movq 0x308(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x46b31
movq 0x504ed(%rip), %rdi     # 0x96ff0
leaq 0x3758c(%rip), %rsi     # 0x7e096
callq 0x8360
movq %rax, 0xf8(%rsp)
jmp 0x46b19
movq 0xf8(%rsp), %rdi
movq 0x50488(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x46b2f
jmp 0x46b31
movl $0x0, 0x26c(%rsp)
movq 0x318(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movq %rax, %rdx
movq 0x308(%rsp), %rax
movslq (%rax), %rsi
movl %esi, %ecx
imulq %rsi, %rdx
movq %rdx, %xmm0
movaps 0x37003(%rip), %xmm1    # 0x7db70
movaps %xmm1, 0xc0(%rsp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x36fff(%rip), %xmm1    # 0x7db80
movaps %xmm1, 0xd0(%rsp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, 0xe8(%rsp)
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x36fa6(%rip), %xmm1    # 0x7db58
mulsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rsp)
movq 0x318(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0xc0(%rsp), %xmm4
movaps 0xd0(%rsp), %xmm3
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movq %rax, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x268(%rsp)
leaq 0x26c(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x14d40
movq %rax, 0xf0(%rsp)
jmp 0x46c3c
movq 0xf0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x274(%rsp)
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x308(%rsp), %rdx
movl 0x2fc(%rsp), %r8d
movl 0x60(%rdx), %r9d
movl 0x274(%rsp), %ecx
movq %rsp, %rax
movl %ecx, 0x8(%rax)
movl $0x0, (%rax)
leaq 0x2a0(%rsp), %rcx
callq 0x41a60
jmp 0x46c93
jmp 0x46c95
movq 0x310(%rsp), %rdi
addq $0xb0, %rdi
callq 0xbe60
testb $0x1, %al
jne 0x46cb2
jmp 0x46e6b
movq 0x308(%rsp), %rax
testb $0x1, 0x71(%rax)
je 0x46e6b
movq 0x308(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x46d07
movq 0x50317(%rip), %rdi     # 0x96ff0
leaq 0x373b6(%rip), %rsi     # 0x7e096
callq 0x8360
movq %rax, 0xb8(%rsp)
jmp 0x46cef
movq 0xb8(%rsp), %rdi
movq 0x502b2(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x46d05
jmp 0x46d07
movl $0x0, 0x264(%rsp)
movq 0x310(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movq %rax, %rdx
movq 0x308(%rsp), %rax
movslq (%rax), %rsi
movl %esi, %ecx
imulq %rsi, %rdx
movq %rdx, %xmm0
movaps 0x36e2d(%rip), %xmm1    # 0x7db70
movaps %xmm1, 0x80(%rsp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x36e29(%rip), %xmm1    # 0x7db80
movaps %xmm1, 0x90(%rsp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x36dd0(%rip), %xmm1    # 0x7db58
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0x310(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0x80(%rsp), %xmm4
movaps 0x90(%rsp), %xmm3
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movq %rax, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x260(%rsp)
leaq 0x264(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x14d40
movq %rax, 0xb0(%rsp)
jmp 0x46e12
movq 0xb0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x270(%rsp)
movq 0x320(%rsp), %rdi
movq 0x310(%rsp), %rsi
movq 0x308(%rsp), %rdx
movl 0x2f8(%rsp), %r8d
movl 0x60(%rdx), %r9d
movl 0x270(%rsp), %ecx
movq %rsp, %rax
movl %ecx, 0x8(%rax)
movl $0x0, (%rax)
leaq 0x288(%rsp), %rcx
callq 0x41a60
jmp 0x46e69
jmp 0x46e6b
movl $0x0, 0x25c(%rsp)
movq 0x308(%rsp), %rax
movl 0x50(%rax), %eax
incl %eax
movl %eax, 0x258(%rsp)
movq 0x318(%rsp), %rdi
callq 0xc0c0
movl %eax, 0x7c(%rsp)
jmp 0x46e9d
movl 0x7c(%rsp), %eax
movl %eax, 0x254(%rsp)
movq 0x310(%rsp), %rdi
callq 0xc0c0
movl %eax, 0x78(%rsp)
jmp 0x46ebb
movl 0x78(%rsp), %eax
movl %eax, 0x250(%rsp)
leaq 0x238(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x4e6a0
movq 0x70(%rsp), %rdi
movl 0x254(%rsp), %eax
movl 0x250(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x4e6b0
jmp 0x46ef7
movq $0x0, 0x230(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x318(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x46fcd
movq 0x230(%rsp), %rsi
movl %esi, %eax
movl %eax, 0x64(%rsp)
movq 0x318(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdae0
movl 0x64(%rsp), %edx
movq (%rax), %rax
movl 0x70(%rax), %ecx
leaq 0x224(%rsp), %rdi
movl $0x1, %esi
callq 0x4e660
jmp 0x46f75
leaq 0x238(%rsp), %rdi
leaq 0x224(%rsp), %rsi
callq 0x4e630
jmp 0x46f8c
jmp 0x46f8e
movq 0x230(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x230(%rsp)
jmp 0x46f03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x238(%rsp), %rdi
callq 0x4e870
jmp 0x47300
movq $0x0, 0x218(%rsp)
movq 0x218(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x310(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x47076
movq 0x218(%rsp), %rsi
movl %esi, %eax
movl %eax, 0x54(%rsp)
movq 0x310(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdae0
movl 0x54(%rsp), %edx
movq (%rax), %rax
movl 0x70(%rax), %ecx
leaq 0x20c(%rsp), %rdi
xorl %esi, %esi
callq 0x4e660
jmp 0x47044
leaq 0x238(%rsp), %rdi
leaq 0x20c(%rsp), %rsi
callq 0x4e630
jmp 0x4705b
jmp 0x4705d
movq 0x218(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x218(%rsp)
jmp 0x46fd9
leaq 0x238(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x4e810
movq 0x48(%rsp), %rdi
movq %rax, 0x200(%rsp)
callq 0x4e840
movq %rax, 0x1f8(%rsp)
movq 0x200(%rsp), %rdi
movq 0x1f8(%rsp), %rsi
leaq -0x2ee9(%rip), %rdx     # 0x441d0
callq 0x4e7c0
jmp 0x470c0
cmpl $0x0, 0x254(%rsp)
jle 0x4716c
cmpl $0x0, 0x250(%rsp)
jle 0x4716c
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x47119
movq 0x4feff(%rip), %rdi     # 0x96ff0
leaq 0x373de(%rip), %rsi     # 0x7e4d6
callq 0x8360
movq %rax, 0x40(%rsp)
jmp 0x47104
movq 0x40(%rsp), %rdi
movq 0x4fea0(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x47117
jmp 0x47119
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x310(%rsp), %rdx
movq 0x308(%rsp), %rcx
movq 0x300(%rsp), %r8
movl 0x258(%rsp), %r9d
movq %rsp, %rax
movl %r9d, 0x8(%rax)
leaq 0x25c(%rsp), %r9
movq %r9, (%rax)
leaq 0x238(%rsp), %r9
callq 0x44f10
jmp 0x4716a
jmp 0x4716c
movq 0x318(%rsp), %rax
movl 0xc8(%rax), %eax
movl %eax, 0x1f4(%rsp)
movq 0x308(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x471d6
movq 0x4fe5a(%rip), %rdi     # 0x96ff0
leaq 0x37224(%rip), %rsi     # 0x7e3c1
callq 0x8360
movq %rax, 0x38(%rsp)
jmp 0x471a9
movq 0x38(%rsp), %rdi
movl 0x1f4(%rsp), %esi
callq 0x8710
movq %rax, 0x30(%rsp)
jmp 0x471c1
movq 0x30(%rsp), %rdi
movq 0x4fde3(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x471d4
jmp 0x471d6
movq 0x300(%rsp), %rax
testb $0x1, 0x9(%rax)
je 0x47252
movl 0x25c(%rsp), %eax
cmpl 0x258(%rsp), %eax
jge 0x47252
movq 0x308(%rsp), %rax
cmpl $0x3, 0x78(%rax)
jl 0x47231
movq 0x4fde7(%rip), %rdi     # 0x96ff0
leaq 0x372e3(%rip), %rsi     # 0x7e4f3
callq 0x8360
movq %rax, 0x28(%rsp)
jmp 0x4721c
movq 0x28(%rsp), %rdi
movq 0x4fd88(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4722f
jmp 0x47231
movq 0x320(%rsp), %rdi
movq 0x318(%rsp), %rsi
movq 0x310(%rsp), %rdx
callq 0x43d30
jmp 0x47250
jmp 0x47252
movq 0x308(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x472b7
movq 0x4fd89(%rip), %rdi     # 0x96ff0
leaq 0x37165(%rip), %rsi     # 0x7e3d3
callq 0x8360
movq %rax, 0x20(%rsp)
jmp 0x4727a
movq 0x20(%rsp), %rdi
movq 0x318(%rsp), %rax
movl 0xc8(%rax), %esi
movl 0x1f4(%rsp), %eax
subl %eax, %esi
callq 0x8710
movq %rax, 0x18(%rsp)
jmp 0x472a2
movq 0x18(%rsp), %rdi
movq 0x4fd02(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x472b5
jmp 0x472b7
leaq 0x238(%rsp), %rdi
callq 0x4e870
leaq 0x288(%rsp), %rdi
callq 0x4e4e0
leaq 0x2a0(%rsp), %rdi
callq 0x4e4e0
leaq 0x2c8(%rsp), %rdi
callq 0x4e4e0
leaq 0x2e0(%rsp), %rdi
callq 0x4e4e0
addq $0x328, %rsp            # imm = 0x328
retq
leaq 0x288(%rsp), %rdi
callq 0x4e4e0
leaq 0x2a0(%rsp), %rdi
callq 0x4e4e0
leaq 0x2c8(%rsp), %rdi
callq 0x4e4e0
leaq 0x2e0(%rsp), %rdi
callq 0x4e4e0
movq 0x2c0(%rsp), %rdi
callq 0x8730
nopw %cs:(%rax,%rax)