// File: drarwood[P]gags/Main.cpp
// Function: main
int main(int argc, char** argv) {

    // 1. Show header
    ShowHeader();
    
    // 2. Parse command line
    ARGS theseArgs;
    ParseCommand(argc, argv, &theseArgs);
    if(!theseArgs.ok) {
        ShowOptions();
        exit(EXIT_FAILURE);
    }
    cout << "Arguments: " << endl;
    cout << "        --pheno      -p " << theseArgs.phenoString << endl;
    cout << "        --ns         -n " << theseArgs.nsString << endl;
    cout << "        --means      -m " << theseArgs.meansString << endl;
    cout << "        --sd         -s " << theseArgs.sdsString << endl;
    cout << "        --seed       -r " << theseArgs.seed << endl;
    cout << "        --mrate      -y " << theseArgs.mRate << endl;
    cout << "        --popsize    -z " << theseArgs.popsize << endl;
    cout << "        --exclusions -e " << theseArgs.exclusionsString << endl;
    cout << "        --iterations -i " << theseArgs.iterations << endl;
    cout << "        --out        -o " << theseArgs.outString << endl << endl;    
    srand(theseArgs.seed);
    
    // Create vectors for list arguments
    vector<int> ns;
    SplitIntArgs(theseArgs.nsString, ns);
    vector<double> means;
    SplitDoubleArgs(theseArgs.meansString, means);
    vector<double> sds;
    SplitDoubleArgs(theseArgs.sdsString, sds);

    // Get required precision input by user
    vector<int> t1;
    DetermineDoubleArgsPrecision(theseArgs.meansString, t1);
    vector<int> t2;
    DetermineDoubleArgsPrecision(theseArgs.sdsString, t2);
    
    // read exclusions file    
    map<string,int> exclusions;
    if (theseArgs.exclusionsString.length() > 0) {
        ReadExclusionsFile(theseArgs.exclusionsString, exclusions);
    }

    // Load the phenotypes
    cout << "Reading phenotypes..." << endl;
    vector<string> idVector;
    vector<double> phenoVector;
    map<string,double> phenoMap;
    ReadPhenotypeFileMinusExclusions(theseArgs.phenoString, idVector, phenoVector, phenoMap, exclusions);    
        
    // Check number of individuals required to formulate the distribution is more than the number with pheneotype
    unsigned int total_n = 0;
    for (unsigned int i = 0; i<ns.size(); ++i) {
        total_n += ns[i];
    }
    //cout << total_n << endl;
    if (total_n > phenoVector.size()) {
        cout << "Unable to process this data as required sample sizes for distributions larger than N in phenotype file" << endl;
    }
    
    // At this point we want to order the Ns and adjust ordering of means and SDs in vecto
    vector<int>    nsSorted;  
    vector<double> meansSorted;
    vector<double> sdsSorted;
    vector<int>    meansPrecision;
    vector<int>    sdsPrecision;

    map<int,int>   jsUsed;

    nsSorted = ns;
    sort(nsSorted.begin(), nsSorted.end());
    for (unsigned int i = 0; i < nsSorted.size(); ++i) {
        for (unsigned int j = 0; j < ns.size(); ++j) {
            if (ns[j] == nsSorted[i] && jsUsed.find(j) == jsUsed.end()) {
                meansSorted.push_back(means[j]);
                sdsSorted.push_back(sds[j]);
                meansPrecision.push_back(t1[j]);
                sdsPrecision.push_back(t2[j]);
                jsUsed[j] = 0;
                break;
            }
        }
    }
    ns.clear();
    means.clear();
    sds.clear();
    
    // If the smallest N >= 10% of total_n then we carry on as usual
    bool solveIndependently;
    bool solveIndependentlyEverSet = false;
    int  independentGroupIndex = 0;
    int  smallestOffset = 0;
    int  nSubtract     = 0;
    int  n;
    
    
    do { 
        
        if ( ((double) nsSorted[smallestOffset] / (double) (total_n-nSubtract)) > 0.1 ) {
            solveIndependently = false;
            n = total_n-nSubtract;            
            for (unsigned int i = smallestOffset; i < nsSorted.size(); ++i) {
                ns.push_back(nsSorted[i]);
                means.push_back(meansSorted[i]);
                sds.push_back(sdsSorted[i]);
            }
        }
        // else we need to solve as seperate problem
        else {
            solveIndependently = true;
            solveIndependentlyEverSet = true;
            n = nsSorted[smallestOffset];
            ns.push_back(nsSorted[smallestOffset]);
            means.push_back(meansSorted[smallestOffset]);
            sds.push_back(sdsSorted[smallestOffset]);
            nSubtract += nsSorted[smallestOffset];
            smallestOffset++;
        }
 
        
        // 1. Initialise solutions
        cout << "Initialising solutions..." << endl;
        vector<vector<string> > population(theseArgs.popsize);
        cout << "Exclusion list size " << exclusions.size() << endl;
        InitializeSolutions(n, idVector, population, exclusions);
        
        // 2. Score solutions
        cout << "Scoring solutions..." << endl;
        vector<double> scores(theseArgs.popsize);
        //double thiscore;
        for (int i = 0; i < theseArgs.popsize; ++i) {
            scores[i] = ScoreSolution(population[i], phenoMap, ns, means, sds);
        }
        
        // 3. Determine the lowest (best) score  and solution with lowest score
        double lowestScore;
        int    bestSolutionIndex;
        DetermineBestSolution(scores, lowestScore, bestSolutionIndex);
        cout << "Best score and solution ID presently: " << lowestScore << " "  << bestSolutionIndex << endl;
        
        // 4. Determine if we have found a solution that is good enough by chance using the best one we have in the population
        bool solutionFound;
        solutionFound = TestBestSolution(population[bestSolutionIndex], phenoMap, ns, means, sds, meansPrecision, sdsPrecision);
        
        // 5. If solution found by chance then output it
        if (solutionFound) {
            cout << "Solution found" << endl;
            if (!solveIndependentlyEverSet) {
                independentGroupIndex++;
                OutputSolution(population[bestSolutionIndex], phenoMap, ns, theseArgs.outString, independentGroupIndex);
            }
            else {
                independentGroupIndex++;
                OutputIndependentSolution(population[bestSolutionIndex], phenoMap, ns, theseArgs.outString, independentGroupIndex);
                // add samples from last solution to exclusion list so we don't include them again
                for (vector<string>::iterator it = population[bestSolutionIndex].begin(); it != population[bestSolutionIndex].end(); ++it) {
                    exclusions[*it] = 0;
                }
            }
        }
        
        
        // 6. else we need tocyce up to max iterations to try and find solution
        else {
            
            // Determine highest (worst) score and solution with worst score
            bool   carryOn = true;
            double highestScore;
            int    worstSolutionIndex;
            DetermineWorstSolution(scores, highestScore, worstSolutionIndex);

            cout << "Iteration 1 ";
            
            // Iterate through for MAX iterations
            for (int i = 0; i < theseArgs.iterations; ++i) {
                
                int iter = (i+1)*100;
                if (100 % iter == 0) {
                    cout << iter << " ";
                }

                // [re]generate Roulette Wheel
                vector<double> rWheel;
                GenerateRouletteWheel(rWheel, scores);
                
                // Spin the wheel x2 to select solutions
                vector<int> randomIndicies;
                int ri1 = SpinWheel(rWheel);
                randomIndicies.push_back(ri1);
                int ri2;
                do {
                    ri2 = SpinWheel(rWheel);
                } while (ri1 == ri2);
                randomIndicies.push_back(ri2);
                
                // Crossover
                vector<vector<string> > chrXY(2);   
                map<string,int> chrXAlleles;
                map<string,int> chrYAlleles;
                CrossoverPMX(population, randomIndicies, idVector, chrXY, chrXAlleles, chrYAlleles);
                
                // Mutate
                Mutate(chrXY, ns, theseArgs.mRate, idVector, phenoMap, chrXAlleles, chrYAlleles, exclusions);
                
                // Identify the worst 2 scores in the population frist
                vector<int> worst2Solutions;
                DetermineX2LeastFit(worst2Solutions, scores);
                
                // 1.  First see if either provide us with a good enough solution //            
                for (int j = 0; j < 2; ++j) {
                    
                    // get score for current child
                    double thisScore = ScoreSolution(chrXY[j], phenoMap, ns, means, sds);
                    
                    // if this score lower (i.e. better) than lowest score in the population check whether solution good enough
                    if (thisScore < lowestScore) {
                    
                        lowestScore = thisScore;
                        
                        // check if we have found a solution
                        solutionFound = TestBestSolution(chrXY[j], phenoMap, ns, means, sds, meansPrecision, sdsPrecision);
                        
                        // if it is - print out and stop
                        if (solutionFound) {
                            
                            cout << thisScore << endl;
                            cout << "Solution found! " << endl;
                            
                            if (!solveIndependentlyEverSet) {
                                independentGroupIndex++;
                                OutputSolution(chrXY[j], phenoMap, ns, theseArgs.outString, independentGroupIndex);
                            }
                            else {
                                independentGroupIndex++;
                                OutputIndependentSolution(chrXY[j], phenoMap, ns, theseArgs.outString, independentGroupIndex);
                                // add samples from last solution to exclusion list so we don't include them again
                                for (vector<string>::iterator it = chrXY[j].begin(); it != chrXY[j].end(); ++it) {
                                    exclusions[*it] = 0;
                                }
                            }
                            
                            carryOn = false;
                            break;
                        }
                        else {
                            // place this solution in the population and update respective score
                            population[worst2Solutions[j]] = chrXY[j];
                            scores[worst2Solutions[j]] = thisScore;
                        }
                    }
                    else {
                        // place this solution in the population
                        population[worst2Solutions[j]] = chrXY[j];
                        scores[worst2Solutions[j]] = thisScore;
                    }
                }
                if (!carryOn) {
                    break;
                }
                // cout << lowestScore << endl;
                randomIndicies.clear();
            }  
        }
        
        // clear out the vectors
        ns.clear();
        means.clear();
        sds.clear();
        population.clear();
        scores.clear();
        
        if (!solutionFound) {
            cout << theseArgs.iterations << endl;
            cout << "Sorry - no solution not found this time." << endl;
            cout << "Error score: " << lowestScore << endl;
        }
                
    } while (solveIndependently);
    
    return 0;
}

