// File: readmapping[P]alfalfa/src/mapper.cpp
// Function: processLisIntervalsAndPair(sparseSA const&, read_t&, read_t&, align_opt const&, paired_opt const&, std::vector<lis_t, std::allocator<lis_t>>&, std::vector<lis_t, std::allocator<lis_t>>&, std::vector<alnScoreInfo_t, std::allocator<alnScoreInfo_t>> const&, int, double, int, int)
inline void processLisIntervalsAndPair(const sparseSA& sa, read_t & mate1, read_t & mate2, 
        const align_opt & alnOptions, const paired_opt & pairedOpt, vector<lis_t> & lisIntervals1, 
        vector<lis_t> & lisIntervals2, const vector<alnScoreInfo_t> & pairedOrder, 
        int maxAlnCount, double minCoveragePercent, int minScore1, int minScore2){
    int minCoverage1 = mate1.sequence.length()*minCoveragePercent;
    int minCoverage2 = mate2.sequence.length()*minCoveragePercent;
    int editDist1 = (int)(alnOptions.errorPercent*mate1.sequence.length())+1;
    int editDist2 = (int)(alnOptions.errorPercent*mate2.sequence.length())+1;
    //for every interval, try to align
    size_t lisIndex = 0;
    //trial parameter for performance reasons
    int trialF = 0;
    int trialR = 0;
    //////////////////////
    //MAIN ALIGNMENT LOOP
    //////////////////////
    //tree containing information for uniqueness option
    kbtree_t(qCov) *treeF;
    kbtree_t(qCov) *treeR;
    treeF = kb_init(qCov, KB_DEFAULT_SIZE);
    treeR = kb_init(qCov, KB_DEFAULT_SIZE);
    int maxAlnScore = 0;
    int alnCount = 0;
    vector<alnScoreInfo_t>  mate1Alns;
    vector<alnScoreInfo_t>  mate2Alns;
    while(alnCount < maxAlnCount && lisIndex < pairedOrder.size()){
        lis_t & cluster = pairedOrder[lisIndex].firstMate ? lisIntervals1[pairedOrder[lisIndex].position] : lisIntervals2[pairedOrder[lisIndex].position];
        bool unique = hasUnique(cluster, cluster.fw ? treeF : treeR);
        bool extend = unique;
        int trial = cluster.fw ? trialF : trialR;
        bool highCoverage = pairedOrder[lisIndex].firstMate ? cluster.score >= minCoverage1 : cluster.score >= minCoverage2;
        bool extensionCriterium = (trial < alnOptions.maxTrial || extend) && (cluster.matches.size() > 1 || highCoverage);        
        if(alnOptions.print >=2 ){
            cerr << "#LISI " << lisIndex << endl;
            cerr << "#UNIQUE " << unique << endl;
            cerr << "#TRIAL " << trial << endl;
            cerr << "#EXTEND " << (extensionCriterium && !cluster.extended) << endl;
            cerr << "#LISMEMS " << cluster.matches.size() << endl;
            cerr << "#LISSCORE " << cluster.score << endl;
        }
        if(extensionCriterium && !cluster.extended){
            //sort matches in this interval according to query position
            const vector<match_t> & matchVector = cluster.matches;
            long chrStart, chrEnd;
            sa.getChromBounds(matchVector[0].ref, chrStart, chrEnd);
            int returnedAlnScore;
            size_t extendCount;
            if(pairedOrder[lisIndex].firstMate){
                if(alnOptions.print >= 5) cerr << "extend cluster on first mate" << endl;
                extendCount = mate1.alignments.size();
                returnedAlnScore = extendAlignmentChain(sa.S, cluster.fw ? mate1.sequence : mate1.rcSequence, matchVector, editDist1, minScore1, minCoverage1, alnOptions, chrStart, chrEnd, mate1, cluster.fw);
                //NEW PART FOR THIS METHOD: TRY TO FIND A MATE FOR THE ALIGNMENTS THAT WERE FOUND HERE
                if(alnOptions.print >= 5) cerr << "alignment of lis in mate 1 resulted in " << (mate1.alignments.size()-extendCount) << " alignments" << endl;
                size_t lastAln = mate1.alignments.size();
                for(size_t i = extendCount; i < lastAln; i++){
                    mate1Alns.push_back(alnScoreInfo_t(true, extendCount, mate1.alignments[extendCount]->alignmentScore));
                    findOrAlignMateToAlignment(sa, mate1, mate2, true, alnOptions, 
                            pairedOpt, lisIntervals2, minScore2, mate2Alns, extendCount);
                }
            }
            else{
                if(alnOptions.print >= 5) cerr << "extend cluster on second mate" << endl;
                extendCount = mate2.alignments.size();
                returnedAlnScore = extendAlignmentChain(sa.S, cluster.fw ? mate2.sequence : mate2.rcSequence, matchVector, editDist2, minScore2, minCoverage2, alnOptions, chrStart, chrEnd, mate2, cluster.fw);
                if(alnOptions.print >= 5) cerr << "alignment of lis in mate 2 resulted in " << (mate1.alignments.size()-extendCount) << " alignments" << endl;
                size_t lastAln = mate2.alignments.size();
                for(size_t i = extendCount; i < lastAln; i++){
                    mate1Alns.push_back(alnScoreInfo_t(false, extendCount, mate2.alignments[extendCount]->alignmentScore));
                    findOrAlignMateToAlignment(sa, mate2, mate1, false, alnOptions, 
                            pairedOpt, lisIntervals1, minScore1, mate1Alns, extendCount);
                }
            }
            //deal with new alignments
            cluster.extended = true;
            if(cluster.fw) trialF++;
            else trialR++;
            if(returnedAlnScore >= 0 && (!alnOptions.maxTrialBest || maxAlnScore < returnedAlnScore)){
                if(cluster.fw) trialF = 0;
                else trialR = 0;
            }
            alnCount = mate1.alignments.size() + mate2.alignments.size();
            maxAlnScore = max(maxAlnScore, returnedAlnScore);
        }
        lisIndex++;
    }  
    kb_destroy(qCov, treeF);
    kb_destroy(qCov, treeR);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x310, %rsp            # imm = 0x310
movl 0x350(%rsp), %eax
movl 0x348(%rsp), %eax
movl 0x340(%rsp), %eax
movq 0x338(%rsp), %rax
movq 0x330(%rsp), %rax
movq %rdi, 0x308(%rsp)
movq %rsi, 0x300(%rsp)
movq %rdx, 0x2f8(%rsp)
movq %rcx, 0x2f0(%rsp)
movq %r8, 0x2e8(%rsp)
movq %r9, 0x2e0(%rsp)
movsd %xmm0, 0x2d8(%rsp)
movq 0x300(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movq %rax, %xmm0
movaps 0x2d0fa(%rip), %xmm1    # 0x7db70
movaps %xmm1, 0x170(%rsp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x2d0f6(%rip), %xmm1    # 0x7db80
movaps %xmm1, 0x180(%rsp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x2d8(%rsp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2d4(%rsp)
movq 0x2f8(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0x170(%rsp), %xmm2
movaps 0x180(%rsp), %xmm1
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x2d8(%rsp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2d0(%rsp)
movq 0x2f0(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x168(%rsp)
movq 0x300(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movsd 0x168(%rsp), %xmm0
movaps 0x170(%rsp), %xmm3
movaps 0x180(%rsp), %xmm2
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
incl %eax
movl %eax, 0x2cc(%rsp)
movq 0x2f0(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x198(%rsp)
movq 0x2f8(%rsp), %rdi
addq $0x20, %rdi
callq 0x8630
movaps 0x170(%rsp), %xmm3
movaps 0x180(%rsp), %xmm2
movsd 0x198(%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, 0x2c8(%rsp)
movq $0x0, 0x2c0(%rsp)
movl $0x0, 0x2bc(%rsp)
movl $0x0, 0x2b8(%rsp)
movl $0x200, %edi            # imm = 0x200
callq 0x41680
movq %rax, 0x2b0(%rsp)
movl $0x200, %edi            # imm = 0x200
callq 0x41680
movq %rax, 0x2a8(%rsp)
movl $0x0, 0x2a4(%rsp)
movl $0x0, 0x2a0(%rsp)
leaq 0x288(%rsp), %rdi
callq 0x4e6a0
leaq 0x270(%rsp), %rdi
callq 0x4e6a0
movl 0x2a0(%rsp), %ecx
xorl %eax, %eax
cmpl 0x340(%rsp), %ecx
movb %al, 0x167(%rsp)
jge 0x50ca1
movq 0x2c0(%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x338(%rsp), %rdi
callq 0x4e5b0
movq %rax, %rcx
movq 0x158(%rsp), %rax
cmpq %rcx, %rax
setb %al
movb %al, 0x167(%rsp)
movb 0x167(%rsp), %al
testb $0x1, %al
jne 0x50cb1
jmp 0x5189f
movq 0x338(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x4e5d0
testb $0x1, (%rax)
je 0x50d0b
movq 0x2e0(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x338(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x4e5d0
movq 0x148(%rsp), %rdi
movslq 0x4(%rax), %rsi
callq 0x4c850
movq %rax, 0x150(%rsp)
jmp 0x50d49
movq 0x330(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x338(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x4e5d0
movq 0x140(%rsp), %rdi
movslq 0x4(%rax), %rsi
callq 0x4c850
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x268(%rsp)
movq 0x268(%rsp), %rax
movq %rax, 0x138(%rsp)
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x50d89
movq 0x2b0(%rsp), %rax
movq %rax, 0x130(%rsp)
jmp 0x50d99
movq 0x2a8(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x138(%rsp), %rdi
movq 0x130(%rsp), %rsi
callq 0x41790
movb %al, 0x12f(%rsp)
jmp 0x50db7
movb 0x12f(%rsp), %al
andb $0x1, %al
movb %al, 0x267(%rsp)
movb 0x267(%rsp), %al
andb $0x1, %al
movb %al, 0x253(%rsp)
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x50df5
movl 0x2bc(%rsp), %eax
movl %eax, 0x128(%rsp)
jmp 0x50e03
movl 0x2b8(%rsp), %eax
movl %eax, 0x128(%rsp)
movl 0x128(%rsp), %eax
movl %eax, 0x24c(%rsp)
movq 0x338(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x4e5d0
testb $0x1, (%rax)
je 0x50e48
movq 0x268(%rsp), %rax
movl (%rax), %eax
cmpl 0x2d4(%rsp), %eax
setge %al
movb %al, 0x127(%rsp)
jmp 0x50e63
movq 0x268(%rsp), %rax
movl (%rax), %eax
cmpl 0x2d0(%rsp), %eax
setge %al
movb %al, 0x127(%rsp)
movb 0x127(%rsp), %al
andb $0x1, %al
movb %al, 0x24b(%rsp)
movl 0x24c(%rsp), %eax
movq 0x2f0(%rsp), %rcx
cmpl 0x54(%rcx), %eax
jl 0x50e9a
xorl %eax, %eax
testb $0x1, 0x253(%rsp)
movb %al, 0x126(%rsp)
je 0x50ed9
movq 0x268(%rsp), %rdi
addq $0x20, %rdi
callq 0x23440
movq %rax, %rcx
movb $0x1, %al
cmpq $0x1, %rcx
movb %al, 0x125(%rsp)
ja 0x50ecb
movb 0x24b(%rsp), %al
movb %al, 0x125(%rsp)
movb 0x125(%rsp), %al
movb %al, 0x126(%rsp)
movb 0x126(%rsp), %al
andb $0x1, %al
movb %al, 0x24a(%rsp)
movq 0x2f0(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x51158
movq 0x460ee(%rip), %rdi     # 0x96ff0
leaq 0x2cff6(%rip), %rsi     # 0x7deff
callq 0x8360
movq %rax, 0x118(%rsp)
jmp 0x50f18
movq 0x118(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x8100
movq %rax, 0x110(%rsp)
jmp 0x50f37
movq 0x110(%rsp), %rdi
movq 0x4606a(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x50f4d
movq 0x4609c(%rip), %rdi     # 0x96ff0
leaq 0x2cfab(%rip), %rsi     # 0x7df06
callq 0x8360
movq %rax, 0x108(%rsp)
jmp 0x50f6a
movq 0x108(%rsp), %rdi
movzbl 0x267(%rsp), %esi
andl $0x1, %esi
callq 0x8760
movq %rax, 0x100(%rsp)
jmp 0x50f8c
movq 0x100(%rsp), %rdi
movq 0x46015(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x50fa2
movq 0x46047(%rip), %rdi     # 0x96ff0
leaq 0x2cf5f(%rip), %rsi     # 0x7df0f
callq 0x8360
movq %rax, 0xf8(%rsp)
jmp 0x50fbf
movq 0xf8(%rsp), %rdi
movl 0x24c(%rsp), %esi
callq 0x8710
movq %rax, 0xf0(%rsp)
jmp 0x50fdd
movq 0xf0(%rsp), %rdi
movq 0x45fc4(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x50ff3
movq 0x45ff6(%rip), %rdi     # 0x96ff0
leaq 0x2cf16(%rip), %rsi     # 0x7df17
callq 0x8360
movq %rax, 0xe8(%rsp)
jmp 0x51010
xorl %eax, %eax
testb $0x1, 0x24a(%rsp)
movb %al, 0xe7(%rsp)
je 0x51037
movq 0x268(%rsp), %rax
movb 0x18(%rax), %al
xorb $-0x1, %al
movb %al, 0xe7(%rsp)
movq 0xe8(%rsp), %rdi
movb 0xe7(%rsp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x8760
movq %rax, 0xd8(%rsp)
jmp 0x5105b
movq 0xd8(%rsp), %rdi
movq 0x45f46(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x51071
movq 0x45f78(%rip), %rdi     # 0x96ff0
leaq 0x2cea1(%rip), %rsi     # 0x7df20
callq 0x8360
movq %rax, 0xd0(%rsp)
jmp 0x5108e
movq 0x268(%rsp), %rdi
addq $0x20, %rdi
callq 0x23440
movq 0xd0(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0xc8(%rsp)
jmp 0x510b9
movq 0xc8(%rsp), %rdi
movq 0x45ee8(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x510cf
movq 0x45f1a(%rip), %rdi     # 0x96ff0
leaq 0x2ce4d(%rip), %rsi     # 0x7df2a
callq 0x8360
movq %rax, 0xc0(%rsp)
jmp 0x510ec
movq 0xc0(%rsp), %rdi
movq 0x268(%rsp), %rax
movl (%rax), %esi
callq 0x8710
movq %rax, 0xb8(%rsp)
jmp 0x5110d
movq 0xb8(%rsp), %rdi
movq 0x45e94(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x51123
jmp 0x51158
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x4e870
leaq 0x288(%rsp), %rdi
callq 0x4e870
jmp 0x51cf7
testb $0x1, 0x24a(%rsp)
je 0x51886
movq 0x268(%rsp), %rax
testb $0x1, 0x18(%rax)
jne 0x51886
movq 0x268(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x240(%rsp)
movq 0x308(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x240(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4c8f0
movq 0xb0(%rsp), %rdi
movq (%rax), %rsi
leaq 0x238(%rsp), %rdx
leaq 0x230(%rsp), %rcx
callq 0x4e1b0
jmp 0x511cf
movq 0x338(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x4e5d0
testb $0x1, (%rax)
je 0x514de
movq 0x2f0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x51230
movq 0x45dee(%rip), %rdi     # 0x96ff0
leaq 0x2d455(%rip), %rsi     # 0x7e65e
callq 0x8360
movq %rax, 0xa8(%rsp)
jmp 0x51218
movq 0xa8(%rsp), %rdi
movq 0x45d89(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x5122e
jmp 0x51230
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, 0x220(%rsp)
movq 0x308(%rsp), %rax
addq $0x50, %rax
movq %rax, 0xa0(%rsp)
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x51284
movq 0x300(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x98(%rsp)
jmp 0x51298
movq 0x300(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x240(%rsp), %rdx
movl 0x2cc(%rsp), %ecx
movl 0x348(%rsp), %r8d
movl 0x2d4(%rsp), %r9d
movq 0x2f0(%rsp), %r10
movq 0x238(%rsp), %r11
movq 0x230(%rsp), %rbx
movq 0x300(%rsp), %r14
movq 0x268(%rsp), %rax
movzbl 0x4(%rax), %ebp
andl $0x1, %ebp
movq %rsp, %rax
movl %ebp, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x3f5b0
movl %eax, 0x94(%rsp)
jmp 0x51319
movl 0x94(%rsp), %eax
movl %eax, 0x22c(%rsp)
movq 0x2f0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x513bf
movq 0x45cb0(%rip), %rdi     # 0x96ff0
leaq 0x2d334(%rip), %rsi     # 0x7e67b
callq 0x8360
movq %rax, 0x88(%rsp)
jmp 0x51356
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq 0x88(%rsp), %rdi
movq %rax, %rsi
movq 0x220(%rsp), %rax
subq %rax, %rsi
callq 0x8100
movq %rax, 0x80(%rsp)
jmp 0x5138f
movq 0x80(%rsp), %rdi
leaq 0x2d149(%rip), %rsi     # 0x7e4e7
callq 0x8360
movq %rax, 0x78(%rsp)
jmp 0x513aa
movq 0x78(%rsp), %rdi
movq 0x45bfa(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x513bd
jmp 0x513bf
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, 0x218(%rsp)
movq 0x220(%rsp), %rax
movq %rax, 0x210(%rsp)
movq 0x210(%rsp), %rax
cmpq 0x218(%rsp), %rax
jae 0x514d9
movq 0x220(%rsp), %rsi
movl %esi, %eax
movl %eax, 0x74(%rsp)
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdae0
movl 0x74(%rsp), %edx
movq (%rax), %rax
movl 0x70(%rax), %ecx
leaq 0x204(%rsp), %rdi
movl $0x1, %esi
callq 0x4e660
jmp 0x51441
leaq 0x288(%rsp), %rdi
leaq 0x204(%rsp), %rsi
callq 0x4e630
jmp 0x51458
movq 0x308(%rsp), %rdi
movq 0x300(%rsp), %rsi
movq 0x2f8(%rsp), %rdx
movq 0x2f0(%rsp), %r8
movq 0x2e8(%rsp), %r9
movq 0x330(%rsp), %rcx
movl 0x350(%rsp), %r10d
movl 0x220(%rsp), %r11d
movq %rsp, %rax
movl %r11d, 0x18(%rax)
leaq 0x270(%rsp), %r11
movq %r11, 0x10(%rax)
movl %r10d, 0x8(%rax)
movq %rcx, (%rax)
movl $0x1, %ecx
callq 0x52e60
jmp 0x514be
jmp 0x514c0
movq 0x210(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x210(%rsp)
jmp 0x513eb
jmp 0x5179b
movq 0x2f0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x5151b
movq 0x45afd(%rip), %rdi     # 0x96ff0
leaq 0x2d1a9(%rip), %rsi     # 0x7e6a3
callq 0x8360
movq %rax, 0x68(%rsp)
jmp 0x51506
movq 0x68(%rsp), %rdi
movq 0x45a9e(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x51519
jmp 0x5151b
movq 0x2f8(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, 0x220(%rsp)
movq 0x308(%rsp), %rax
addq $0x50, %rax
movq %rax, 0x60(%rsp)
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x51569
movq 0x2f8(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x58(%rsp)
jmp 0x5157a
movq 0x2f8(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x240(%rsp), %rdx
movl 0x2c8(%rsp), %ecx
movl 0x350(%rsp), %r8d
movl 0x2d0(%rsp), %r9d
movq 0x2f0(%rsp), %r10
movq 0x238(%rsp), %r11
movq 0x230(%rsp), %rbx
movq 0x2f8(%rsp), %r14
movq 0x268(%rsp), %rax
movzbl 0x4(%rax), %ebp
andl $0x1, %ebp
movq %rsp, %rax
movl %ebp, 0x20(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x3f5b0
movl %eax, 0x54(%rsp)
jmp 0x515f2
movl 0x54(%rsp), %eax
movl %eax, 0x22c(%rsp)
movq 0x2f0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x51685
movq 0x459de(%rip), %rdi     # 0x96ff0
leaq 0x2d0a8(%rip), %rsi     # 0x7e6c1
callq 0x8360
movq %rax, 0x48(%rsp)
jmp 0x51625
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq 0x48(%rsp), %rdi
movq %rax, %rsi
movq 0x220(%rsp), %rax
subq %rax, %rsi
callq 0x8100
movq %rax, 0x40(%rsp)
jmp 0x51658
movq 0x40(%rsp), %rdi
leaq 0x2ce83(%rip), %rsi     # 0x7e4e7
callq 0x8360
movq %rax, 0x38(%rsp)
jmp 0x51670
movq 0x38(%rsp), %rdi
movq 0x45934(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x51683
jmp 0x51685
movq 0x2f8(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, 0x1f8(%rsp)
movq 0x220(%rsp), %rax
movq %rax, 0x1f0(%rsp)
movq 0x1f0(%rsp), %rax
cmpq 0x1f8(%rsp), %rax
jae 0x51799
movq 0x220(%rsp), %rsi
movl %esi, %eax
movl %eax, 0x34(%rsp)
movq 0x2f8(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdae0
movl 0x34(%rsp), %edx
movq (%rax), %rax
movl 0x70(%rax), %ecx
leaq 0x1e4(%rsp), %rdi
xorl %esi, %esi
callq 0x4e660
jmp 0x51704
leaq 0x288(%rsp), %rdi
leaq 0x1e4(%rsp), %rsi
callq 0x4e630
jmp 0x5171b
movq 0x308(%rsp), %rdi
movq 0x2f8(%rsp), %rsi
movq 0x300(%rsp), %rdx
movq 0x2f0(%rsp), %r8
movq 0x2e8(%rsp), %r9
movq 0x2e0(%rsp), %rcx
movl 0x348(%rsp), %r10d
movl 0x220(%rsp), %r11d
movq %rsp, %rax
movl %r11d, 0x18(%rax)
leaq 0x288(%rsp), %r11
movq %r11, 0x10(%rax)
movl %r10d, 0x8(%rax)
movq %rcx, (%rax)
xorl %ecx, %ecx
callq 0x52e60
jmp 0x5177e
jmp 0x51780
movq 0x1f0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1f0(%rsp)
jmp 0x516b1
jmp 0x5179b
movq 0x268(%rsp), %rax
movb $0x1, 0x18(%rax)
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x517c8
movl 0x2bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2bc(%rsp)
jmp 0x517d9
movl 0x2b8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2b8(%rsp)
cmpl $0x0, 0x22c(%rsp)
jl 0x51829
movq 0x2f0(%rsp), %rax
testb $0x1, 0x5c(%rax)
je 0x51801
movl 0x2a4(%rsp), %eax
cmpl 0x22c(%rsp), %eax
jge 0x51829
movq 0x268(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0x5181c
movl $0x0, 0x2bc(%rsp)
jmp 0x51827
movl $0x0, 0x2b8(%rsp)
jmp 0x51829
movq 0x300(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, 0x28(%rsp)
movq 0x2f8(%rsp), %rdi
addq $0xb0, %rdi
callq 0xdac0
movq %rax, %rcx
movq 0x28(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x2a0(%rsp)
leaq 0x2a4(%rsp), %rdi
leaq 0x22c(%rsp), %rsi
callq 0x14d40
movl (%rax), %eax
movl %eax, 0x2a4(%rsp)
movq 0x2c0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2c0(%rsp)
jmp 0x50c53
jmp 0x518a1
movl $0x8, 0x1dc(%rsp)
movq $0x0, 0x1c0(%rsp)
cmpq $0x0, 0x2b0(%rsp)
je 0x51a9c
movslq 0x1dc(%rsp), %rdi
movl $0x8, %esi
callq 0x8220
movq %rax, 0x1c0(%rsp)
movq %rax, 0x1c8(%rsp)
movq 0x2b0(%rsp), %rax
movq (%rax), %rcx
movq 0x1c8(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x1c8(%rsp)
movq %rcx, (%rax)
movq 0x1c8(%rsp), %rax
cmpq 0x1c0(%rsp), %rax
je 0x51a9a
movq 0x1c8(%rsp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, 0x1c8(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rax
movl (%rax), %eax
shll $0x1f, %eax
sarl $0x1f, %eax
cmpl $0x0, %eax
jne 0x5196b
movq 0x1d0(%rsp), %rdi
callq 0x8470
jmp 0x5190e
movl $0x0, 0x1e0(%rsp)
movl 0x1e0(%rsp), %eax
movq 0x1d0(%rsp), %rcx
movl (%rcx), %ecx
sarl %ecx
cmpl %ecx, %eax
jg 0x51a88
movq 0x1d0(%rsp), %rax
movq 0x2b0(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movslq 0x1e0(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x51a70
movq 0x1c8(%rsp), %rax
movq 0x1c0(%rsp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movslq 0x1dc(%rsp), %rcx
cmpq %rcx, %rax
jne 0x51a33
movl 0x1dc(%rsp), %eax
shll %eax
movl %eax, 0x1dc(%rsp)
movq 0x1c0(%rsp), %rdi
movslq 0x1dc(%rsp), %rsi
shlq $0x3, %rsi
callq 0x86d0
movq %rax, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rax
movl 0x1dc(%rsp), %ecx
sarl %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rax
movq 0x2b0(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movslq 0x1e0(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x1c8(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x1c8(%rsp)
movq %rcx, (%rax)
jmp 0x51a72
movl 0x1e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e0(%rsp)
jmp 0x51976
movq 0x1d0(%rsp), %rdi
callq 0x8470
jmp 0x5190e
jmp 0x51a9c
movq 0x2b0(%rsp), %rdi
callq 0x8470
movq 0x1c0(%rsp), %rdi
callq 0x8470
jmp 0x51ab8
jmp 0x51aba
movl $0x8, 0x1b8(%rsp)
movq $0x0, 0x1a0(%rsp)
cmpq $0x0, 0x2a8(%rsp)
je 0x51cb5
movslq 0x1b8(%rsp), %rdi
movl $0x8, %esi
callq 0x8220
movq %rax, 0x1a0(%rsp)
movq %rax, 0x1a8(%rsp)
movq 0x2a8(%rsp), %rax
movq (%rax), %rcx
movq 0x1a8(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x1a8(%rsp)
movq %rcx, (%rax)
movq 0x1a8(%rsp), %rax
cmpq 0x1a0(%rsp), %rax
je 0x51cb3
movq 0x1a8(%rsp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, 0x1a8(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rax
movl (%rax), %eax
shll $0x1f, %eax
sarl $0x1f, %eax
cmpl $0x0, %eax
jne 0x51b84
movq 0x1b0(%rsp), %rdi
callq 0x8470
jmp 0x51b27
movl $0x0, 0x1bc(%rsp)
movl 0x1bc(%rsp), %eax
movq 0x1b0(%rsp), %rcx
movl (%rcx), %ecx
sarl %ecx
cmpl %ecx, %eax
jg 0x51ca1
movq 0x1b0(%rsp), %rax
movq 0x2a8(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movslq 0x1bc(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x51c89
movq 0x1a8(%rsp), %rax
movq 0x1a0(%rsp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movslq 0x1b8(%rsp), %rcx
cmpq %rcx, %rax
jne 0x51c4c
movl 0x1b8(%rsp), %eax
shll %eax
movl %eax, 0x1b8(%rsp)
movq 0x1a0(%rsp), %rdi
movslq 0x1b8(%rsp), %rsi
shlq $0x3, %rsi
callq 0x86d0
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rax
movl 0x1b8(%rsp), %ecx
sarl %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x1a8(%rsp)
movq 0x1b0(%rsp), %rax
movq 0x2a8(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movslq 0x1bc(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x1a8(%rsp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x1a8(%rsp)
movq %rcx, (%rax)
jmp 0x51c8b
movl 0x1bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1bc(%rsp)
jmp 0x51b8f
movq 0x1b0(%rsp), %rdi
callq 0x8470
jmp 0x51b27
jmp 0x51cb5
movq 0x2a8(%rsp), %rdi
callq 0x8470
movq 0x1a0(%rsp), %rdi
callq 0x8470
jmp 0x51cd1
leaq 0x270(%rsp), %rdi
callq 0x4e870
leaq 0x288(%rsp), %rdi
callq 0x4e870
addq $0x310, %rsp            # imm = 0x310
popq %rbx
popq %r14
popq %rbp
retq
movq 0x258(%rsp), %rdi
callq 0x8730
nopw %cs:(%rax,%rax)
nop