// File: readmapping[P]alfalfa/src/mapper.cpp
// Function: extendAlignmentChain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<match_t, std::allocator<match_t>> const&, int, int, int, align_opt const&, long, long, read_t&, bool)
int extendAlignmentChain(const string& S, const string& P, 
        const vector<match_t>& matches, int editDist, int minScore, int minCoverage, 
        const align_opt & alnOptions, long chrStart, long chrEnd, read_t & read, bool fw){
    int maxAlnScore = min(-1, minScore-10);
    if(alnOptions.print >= 5){
        cerr << "min Score is " << minScore << endl;
        cerr << "seeds are: " << endl;
        for(size_t i = 0; i < matches.size(); i++)
            cerr << matches[i].query << "," << matches[i].ref << "," << matches[i].len << endl;
    }
    list<size_t> chain;
    //seeds in order of 
    vector<long> seedOrder;
    seedOrder.reserve(matches.size());
    vector<bool> used;
    used.assign(matches.size(),false);
    for(size_t i = 0; i < matches.size(); i++)
        seedOrder.push_back((long)matches[i].len<<32 | i);
    sort(seedOrder.begin(), seedOrder.end());
    //for all seeds:
    vector<boundaries> alnBounds;
    vector<int> alnScores;
    vector<long> alnBegins;
    for(int i = seedOrder.size()-1; i >=0; i--){
        size_t anchorPos = (uint32_t)seedOrder[i];
        match_t anchor = matches[anchorPos];
        if(alnOptions.print >= 5) cerr << "anchor " << anchor.query << "," << anchor.ref << "," << anchor.len << endl;
        //check if current anchor is not already in alignment
        bool extend = !used[anchorPos];
        size_t j = 0;
        while(j < alnBounds.size() && extend){
            bool notContained = anchor.query < alnBounds[j].queryB || anchor.query+anchor.len >= alnBounds[j].queryE || anchor.ref < alnBounds[j].refB || anchor.ref+anchor.len >= alnBounds[j].refE;
            if(!notContained){
                int qDist = anchor.query - alnBounds[j].queryB;
                int refDist = anchor.ref - alnBounds[j].refB;
                int max_gapL = min(alnOptions.fixedBandSize, (int)((min(qDist,refDist)*alnOptions.match + alnOptions.openGap)/alnOptions.extendGap + 1.));
                extend = max(qDist,refDist) >= max_gapL;
                if(extend){
                    qDist = alnBounds[j].queryE - (anchor.query+anchor.len);
                    refDist = alnBounds[j].refE - (anchor.ref+anchor.len);
                    max_gapL = min(alnOptions.fixedBandSize, (int)((min(qDist,refDist)*alnOptions.match + alnOptions.openGap)/alnOptions.extendGap + 1.));
                    extend = max(qDist,refDist) >= max_gapL;
                }
            }
            j++;
        }
        if(extend){
            //CREATE CHAIN AROUND THIS ANCHOR
            int curScore = 0;
            int minEdit = nextChain(matches, chain, anchorPos, alnOptions.errorPercent, used, P.length(), curScore);
            int chainScore = curScore;//for debug purpose
            if(alnOptions.print >= 2){
                cerr << "#CHAIN " << chain.size() << endl;
                cerr << "#CHAINSCORE " << curScore << endl;
                cerr << "#CHAINSKEW " << minEdit << endl;
                cerr << "#CHAINMINSCORE " << minCoverage << endl;
                if(alnOptions.print >= 5)
                        cerr << "extend chain of size " << chain.size() << " elements and minEdit,curScore =  " << minEdit << "," << curScore << endl;
            }
            //ITERATE THROUGH CHAIN
            if(minEdit <= editDist && (chain.size() > 1 || anchor.len >= minCoverage )){
                std::list<size_t>::const_iterator iterator = chain.begin(), itEnd = chain.end();
                int bandSize = min(alnOptions.fixedBandSize, (int)(editDist-minEdit+1));
                anchor = matches[*iterator];
                iterator++;
                int tmpQB = anchor.query;
                int tmpQE = anchor.query+anchor.len-1;
                long tmpRB = anchor.ref;
                long tmpRE = anchor.ref + anchor.len-1L;
                if(alnOptions.print >= 7) cerr << "first seed (q/r/l): " << tmpQB << "," << tmpRB << "," << anchor.len << endl;
                //INSIDE CHAIN
                while(iterator != itEnd){
                    match_t seed = matches[*iterator];
                    if(alnOptions.print >= 6) cerr << "current seed (q/r/l): " << seed.query << "," << seed.ref << "," << seed.len << endl;
                    long qDist = seed.query - tmpQE;
                    long refDist = seed.ref - tmpRE;
                    if (qDist < 0 || refDist < 0) {
                        if (qDist >= refDist)
                            qDist -= refDist; //qDist insertions
                        else
                            refDist -= qDist;
                    }
                    if (qDist <= 0) {//minRefDist deletions
                        //1+|qDist| matches lost of next mem
                        curScore += alnOptions.openGap + alnOptions.extendGap*refDist;
                        if(alnOptions.print >= 7) cerr << "added deletion of size " << refDist << endl;
                    } else if (refDist <= 0) {
                        curScore += alnOptions.openGap + alnOptions.extendGap*qDist;
                        if(alnOptions.print >= 7) cerr << "added insertion of size " << qDist << endl;
                    } else if (qDist == 1) {
                        curScore += alnOptions.openGap + alnOptions.extendGap*(refDist-1);
                        if(alnOptions.print >= 7) cerr << "added deletion of size " << refDist-1 << endl;
                    } else if (refDist == 1) {
                        curScore += alnOptions.openGap + alnOptions.extendGap*(qDist-1);
                        if(alnOptions.print >= 7) cerr << "added insertion of size " << qDist-1 << endl;
                    } else if (refDist == 2 && qDist==2) {
                        curScore += alnOptions.mismatch;
                        if(alnOptions.print >= 7) cerr << "added mutation" << endl;
                    } else {//both distances are positive and not equal to (1,1), otherwise seeds would not be maximal!
                        uint8_t *target;
                        int tLen = seed.ref - tmpRE - 1;
                        target = (uint8_t *)malloc(tLen);
                        for (int j = 0; j < tLen; ++j) // convert to the nt4 encoding
                            target[j] = Utils::ORDVALUE[(size_t)S[tmpRE+1+j]];
                        uint8_t *query;
                        int qLen = seed.query - tmpQE - 1;
                        query = (uint8_t *)malloc(qLen);
                        for (int j = 0; j < qLen; ++j)
                            query[j] = Utils::ORDVALUE[(size_t)P[tmpQE+1+j]];
                        int innerBand = min(alnOptions.fixedBandSize, (int)(editDist-minEdit+abs(qLen-tLen)+3));
                        innerBand = max(innerBand,abs(qLen-tLen)+(int)(abs(qLen-tLen)*alnOptions.errorPercent));
                        if(alnOptions.print >= 2) cerr << "#DP " << (tLen*innerBand) << endl;
                        if(alnOptions.print >= 7) cerr << "dp called with dimension " << (seed.query-tmpQE+1) << "x" << (seed.ref-tmpRE+1) << " and band " << innerBand << endl;
                        curScore += ksw_nw(qLen, query, tLen, target, 5, alnOptions.mat, 
                                -1*alnOptions.openGap, -1*alnOptions.extendGap, innerBand);
                        free(query);
                        free(target);
                    }
                    if(alnOptions.print >= 6) cerr << "curScore is " << curScore << endl;
                    //update bounds
                    tmpRE = seed.ref + seed.len - 1L;
                    tmpQE = seed.query + seed.len - 1;            
                    ++iterator;
                }
                //lef-right extensions
                if(tmpQB <= (int)(P.length()-1)-tmpQE){
                    leftExtension(S, P, tmpQB, tmpRB, chrStart, alnOptions, curScore, bandSize, editDist-minEdit+1);
                    rightExtension(S, P, tmpQE, tmpRE, chrEnd, alnOptions, curScore, bandSize, editDist);
                }
                else{
                    rightExtension(S, P, tmpQE, tmpRE, chrEnd, alnOptions, curScore, bandSize, editDist);
                    leftExtension(S, P, tmpQB, tmpRB, chrStart, alnOptions, curScore, bandSize, editDist-minEdit+1);
                }
                if(alnOptions.print >= 5) cerr << "current alignments startpos would be " << tmpRB << endl;
                maxAlnScore = max(maxAlnScore, curScore);
                if(curScore >= minScore){
                    if(alnOptions.print >= 2) cerr << "#SUCCES " << curScore << endl;
                    bool equal = false;
                    for(size_t i = 0; i < alnScores.size(); i++){
                        if(alnScores[i]>= curScore && abs(alnBegins[i]-tmpRB) < editDist)
                            equal = true;
                    }
                    if(!equal){
                        alignment_t * alignmentFound = new alignment_t();
                        alignmentFound->refB = tmpRB;
                        alignmentFound->refE = tmpRE;
                        alignmentFound->qB = tmpQB;
                        alignmentFound->qE = tmpQE;
                        alignmentFound->alignmentScore = curScore;
                        if(!fw){
                            alignmentFound->flag.set(4,true);
                        }
                        alignmentFound->refLength = (tmpRE-tmpRB+1);
                        for(std::list<size_t>::const_iterator iterator = chain.begin(); iterator != chain.end(); iterator++){
                            match_t seed = matches[*iterator];
                            alignmentFound->chain.push_back(seed);
                        }
                        read.alignments.push_back(alignmentFound);
                        alnScores.push_back(curScore);
                        alnBegins.push_back(tmpRB);
                    }
                }
                else if(alnOptions.print >= 2)
                    cerr << "#FAIL " << curScore << endl;
                if(alnOptions.print >= 5) cerr << "final score is " << curScore << endl;
                alnBounds.push_back(boundaries(tmpRB, tmpRE, tmpQB, tmpQE));
#ifndef NDEBUG
                if(alnOptions.debugFile != NULL){
                    //print alignment
                    fprintf(alnOptions.debugFile,"@CHA %lu %d %d\n", chain.size(), chainScore, anchor.len);
                    for( list<size_t>::const_iterator iterator = chain.begin(); iterator != chain.end(); iterator++){
                        fprintf(alnOptions.debugFile,"%d %ld %d\n", matches[*iterator].query, matches[*iterator].ref, matches[*iterator].len);
                    }
                    if(curScore >= (int) (P.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*editDist)){
                        alignment_t * alignmentFound = new alignment_t();
                        alignmentFound->refB = tmpRB;
                        alignmentFound->refE = tmpRE;
                        alignmentFound->qB = tmpQB;
                        alignmentFound->qE = tmpQE;
                        alignmentFound->alignmentScore = curScore;
                        for(std::list<size_t>::const_iterator iterator = chain.begin(); iterator != chain.end(); iterator++){
                            match_t seed = matches[*iterator];
                            alignmentFound->chain.push_back(seed);
                        }
                        uint8_t *query;
                        query = (uint8_t *)malloc(P.length());
                        for (size_t i = 0; i < P.length(); ++i) // convert to the nt4 encoding
                            query[i] = Utils::ORDVALUE[(size_t)P[i]];
                        alignmentFound->constructCIGAR(S, query, P.length(), alnOptions.fixedBandSize, alnOptions.mat, 
                                alnOptions.match, alnOptions.openGap, alnOptions.extendGap, 0);
                        free(query);
                        fprintf(alnOptions.debugFile,"@SUC %d %ld %s %d\n", alignmentFound->editDist, tmpRB, alignmentFound->NMtag.c_str(), curScore);
                        delete alignmentFound;
                    }
                    else{//print fail reason
                        fprintf(alnOptions.debugFile,"@ERR %ld %d\n", tmpRB, curScore);
                    }
                    //print best possible alignment
                    long refB = matches[chain.front()].ref - matches[chain.front()].query - 3*editDist;
                    long refE = refB+P.length() + 6*editDist;
                    dp_output output = dpInRegion(S, P, refB, refE, 0, P.length());
                    string cigarstring = createCigar(output.cigarChars, output.cigarLengths);
                    fprintf(alnOptions.debugFile,"@BEST %d %ld %s %d\n", output.editDist, refB, cigarstring.c_str(), output.dpScore);
                }
#endif
            }
        }
    }
    int scoreReturned = -1;
    if(maxAlnScore >= minScore)
        scoreReturned = maxAlnScore;
    return scoreReturned;
}