// Assembly:
subq $0x748, %rsp            # imm = 0x748
movl $0x0, 0x744(%rsp)
movl %edi, 0x740(%rsp)
movq %rsi, 0x738(%rsp)
callq 0x14be0
leaq 0x658(%rsp), %rdi
movq %rdi, 0x268(%rsp)
callq 0x5670
movq 0x268(%rsp), %rdx
movl 0x740(%rsp), %edi
movq 0x738(%rsp), %rsi
callq 0x14e90
jmp 0x38a9
testb $0x1, 0x730(%rsp)
jne 0x38dd
callq 0x14d00
jmp 0x38ba
movl $0x1, %edi
callq 0x33a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5656
movq 0x1f6f4(%rip), %rdi     # 0x22fd8
leaq 0x16725(%rip), %rsi     # 0x1a010
callq 0x32c0
movq %rax, 0x260(%rsp)
jmp 0x38fa
movq 0x260(%rsp), %rdi
movq 0x1f6bf(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3910
movq 0x1f6c1(%rip), %rdi     # 0x22fd8
leaq 0x166fe(%rip), %rsi     # 0x1a01c
callq 0x32c0
movq %rax, 0x258(%rsp)
jmp 0x392d
movq 0x258(%rsp), %rdi
leaq 0x658(%rsp), %rsi
callq 0x32a0
movq %rax, 0x250(%rsp)
jmp 0x394c
movq 0x250(%rsp), %rdi
movq 0x1f66d(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3962
movq 0x1f66f(%rip), %rdi     # 0x22fd8
leaq 0x166c5(%rip), %rsi     # 0x1a035
callq 0x32c0
movq %rax, 0x248(%rsp)
jmp 0x397f
movq 0x248(%rsp), %rdi
leaq 0x678(%rsp), %rsi
callq 0x32a0
movq %rax, 0x240(%rsp)
jmp 0x399e
movq 0x240(%rsp), %rdi
movq 0x1f61b(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x39b4
movq 0x1f61d(%rip), %rdi     # 0x22fd8
leaq 0x1668c(%rip), %rsi     # 0x1a04e
callq 0x32c0
movq %rax, 0x238(%rsp)
jmp 0x39d1
movq 0x238(%rsp), %rdi
leaq 0x698(%rsp), %rsi
callq 0x32a0
movq %rax, 0x230(%rsp)
jmp 0x39f0
movq 0x230(%rsp), %rdi
movq 0x1f5c9(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3a06
movq 0x1f5cb(%rip), %rdi     # 0x22fd8
leaq 0x16653(%rip), %rsi     # 0x1a067
callq 0x32c0
movq %rax, 0x228(%rsp)
jmp 0x3a23
movq 0x228(%rsp), %rdi
leaq 0x6b8(%rsp), %rsi
callq 0x32a0
movq %rax, 0x220(%rsp)
jmp 0x3a42
movq 0x220(%rsp), %rdi
movq 0x1f577(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3a58
movq 0x1f579(%rip), %rdi     # 0x22fd8
leaq 0x1661a(%rip), %rsi     # 0x1a080
callq 0x32c0
movq %rax, 0x218(%rsp)
jmp 0x3a75
movq 0x218(%rsp), %rdi
movl 0x718(%rsp), %esi
callq 0x34f0
movq %rax, 0x210(%rsp)
jmp 0x3a93
movq 0x210(%rsp), %rdi
movq 0x1f526(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3aa9
movq 0x1f528(%rip), %rdi     # 0x22fd8
leaq 0x165e2(%rip), %rsi     # 0x1a099
callq 0x32c0
movq %rax, 0x208(%rsp)
jmp 0x3ac6
movq 0x208(%rsp), %rdi
movsd 0x728(%rsp), %xmm0
callq 0x3550
movq %rax, 0x200(%rsp)
jmp 0x3ae6
movq 0x200(%rsp), %rdi
movq 0x1f4d3(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3afc
movq 0x1f4d5(%rip), %rdi     # 0x22fd8
leaq 0x165a8(%rip), %rsi     # 0x1a0b2
callq 0x32c0
movq %rax, 0x1f8(%rsp)
jmp 0x3b19
movq 0x1f8(%rsp), %rdi
movl 0x71c(%rsp), %esi
callq 0x34f0
movq %rax, 0x1f0(%rsp)
jmp 0x3b37
movq 0x1f0(%rsp), %rdi
movq 0x1f482(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3b4d
movq 0x1f484(%rip), %rdi     # 0x22fd8
leaq 0x16570(%rip), %rsi     # 0x1a0cb
callq 0x32c0
movq %rax, 0x1e8(%rsp)
jmp 0x3b6a
movq 0x1e8(%rsp), %rdi
leaq 0x6d8(%rsp), %rsi
callq 0x32a0
movq %rax, 0x1e0(%rsp)
jmp 0x3b89
movq 0x1e0(%rsp), %rdi
movq 0x1f430(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3b9f
movq 0x1f432(%rip), %rdi     # 0x22fd8
leaq 0x16537(%rip), %rsi     # 0x1a0e4
callq 0x32c0
movq %rax, 0x1d8(%rsp)
jmp 0x3bbc
movq 0x1d8(%rsp), %rdi
movl 0x720(%rsp), %esi
callq 0x34f0
movq %rax, 0x1d0(%rsp)
jmp 0x3bda
movq 0x1d0(%rsp), %rdi
movq 0x1f3df(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3bf0
movq 0x1f3e1(%rip), %rdi     # 0x22fd8
leaq 0x164ff(%rip), %rsi     # 0x1a0fd
callq 0x32c0
movq %rax, 0x1c8(%rsp)
jmp 0x3c0d
movq 0x1c8(%rsp), %rdi
leaq 0x6f8(%rsp), %rsi
callq 0x32a0
movq %rax, 0x1c0(%rsp)
jmp 0x3c2c
movq 0x1c0(%rsp), %rdi
movq 0x1f38d(%rip), %rsi     # 0x22fc8
callq 0x3330
movq %rax, 0x1b8(%rsp)
jmp 0x3c4a
movq 0x1b8(%rsp), %rdi
movq 0x1f36f(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3c60
movl 0x718(%rsp), %edi
callq 0x32b0
leaq 0x630(%rsp), %rdi
movq %rdi, 0x1b0(%rsp)
callq 0x56e0
movq 0x1b0(%rsp), %rsi
leaq 0x678(%rsp), %rdi
callq 0x18280
jmp 0x3c98
leaq 0x618(%rsp), %rdi
movq %rdi, 0x1a8(%rsp)
callq 0x56f0
movq 0x1a8(%rsp), %rsi
leaq 0x698(%rsp), %rdi
callq 0x180c0
jmp 0x3cc4
leaq 0x600(%rsp), %rdi
movq %rdi, 0x1a0(%rsp)
callq 0x56f0
movq 0x1a0(%rsp), %rsi
leaq 0x6b8(%rsp), %rdi
callq 0x180c0
jmp 0x3cf0
leaq 0x5e8(%rsp), %rdi
movq %rdi, 0x198(%rsp)
callq 0x56e0
movq 0x198(%rsp), %rsi
leaq 0x698(%rsp), %rdi
callq 0x18430
jmp 0x3d1c
leaq 0x5d0(%rsp), %rdi
movq %rdi, 0x190(%rsp)
callq 0x56e0
movq 0x190(%rsp), %rsi
leaq 0x6b8(%rsp), %rdi
callq 0x18430
jmp 0x3d48
leaq 0x5a0(%rsp), %rdi
callq 0x5700
leaq 0x658(%rsp), %rdi
addq $0x80, %rdi
callq 0x3450
cmpq $0x0, %rax
jbe 0x3e6f
leaq 0x6d8(%rsp), %rsi
leaq 0x580(%rsp), %rdi
callq 0x3140
jmp 0x3d8a
leaq 0x580(%rsp), %rdi
leaq 0x5a0(%rsp), %rsi
callq 0xe260
jmp 0x3da1
leaq 0x580(%rsp), %rdi
callq 0x31c0
jmp 0x3e6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5649
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x563c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x562f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5622
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5615
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5608
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x580(%rsp), %rdi
callq 0x31c0
jmp 0x5608
movq 0x1f162(%rip), %rdi     # 0x22fd8
leaq 0x16299(%rip), %rsi     # 0x1a116
callq 0x32c0
movq %rax, 0x188(%rsp)
jmp 0x3e8c
movq 0x188(%rsp), %rdi
movq 0x1f12d(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x3ea2
leaq 0x568(%rsp), %rdi
callq 0x5710
leaq 0x550(%rsp), %rdi
callq 0x56f0
leaq 0x520(%rsp), %rdi
callq 0x5720
leaq 0x500(%rsp), %rdi
leaq 0x658(%rsp), %rsi
callq 0x3140
jmp 0x3ee0
leaq 0x500(%rsp), %rdi
leaq 0x568(%rsp), %rsi
leaq 0x550(%rsp), %rdx
leaq 0x520(%rsp), %rcx
leaq 0x5a0(%rsp), %r8
callq 0x18cc0
jmp 0x3f0f
leaq 0x500(%rsp), %rdi
callq 0x31c0
movl $0x0, 0x4fc(%rsp)
movl $0x0, 0x4f8(%rsp)
movl 0x4f8(%rsp), %eax
movq %rax, 0x180(%rsp)
leaq 0x630(%rsp), %rdi
callq 0x5730
movq %rax, %rcx
movq 0x180(%rsp), %rax
cmpq %rcx, %rax
jae 0x3fd6
movl 0x4f8(%rsp), %eax
movl %eax, %esi
leaq 0x630(%rsp), %rdi
callq 0x5750
movl (%rax), %eax
addl 0x4fc(%rsp), %eax
movl %eax, 0x4fc(%rsp)
movl 0x4f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4f8(%rsp)
jmp 0x3f32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x55e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x500(%rsp), %rdi
callq 0x31c0
jmp 0x55e1
movl 0x4fc(%rsp), %eax
movq %rax, 0x178(%rsp)
leaq 0x550(%rsp), %rdi
callq 0x5770
movq %rax, %rcx
movq 0x178(%rsp), %rax
cmpq %rcx, %rax
jbe 0x4037
movq 0x1efcf(%rip), %rdi     # 0x22fd8
leaq 0x1611c(%rip), %rsi     # 0x1a12c
callq 0x32c0
movq %rax, 0x170(%rsp)
jmp 0x401f
movq 0x170(%rsp), %rdi
movq 0x1ef9a(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x4035
jmp 0x4037
leaq 0x4e0(%rsp), %rdi
movq %rdi, 0x168(%rsp)
callq 0x56e0
leaq 0x4c8(%rsp), %rdi
callq 0x56f0
leaq 0x4b0(%rsp), %rdi
callq 0x56f0
leaq 0x498(%rsp), %rdi
callq 0x56e0
leaq 0x480(%rsp), %rdi
callq 0x56e0
leaq 0x450(%rsp), %rdi
callq 0x5790
movq 0x168(%rsp), %rdi
leaq 0x630(%rsp), %rsi
callq 0x57a0
jmp 0x40a4
leaq 0x4e0(%rsp), %rdi
movq %rdi, 0x160(%rsp)
callq 0x5aa0
movq 0x160(%rsp), %rdi
movq %rax, 0x448(%rsp)
callq 0x5ad0
movq %rax, 0x440(%rsp)
movq 0x448(%rsp), %rdi
movq 0x440(%rsp), %rsi
callq 0x5a60
jmp 0x40ed
movl $0x0, 0x43c(%rsp)
movl 0x43c(%rsp), %eax
movq %rax, 0x158(%rsp)
leaq 0x4e0(%rsp), %rdi
callq 0x5730
movq %rax, %rcx
movq 0x158(%rsp), %rax
cmpq %rcx, %rax
jae 0x4353
movl $0x0, 0x438(%rsp)
movl 0x438(%rsp), %eax
movq %rax, 0x150(%rsp)
leaq 0x630(%rsp), %rdi
callq 0x5730
movq %rax, %rcx
movq 0x150(%rsp), %rax
cmpq %rcx, %rax
jae 0x433b
movl 0x438(%rsp), %eax
movl %eax, %esi
leaq 0x630(%rsp), %rdi
callq 0x5750
movl (%rax), %eax
movl %eax, 0x148(%rsp)
movl 0x43c(%rsp), %eax
movl %eax, %esi
leaq 0x4e0(%rsp), %rdi
callq 0x5750
movl 0x148(%rsp), %ecx
movq %rax, %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x14f(%rsp)
jne 0x421d
movl 0x438(%rsp), %eax
movl %eax, 0x42c(%rsp)
leaq 0x450(%rsp), %rdi
leaq 0x42c(%rsp), %rsi
callq 0x5b20
movq %rax, 0x140(%rsp)
jmp 0x41dc
movq 0x140(%rsp), %rax
movq %rax, 0x430(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x5b50
movq %rax, 0x420(%rsp)
leaq 0x430(%rsp), %rdi
leaq 0x420(%rsp), %rsi
callq 0x5b00
movb %al, 0x14f(%rsp)
movb 0x14f(%rsp), %al
testb $0x1, %al
jne 0x422d
jmp 0x4323
movl 0x438(%rsp), %eax
movl %eax, %esi
leaq 0x618(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x4c8(%rsp), %rdi
callq 0x5b80
jmp 0x4255
movl 0x438(%rsp), %eax
movl %eax, %esi
leaq 0x600(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x4b0(%rsp), %rdi
callq 0x5b80
jmp 0x427d
movl 0x438(%rsp), %eax
movl %eax, %esi
leaq 0x5e8(%rsp), %rdi
callq 0x5750
movq %rax, %rsi
leaq 0x498(%rsp), %rdi
callq 0x5c10
jmp 0x42a5
movl 0x438(%rsp), %eax
movl %eax, %esi
leaq 0x5d0(%rsp), %rdi
callq 0x5750
movq %rax, %rsi
leaq 0x480(%rsp), %rdi
callq 0x5c10
jmp 0x42cd
movl 0x438(%rsp), %eax
movl %eax, 0x41c(%rsp)
leaq 0x450(%rsp), %rdi
leaq 0x41c(%rsp), %rsi
callq 0x5c80
movq %rax, 0x138(%rsp)
jmp 0x42fa
movq 0x138(%rsp), %rax
movl $0x0, (%rax)
jmp 0x433b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5593
jmp 0x4325
movl 0x438(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x438(%rsp)
jmp 0x4133
jmp 0x433d
movl 0x43c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x43c(%rsp)
jmp 0x40f8
leaq 0x630(%rsp), %rdi
callq 0x5d70
leaq 0x618(%rsp), %rdi
callq 0x5d90
leaq 0x600(%rsp), %rdi
callq 0x5d90
movb $0x0, 0x41a(%rsp)
movl $0x0, 0x414(%rsp)
movl $0x0, 0x410(%rsp)
movl $0x0, 0x40c(%rsp)
movslq 0x410(%rsp), %rsi
leaq 0x4e0(%rsp), %rdi
callq 0x5750
cvtsi2sdl (%rax), %xmm0
movl 0x4fc(%rsp), %eax
movl 0x40c(%rsp), %ecx
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd 0x15c2b(%rip), %xmm1    # 0x1a008
ucomisd %xmm1, %xmm0
jbe 0x44d7
movb $0x0, 0x41b(%rsp)
movl 0x4fc(%rsp), %eax
subl 0x40c(%rsp), %eax
movl %eax, 0x408(%rsp)
movl 0x410(%rsp), %eax
movl %eax, 0x404(%rsp)
movl 0x404(%rsp), %eax
movq %rax, 0x130(%rsp)
leaq 0x4e0(%rsp), %rdi
callq 0x5730
movq %rax, %rcx
movq 0x130(%rsp), %rax
cmpq %rcx, %rax
jae 0x44d2
movl 0x404(%rsp), %eax
movl %eax, %esi
leaq 0x4e0(%rsp), %rdi
callq 0x5750
movq %rax, %rsi
leaq 0x630(%rsp), %rdi
callq 0x5c10
jmp 0x446a
movl 0x404(%rsp), %eax
movl %eax, %esi
leaq 0x4c8(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x618(%rsp), %rdi
callq 0x5b80
jmp 0x4492
movl 0x404(%rsp), %eax
movl %eax, %esi
leaq 0x4b0(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x600(%rsp), %rdi
callq 0x5b80
jmp 0x44ba
jmp 0x44bc
movl 0x404(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x404(%rsp)
jmp 0x4412
jmp 0x45b8
movb $0x1, 0x41b(%rsp)
movb $0x1, 0x41a(%rsp)
movslq 0x410(%rsp), %rsi
leaq 0x4e0(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x5750
movq 0x128(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x408(%rsp)
movslq 0x410(%rsp), %rsi
callq 0x5750
movq %rax, %rsi
leaq 0x630(%rsp), %rdi
callq 0x5c10
jmp 0x4534
movslq 0x410(%rsp), %rsi
leaq 0x4c8(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x618(%rsp), %rdi
callq 0x5b80
jmp 0x455b
movslq 0x410(%rsp), %rsi
leaq 0x4b0(%rsp), %rdi
callq 0x5bf0
movq %rax, %rsi
leaq 0x600(%rsp), %rdi
callq 0x5b80
jmp 0x4582
movslq 0x410(%rsp), %rsi
leaq 0x4e0(%rsp), %rdi
callq 0x5750
movl (%rax), %eax
addl 0x40c(%rsp), %eax
movl %eax, 0x40c(%rsp)
movl 0x410(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x410(%rsp)
movq 0x1ea19(%rip), %rdi     # 0x22fd8
leaq 0x15bcd(%rip), %rsi     # 0x1a193
callq 0x32c0
movq %rax, 0x120(%rsp)
jmp 0x45d5
movq 0x120(%rsp), %rdi
movq 0x1e9e4(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x45eb
movslq 0x71c(%rsp), %rax
movq %rax, 0x110(%rsp)
leaq 0x3e7(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x5db0
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq 0x3e8(%rsp), %rdi
callq 0x5dc0
jmp 0x462f
leaq 0x3e7(%rsp), %rdi
callq 0x5e40
movq 0x1e995(%rip), %rdi     # 0x22fd8
leaq 0x15b63(%rip), %rsi     # 0x1a1ad
callq 0x32c0
movq %rax, 0x108(%rsp)
jmp 0x4659
leaq 0x5a0(%rsp), %rdi
callq 0x5e50
movq 0x108(%rsp), %rdi
movq %rax, %rsi
callq 0x30a0
movq %rax, 0x100(%rsp)
jmp 0x4680
movq 0x100(%rsp), %rdi
movq 0x1e939(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x4696
movl 0x408(%rsp), %edi
leaq 0x568(%rsp), %rsi
leaq 0x3e8(%rsp), %rdx
leaq 0x5a0(%rsp), %rcx
callq 0xfbf0
jmp 0x46bc
movq 0x1e915(%rip), %rdi     # 0x22fd8
leaq 0x15af8(%rip), %rsi     # 0x1a1c2
callq 0x32c0
movq %rax, 0xf8(%rsp)
jmp 0x46d9
movq 0xf8(%rsp), %rdi
movq 0x1e8e0(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x46ef
movslq 0x71c(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0x3c7(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
callq 0x5e60
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
leaq 0x3c8(%rsp), %rdi
callq 0x5e70
jmp 0x4733
leaq 0x3c7(%rsp), %rdi
callq 0x5ef0
movl $0x0, 0x3c0(%rsp)
movl 0x3c0(%rsp), %eax
cmpl 0x71c(%rsp), %eax
jge 0x485d
movslq 0x3c0(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x618(%rsp), %rcx
leaq 0x600(%rsp), %r8
callq 0xfe60
movsd %xmm0, 0xe0(%rsp)
jmp 0x47a7
movslq 0x3c0(%rsp), %rsi
leaq 0x3c8(%rsp), %rdi
callq 0x5bf0
movsd 0xe0(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x3c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c0(%rsp)
jmp 0x474b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x3e7(%rsp), %rdi
callq 0x5e40
jmp 0x5593
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5586
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x3c7(%rsp), %rdi
callq 0x5ef0
jmp 0x5586
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5579
leaq 0x3c8(%rsp), %rdi
leaq 0x3b8(%rsp), %rsi
leaq 0x3b4(%rsp), %rdx
callq 0x100e0
jmp 0x487c
movq 0x1e755(%rip), %rdi     # 0x22fd8
leaq 0x1594d(%rip), %rsi     # 0x1a1d7
callq 0x32c0
movq %rax, 0xd8(%rsp)
jmp 0x4899
movq 0xd8(%rsp), %rdi
movsd 0x3b8(%rsp), %xmm0
callq 0x3550
movq %rax, 0xd0(%rsp)
jmp 0x48b9
movq 0xd0(%rsp), %rdi
leaq 0x15b70(%rip), %rsi     # 0x1a438
callq 0x32c0
movq %rax, 0xc8(%rsp)
jmp 0x48d7
movq 0xc8(%rsp), %rdi
movl 0x3b4(%rsp), %esi
callq 0x34f0
movq %rax, 0xc0(%rsp)
jmp 0x48f5
movq 0xc0(%rsp), %rdi
movq 0x1e6c4(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x490b
movslq 0x3b4(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
movq %rsp, %rax
leaq 0x480(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x618(%rsp), %rcx
leaq 0x600(%rsp), %r8
leaq 0x498(%rsp), %r9
callq 0x101a0
movb %al, 0xbf(%rsp)
jmp 0x4967
movb 0xbf(%rsp), %al
andb $0x1, %al
movb %al, 0x3b3(%rsp)
testb $0x1, 0x3b3(%rsp)
je 0x4b18
movq 0x1e64c(%rip), %rdi     # 0x22fd8
leaq 0x1586b(%rip), %rsi     # 0x1a1fe
callq 0x32c0
movq %rax, 0xb0(%rsp)
jmp 0x49a2
movq 0xb0(%rsp), %rdi
movq 0x1e617(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x49b8
testb $0x1, 0x41a(%rsp)
jne 0x4a16
movl 0x414(%rsp), %eax
incl %eax
movl %eax, 0x414(%rsp)
movslq 0x3b4(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x6f8(%rsp), %rcx
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x414(%rsp), %r8
callq 0xe440
jmp 0x4a11
jmp 0x4b13
movl 0x414(%rsp), %eax
incl %eax
movl %eax, 0x414(%rsp)
movslq 0x3b4(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x6f8(%rsp), %rcx
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x414(%rsp), %r8
callq 0xe730
jmp 0x4a65
movslq 0x3b4(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
callq 0x5f20
movq %rax, 0x3a8(%rsp)
movslq 0x3b4(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
callq 0x5f90
movq %rax, 0x3a0(%rsp)
leaq 0x3a8(%rsp), %rdi
leaq 0x3a0(%rsp), %rsi
callq 0x5f50
testb $0x1, %al
jne 0x4aca
jmp 0x4b11
leaq 0x3a8(%rsp), %rdi
callq 0x60b0
movq %rax, %rsi
leaq 0x5a0(%rsp), %rdi
callq 0x5fc0
movq %rax, 0xa8(%rsp)
jmp 0x4af1
movq 0xa8(%rsp), %rax
movl $0x0, (%rax)
leaq 0x3a8(%rsp), %rdi
callq 0x60c0
jmp 0x4a8a
jmp 0x4b13
jmp 0x536a
movb $0x1, 0x39f(%rsp)
leaq 0x3c8(%rsp), %rdi
leaq 0x390(%rsp), %rsi
leaq 0x38c(%rsp), %rdx
callq 0x10880
jmp 0x4b3f
movq 0x1e492(%rip), %rdi     # 0x22fd8
leaq 0x156c0(%rip), %rsi     # 0x1a20d
callq 0x32c0
jmp 0x4b54
movl $0x0, 0x388(%rsp)
movl 0x388(%rsp), %eax
cmpl 0x720(%rsp), %eax
jge 0x5368
movl 0x388(%rsp), %eax
addl $0x1, %eax
imull $0x64, %eax, %eax
movl %eax, 0x384(%rsp)
movl $0x64, %eax
cltd
idivl 0x384(%rsp)
cmpl $0x0, %edx
jne 0x4bce
movl 0x384(%rsp), %esi
movq 0x1e431(%rip), %rdi     # 0x22fd8
callq 0x34f0
movq %rax, 0xa0(%rsp)
jmp 0x4bb6
movq 0xa0(%rsp), %rdi
leaq 0x15873(%rip), %rsi     # 0x1a438
callq 0x32c0
jmp 0x4bcc
jmp 0x4bce
leaq 0x368(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x56f0
movq 0x98(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0x10570
jmp 0x4bfa
leaq 0x350(%rsp), %rdi
callq 0x56e0
leaq 0x368(%rsp), %rdi
callq 0x107f0
movl %eax, 0x94(%rsp)
jmp 0x4c1d
movl 0x94(%rsp), %eax
movl %eax, 0x34c(%rsp)
leaq 0x350(%rsp), %rdi
leaq 0x34c(%rsp), %rsi
callq 0x5c10
jmp 0x4c42
jmp 0x4c44
leaq 0x368(%rsp), %rdi
callq 0x107f0
movl %eax, 0x90(%rsp)
jmp 0x4c5a
movl 0x90(%rsp), %eax
movl %eax, 0x348(%rsp)
movl 0x34c(%rsp), %eax
cmpl 0x348(%rsp), %eax
je 0x4c44
leaq 0x350(%rsp), %rdi
leaq 0x348(%rsp), %rsi
callq 0x5c10
jmp 0x4c8f
leaq 0x32f(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x5db0
movq 0x88(%rsp), %rdx
leaq 0x330(%rsp), %rdi
movl $0x2, %esi
callq 0x5dc0
jmp 0x4cc0
leaq 0x32f(%rsp), %rdi
callq 0x5e40
leaq 0x2f8(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x5700
leaq 0x2c8(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x5700
movq 0x78(%rsp), %r8
movq 0x80(%rsp), %r9
leaq 0x3e8(%rsp), %rdi
leaq 0x350(%rsp), %rsi
leaq 0x568(%rsp), %rdx
leaq 0x330(%rsp), %rcx
callq 0x10930
jmp 0x4d28
movsd 0x728(%rsp), %xmm0
movq %rsp, %rax
leaq 0x5a0(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x330(%rsp), %rdi
leaq 0x630(%rsp), %rsi
leaq 0x568(%rsp), %rdx
leaq 0x520(%rsp), %rcx
leaq 0x2f8(%rsp), %r8
leaq 0x2c8(%rsp), %r9
callq 0x115d0
jmp 0x4d76
leaq 0x2b0(%rsp), %rdi
callq 0x56e0
leaq 0x298(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0x60e0
jmp 0x4d9a
leaq 0x2b0(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x11e20
jmp 0x4db1
leaq 0x298(%rsp), %rdi
callq 0x61e0
movl $0x0, 0x294(%rsp)
cmpl $0x2, 0x294(%rsp)
jge 0x5271
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x618(%rsp), %rcx
leaq 0x600(%rsp), %r8
callq 0xfe60
movsd %xmm0, 0x70(%rsp)
jmp 0x4e1c
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x288(%rsp)
movsd 0x288(%rsp), %xmm1
movsd 0x3b8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x51cd
movsd 0x288(%rsp), %xmm0
movsd %xmm0, 0x3b8(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
movq %rsp, %rax
leaq 0x480(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x618(%rsp), %rcx
leaq 0x600(%rsp), %r8
leaq 0x498(%rsp), %r9
callq 0x101a0
movb %al, 0x6f(%rsp)
jmp 0x4eb2
movb 0x6f(%rsp), %al
andb $0x1, %al
movb %al, 0x3b3(%rsp)
testb $0x1, 0x3b3(%rsp)
je 0x513c
movsd 0x288(%rsp), %xmm0
movq 0x1e0fb(%rip), %rdi     # 0x22fd8
callq 0x3550
movq %rax, 0x60(%rsp)
jmp 0x4ee9
movq 0x60(%rsp), %rdi
movq 0x1e0d3(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x4efc
movq 0x1e0d5(%rip), %rdi     # 0x22fd8
leaq 0x15310(%rip), %rsi     # 0x1a21a
callq 0x32c0
movq %rax, 0x58(%rsp)
jmp 0x4f16
movq 0x58(%rsp), %rdi
movq 0x1e0a6(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x4f29
testb $0x1, 0x41a(%rsp)
jne 0x503b
movl 0x414(%rsp), %eax
incl %eax
movl %eax, 0x414(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x6f8(%rsp), %rcx
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x414(%rsp), %r8
callq 0xe440
jmp 0x4f86
jmp 0x512f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5356
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5349
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x32f(%rsp), %rdi
callq 0x5e40
jmp 0x5349
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5322
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
jmp 0x5315
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x650(%rsp)
movl %eax, 0x64c(%rsp)
leaq 0x298(%rsp), %rdi
callq 0x61e0
jmp 0x5315
movl 0x414(%rsp), %eax
incl %eax
movl %eax, 0x414(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
leaq 0x6f8(%rsp), %rcx
leaq 0x520(%rsp), %rsi
leaq 0x630(%rsp), %rdx
leaq 0x414(%rsp), %r8
callq 0xe730
jmp 0x508a
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
callq 0x5f20
movq %rax, 0x280(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, %rdi
callq 0x5f90
movq %rax, 0x278(%rsp)
leaq 0x280(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x5f50
testb $0x1, %al
jne 0x50ef
jmp 0x512d
leaq 0x280(%rsp), %rdi
callq 0x60b0
movq %rax, %rsi
leaq 0x5a0(%rsp), %rdi
callq 0x5fc0
movq %rax, 0x50(%rsp)
jmp 0x5113
movq 0x50(%rsp), %rax
movl $0x0, (%rax)
leaq 0x280(%rsp), %rdi
callq 0x60c0
jmp 0x50af
jmp 0x512f
movb $0x0, 0x39f(%rsp)
jmp 0x5271
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, 0x48(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x5750
movslq (%rax), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq 0x48(%rsp), %rsi
movq %rax, %rdi
callq 0x6240
jmp 0x518a
movsd 0x288(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x5750
movslq (%rax), %rsi
leaq 0x3c8(%rsp), %rdi
callq 0x5bf0
movsd 0x40(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x5259
movslq 0x294(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x5f00
movq %rax, 0x38(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x5750
movslq (%rax), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x5f00
movq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x6240
jmp 0x521b
movsd 0x288(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movslq 0x294(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x5750
movslq (%rax), %rsi
leaq 0x3c8(%rsp), %rdi
callq 0x5bf0
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x525b
movl 0x294(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x294(%rsp)
jmp 0x4dc9
testb $0x1, 0x39f(%rsp)
jne 0x5288
movl $0x16, 0x274(%rsp)
jmp 0x52a0
leaq 0x350(%rsp), %rdi
callq 0x5d70
movl $0x0, 0x274(%rsp)
leaq 0x2b0(%rsp), %rdi
callq 0x6500
leaq 0x2c8(%rsp), %rdi
callq 0x6560
leaq 0x2f8(%rsp), %rdi
callq 0x6560
leaq 0x330(%rsp), %rdi
callq 0x6570
leaq 0x350(%rsp), %rdi
callq 0x6500
leaq 0x368(%rsp), %rdi
callq 0x61e0
movl 0x274(%rsp), %eax
testl %eax, %eax
je 0x52fd
jmp 0x52fb
jmp 0x5368
jmp 0x52ff
movl 0x388(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x388(%rsp)
jmp 0x4b5f
leaq 0x2b0(%rsp), %rdi
callq 0x6500
leaq 0x2c8(%rsp), %rdi
callq 0x6560
leaq 0x2f8(%rsp), %rdi
callq 0x6560
leaq 0x330(%rsp), %rdi
callq 0x6570
leaq 0x350(%rsp), %rdi
callq 0x6500
leaq 0x368(%rsp), %rdi
callq 0x61e0
jmp 0x5579
jmp 0x536a
leaq 0x630(%rsp), %rdi
callq 0x5d70
leaq 0x618(%rsp), %rdi
callq 0x5d90
leaq 0x600(%rsp), %rdi
callq 0x5d90
leaq 0x3e8(%rsp), %rdi
callq 0x65d0
leaq 0x3c8(%rsp), %rdi
callq 0x5d90
testb $0x1, 0x3b3(%rsp)
jne 0x545c
movl 0x720(%rsp), %esi
movq 0x1dc11(%rip), %rdi     # 0x22fd8
callq 0x34f0
movq %rax, 0x28(%rsp)
jmp 0x53d3
movq 0x28(%rsp), %rdi
movq 0x1dbe9(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x53e6
movq 0x1dbeb(%rip), %rdi     # 0x22fd8
leaq 0x14e37(%rip), %rsi     # 0x1a22b
callq 0x32c0
movq %rax, 0x20(%rsp)
jmp 0x5400
movq 0x20(%rsp), %rdi
movq 0x1dbbc(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x5413
movq 0x1dbbe(%rip), %rdi     # 0x22fd8
leaq 0x14e33(%rip), %rsi     # 0x1a254
callq 0x32c0
movq %rax, 0x18(%rsp)
jmp 0x542d
movq 0x18(%rsp), %rdi
movsd 0x3b8(%rsp), %xmm0
callq 0x3550
movq %rax, 0x10(%rsp)
jmp 0x5447
movq 0x10(%rsp), %rdi
movq 0x1db75(%rip), %rsi     # 0x22fc8
callq 0x3330
jmp 0x545a
jmp 0x545c
leaq 0x3c8(%rsp), %rdi
callq 0x61e0
leaq 0x3e8(%rsp), %rdi
callq 0x6570
testb $0x1, 0x41b(%rsp)
jne 0x43a3
movl $0x0, 0x744(%rsp)
movl $0x1, 0x274(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x65f0
leaq 0x480(%rsp), %rdi
callq 0x6500
leaq 0x498(%rsp), %rdi
callq 0x6500
leaq 0x4b0(%rsp), %rdi
callq 0x61e0
leaq 0x4c8(%rsp), %rdi
callq 0x61e0
leaq 0x4e0(%rsp), %rdi
callq 0x6500
leaq 0x520(%rsp), %rdi
callq 0x6600
leaq 0x550(%rsp), %rdi
callq 0x61e0
leaq 0x568(%rsp), %rdi
callq 0x6610
leaq 0x5a0(%rsp), %rdi
callq 0x6560
leaq 0x5d0(%rsp), %rdi
callq 0x6500
leaq 0x5e8(%rsp), %rdi
callq 0x6500
leaq 0x600(%rsp), %rdi
callq 0x61e0
leaq 0x618(%rsp), %rdi
callq 0x61e0
leaq 0x630(%rsp), %rdi
callq 0x6500
leaq 0x658(%rsp), %rdi
callq 0x6670
movl 0x744(%rsp), %eax
addq $0x748, %rsp            # imm = 0x748
retq
leaq 0x3c8(%rsp), %rdi
callq 0x61e0
leaq 0x3e8(%rsp), %rdi
callq 0x6570
leaq 0x450(%rsp), %rdi
callq 0x65f0
leaq 0x480(%rsp), %rdi
callq 0x6500
leaq 0x498(%rsp), %rdi
callq 0x6500
leaq 0x4b0(%rsp), %rdi
callq 0x61e0
leaq 0x4c8(%rsp), %rdi
callq 0x61e0
leaq 0x4e0(%rsp), %rdi
callq 0x6500
leaq 0x520(%rsp), %rdi
callq 0x6600
leaq 0x550(%rsp), %rdi
callq 0x61e0
leaq 0x568(%rsp), %rdi
callq 0x6610
leaq 0x5a0(%rsp), %rdi
callq 0x6560
leaq 0x5d0(%rsp), %rdi
callq 0x6500
leaq 0x5e8(%rsp), %rdi
callq 0x6500
leaq 0x600(%rsp), %rdi
callq 0x61e0
leaq 0x618(%rsp), %rdi
callq 0x61e0
leaq 0x630(%rsp), %rdi
callq 0x6500
leaq 0x658(%rsp), %rdi
callq 0x6670
movq 0x650(%rsp), %rdi
callq 0x3510