// Assembly:
subq $0x5d8, %rsp            # imm = 0x5D8
movb 0x600(%rsp), %al
movq 0x5f8(%rsp), %r10
movq 0x5f0(%rsp), %r10
movq 0x5e8(%rsp), %r10
movq 0x5e0(%rsp), %r10
movq %rdi, 0x5d0(%rsp)
movq %rsi, 0x5c8(%rsp)
movq %rdx, 0x5c0(%rsp)
movl %ecx, 0x5bc(%rsp)
movl %r8d, 0x5b8(%rsp)
movl %r9d, 0x5b4(%rsp)
andb $0x1, %al
movb %al, 0x5b3(%rsp)
movl $0xffffffff, 0x5a8(%rsp) # imm = 0xFFFFFFFF
movl 0x5b8(%rsp), %eax
subl $0xa, %eax
movl %eax, 0x5a4(%rsp)
leaq 0x5a8(%rsp), %rdi
leaq 0x5a4(%rsp), %rsi
callq 0xc080
movl (%rax), %eax
movl %eax, 0x5ac(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x3f7b8
movq 0x57987(%rip), %rdi     # 0x96ff0
leaq 0x3e73f(%rip), %rsi     # 0x7ddaf
callq 0x8360
movq %rax, %rdi
movl 0x5b8(%rsp), %esi
callq 0x8710
movq %rax, %rdi
movq 0x57922(%rip), %rsi     # 0x96fb0
callq 0x83b0
movq 0x57956(%rip), %rdi     # 0x96ff0
leaq 0x3e71c(%rip), %rsi     # 0x7ddbd
callq 0x8360
movq %rax, %rdi
movq 0x57900(%rip), %rsi     # 0x96fb0
callq 0x83b0
movq $0x0, 0x598(%rsp)
movq 0x598(%rsp), %rax
movq %rax, 0x350(%rsp)
movq 0x5c0(%rsp), %rdi
callq 0x23440
movq %rax, %rcx
movq 0x350(%rsp), %rax
cmpq %rcx, %rax
jae 0x3f7b6
movq 0x5c0(%rsp), %rdi
movq 0x598(%rsp), %rsi
callq 0x4c8f0
movl 0x8(%rax), %esi
movq 0x578df(%rip), %rdi     # 0x96ff0
callq 0x8710
movq %rax, %rdi
leaq 0x3e5d0(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x340(%rsp)
movq 0x5c0(%rsp), %rdi
movq 0x598(%rsp), %rsi
callq 0x4c8f0
movq 0x340(%rsp), %rdi
movq (%rax), %rsi
callq 0x8790
movq %rax, %rdi
leaq 0x3e594(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x348(%rsp)
movq 0x5c0(%rsp), %rdi
movq 0x598(%rsp), %rsi
callq 0x4c8f0
movq 0x348(%rsp), %rdi
movl 0xc(%rax), %esi
callq 0x8710
movq %rax, %rdi
movq 0x57818(%rip), %rsi     # 0x96fb0
callq 0x83b0
movq 0x598(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x598(%rsp)
jmp 0x3f6c1
jmp 0x3f7b8
leaq 0x580(%rsp), %rdi
callq 0x4cad0
leaq 0x568(%rsp), %rdi
movq %rdi, 0x338(%rsp)
callq 0xecb0
movq 0x5c0(%rsp), %rdi
callq 0x23440
movq 0x338(%rsp), %rdi
movq %rax, %rsi
callq 0x4cae0
jmp 0x3f7f9
leaq 0x530(%rsp), %rdi
movq %rdi, 0x330(%rsp)
callq 0x4cbf0
movq 0x5c0(%rsp), %rdi
callq 0x23440
movq 0x330(%rsp), %rdi
movq %rax, %rsi
movb $0x0, 0x52f(%rsp)
leaq 0x52f(%rsp), %rdx
callq 0x4cc00
jmp 0x3f83d
movq $0x0, 0x520(%rsp)
movq 0x520(%rsp), %rax
movq %rax, 0x328(%rsp)
movq 0x5c0(%rsp), %rdi
callq 0x23440
movq %rax, %rcx
movq 0x328(%rsp), %rax
cmpq %rcx, %rax
jae 0x3f90d
movq 0x5c0(%rsp), %rdi
movq 0x520(%rsp), %rsi
callq 0x4c8f0
movl 0xc(%rax), %eax
shlq $0x20, %rax
movq 0x520(%rsp), %rcx
orq %rcx, %rax
movq %rax, 0x518(%rsp)
leaq 0x568(%rsp), %rdi
leaq 0x518(%rsp), %rsi
callq 0x1eaf0
jmp 0x3f8c0
jmp 0x3f8c2
movq 0x520(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x520(%rsp)
jmp 0x3f849
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x560(%rsp)
movl %eax, 0x55c(%rsp)
jmp 0x4164d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x560(%rsp)
movl %eax, 0x55c(%rsp)
jmp 0x41640
leaq 0x568(%rsp), %rdi
movq %rdi, 0x320(%rsp)
callq 0x26410
movq 0x320(%rsp), %rdi
movq %rax, 0x510(%rsp)
callq 0x26250
movq %rax, 0x508(%rsp)
movq 0x510(%rsp), %rdi
movq 0x508(%rsp), %rsi
callq 0x4cc40
jmp 0x3f956
leaq 0x4f0(%rsp), %rdi
callq 0x4cc80
leaq 0x4d8(%rsp), %rdi
callq 0xe760
leaq 0x4c0(%rsp), %rdi
callq 0xecb0
leaq 0x568(%rsp), %rdi
callq 0x1f490
subq $0x1, %rax
movl %eax, 0x4bc(%rsp)
cmpl $0x0, 0x4bc(%rsp)
jl 0x4158b
movslq 0x4bc(%rsp), %rsi
leaq 0x568(%rsp), %rdi
callq 0xccd0
movl (%rax), %eax
movq %rax, 0x4b0(%rsp)
movq 0x5c0(%rsp), %rdi
movq 0x4b0(%rsp), %rsi
callq 0x4c8f0
movq %rax, %rsi
leaq 0x4a0(%rsp), %rdi
callq 0x231a0
jmp 0x3f9e9
movq 0x5e0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x3fae0
movq 0x575ee(%rip), %rdi     # 0x96ff0
leaq 0x3e3c0(%rip), %rsi     # 0x7ddc9
callq 0x8360
movq %rax, 0x318(%rsp)
jmp 0x3fa18
movq 0x318(%rsp), %rdi
movl 0x4a8(%rsp), %esi
callq 0x8710
movq %rax, 0x310(%rsp)
jmp 0x3fa36
movq 0x310(%rsp), %rdi
leaq 0x3e2ab(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x308(%rsp)
jmp 0x3fa54
movq 0x308(%rsp), %rdi
movq 0x4a0(%rsp), %rsi
callq 0x8790
movq %rax, 0x300(%rsp)
jmp 0x3fa73
movq 0x300(%rsp), %rdi
leaq 0x3e26e(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x2f8(%rsp)
jmp 0x3fa91
movq 0x2f8(%rsp), %rdi
movl 0x4ac(%rsp), %esi
callq 0x8710
movq %rax, 0x2f0(%rsp)
jmp 0x3faaf
movq 0x2f0(%rsp), %rdi
movq 0x574f2(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x3fac5
jmp 0x3fae0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x560(%rsp)
movl %eax, 0x55c(%rsp)
jmp 0x41619
movq 0x4b0(%rsp), %rsi
leaq 0x530(%rsp), %rdi
callq 0x4c9e0
movq %rdx, 0x2e0(%rsp)
movq %rax, 0x2e8(%rsp)
jmp 0x3fb07
movq 0x2e0(%rsp), %rax
movq 0x2e8(%rsp), %rcx
movq %rcx, 0x488(%rsp)
movq %rax, 0x490(%rsp)
leaq 0x488(%rsp), %rdi
callq 0x4cc90
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0x49f(%rsp)
movq $0x0, 0x480(%rsp)
movq 0x480(%rsp), %rax
movq %rax, 0x2d0(%rsp)
leaq 0x4f0(%rsp), %rdi
callq 0x4ccc0
movq 0x2d0(%rsp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x2df(%rsp)
jae 0x3fb8f
movb 0x49f(%rsp), %al
movb %al, 0x2df(%rsp)
movb 0x2df(%rsp), %al
testb $0x1, %al
jne 0x3fb9f
jmp 0x3ff91
movl 0x4a8(%rsp), %eax
movl %eax, 0x2c8(%rsp)
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
callq 0x4cce0
movl 0x2c8(%rsp), %ecx
movq %rax, %rdx
movb $0x1, %al
cmpl 0x10(%rdx), %ecx
movb %al, 0x2cf(%rsp)
jl 0x3fcab
movl 0x4a8(%rsp), %eax
addl 0x4ac(%rsp), %eax
movl %eax, 0x2c4(%rsp)
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
callq 0x4cce0
movl 0x2c4(%rsp), %ecx
movq %rax, %rdx
movb $0x1, %al
cmpl 0x14(%rdx), %ecx
movb %al, 0x2cf(%rsp)
jge 0x3fcab
movq 0x4a0(%rsp), %rax
movq %rax, 0x2b8(%rsp)
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
callq 0x4cce0
movq 0x2b8(%rsp), %rcx
movq %rax, %rdx
movb $0x1, %al
cmpq (%rdx), %rcx
movb %al, 0x2cf(%rsp)
jl 0x3fcab
movq 0x4a0(%rsp), %rax
movslq 0x4ac(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x2b0(%rsp)
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
callq 0x4cce0
movq %rax, %rcx
movq 0x2b0(%rsp), %rax
cmpq 0x8(%rcx), %rax
setge %al
movb %al, 0x2cf(%rsp)
movb 0x2cf(%rsp), %al
andb $0x1, %al
movb %al, 0x47f(%rsp)
testb $0x1, 0x47f(%rsp)
jne 0x3ff78
movl 0x4a8(%rsp), %eax
movl %eax, 0x298(%rsp)
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
movq %rdi, 0x290(%rsp)
callq 0x4cce0
movq 0x290(%rsp), %rdi
movq %rax, %rcx
movl 0x298(%rsp), %eax
movl 0x10(%rcx), %ecx
subl %ecx, %eax
movl %eax, 0x478(%rsp)
movl 0x4a0(%rsp), %eax
movl %eax, 0x29c(%rsp)
movq 0x480(%rsp), %rsi
callq 0x4cce0
movq %rax, %rcx
movl 0x29c(%rsp), %eax
movl (%rcx), %ecx
subl %ecx, %eax
movl %eax, 0x474(%rsp)
movq 0x5e0(%rsp), %rax
addq $0x90, %rax
movq %rax, 0x2a0(%rsp)
leaq 0x478(%rsp), %rdi
leaq 0x474(%rsp), %rsi
callq 0xc080
movq %rax, 0x2a8(%rsp)
jmp 0x3fd77
movq 0x2a0(%rsp), %rdi
movq 0x2a8(%rsp), %rax
movl (%rax), %eax
movq 0x5e0(%rsp), %rcx
movl (%rcx), %esi
movl 0x8(%rcx), %edx
imull %esi, %eax
addl %edx, %eax
movl 0xc(%rcx), %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
movsd 0x39b33(%rip), %xmm1    # 0x798e0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x46c(%rsp)
leaq 0x46c(%rsp), %rsi
callq 0xc080
movq %rax, 0x288(%rsp)
jmp 0x3fdd3
movq 0x288(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x470(%rsp)
leaq 0x478(%rsp), %rdi
leaq 0x474(%rsp), %rsi
callq 0x14d40
movq %rax, 0x280(%rsp)
jmp 0x3fe03
movq 0x280(%rsp), %rax
movl (%rax), %eax
cmpl 0x470(%rsp), %eax
setge %al
andb $0x1, %al
movb %al, 0x49f(%rsp)
testb $0x1, 0x49f(%rsp)
je 0x3ff76
movq 0x480(%rsp), %rsi
leaq 0x4f0(%rsp), %rdi
movq %rdi, 0x268(%rsp)
callq 0x4cce0
movq 0x268(%rsp), %rdi
movl 0x14(%rax), %eax
movl 0x4a8(%rsp), %ecx
movl 0x4ac(%rsp), %edx
addl %edx, %ecx
subl %ecx, %eax
movl %eax, 0x478(%rsp)
movq 0x480(%rsp), %rsi
callq 0x4cce0
movl 0x8(%rax), %eax
movl 0x4a0(%rsp), %ecx
movl 0x4ac(%rsp), %edx
addl %edx, %ecx
subl %ecx, %eax
movl %eax, 0x474(%rsp)
movq 0x5e0(%rsp), %rax
addq $0x90, %rax
movq %rax, 0x270(%rsp)
leaq 0x478(%rsp), %rdi
leaq 0x474(%rsp), %rsi
callq 0xc080
movq %rax, 0x278(%rsp)
jmp 0x3fecd
movq 0x270(%rsp), %rdi
movq 0x278(%rsp), %rax
movl (%rax), %eax
movq 0x5e0(%rsp), %rcx
movl (%rcx), %esi
movl 0x8(%rcx), %edx
imull %esi, %eax
addl %edx, %eax
movl 0xc(%rcx), %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
movsd 0x399dd(%rip), %xmm1    # 0x798e0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x468(%rsp)
leaq 0x468(%rsp), %rsi
callq 0xc080
movq %rax, 0x260(%rsp)
jmp 0x3ff29
movq 0x260(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x470(%rsp)
leaq 0x478(%rsp), %rdi
leaq 0x474(%rsp), %rsi
callq 0x14d40
movq %rax, 0x258(%rsp)
jmp 0x3ff59
movq 0x258(%rsp), %rax
movl (%rax), %eax
cmpl 0x470(%rsp), %eax
setge %al
andb $0x1, %al
movb %al, 0x49f(%rsp)
jmp 0x3ff78
movq 0x480(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x480(%rsp)
jmp 0x3fb4b
testb $0x1, 0x49f(%rsp)
je 0x41573
movl $0x0, 0x464(%rsp)
movq 0x5c0(%rsp), %rax
movq %rax, 0x238(%rsp)
movq 0x4b0(%rsp), %rax
movq %rax, 0x240(%rsp)
movq 0x5e0(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x248(%rsp)
movq 0x5c8(%rsp), %rdi
callq 0x8630
movq 0x238(%rsp), %rdi
movq 0x240(%rsp), %rdx
movsd 0x248(%rsp), %xmm0
movq %rax, %r8
leaq 0x580(%rsp), %rsi
leaq 0x530(%rsp), %rcx
leaq 0x464(%rsp), %r9
callq 0x3ed90
movl %eax, 0x254(%rsp)
jmp 0x4002f
movl 0x254(%rsp), %eax
movl %eax, 0x460(%rsp)
movl 0x464(%rsp), %eax
movl %eax, 0x45c(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x40292
movq 0x56f8c(%rip), %rdi     # 0x96ff0
leaq 0x3dd66(%rip), %rsi     # 0x7ddd1
callq 0x8360
movq %rax, 0x230(%rsp)
jmp 0x4007a
leaq 0x580(%rsp), %rdi
callq 0x4cd00
movq 0x230(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x228(%rsp)
jmp 0x400a1
movq 0x228(%rsp), %rdi
movq 0x56f00(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x400b7
movq 0x56f32(%rip), %rdi     # 0x96ff0
leaq 0x3dd14(%rip), %rsi     # 0x7ddd9
callq 0x8360
movq %rax, 0x220(%rsp)
jmp 0x400d4
movq 0x220(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x218(%rsp)
jmp 0x400f2
movq 0x218(%rsp), %rdi
movq 0x56eaf(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40108
movq 0x56ee1(%rip), %rdi     # 0x96ff0
leaq 0x3dcd0(%rip), %rsi     # 0x7dde6
callq 0x8360
movq %rax, 0x210(%rsp)
jmp 0x40125
movq 0x210(%rsp), %rdi
movl 0x460(%rsp), %esi
callq 0x8710
movq %rax, 0x208(%rsp)
jmp 0x40143
movq 0x208(%rsp), %rdi
movq 0x56e5e(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40159
movq 0x56e90(%rip), %rdi     # 0x96ff0
leaq 0x3dc8b(%rip), %rsi     # 0x7ddf2
callq 0x8360
movq %rax, 0x200(%rsp)
jmp 0x40176
movq 0x200(%rsp), %rdi
movl 0x5b4(%rsp), %esi
callq 0x8710
movq %rax, 0x1f8(%rsp)
jmp 0x40194
movq 0x1f8(%rsp), %rdi
movq 0x56e0d(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x401aa
movq 0x5e0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x40290
movq 0x56e2d(%rip), %rdi     # 0x96ff0
leaq 0x3dc38(%rip), %rsi     # 0x7de02
callq 0x8360
movq %rax, 0x1f0(%rsp)
jmp 0x401d9
leaq 0x580(%rsp), %rdi
callq 0x4cd00
movq 0x1f0(%rsp), %rdi
movq %rax, %rsi
callq 0x8100
movq %rax, 0x1e8(%rsp)
jmp 0x40200
movq 0x1e8(%rsp), %rdi
leaq 0x3dc09(%rip), %rsi     # 0x7de18
callq 0x8360
movq %rax, 0x1e0(%rsp)
jmp 0x4021e
movq 0x1e0(%rsp), %rdi
movl 0x460(%rsp), %esi
callq 0x8710
movq %rax, 0x1d8(%rsp)
jmp 0x4023c
movq 0x1d8(%rsp), %rdi
leaq 0x3daa5(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x1d0(%rsp)
jmp 0x4025a
movq 0x1d0(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x1c8(%rsp)
jmp 0x40278
movq 0x1c8(%rsp), %rdi
movq 0x56d29(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4028e
jmp 0x40290
jmp 0x40292
movl 0x460(%rsp), %eax
cmpl 0x5bc(%rsp), %eax
jg 0x41571
leaq 0x580(%rsp), %rdi
callq 0x4cd00
cmpq $0x1, %rax
ja 0x402cd
movl 0x4ac(%rsp), %eax
cmpl 0x5b4(%rsp), %eax
jl 0x41571
leaq 0x580(%rsp), %rdi
movq %rdi, 0x1b8(%rsp)
callq 0x4cd30
movq %rax, 0x448(%rsp)
leaq 0x450(%rsp), %rdi
leaq 0x448(%rsp), %rsi
callq 0x4cd60
movq 0x1b8(%rsp), %rdi
callq 0x4cd80
movq %rax, 0x438(%rsp)
leaq 0x440(%rsp), %rdi
leaq 0x438(%rsp), %rsi
callq 0x4cd60
movq 0x5e0(%rsp), %rdi
addq $0x90, %rdi
movl 0x5bc(%rsp), %eax
movl 0x460(%rsp), %ecx
subl %ecx, %eax
incl %eax
movl %eax, 0x430(%rsp)
leaq 0x430(%rsp), %rsi
callq 0xc080
movq %rax, 0x1c0(%rsp)
jmp 0x40368
movq 0x1c0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x434(%rsp)
movq 0x5c0(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x4cdb0
movq 0x1b0(%rsp), %rdi
movq (%rax), %rsi
callq 0x4c8f0
movq (%rax), %rcx
movq %rcx, 0x4a0(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x4a8(%rsp)
leaq 0x450(%rsp), %rdi
xorl %esi, %esi
callq 0x4cde0
movq %rax, 0x428(%rsp)
movl 0x4a8(%rsp), %eax
movl %eax, 0x424(%rsp)
movl 0x4a8(%rsp), %eax
addl 0x4ac(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x420(%rsp)
movq 0x4a0(%rsp), %rax
movq %rax, 0x418(%rsp)
movq 0x4a0(%rsp), %rax
movslq 0x4ac(%rsp), %rcx
addq %rcx, %rax
subq $0x1, %rax
movq %rax, 0x410(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x40507
movq 0x56bae(%rip), %rdi     # 0x96ff0
leaq 0x3d9f2(%rip), %rsi     # 0x7de3b
callq 0x8360
movq %rax, 0x1a8(%rsp)
jmp 0x40458
movq 0x1a8(%rsp), %rdi
movl 0x424(%rsp), %esi
callq 0x8710
movq %rax, 0x1a0(%rsp)
jmp 0x40476
movq 0x1a0(%rsp), %rdi
leaq 0x3d86b(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x198(%rsp)
jmp 0x40494
movq 0x198(%rsp), %rdi
movq 0x418(%rsp), %rsi
callq 0x8790
movq %rax, 0x190(%rsp)
jmp 0x404b3
movq 0x190(%rsp), %rdi
leaq 0x3d82e(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x188(%rsp)
jmp 0x404d1
movq 0x188(%rsp), %rdi
movl 0x4ac(%rsp), %esi
callq 0x8710
movq %rax, 0x180(%rsp)
jmp 0x404ef
movq 0x180(%rsp), %rdi
movq 0x56ab2(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40505
jmp 0x40507
jmp 0x40509
leaq 0x450(%rsp), %rdi
leaq 0x440(%rsp), %rsi
callq 0x4ce10
testb $0x1, %al
jne 0x40527
jmp 0x40ecf
movq 0x5c0(%rsp), %rax
movq %rax, 0x178(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x4cdb0
movq 0x178(%rsp), %rdi
movq (%rax), %rsi
callq 0x4c8f0
movq %rax, %rsi
leaq 0x400(%rsp), %rdi
callq 0x231a0
jmp 0x40566
movq 0x5e0(%rsp), %rax
cmpl $0x6, 0x78(%rax)
jl 0x40644
movq 0x56a71(%rip), %rdi     # 0x96ff0
leaq 0x3d8ca(%rip), %rsi     # 0x7de50
callq 0x8360
movq %rax, 0x170(%rsp)
jmp 0x40595
movq 0x170(%rsp), %rdi
movl 0x408(%rsp), %esi
callq 0x8710
movq %rax, 0x168(%rsp)
jmp 0x405b3
movq 0x168(%rsp), %rdi
leaq 0x3d72e(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x160(%rsp)
jmp 0x405d1
movq 0x160(%rsp), %rdi
movq 0x400(%rsp), %rsi
callq 0x8790
movq %rax, 0x158(%rsp)
jmp 0x405f0
movq 0x158(%rsp), %rdi
leaq 0x3d6f1(%rip), %rsi     # 0x7dcf0
callq 0x8360
movq %rax, 0x150(%rsp)
jmp 0x4060e
movq 0x150(%rsp), %rdi
movl 0x40c(%rsp), %esi
callq 0x8710
movq %rax, 0x148(%rsp)
jmp 0x4062c
movq 0x148(%rsp), %rdi
movq 0x56975(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40642
jmp 0x40644
movl 0x408(%rsp), %eax
subl 0x420(%rsp), %eax
cltq
movq %rax, 0x3f8(%rsp)
movq 0x400(%rsp), %rax
subq 0x410(%rsp), %rax
movq %rax, 0x3f0(%rsp)
cmpq $0x0, 0x3f8(%rsp)
jl 0x4068a
cmpq $0x0, 0x3f0(%rsp)
jge 0x406d6
movq 0x3f8(%rsp), %rax
cmpq 0x3f0(%rsp), %rax
jl 0x406b9
movq 0x3f0(%rsp), %rcx
movq 0x3f8(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x3f8(%rsp)
jmp 0x406d4
movq 0x3f8(%rsp), %rcx
movq 0x3f0(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x3f0(%rsp)
jmp 0x406d6
cmpq $0x0, 0x3f8(%rsp)
jg 0x40782
movq 0x5e0(%rsp), %rax
movslq 0x8(%rax), %rcx
movq 0x5e0(%rsp), %rax
movslq 0xc(%rax), %rax
imulq 0x3f0(%rsp), %rax
addq %rax, %rcx
movslq 0x464(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x464(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x4077d
movq 0x568c0(%rip), %rdi     # 0x96ff0
leaq 0x3d730(%rip), %rsi     # 0x7de67
callq 0x8360
movq %rax, 0x140(%rsp)
jmp 0x40746
movq 0x140(%rsp), %rdi
movq 0x3f0(%rsp), %rsi
callq 0x8790
movq %rax, 0x138(%rsp)
jmp 0x40765
movq 0x138(%rsp), %rdi
movq 0x5683c(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4077b
jmp 0x4077d
jmp 0x40e25
cmpq $0x0, 0x3f0(%rsp)
jg 0x4082e
movq 0x5e0(%rsp), %rax
movslq 0x8(%rax), %rcx
movq 0x5e0(%rsp), %rax
movslq 0xc(%rax), %rax
imulq 0x3f8(%rsp), %rax
addq %rax, %rcx
movslq 0x464(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x464(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x40829
movq 0x56814(%rip), %rdi     # 0x96ff0
leaq 0x3d69c(%rip), %rsi     # 0x7de7f
callq 0x8360
movq %rax, 0x130(%rsp)
jmp 0x407f2
movq 0x130(%rsp), %rdi
movq 0x3f8(%rsp), %rsi
callq 0x8790
movq %rax, 0x128(%rsp)
jmp 0x40811
movq 0x128(%rsp), %rdi
movq 0x56790(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40827
jmp 0x40829
jmp 0x40e23
cmpq $0x1, 0x3f8(%rsp)
jne 0x408e4
movq 0x5e0(%rsp), %rax
movslq 0x8(%rax), %rcx
movq 0x5e0(%rsp), %rax
movslq 0xc(%rax), %rax
movq 0x3f0(%rsp), %rdx
subq $0x1, %rdx
imulq %rdx, %rax
addq %rax, %rcx
movslq 0x464(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x464(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x408df
movq 0x56761(%rip), %rdi     # 0x96ff0
leaq 0x3d5d1(%rip), %rsi     # 0x7de67
callq 0x8360
movq %rax, 0x120(%rsp)
jmp 0x408a5
movq 0x120(%rsp), %rdi
movq 0x3f0(%rsp), %rsi
decq %rsi
callq 0x8790
movq %rax, 0x118(%rsp)
jmp 0x408c7
movq 0x118(%rsp), %rdi
movq 0x566da(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x408dd
jmp 0x408df
jmp 0x40e21
cmpq $0x1, 0x3f0(%rsp)
jne 0x4099a
movq 0x5e0(%rsp), %rax
movslq 0x8(%rax), %rcx
movq 0x5e0(%rsp), %rax
movslq 0xc(%rax), %rax
movq 0x3f8(%rsp), %rdx
subq $0x1, %rdx
imulq %rdx, %rax
addq %rax, %rcx
movslq 0x464(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x464(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x40995
movq 0x566ab(%rip), %rdi     # 0x96ff0
leaq 0x3d533(%rip), %rsi     # 0x7de7f
callq 0x8360
movq %rax, 0x110(%rsp)
jmp 0x4095b
movq 0x110(%rsp), %rdi
movq 0x3f8(%rsp), %rsi
decq %rsi
callq 0x8790
movq %rax, 0x108(%rsp)
jmp 0x4097d
movq 0x108(%rsp), %rdi
movq 0x56624(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40993
jmp 0x40995
jmp 0x40e1f
cmpq $0x2, 0x3f0(%rsp)
jne 0x40a11
cmpq $0x2, 0x3f8(%rsp)
jne 0x40a11
movq 0x5e0(%rsp), %rax
movl 0x4(%rax), %eax
addl 0x464(%rsp), %eax
movl %eax, 0x464(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x40a0c
movq 0x56612(%rip), %rdi     # 0x96ff0
leaq 0x3d4b3(%rip), %rsi     # 0x7de98
callq 0x8360
movq %rax, 0x100(%rsp)
jmp 0x409f4
movq 0x100(%rsp), %rdi
movq 0x565ad(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40a0a
jmp 0x40a0c
jmp 0x40e1d
movq 0x400(%rsp), %rax
subq 0x410(%rsp), %rax
subq $0x1, %rax
movl %eax, 0x3e4(%rsp)
movslq 0x3e4(%rsp), %rdi
callq 0x8560
movq %rax, 0x3e8(%rsp)
movl $0x0, 0x3e0(%rsp)
movl 0x3e0(%rsp), %eax
cmpl 0x3e4(%rsp), %eax
jge 0x40ab4
movq 0x5d0(%rsp), %rdi
movq 0x410(%rsp), %rsi
addq $0x1, %rsi
movslq 0x3e0(%rsp), %rax
addq %rax, %rsi
callq 0x8410
movsbq (%rax), %rcx
leaq 0x3dd15(%rip), %rax     # 0x7e7a0
movb (%rax,%rcx), %dl
movq 0x3e8(%rsp), %rax
movslq 0x3e0(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x3e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3e0(%rsp)
jmp 0x40a4c
movl 0x408(%rsp), %eax
subl 0x420(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x3d4(%rsp)
movslq 0x3d4(%rsp), %rdi
callq 0x8560
movq %rax, 0x3d8(%rsp)
movl $0x0, 0x3d0(%rsp)
movl 0x3d0(%rsp), %eax
cmpl 0x3d4(%rsp), %eax
jge 0x40b51
movq 0x5c8(%rsp), %rdi
movl 0x420(%rsp), %eax
addl $0x1, %eax
addl 0x3d0(%rsp), %eax
movslq %eax, %rsi
callq 0x8410
movsbq (%rax), %rcx
leaq 0x3dc78(%rip), %rax     # 0x7e7a0
movb (%rax,%rcx), %dl
movq 0x3d8(%rsp), %rax
movslq 0x3d0(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x3d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3d0(%rsp)
jmp 0x40aec
movq 0x5e0(%rsp), %rdi
addq $0x90, %rdi
movl 0x5bc(%rsp), %edx
movl 0x460(%rsp), %eax
subl %eax, %edx
movl 0x3d4(%rsp), %eax
movl 0x3e4(%rsp), %ecx
subl %ecx, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x3(%rax,%rcx), %eax
movl %eax, 0x3c8(%rsp)
leaq 0x3c8(%rsp), %rsi
callq 0xc080
movq %rax, 0xf8(%rsp)
jmp 0x40bad
movq 0xf8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x3cc(%rsp)
movl 0x3d4(%rsp), %eax
movl 0x3e4(%rsp), %ecx
subl %ecx, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
cvtsi2sd %eax, %xmm0
movq 0x5e0(%rsp), %rcx
movsd 0x30(%rcx), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, 0x3c4(%rsp)
leaq 0x3cc(%rsp), %rdi
leaq 0x3c4(%rsp), %rsi
callq 0x14d40
movq %rax, 0xf0(%rsp)
jmp 0x40c16
movq 0xf0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x3cc(%rsp)
movq 0x5e0(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x40c92
movq 0x563b4(%rip), %rdi     # 0x96ff0
leaq 0x3d264(%rip), %rsi     # 0x7dea7
callq 0x8360
movq %rax, 0xe8(%rsp)
jmp 0x40c52
movq 0xe8(%rsp), %rdi
movl 0x3e4(%rsp), %esi
movl 0x3cc(%rsp), %eax
imull %eax, %esi
callq 0x8710
movq %rax, 0xe0(%rsp)
jmp 0x40c7a
movq 0xe0(%rsp), %rdi
movq 0x56327(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40c90
jmp 0x40c92
movq 0x5e0(%rsp), %rax
cmpl $0x7, 0x78(%rax)
jl 0x40d89
movq 0x56345(%rip), %rdi     # 0x96ff0
leaq 0x3cf06(%rip), %rsi     # 0x7dbb8
callq 0x8360
movq %rax, 0xd8(%rsp)
jmp 0x40cc1
movq 0xd8(%rsp), %rdi
movl 0x408(%rsp), %esi
movl 0x420(%rsp), %eax
subl %eax, %esi
incl %esi
callq 0x8710
movq %rax, 0xd0(%rsp)
jmp 0x40cea
movq 0xd0(%rsp), %rdi
leaq 0x39182(%rip), %rsi     # 0x79e7b
callq 0x8360
movq %rax, 0xc8(%rsp)
jmp 0x40d08
movq 0xc8(%rsp), %rdi
movq 0x400(%rsp), %rsi
movq 0x410(%rsp), %rax
subq %rax, %rsi
incq %rsi
callq 0x8790
movq %rax, 0xc0(%rsp)
jmp 0x40d35
movq 0xc0(%rsp), %rdi
leaq 0x3ce8e(%rip), %rsi     # 0x7dbd2
callq 0x8360
movq %rax, 0xb8(%rsp)
jmp 0x40d53
movq 0xb8(%rsp), %rdi
movl 0x3cc(%rsp), %esi
callq 0x8710
movq %rax, 0xb0(%rsp)
jmp 0x40d71
movq 0xb0(%rsp), %rdi
movq 0x56230(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40d87
jmp 0x40d89
movl 0x3d4(%rsp), %edi
movq 0x3d8(%rsp), %rsi
movl 0x3e4(%rsp), %edx
movq 0x3e8(%rsp), %rcx
movq 0x5e0(%rsp), %rax
movq %rax, %r9
addq $0x10, %r9
movl 0x8(%rax), %r8d
movl 0xc(%rax), %r10d
negl %r8d
negl %r10d
movl 0x3cc(%rsp), %r11d
movq %rsp, %rax
movl %r11d, 0x10(%rax)
movl %r10d, 0x8(%rax)
movl %r8d, (%rax)
movl $0x5, %r8d
callq 0x77bd0
movl %eax, 0xac(%rsp)
jmp 0x40dee
movl 0xac(%rsp), %eax
addl 0x464(%rsp), %eax
movl %eax, 0x464(%rsp)
movq 0x3d8(%rsp), %rdi
callq 0x8470
movq 0x3e8(%rsp), %rdi
callq 0x8470
jmp 0x40e1f
jmp 0x40e21
jmp 0x40e23
jmp 0x40e25
movq 0x5e0(%rsp), %rax
cmpl $0x6, 0x78(%rax)
jl 0x40e86
movq 0x561b6(%rip), %rdi     # 0x96ff0
leaq 0x3d06b(%rip), %rsi     # 0x7deac
callq 0x8360
movq %rax, 0xa0(%rsp)
jmp 0x40e50
movq 0xa0(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x98(%rsp)
jmp 0x40e6e
movq 0x98(%rsp), %rdi
movq 0x56133(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x40e84
jmp 0x40e86
movq 0x400(%rsp), %rax
movslq 0x40c(%rsp), %rcx
addq %rcx, %rax
subq $0x1, %rax
movq %rax, 0x410(%rsp)
movl 0x408(%rsp), %eax
addl 0x40c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x420(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x4ce30
jmp 0x40509
movl 0x424(%rsp), %eax
movl %eax, 0x94(%rsp)
movq 0x5c8(%rsp), %rdi
callq 0x8630
movq %rax, %rcx
movl 0x94(%rsp), %eax
subq $0x1, %rcx
subl 0x420(%rsp), %ecx
cmpl %ecx, %eax
jg 0x40fc9
movq 0x5d0(%rsp), %rdi
movq 0x5c8(%rsp), %rsi
movq 0x5e8(%rsp), %r8
movq 0x5e0(%rsp), %r9
movl 0x434(%rsp), %ecx
movl 0x5bc(%rsp), %edx
movl 0x460(%rsp), %eax
subl %eax, %edx
incl %edx
movq %rsp, %rax
movl %edx, 0x10(%rax)
movl %ecx, 0x8(%rax)
leaq 0x464(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x424(%rsp), %rdx
leaq 0x418(%rsp), %rcx
callq 0x4ce50
jmp 0x40f6b
movq 0x5d0(%rsp), %rdi
movq 0x5c8(%rsp), %rsi
movq 0x5f0(%rsp), %r8
movq 0x5e0(%rsp), %r9
movl 0x434(%rsp), %ecx
movl 0x5bc(%rsp), %edx
movq %rsp, %rax
movl %edx, 0x10(%rax)
movl %ecx, 0x8(%rax)
leaq 0x464(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x420(%rsp), %rdx
leaq 0x410(%rsp), %rcx
callq 0x4d580
jmp 0x40fc4
jmp 0x41088
movq 0x5d0(%rsp), %rdi
movq 0x5c8(%rsp), %rsi
movq 0x5f0(%rsp), %r8
movq 0x5e0(%rsp), %r9
movl 0x434(%rsp), %ecx
movl 0x5bc(%rsp), %edx
movq %rsp, %rax
movl %edx, 0x10(%rax)
movl %ecx, 0x8(%rax)
leaq 0x464(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x420(%rsp), %rdx
leaq 0x410(%rsp), %rcx
callq 0x4d580
jmp 0x41022
movq 0x5d0(%rsp), %rdi
movq 0x5c8(%rsp), %rsi
movq 0x5e8(%rsp), %r8
movq 0x5e0(%rsp), %r9
movl 0x434(%rsp), %ecx
movl 0x5bc(%rsp), %edx
movl 0x460(%rsp), %eax
subl %eax, %edx
incl %edx
movq %rsp, %rax
movl %edx, 0x10(%rax)
movl %ecx, 0x8(%rax)
leaq 0x464(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x424(%rsp), %rdx
leaq 0x418(%rsp), %rcx
callq 0x4ce50
jmp 0x41086
jmp 0x41088
movq 0x5e0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x410ea
movq 0x55f53(%rip), %rdi     # 0x96ff0
leaq 0x3ce15(%rip), %rsi     # 0x7deb9
callq 0x8360
movq %rax, 0x88(%rsp)
jmp 0x410b3
movq 0x88(%rsp), %rdi
movq 0x418(%rsp), %rsi
callq 0x8790
movq %rax, 0x80(%rsp)
jmp 0x410d2
movq 0x80(%rsp), %rdi
movq 0x55ecf(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x410e8
jmp 0x410ea
leaq 0x5ac(%rsp), %rdi
leaq 0x464(%rsp), %rsi
callq 0x14d40
movq %rax, 0x78(%rsp)
jmp 0x41106
movq 0x78(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x5ac(%rsp)
movl 0x464(%rsp), %eax
cmpl 0x5b8(%rsp), %eax
jl 0x4147e
movq 0x5e0(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x4117d
movq 0x55eb3(%rip), %rdi     # 0x96ff0
leaq 0x3cd9b(%rip), %rsi     # 0x7dedf
callq 0x8360
movq %rax, 0x70(%rsp)
jmp 0x41150
movq 0x70(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x68(%rsp)
jmp 0x41168
movq 0x68(%rsp), %rdi
movq 0x55e3c(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x4117b
jmp 0x4117d
movb $0x0, 0x3c3(%rsp)
movq $0x0, 0x3b8(%rsp)
movq 0x3b8(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x4d8(%rsp), %rdi
callq 0x1f530
movq %rax, %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
jae 0x41240
movq 0x3b8(%rsp), %rsi
leaq 0x4d8(%rsp), %rdi
callq 0x1eb90
movl (%rax), %eax
cmpl 0x464(%rsp), %eax
jl 0x41225
movq 0x3b8(%rsp), %rsi
leaq 0x4c0(%rsp), %rdi
callq 0xccd0
movq (%rax), %rdi
movq 0x418(%rsp), %rax
subq %rax, %rdi
callq 0x4c980
movq %rax, 0x58(%rsp)
jmp 0x4120b
movq 0x58(%rsp), %rax
movslq 0x5bc(%rsp), %rcx
cmpq %rcx, %rax
jge 0x41225
movb $0x1, 0x3c3(%rsp)
jmp 0x41227
movq 0x3b8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3b8(%rsp)
jmp 0x41191
testb $0x1, 0x3c3(%rsp)
jne 0x4147c
movl $0x100, %edi            # imm = 0x100
callq 0x8380
movq %rax, 0x50(%rsp)
jmp 0x4125f
movq 0x50(%rsp), %rdi
callq 0x4dd90
jmp 0x4126b
movq 0x50(%rsp), %rax
movq %rax, 0x3b0(%rsp)
movq 0x418(%rsp), %rcx
movq 0x3b0(%rsp), %rax
movq %rcx, (%rax)
movq 0x410(%rsp), %rcx
movq 0x3b0(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x424(%rsp), %ecx
movq 0x3b0(%rsp), %rax
movl %ecx, 0x10(%rax)
movl 0x420(%rsp), %ecx
movq 0x3b0(%rsp), %rax
movl %ecx, 0x14(%rax)
movl 0x464(%rsp), %ecx
movq 0x3b0(%rsp), %rax
movl %ecx, 0x70(%rax)
testb $0x1, 0x5b3(%rsp)
jne 0x41326
movq 0x3b0(%rsp), %rdi
addq $0x40, %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xe640
jmp 0x412fc
jmp 0x41326
movq 0x50(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x560(%rsp)
movl %eax, 0x55c(%rsp)
movl $0x100, %esi            # imm = 0x100
callq 0x8390
jmp 0x41619
movq 0x410(%rsp), %rax
subq 0x418(%rsp), %rax
addq $0x1, %rax
movl %eax, %ecx
movq 0x3b0(%rsp), %rax
movl %ecx, 0x98(%rax)
leaq 0x580(%rsp), %rdi
callq 0x4cd30
movq %rax, 0x3a0(%rsp)
leaq 0x3a8(%rsp), %rdi
leaq 0x3a0(%rsp), %rsi
callq 0x4cd60
leaq 0x580(%rsp), %rdi
callq 0x4cd80
movq %rax, 0x390(%rsp)
leaq 0x398(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x4cd60
leaq 0x3a8(%rsp), %rdi
leaq 0x398(%rsp), %rsi
callq 0x4ce10
testb $0x1, %al
jne 0x413b9
jmp 0x4142e
movq 0x5c0(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x3a8(%rsp), %rdi
callq 0x4cdb0
movq 0x48(%rsp), %rdi
movq (%rax), %rsi
callq 0x4c8f0
movq %rax, %rsi
leaq 0x380(%rsp), %rdi
callq 0x231a0
jmp 0x413f2
movq 0x3b0(%rsp), %rdi
addq $0xe8, %rdi
leaq 0x380(%rsp), %rsi
callq 0x4c670
jmp 0x41410
jmp 0x41412
leaq 0x3a8(%rsp), %rdi
xorl %esi, %esi
callq 0x4cde0
movq %rax, 0x378(%rsp)
jmp 0x41374
movq 0x5f8(%rsp), %rdi
addq $0xb0, %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x4dfc0
jmp 0x4144c
leaq 0x4d8(%rsp), %rdi
leaq 0x464(%rsp), %rsi
callq 0x4e030
jmp 0x41463
leaq 0x4c0(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x270b0
jmp 0x4147a
jmp 0x4147c
jmp 0x414d5
movq 0x5e0(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x414d3
movq 0x55b5d(%rip), %rdi     # 0x96ff0
leaq 0x3ca4e(%rip), %rsi     # 0x7dee8
callq 0x8360
movq %rax, 0x40(%rsp)
jmp 0x414a6
movq 0x40(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x38(%rsp)
jmp 0x414be
movq 0x38(%rsp), %rdi
movq 0x55ae6(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x414d1
jmp 0x414d3
jmp 0x414d5
movq 0x5e0(%rsp), %rax
cmpl $0x5, 0x78(%rax)
jl 0x4152a
movq 0x55b06(%rip), %rdi     # 0x96ff0
leaq 0x3c9fe(%rip), %rsi     # 0x7deef
callq 0x8360
movq %rax, 0x30(%rsp)
jmp 0x414fd
movq 0x30(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x8710
movq %rax, 0x28(%rsp)
jmp 0x41515
movq 0x28(%rsp), %rdi
movq 0x55a8f(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x41528
jmp 0x4152a
movq 0x418(%rsp), %rsi
movq 0x410(%rsp), %rdx
movl 0x424(%rsp), %ecx
movl 0x420(%rsp), %r8d
leaq 0x360(%rsp), %rdi
callq 0x4e0d0
jmp 0x41558
leaq 0x4f0(%rsp), %rdi
leaq 0x360(%rsp), %rsi
callq 0x4e0a0
jmp 0x4156f
jmp 0x41571
jmp 0x41573
jmp 0x41575
movl 0x4bc(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x4bc(%rsp)
jmp 0x3f995
movl $0xffffffff, 0x35c(%rsp) # imm = 0xFFFFFFFF
movl 0x5ac(%rsp), %eax
cmpl 0x5b8(%rsp), %eax
jl 0x415b4
movl 0x5ac(%rsp), %eax
movl %eax, 0x35c(%rsp)
movl 0x35c(%rsp), %eax
movl %eax, 0x24(%rsp)
leaq 0x4c0(%rsp), %rdi
callq 0xf0f0
leaq 0x4d8(%rsp), %rdi
callq 0xe770
leaq 0x4f0(%rsp), %rdi
callq 0x4e110
leaq 0x530(%rsp), %rdi
callq 0x4e170
leaq 0x568(%rsp), %rdi
callq 0xf0f0
leaq 0x580(%rsp), %rdi
callq 0x4e180
movl 0x24(%rsp), %eax
addq $0x5d8, %rsp            # imm = 0x5D8
retq
leaq 0x4c0(%rsp), %rdi
callq 0xf0f0
leaq 0x4d8(%rsp), %rdi
callq 0xe770
leaq 0x4f0(%rsp), %rdi
callq 0x4e110
leaq 0x530(%rsp), %rdi
callq 0x4e170
leaq 0x568(%rsp), %rdi
callq 0xf0f0
leaq 0x580(%rsp), %rdi
callq 0x4e180
movq 0x560(%rsp), %rdi
callq 0x8730
nopw %cs:(%rax,%rax)