// File: millanek[P]evo/evo_shared_variation.cpp
// Function: sharedVarMain(int, char**)
int sharedVarMain(int argc, char** argv) {
    parseSharedVarOptions(argc, argv);
    string line; // for reading the input files
    
    std::istream* vcfFile = createReader(opt::vcfFile.c_str());
    std::ifstream* setsFile = new std::ifstream(opt::setsFile.c_str());
    string fileRoot = stripExtension(opt::setsFile);
    std::cerr << "Looking shared variation between samples in: " << opt::vcfFile << std::endl;
    std::cerr << "The groups are defined in: " << opt::setsFile << std::endl;
    
    std::map<string, std::vector<string>> speciesToIDsMap;
    std::map<string, string> IDsToSpeciesMap;
    std::map<string, std::vector<size_t>> speciesToPosMap;
    std::map<size_t, string> posToSpeciesMap;
    
    // Get the sample sets
    while (getline(*setsFile, line)) {
        std::vector<string> ID_Species = split(line, '\t');
        speciesToIDsMap[ID_Species[1]].push_back(ID_Species[0]);
        IDsToSpeciesMap[ID_Species[0]] = ID_Species[1];
    }
    
    // Get a vector of set names (usually species)
    std::vector<string> species;
    for(std::map<string,std::vector<string>>::iterator it = speciesToIDsMap.begin(); it != speciesToIDsMap.end(); ++it) {
        if ((it->first) != "Outgroup" && it->first != "xxx") {
            species.push_back(it->first);
            // std::cerr << it->first << std::endl;
        }
    } std::cerr << "There are " << species.size() << " sets (excluding the Outgroup)" << std::endl;
    
    std::ofstream* sharedLocsFile;
    if (opt::getLocsFor.size() == 2) {
        sharedLocsFile = new std::ofstream(opt::runName+"sharedVariationLocation_" + opt::getLocsFor[0] + "_" + opt::getLocsFor[1] + ".txt");
    }

    string sharedPerIndividualN = opt::runName + "sharedHets_perIndividual.txt";
    string sharedBetweenGroupsN = "sharedVariationBetween_" + fileRoot + "_" + opt::runName + ".txt";
    string sharedPerIndividualNscaled = opt::runName + "sharedHets_perIndividual_scaled.txt";
    string sharedBetweenGroupsNscaled = "sharedVariationBetween_" + fileRoot + "_" + opt::runName + "_scaled.txt";
    std::ofstream* sharedPerIndividual = new std::ofstream(sharedPerIndividualN.c_str());
    std::ofstream* sharedBetweenGroups = new std::ofstream(sharedBetweenGroupsN.c_str());
    std::ofstream* sharedPerIndividualScaled = new std::ofstream(sharedPerIndividualNscaled.c_str());
    std::ofstream* sharedBetweenGroupsScaled = new std::ofstream(sharedBetweenGroupsNscaled.c_str());
    std::vector<std::vector<double> > hetMatrix; std::vector<std::vector<double> > hetMatrixMissing;
    std::vector<std::vector<double> > sharedBetweenGroupsMatrix; std::vector<std::vector<double> > sharedBetweenGroupsMatrixMissing;
    
    int totalVariantNumber = 0; int reportProgressEvery = 10000;
    std::vector<string> sampleNames; int numSamples = 0;
    std::vector<string> fields;
    std::map<std::string, double> loc_pval;
    std::clock_t start; double durationOverall;
    while (getline(*vcfFile, line)) {
        line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); // Deal with any left over \r from files prepared on Windows
        if (line[0] == '#' && line[1] == '#')
            continue;
        else if (line[0] == '#' && line[1] == 'C') {
            fields = split(line, '\t');
            std::vector<std::string> sN(fields.begin()+NUM_NON_GENOTYPE_COLUMNS,fields.end());
            sampleNames = sN;
            for (std::vector<std::string>::size_type i = 0; i != sampleNames.size(); i++) {
                posToSpeciesMap[i] = IDsToSpeciesMap[sampleNames[i]];
            }
            numSamples = (int)sampleNames.size();
            
            // Iterate over all the keys in the map to find the samples in the VCF:
            // Give an error if no sample is found for a species:
            for(std::map<string, std::vector<string>>::iterator it = speciesToIDsMap.begin(); it != speciesToIDsMap.end(); ++it) {
                string sp =  it->first;
                //std::cerr << "sp " << sp << std::endl;
                std::vector<string> IDs = it->second;
                std::vector<size_t> spPos = locateSet(sampleNames, IDs);
                if (spPos.empty()) {
                    std::cerr << "Did not find any samples in the VCF for \"" << sp << "\"" << std::endl;
                    assert(!spPos.empty());
                }
                speciesToPosMap[sp] = spPos;
            }
            
            initialize_matrix_double(hetMatrix, numSamples); initialize_matrix_double(hetMatrixMissing, numSamples);
            initialize_matrix_double(sharedBetweenGroupsMatrix, (int)species.size());
            initialize_matrix_double(sharedBetweenGroupsMatrixMissing, (int)species.size());
            start = std::clock();
        } else {
            totalVariantNumber++;
            if (totalVariantNumber % reportProgressEvery == 0) {
                durationOverall = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
                std::cerr << "Processed " << totalVariantNumber << " variants in " << durationOverall << "secs" << std::endl;
            }
            fields = split(line, '\t');
            std::vector<std::string> genotypes(fields.begin()+NUM_NON_GENOTYPE_COLUMNS,fields.end());

            // Only consider biallelic SNPs
            string refAllele = fields[3]; string altAllele = fields[4];
            if (refAllele.length() > 1 || altAllele.length() > 1) {
                refAllele.clear(); refAllele.shrink_to_fit(); altAllele.clear(); altAllele.shrink_to_fit();
                genotypes.clear(); genotypes.shrink_to_fit(); continue;
            }
            
            GeneralSetCounts* c = new GeneralSetCounts(speciesToPosMap, (int)genotypes.size());
            c->getSetVariantCounts(genotypes, posToSpeciesMap);
            genotypes.clear(); genotypes.shrink_to_fit();
            
            // Put the number of hets in each sample on the diagonal
            for (int i = 0; i < numSamples; i++) {
                if (c->individualsWithVariant[i] == 1)
                    hetMatrix[i][i]++;
                else if (c->individualsWithVariant[i] == -1) // Missing data for this individual
                    hetMatrixMissing[i][i]++;
            }
            // Now look if the het is shared between individuals
            for (int i = 0; i < (numSamples-1); i++) {
                int iAllele = c->individualsWithVariant[i];
                if (iAllele == 1) {
                    for (int j = i+1; j != numSamples; j++) {
                        if (c->individualsWithVariant[j] == 1)
                            hetMatrix[j][i]++;
                        else if (c->individualsWithVariant[j] == -1)
                            hetMatrixMissing[j][i]++;
                    }
                } else if (iAllele == -1) {
                    for (int j = i+1; j != numSamples; j++) {
                        hetMatrixMissing[j][i]++;
                    }
                }
            }
            
            // Now look at the numbers a polymorphic sites in groups and shared between groups:
            std::vector<double> allPs;
            for (int i = 0; i < (int)species.size(); i++) {
                allPs.push_back(c->setAAFs.at(species[i]));
                double p_Si = allPs[i];
                if (p_Si > 0 && p_Si < 1)
                    sharedBetweenGroupsMatrix[i][i]++;
                else if (p_Si == -1)
                    sharedBetweenGroupsMatrixMissing[i][i]++;
            }
            for (int i = 0; i < ((int)species.size()-1); i++) {
                double p_Si = allPs[i];
                if (p_Si > 0 && p_Si < 1) {
                    for (int j = i+1; j != (int)species.size(); j++) {
                        double p_Sj = allPs[j];
                        if (p_Sj > 0 && p_Sj < 1) {
                            sharedBetweenGroupsMatrix[j][i]++;
                            if (opt::getLocsFor.size() == 2) {
                                if ((species[i] == opt::getLocsFor[0] && species[j] == opt::getLocsFor[1]) || (species[i] == opt::getLocsFor[1] && species[j] == opt::getLocsFor[0]))
                                    *sharedLocsFile << fields[0] << "\t" << fields[1] << std::endl;
                            }
                        }
                        else if (p_Sj == -1)
                            sharedBetweenGroupsMatrixMissing[j][i]++;
                    }
                } else if (p_Si == -1) { // Entirely missing data for this species/population
                    for (int j = i+1; j != (int)species.size(); j++) {
                        sharedBetweenGroupsMatrixMissing[j][i]++;
                    }
                }
            }
            delete c;
        }
    }
    
    // print het sharing per individual
    print_vector(sampleNames, *sharedPerIndividual);
    print_matrix<const std::vector<std::vector<double> >&>(hetMatrix, *sharedPerIndividual);
    for (int i = 0; i < numSamples; i++) {
        for (int j = 0; j < numSamples; j++) {
            double proportionUsed = 1 - (hetMatrixMissing[j][i]/totalVariantNumber);
            hetMatrix[j][i] = hetMatrix[j][i]/proportionUsed;
        }
    }
    print_vector(sampleNames, *sharedPerIndividualScaled);
    print_matrix<const std::vector<std::vector<double> >&>(hetMatrix, *sharedPerIndividualScaled);
    
    // Print variant sharing between groups
    print_vector(species, *sharedBetweenGroups);
    print_matrix<const std::vector<std::vector<double> >&>(sharedBetweenGroupsMatrix, *sharedBetweenGroups);
    for (int i = 0; i < (int)species.size(); i++) {
        for (int j = 0; j < (int)species.size(); j++) {
            double proportionUsed = 1 - (sharedBetweenGroupsMatrixMissing[j][i]/totalVariantNumber);
            sharedBetweenGroupsMatrix[j][i] = sharedBetweenGroupsMatrix[j][i]/proportionUsed;
        }
    }
    print_vector(species, *sharedBetweenGroupsScaled);
    print_matrix<const std::vector<std::vector<double> >&>(sharedBetweenGroupsMatrix, *sharedBetweenGroupsScaled);
    
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x950, %rsp            # imm = 0x950
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xc61f0
leaq -0x30(%rbp), %rdi
callq 0xa820
leaq 0xd6d2a(%rip), %rdi     # 0x19abf8
callq 0xa220
movq %rax, -0x718(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x710(%rbp)
callq 0xab60
movq -0x718(%rbp), %rsi
movq -0x710(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x2d6c0
jmp 0xc3f03
leaq -0x58(%rbp), %rdi
movl $0x8, %esi
callq 0x80e30
movq %rax, -0x720(%rbp)
jmp 0xc3f1a
leaq -0x58(%rbp), %rdi
callq 0xac88
leaq -0x59(%rbp), %rdi
callq 0xa640
movq -0x720(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x728(%rbp)
jmp 0xc3f4a
leaq 0xd6cc7(%rip), %rdi     # 0x19ac18
callq 0xa220
movq -0x728(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0xc3f6c
movq -0x728(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq 0xd6c9a(%rip), %rsi     # 0x19ac18
leaq -0x98(%rbp), %rdi
callq 0x7be70
jmp 0xc3f8c
movq 0xd505d(%rip), %rdi     # 0x198ff0
leaq 0x7ea3a(%rip), %rsi     # 0x1429d4
callq 0xa5c0
movq %rax, -0x730(%rbp)
jmp 0xc3fa8
movq -0x730(%rbp), %rdi
leaq 0xd6c42(%rip), %rsi     # 0x19abf8
callq 0xa520
movq %rax, -0x738(%rbp)
jmp 0xc3fc4
movq -0x738(%rbp), %rdi
movq 0xd4fb6(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc3fd9
movq 0xd5010(%rip), %rdi     # 0x198ff0
leaq 0x7ea1b(%rip), %rsi     # 0x142a02
callq 0xa5c0
movq %rax, -0x740(%rbp)
jmp 0xc3ff5
movq -0x740(%rbp), %rdi
leaq 0xd6c15(%rip), %rsi     # 0x19ac18
callq 0xa520
movq %rax, -0x748(%rbp)
jmp 0xc4011
movq -0x748(%rbp), %rdi
movq 0xd4f69(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc4026
leaq -0xc8(%rbp), %rdi
callq 0x58920
leaq -0xf8(%rbp), %rdi
callq 0x584b0
leaq -0x128(%rbp), %rdi
callq 0x951b0
leaq -0x158(%rbp), %rdi
callq 0x951d0
movq -0x78(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x750(%rbp)
jmp 0xc406c
movq -0x750(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x751(%rbp)
jmp 0xc408a
movb -0x751(%rbp), %al
testb $0x1, %al
jne 0xc4099
jmp 0xc420a
leaq -0x170(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0xc40b0
leaq -0x170(%rbp), %rdi
movl $0x1, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x6b400
movq %rax, -0x760(%rbp)
jmp 0xc40d9
xorl %eax, %eax
movl %eax, %esi
leaq -0x170(%rbp), %rdi
callq 0x3d940
movq -0x760(%rbp), %rdi
movq %rax, %rsi
callq 0x48dc0
jmp 0xc40fa
leaq -0x170(%rbp), %rdi
movq %rdi, -0x778(%rbp)
movl $0x1, %esi
callq 0x3d940
movq -0x778(%rbp), %rdi
movq %rax, -0x770(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x584d0
movq %rax, -0x768(%rbp)
jmp 0xc4141
movq -0x770(%rbp), %rsi
movq -0x768(%rbp), %rdi
callq 0xa060
jmp 0xc4156
leaq -0x170(%rbp), %rdi
callq 0x3dfa0
jmp 0xc4056
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc418a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xac88
leaq -0x59(%rbp), %rdi
callq 0xa640
jmp 0xc61de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc61de
movq -0x728(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0xc61de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc61d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc61a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x3dfa0
jmp 0xc61a2
leaq -0x188(%rbp), %rdi
callq 0x48da0
leaq -0xc8(%rbp), %rdi
callq 0x6c3d0
movq %rax, -0x190(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6c430
movq %rax, -0x198(%rbp)
leaq -0x190(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x6c400
testb $0x1, %al
jne 0xc4258
jmp 0xc42f9
leaq -0x190(%rbp), %rdi
callq 0x6c460
movq %rax, %rdi
leaq 0x76fec(%rip), %rsi     # 0x13b25a
callq 0x50eb0
movb %al, -0x779(%rbp)
jmp 0xc427b
movb -0x779(%rbp), %al
testb $0x1, %al
jne 0xc4287
jmp 0xc42e6
leaq -0x190(%rbp), %rdi
callq 0x6c460
movq %rax, %rdi
leaq 0x784d3(%rip), %rsi     # 0x13c770
callq 0x50eb0
movb %al, -0x77a(%rbp)
jmp 0xc42aa
movb -0x77a(%rbp), %al
testb $0x1, %al
jne 0xc42b6
jmp 0xc42e6
leaq -0x190(%rbp), %rdi
callq 0x6c460
movq %rax, %rsi
leaq -0x188(%rbp), %rdi
callq 0x48dc0
jmp 0xc42d3
jmp 0xc42e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc6196
jmp 0xc42e8
leaq -0x190(%rbp), %rdi
callq 0x71fc0
jmp 0xc4229
movq 0xd4cf0(%rip), %rdi     # 0x198ff0
leaq 0x8a6f6(%rip), %rsi     # 0x14e9fd
callq 0xa5c0
movq %rax, -0x788(%rbp)
jmp 0xc4315
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq -0x788(%rbp), %rdi
movq %rax, %rsi
callq 0xa140
movq %rax, -0x790(%rbp)
jmp 0xc4339
movq -0x790(%rbp), %rdi
leaq 0x7e6d7(%rip), %rsi     # 0x142a1e
callq 0xa5c0
movq %rax, -0x798(%rbp)
jmp 0xc4355
movq -0x798(%rbp), %rdi
movq 0xd4c25(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc436a
leaq 0xd68c7(%rip), %rdi     # 0x19ac38
callq 0x3ffd0
cmpq $0x2, %rax
jne 0xc4561
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x7a0(%rbp)
jmp 0xc4393
movb $0x1, -0x241(%rbp)
leaq 0xd68af(%rip), %rsi     # 0x19ac50
leaq 0x7e695(%rip), %rdx     # 0x142a3d
leaq -0x240(%rbp), %rdi
callq 0x3da80
jmp 0xc43b6
leaq 0xd687b(%rip), %rdi     # 0x19ac38
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq %rax, %rdx
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3da30
jmp 0xc43de
leaq 0x7b9ab(%rip), %rdx     # 0x13fd90
leaq -0x200(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x3e020
jmp 0xc43fa
leaq 0xd6837(%rip), %rdi     # 0x19ac38
movl $0x1, %esi
callq 0x3d940
movq %rax, %rdx
leaq -0x1e0(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x3da30
jmp 0xc4423
leaq 0x8517d(%rip), %rdx     # 0x1495a7
leaq -0x1c0(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3e020
jmp 0xc443f
movq -0x7a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
movl $0x10, %edx
callq 0xac00
jmp 0xc4459
movq -0x7a0(%rbp), %rax
movb $0x0, -0x241(%rbp)
movq %rax, -0x1a0(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xac88
leaq -0x1e0(%rbp), %rdi
callq 0xac88
leaq -0x200(%rbp), %rdi
callq 0xac88
leaq -0x220(%rbp), %rdi
callq 0xac88
leaq -0x240(%rbp), %rdi
callq 0xac88
jmp 0xc4561
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4540
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4534
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4528
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc451c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4510
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xac88
leaq -0x1e0(%rbp), %rdi
callq 0xac88
leaq -0x200(%rbp), %rdi
callq 0xac88
leaq -0x220(%rbp), %rdi
callq 0xac88
leaq -0x240(%rbp), %rdi
callq 0xac88
testb $0x1, -0x241(%rbp)
jne 0xc454b
jmp 0xc455c
movq -0x7a0(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xc6196
leaq 0xd66e8(%rip), %rsi     # 0x19ac50
leaq 0x7e4e7(%rip), %rdx     # 0x142a56
leaq -0x268(%rbp), %rdi
callq 0x3da80
jmp 0xc457d
leaq 0x7e4ef(%rip), %rsi     # 0x142a73
leaq -0x2e8(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0xba820
jmp 0xc4599
leaq 0x7b7f0(%rip), %rdx     # 0x13fd90
leaq -0x2c8(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x3e020
jmp 0xc45b5
leaq 0xd6694(%rip), %rdx     # 0x19ac50
leaq -0x2a8(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x3da30
jmp 0xc45d1
leaq 0x84fcf(%rip), %rdx     # 0x1495a7
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3e020
jmp 0xc45ed
leaq -0x2a8(%rbp), %rdi
callq 0xac88
leaq -0x2c8(%rbp), %rdi
callq 0xac88
leaq -0x2e8(%rbp), %rdi
callq 0xac88
leaq 0xd6638(%rip), %rsi     # 0x19ac50
leaq 0x7e46c(%rip), %rdx     # 0x142a8b
leaq -0x308(%rbp), %rdi
callq 0x3da80
jmp 0xc462d
leaq 0x7e43f(%rip), %rsi     # 0x142a73
leaq -0x388(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0xba820
jmp 0xc4649
leaq 0x7b740(%rip), %rdx     # 0x13fd90
leaq -0x368(%rbp), %rdi
leaq -0x388(%rbp), %rsi
callq 0x3e020
jmp 0xc4665
leaq 0xd65e4(%rip), %rdx     # 0x19ac50
leaq -0x348(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x3da30
jmp 0xc4681
leaq 0x7e41b(%rip), %rdx     # 0x142aa3
leaq -0x328(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x3e020
jmp 0xc469d
leaq -0x348(%rbp), %rdi
callq 0xac88
leaq -0x368(%rbp), %rdi
callq 0xac88
leaq -0x388(%rbp), %rdi
callq 0xac88
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x7a8(%rbp)
jmp 0xc46d4
leaq -0x268(%rbp), %rdi
callq 0xa220
movq -0x7a8(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0xc46f6
movq -0x7a8(%rbp), %rax
movq %rax, -0x390(%rbp)
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x7b0(%rbp)
jmp 0xc4717
leaq -0x288(%rbp), %rdi
callq 0xa220
movq -0x7b0(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0xc4739
movq -0x7b0(%rbp), %rax
movq %rax, -0x398(%rbp)
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x7b8(%rbp)
jmp 0xc475a
leaq -0x308(%rbp), %rdi
callq 0xa220
movq -0x7b8(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0xc477c
movq -0x7b8(%rbp), %rax
movq %rax, -0x3a0(%rbp)
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x7c0(%rbp)
jmp 0xc479d
leaq -0x328(%rbp), %rdi
callq 0xa220
movq -0x7c0(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0xc47bf
movq -0x7c0(%rbp), %rax
movq %rax, -0x3a8(%rbp)
leaq -0x3c0(%rbp), %rdi
callq 0x65060
leaq -0x3d8(%rbp), %rdi
callq 0x65060
leaq -0x3f0(%rbp), %rdi
callq 0x65060
leaq -0x408(%rbp), %rdi
callq 0x65060
movl $0x0, -0x40c(%rbp)
movl $0x2710, -0x410(%rbp)   # imm = 0x2710
leaq -0x428(%rbp), %rdi
callq 0x48da0
movl $0x0, -0x42c(%rbp)
leaq -0x448(%rbp), %rdi
callq 0x48da0
leaq -0x478(%rbp), %rdi
callq 0xc6550
movq -0x38(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x7c8(%rbp)
jmp 0xc4855
movq -0x7c8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x7c9(%rbp)
jmp 0xc4873
movb -0x7c9(%rbp), %al
testb $0x1, %al
jne 0xc4882
jmp 0xc5c1f
leaq -0x30(%rbp), %rdi
movq %rdi, -0x7e0(%rbp)
callq 0xa4f0
movq -0x7e0(%rbp), %rdi
movq %rax, -0x4a0(%rbp)
callq 0xa330
movq %rax, -0x4a8(%rbp)
movb $0xd, -0x4a9(%rbp)
movq -0x4a0(%rbp), %rdi
movq -0x4a8(%rbp), %rsi
leaq -0x4a9(%rbp), %rdx
callq 0xc6570
movq %rax, -0x7d8(%rbp)
jmp 0xc48d6
movq -0x7d8(%rbp), %rax
movq %rax, -0x498(%rbp)
leaq -0x490(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0xc65c0
leaq -0x30(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0xa330
movq %rax, -0x4c0(%rbp)
leaq -0x4b8(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0xc65c0
movq -0x7f0(%rbp), %rdi
movq -0x490(%rbp), %rsi
movq -0x4b8(%rbp), %rdx
callq 0xa120
movq %rax, -0x7e8(%rbp)
jmp 0xc4944
movq -0x7e8(%rbp), %rax
movq %rax, -0x4c8(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xac60
movq %rax, -0x7f8(%rbp)
jmp 0xc4968
movq -0x7f8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xc4b29
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0xac60
movq %rax, -0x800(%rbp)
jmp 0xc4992
movq -0x800(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xc4b29
jmp 0xc483f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc618a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc49fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc49ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0xac88
leaq -0x2c8(%rbp), %rdi
callq 0xac88
leaq -0x2e8(%rbp), %rdi
callq 0xac88
jmp 0xc618a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc617e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc6172
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4a62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x348(%rbp), %rdi
callq 0xac88
leaq -0x368(%rbp), %rdi
callq 0xac88
leaq -0x388(%rbp), %rdi
callq 0xac88
jmp 0xc6172
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc6166
movq -0x7a8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xc6166
movq -0x7b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xc6166
movq -0x7b8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xc6166
movq -0x7c0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xc6166
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc6112
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xac60
movq %rax, -0x808(%rbp)
jmp 0xc4b3f
movq -0x808(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xc4fe8
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0xac60
movq %rax, -0x810(%rbp)
jmp 0xc4b69
movq -0x810(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x43, %eax
jne 0xc4fe8
leaq -0x4e0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0xc4b93
leaq -0x448(%rbp), %rdi
movq %rdi, -0x820(%rbp)
leaq -0x4e0(%rbp), %rsi
movq %rsi, -0x828(%rbp)
callq 0x50c30
movq -0x828(%rbp), %rdi
callq 0x3dfa0
movq -0x820(%rbp), %rdi
callq 0x44030
movq %rax, -0x508(%rbp)
leaq -0x508(%rbp), %rdi
movl $0x9, %esi
callq 0x44390
movq -0x820(%rbp), %rdi
movq %rax, -0x500(%rbp)
callq 0x44060
movq %rax, -0x510(%rbp)
leaq -0x511(%rbp), %rdi
movq %rdi, -0x818(%rbp)
callq 0x48e80
movq -0x818(%rbp), %rcx
movq -0x500(%rbp), %rsi
movq -0x510(%rbp), %rdx
leaq -0x4f8(%rbp), %rdi
callq 0xc6600
jmp 0xc4c34
leaq -0x511(%rbp), %rdi
callq 0x40090
leaq -0x428(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
callq 0x43c10
jmp 0xc4c55
movq $0x0, -0x520(%rbp)
movq -0x520(%rbp), %rax
movq %rax, -0x830(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0x830(%rbp), %rax
cmpq %rcx, %rax
je 0xc4d30
movq -0x520(%rbp), %rsi
leaq -0x428(%rbp), %rdi
callq 0x3d940
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x584d0
movq %rax, -0x838(%rbp)
jmp 0xc4cb8
leaq -0x158(%rbp), %rdi
leaq -0x520(%rbp), %rsi
callq 0x95260
movq %rax, -0x840(%rbp)
jmp 0xc4cd4
movq -0x838(%rbp), %rsi
movq -0x840(%rbp), %rdi
callq 0xa060
jmp 0xc4ce9
jmp 0xc4ceb
movq -0x520(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x520(%rbp)
jmp 0xc4c60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x511(%rbp), %rdi
callq 0x40090
jmp 0xc6112
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4fd7
leaq -0x428(%rbp), %rdi
callq 0x3ffd0
movl %eax, -0x42c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6c3d0
movq %rax, -0x528(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6c430
movq %rax, -0x530(%rbp)
leaq -0x528(%rbp), %rdi
leaq -0x530(%rbp), %rsi
callq 0x6c400
testb $0x1, %al
jne 0xc4d84
jmp 0xc4f52
leaq -0x528(%rbp), %rdi
callq 0x6c460
movq %rax, %rsi
leaq -0x550(%rbp), %rdi
callq 0xa250
jmp 0xc4da1
leaq -0x528(%rbp), %rdi
callq 0x6c460
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x568(%rbp), %rdi
callq 0x3fee0
jmp 0xc4dc2
leaq -0x580(%rbp), %rdi
leaq -0x428(%rbp), %rsi
leaq -0x568(%rbp), %rdx
callq 0x81250
jmp 0xc4dde
leaq -0x580(%rbp), %rdi
callq 0x95340
testb $0x1, %al
jne 0xc4df3
jmp 0xc4ecf
movq 0xd41f6(%rip), %rdi     # 0x198ff0
leaq 0x77ada(%rip), %rsi     # 0x13c8db
callq 0xa5c0
movq %rax, -0x848(%rbp)
jmp 0xc4e0f
movq -0x848(%rbp), %rdi
leaq -0x550(%rbp), %rsi
callq 0xa520
movq %rax, -0x850(%rbp)
jmp 0xc4e2b
movq -0x850(%rbp), %rdi
leaq 0x765d6(%rip), %rsi     # 0x13b40f
callq 0xa5c0
movq %rax, -0x858(%rbp)
jmp 0xc4e47
movq -0x858(%rbp), %rdi
movq 0xd4133(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc4e5c
leaq -0x580(%rbp), %rdi
callq 0x95340
xorb $-0x1, %al
testb $0x1, %al
jne 0xc4e70
jmp 0xc4e72
jmp 0xc4ecd
leaq 0x77a8c(%rip), %rdi     # 0x13c905
leaq 0x7dc2f(%rip), %rsi     # 0x142aaf
movl $0x77, %edx
leaq 0x7dc3c(%rip), %rcx     # 0x142ac8
callq 0xa390
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4f41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc4f35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x580(%rbp), %rdi
callq 0x50d40
jmp 0xc4f35
jmp 0xc4ecf
leaq -0x128(%rbp), %rdi
leaq -0x550(%rbp), %rsi
callq 0x95380
movq %rax, -0x860(%rbp)
jmp 0xc4eeb
movq -0x860(%rbp), %rdi
leaq -0x580(%rbp), %rsi
callq 0x95460
jmp 0xc4f00
leaq -0x580(%rbp), %rdi
callq 0x50d40
leaq -0x568(%rbp), %rdi
callq 0x3dfa0
leaq -0x550(%rbp), %rdi
callq 0xac88
leaq -0x528(%rbp), %rdi
callq 0x71fc0
jmp 0xc4d55
leaq -0x568(%rbp), %rdi
callq 0x3dfa0
leaq -0x550(%rbp), %rdi
callq 0xac88
jmp 0xc4fd7
movl -0x42c(%rbp), %esi
leaq -0x3c0(%rbp), %rdi
xorl %edx, %edx
callq 0x7bc60
jmp 0xc4f68
movl -0x42c(%rbp), %esi
leaq -0x3d8(%rbp), %rdi
xorl %edx, %edx
callq 0x7bc60
jmp 0xc4f7e
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movl %eax, %esi
leaq -0x3f0(%rbp), %rdi
xorl %edx, %edx
callq 0x7bc60
jmp 0xc4f9c
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movl %eax, %esi
leaq -0x408(%rbp), %rdi
xorl %edx, %edx
callq 0x7bc60
jmp 0xc4fba
callq 0xa3a0
movq %rax, -0x480(%rbp)
leaq -0x4f8(%rbp), %rdi
callq 0x3dfa0
jmp 0xc5c18
leaq -0x4f8(%rbp), %rdi
callq 0x3dfa0
jmp 0xc6112
movl -0x40c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40c(%rbp)
movl -0x40c(%rbp), %eax
cltd
idivl -0x410(%rbp)
cmpl $0x0, %edx
jne 0xc50d8
callq 0xa3a0
movq -0x480(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x743ff(%rip), %xmm1    # 0x139428
divsd %xmm1, %xmm0
movsd %xmm0, -0x488(%rbp)
movq 0xd3fb4(%rip), %rdi     # 0x198ff0
leaq 0x77903(%rip), %rsi     # 0x13c946
callq 0xa5c0
movq %rax, -0x868(%rbp)
jmp 0xc5051
movq -0x868(%rbp), %rdi
movl -0x40c(%rbp), %esi
callq 0xab20
movq %rax, -0x870(%rbp)
jmp 0xc506c
movq -0x870(%rbp), %rdi
leaq 0x7ab08(%rip), %rsi     # 0x13fb82
callq 0xa5c0
movq %rax, -0x878(%rbp)
jmp 0xc5088
movq -0x878(%rbp), %rdi
movsd -0x488(%rbp), %xmm0
callq 0xabd0
movq %rax, -0x880(%rbp)
jmp 0xc50a5
movq -0x880(%rbp), %rdi
leaq 0x7da35(%rip), %rsi     # 0x142ae8
callq 0xa5c0
movq %rax, -0x888(%rbp)
jmp 0xc50c1
movq -0x888(%rbp), %rdi
movq 0xd3eb9(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc50d6
jmp 0xc50d8
leaq -0x598(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0xc50ef
leaq -0x448(%rbp), %rdi
movq %rdi, -0x898(%rbp)
leaq -0x598(%rbp), %rsi
movq %rsi, -0x8a0(%rbp)
callq 0x50c30
movq -0x8a0(%rbp), %rdi
callq 0x3dfa0
movq -0x898(%rbp), %rdi
callq 0x44030
movq %rax, -0x5c0(%rbp)
leaq -0x5c0(%rbp), %rdi
movl $0x9, %esi
callq 0x44390
movq -0x898(%rbp), %rdi
movq %rax, -0x5b8(%rbp)
callq 0x44060
movq %rax, -0x5c8(%rbp)
leaq -0x5c9(%rbp), %rdi
movq %rdi, -0x890(%rbp)
callq 0x48e80
movq -0x890(%rbp), %rcx
movq -0x5b8(%rbp), %rsi
movq -0x5c8(%rbp), %rdx
leaq -0x5b0(%rbp), %rdi
callq 0xc6600
jmp 0xc5190
leaq -0x5c9(%rbp), %rdi
callq 0x40090
leaq -0x448(%rbp), %rdi
movl $0x3, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x5f0(%rbp), %rdi
callq 0xa250
jmp 0xc51be
leaq -0x448(%rbp), %rdi
movl $0x4, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x610(%rbp), %rdi
callq 0xa250
jmp 0xc51e0
leaq -0x5f0(%rbp), %rdi
callq 0xa930
cmpq $0x1, %rax
ja 0xc5208
leaq -0x610(%rbp), %rdi
callq 0xa930
cmpq $0x1, %rax
jbe 0xc52c6
leaq -0x5f0(%rbp), %rdi
movq %rdi, -0x8b8(%rbp)
callq 0xa7b0
movq -0x8b8(%rbp), %rdi
callq 0xac30
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8b0(%rbp)
callq 0xa7b0
movq -0x8b0(%rbp), %rdi
callq 0xac30
leaq -0x5b0(%rbp), %rdi
movq %rdi, -0x8a8(%rbp)
callq 0x591f0
movq -0x8a8(%rbp), %rdi
callq 0xc6680
jmp 0xc5267
movl $0x7, -0x614(%rbp)
jmp 0xc5bb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x5c9(%rbp), %rdi
callq 0x40090
jmp 0xc6112
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc5c07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc5bfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xc5bef
movl $0x240, %edi            # imm = 0x240
callq 0xa5d0
movq %rax, -0x8c0(%rbp)
jmp 0xc52d9
leaq -0x5b0(%rbp), %rdi
callq 0x3ffd0
movq -0x8c0(%rbp), %rdi
movl %eax, %edx
leaq -0x128(%rbp), %rsi
callq 0xc66a0
jmp 0xc52fc
movq -0x8c0(%rbp), %rax
movq %rax, -0x620(%rbp)
movq -0x620(%rbp), %rdi
leaq -0x5b0(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x7acd0
jmp 0xc5326
leaq -0x5b0(%rbp), %rdi
movq %rdi, -0x8c8(%rbp)
callq 0x591f0
movq -0x8c8(%rbp), %rdi
callq 0xc6680
jmp 0xc5347
movl $0x0, -0x624(%rbp)
movl -0x624(%rbp), %eax
cmpl -0x42c(%rbp), %eax
jge 0xc5441
movq -0x620(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0x624(%rbp), %rsi
callq 0x4d100
cmpl $0x1, (%rax)
jne 0xc53d8
movslq -0x624(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x624(%rbp), %rsi
callq 0x3ec30
movsd 0x6cf0c(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc542b
movq -0x8c0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x240, %esi            # imm = 0x240
callq 0xa5e0
jmp 0xc5bef
movq -0x620(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0x624(%rbp), %rsi
callq 0x4d100
cmpl $-0x1, (%rax)
jne 0xc5429
movslq -0x624(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x624(%rbp), %rsi
callq 0x3ec30
movsd 0x6ce97(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc542b
jmp 0xc542d
movl -0x624(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x624(%rbp)
jmp 0xc5351
movl $0x0, -0x628(%rbp)
movl -0x628(%rbp), %eax
movl -0x42c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xc55f3
movq -0x620(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0x628(%rbp), %rsi
callq 0x4d100
movl (%rax), %eax
movl %eax, -0x62c(%rbp)
cmpl $0x1, -0x62c(%rbp)
jne 0xc5570
movl -0x628(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
movl -0x630(%rbp), %eax
cmpl -0x42c(%rbp), %eax
je 0xc556e
movq -0x620(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0x630(%rbp), %rsi
callq 0x4d100
cmpl $0x1, (%rax)
jne 0xc5505
movslq -0x630(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x628(%rbp), %rsi
callq 0x3ec30
movsd 0x6cdbd(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc5558
movq -0x620(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0x630(%rbp), %rsi
callq 0x4d100
cmpl $-0x1, (%rax)
jne 0xc5556
movslq -0x630(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x628(%rbp), %rsi
callq 0x3ec30
movsd 0x6cd6a(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc5558
jmp 0xc555a
movl -0x630(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
jmp 0xc54a0
jmp 0xc55dd
cmpl $-0x1, -0x62c(%rbp)
jne 0xc55db
movl -0x628(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x634(%rbp)
movl -0x634(%rbp), %eax
cmpl -0x42c(%rbp), %eax
je 0xc55d9
movslq -0x634(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x628(%rbp), %rsi
callq 0x3ec30
movsd 0x6ccf8(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x634(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x634(%rbp)
jmp 0xc5588
jmp 0xc55db
jmp 0xc55dd
jmp 0xc55df
movl -0x628(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x628(%rbp)
jmp 0xc544b
leaq -0x650(%rbp), %rdi
callq 0x48410
movl $0x0, -0x654(%rbp)
movl -0x654(%rbp), %eax
movl %eax, -0x8cc(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x8cc(%rbp), %eax
cmpl %ecx, %eax
jge 0xc577b
movq -0x620(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0x8e0(%rbp)
movslq -0x654(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3d940
movq -0x8e0(%rbp), %rdi
movq %rax, %rsi
callq 0x847c0
movq %rax, -0x8d8(%rbp)
jmp 0xc5671
movq -0x8d8(%rbp), %rsi
leaq -0x650(%rbp), %rdi
callq 0xb77b0
jmp 0xc5686
movslq -0x654(%rbp), %rsi
leaq -0x650(%rbp), %rdi
callq 0x3ec30
movsd (%rax), %xmm0
movsd %xmm0, -0x660(%rbp)
movsd -0x660(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc5719
movsd 0x6cbfa(%rip), %xmm0    # 0x1322b8
ucomisd -0x660(%rbp), %xmm0
jbe 0xc5719
movslq -0x654(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x654(%rbp), %rsi
callq 0x3ec30
movsd 0x6cbc6(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc5765
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x650(%rbp), %rdi
callq 0x3ecb0
jmp 0xc5bef
movsd -0x660(%rbp), %xmm0
movsd 0x6df97(%rip), %xmm1    # 0x1336c0
ucomisd %xmm1, %xmm0
jne 0xc5763
jp 0xc5763
movslq -0x654(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x654(%rbp), %rsi
callq 0x3ec30
movsd 0x6cb5d(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc5765
jmp 0xc5767
movl -0x654(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x654(%rbp)
jmp 0xc5609
movl $0x0, -0x664(%rbp)
movl -0x664(%rbp), %eax
movl %eax, -0x8e4(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x8e4(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xc5b71
movslq -0x664(%rbp), %rsi
leaq -0x650(%rbp), %rdi
callq 0x3ec30
movsd (%rax), %xmm0
movsd %xmm0, -0x670(%rbp)
movsd -0x670(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc5ac8
movsd 0x6cacb(%rip), %xmm0    # 0x1322b8
ucomisd -0x670(%rbp), %xmm0
jbe 0xc5ac8
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x674(%rbp)
movl -0x674(%rbp), %eax
movl %eax, -0x8e8(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x8e8(%rbp), %eax
cmpl %ecx, %eax
je 0xc5ac3
movslq -0x674(%rbp), %rsi
leaq -0x650(%rbp), %rdi
callq 0x3ec30
movsd (%rax), %xmm0
movsd %xmm0, -0x680(%rbp)
movsd -0x680(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc5a61
movsd 0x6ca49(%rip), %xmm0    # 0x1322b8
ucomisd -0x680(%rbp), %xmm0
jbe 0xc5a61
movslq -0x674(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x664(%rbp), %rsi
callq 0x3ec30
movsd 0x6ca11(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
leaq 0xd5382(%rip), %rdi     # 0x19ac38
callq 0x3ffd0
cmpq $0x2, %rax
jne 0xc5a5f
movslq -0x664(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3d940
movq %rax, -0x8f0(%rbp)
leaq 0xd5352(%rip), %rdi     # 0x19ac38
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq -0x8f0(%rbp), %rdi
movq %rax, %rsi
callq 0x39210
testb $0x1, %al
jne 0xc5904
jmp 0xc5946
movslq -0x674(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3d940
movq %rax, -0x8f8(%rbp)
leaq 0xd5313(%rip), %rdi     # 0x19ac38
movl $0x1, %esi
callq 0x3d940
movq -0x8f8(%rbp), %rdi
movq %rax, %rsi
callq 0x39210
testb $0x1, %al
jne 0xc59cb
movslq -0x664(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3d940
movq %rax, -0x900(%rbp)
leaq 0xd52d1(%rip), %rdi     # 0x19ac38
movl $0x1, %esi
callq 0x3d940
movq -0x900(%rbp), %rdi
movq %rax, %rsi
callq 0x39210
testb $0x1, %al
jne 0xc5989
jmp 0xc5a5d
movslq -0x674(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x3d940
movq %rax, -0x908(%rbp)
leaq 0xd528e(%rip), %rdi     # 0x19ac38
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq -0x908(%rbp), %rdi
movq %rax, %rsi
callq 0x39210
testb $0x1, %al
jne 0xc59cb
jmp 0xc5a5d
movq -0x1a0(%rbp), %rax
movq %rax, -0x918(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x448(%rbp), %rdi
callq 0x3d940
movq -0x918(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x910(%rbp)
jmp 0xc5a01
movq -0x910(%rbp), %rdi
leaq 0x704cf(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x920(%rbp)
jmp 0xc5a1d
leaq -0x448(%rbp), %rdi
movl $0x1, %esi
callq 0x3d940
movq -0x920(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x928(%rbp)
jmp 0xc5a46
movq -0x928(%rbp), %rdi
movq 0xd3534(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xc5a5b
jmp 0xc5a5d
jmp 0xc5a5f
jmp 0xc5aad
movsd -0x680(%rbp), %xmm0
movsd 0x6dc4f(%rip), %xmm1    # 0x1336c0
ucomisd %xmm1, %xmm0
jne 0xc5aab
jp 0xc5aab
movslq -0x674(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x664(%rbp), %rsi
callq 0x3ec30
movsd 0x6c815(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc5aad
jmp 0xc5aaf
movl -0x674(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x674(%rbp)
jmp 0xc580a
jmp 0xc5b5b
movsd -0x670(%rbp), %xmm0
movsd 0x6dbe8(%rip), %xmm1    # 0x1336c0
ucomisd %xmm1, %xmm0
jne 0xc5b59
jp 0xc5b59
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x684(%rbp)
movl -0x684(%rbp), %eax
movl %eax, -0x92c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x92c(%rbp), %eax
cmpl %ecx, %eax
je 0xc5b57
movslq -0x684(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x664(%rbp), %rsi
callq 0x3ec30
movsd 0x6c77a(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x684(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x684(%rbp)
jmp 0xc5aef
jmp 0xc5b59
jmp 0xc5b5b
jmp 0xc5b5d
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
jmp 0xc5785
movq -0x620(%rbp), %rax
movq %rax, -0x938(%rbp)
cmpq $0x0, %rax
je 0xc5ba2
movq -0x938(%rbp), %rdi
callq 0xc6bd0
movq -0x938(%rbp), %rdi
movl $0x240, %esi            # imm = 0x240
callq 0xa5e0
leaq -0x650(%rbp), %rdi
callq 0x3ecb0
movl $0x0, -0x614(%rbp)
leaq -0x610(%rbp), %rdi
callq 0xac88
leaq -0x5f0(%rbp), %rdi
callq 0xac88
leaq -0x5b0(%rbp), %rdi
callq 0x3dfa0
movl -0x614(%rbp), %eax
testl %eax, %eax
je 0xc5bed
jmp 0xc5be8
jmp 0xc483f
jmp 0xc5c18
leaq -0x610(%rbp), %rdi
callq 0xac88
leaq -0x5f0(%rbp), %rdi
callq 0xac88
leaq -0x5b0(%rbp), %rdi
callq 0x3dfa0
jmp 0xc6112
jmp 0xc5c1a
jmp 0xc483f
leaq -0x6a0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x3fee0
jmp 0xc5c34
movq -0x390(%rbp), %rsi
leaq -0x6a0(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x50da0
jmp 0xc5c53
leaq -0x6a0(%rbp), %rdi
callq 0x3dfa0
movq -0x390(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x926b0
jmp 0xc5c74
movl $0x0, -0x6a4(%rbp)
movl -0x6a4(%rbp), %eax
cmpl -0x42c(%rbp), %eax
jge 0xc5d9d
movl $0x0, -0x6a8(%rbp)
movl -0x6a8(%rbp), %eax
cmpl -0x42c(%rbp), %eax
jge 0xc5d87
movslq -0x6a8(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6a4(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm1
cvtsi2sdl -0x40c(%rbp), %xmm0
divsd %xmm0, %xmm1
movsd 0x6c5d2(%rip), %xmm0    # 0x1322b8
subsd %xmm1, %xmm0
movsd %xmm0, -0x6b0(%rbp)
movslq -0x6a8(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6a4(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
divsd -0x6b0(%rbp), %xmm0
movsd %xmm0, -0x940(%rbp)
movslq -0x6a8(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6a4(%rbp), %rsi
callq 0x3ec30
movsd -0x940(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x6a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a8(%rbp)
jmp 0xc5c9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x3dfa0
jmp 0xc6112
jmp 0xc5d89
movl -0x6a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a4(%rbp)
jmp 0xc5c7e
leaq -0x6c8(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x3fee0
jmp 0xc5db2
movq -0x3a0(%rbp), %rsi
leaq -0x6c8(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x50da0
jmp 0xc5dd1
leaq -0x6c8(%rbp), %rdi
callq 0x3dfa0
movq -0x3a0(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x926b0
jmp 0xc5df2
leaq -0x6e0(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x3fee0
jmp 0xc5e07
movq -0x398(%rbp), %rsi
leaq -0x6e0(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x50da0
jmp 0xc5e26
leaq -0x6e0(%rbp), %rdi
callq 0x3dfa0
movq -0x398(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x926b0
jmp 0xc5e47
movl $0x0, -0x6e4(%rbp)
movl -0x6e4(%rbp), %eax
movl %eax, -0x944(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x944(%rbp), %eax
cmpl %ecx, %eax
jge 0xc5fbb
movl $0x0, -0x6e8(%rbp)
movl -0x6e8(%rbp), %eax
movl %eax, -0x948(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movl -0x948(%rbp), %eax
cmpl %ecx, %eax
jge 0xc5fa5
movslq -0x6e8(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6e4(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm1
cvtsi2sdl -0x40c(%rbp), %xmm0
divsd %xmm0, %xmm1
movsd 0x6c3d1(%rip), %xmm0    # 0x1322b8
subsd %xmm1, %xmm0
movsd %xmm0, -0x6f0(%rbp)
movslq -0x6e8(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6e4(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
divsd -0x6f0(%rbp), %xmm0
movsd %xmm0, -0x950(%rbp)
movslq -0x6e8(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x651e0
movq %rax, %rdi
movslq -0x6e4(%rbp), %rsi
callq 0x3ec30
movsd -0x950(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x6e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6e8(%rbp)
jmp 0xc5e84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x6c8(%rbp), %rdi
callq 0x3dfa0
jmp 0xc6112
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x6e0(%rbp), %rdi
callq 0x3dfa0
jmp 0xc6112
jmp 0xc5fa7
movl -0x6e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6e4(%rbp)
jmp 0xc5e51
leaq -0x708(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x3fee0
jmp 0xc5fd0
movq -0x3a8(%rbp), %rsi
leaq -0x708(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x50da0
jmp 0xc5fef
leaq -0x708(%rbp), %rdi
callq 0x3dfa0
movq -0x3a8(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x926b0
jmp 0xc6010
movl $0x1, -0x614(%rbp)
leaq -0x478(%rbp), %rdi
callq 0xc6ca0
leaq -0x448(%rbp), %rdi
callq 0x3dfa0
leaq -0x428(%rbp), %rdi
callq 0x3dfa0
leaq -0x408(%rbp), %rdi
callq 0x65200
leaq -0x3f0(%rbp), %rdi
callq 0x65200
leaq -0x3d8(%rbp), %rdi
callq 0x65200
leaq -0x3c0(%rbp), %rdi
callq 0x65200
leaq -0x328(%rbp), %rdi
callq 0xac88
leaq -0x308(%rbp), %rdi
callq 0xac88
leaq -0x288(%rbp), %rdi
callq 0xac88
leaq -0x268(%rbp), %rdi
callq 0xac88
leaq -0x188(%rbp), %rdi
callq 0x3dfa0
leaq -0x158(%rbp), %rdi
callq 0x95b50
leaq -0x128(%rbp), %rdi
callq 0x95b70
leaq -0xf8(%rbp), %rdi
callq 0x58620
leaq -0xc8(%rbp), %rdi
callq 0x58f00
leaq -0x98(%rbp), %rdi
callq 0xac88
leaq -0x30(%rbp), %rdi
callq 0xac88
xorl %eax, %eax
addq $0x950, %rsp            # imm = 0x950
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x708(%rbp), %rdi
callq 0x3dfa0
leaq -0x478(%rbp), %rdi
callq 0xc6ca0
leaq -0x448(%rbp), %rdi
callq 0x3dfa0
leaq -0x428(%rbp), %rdi
callq 0x3dfa0
leaq -0x408(%rbp), %rdi
callq 0x65200
leaq -0x3f0(%rbp), %rdi
callq 0x65200
leaq -0x3d8(%rbp), %rdi
callq 0x65200
leaq -0x3c0(%rbp), %rdi
callq 0x65200
leaq -0x328(%rbp), %rdi
callq 0xac88
leaq -0x308(%rbp), %rdi
callq 0xac88
leaq -0x288(%rbp), %rdi
callq 0xac88
leaq -0x268(%rbp), %rdi
callq 0xac88
leaq -0x188(%rbp), %rdi
callq 0x3dfa0
leaq -0x158(%rbp), %rdi
callq 0x95b50
leaq -0x128(%rbp), %rdi
callq 0x95b70
leaq -0xf8(%rbp), %rdi
callq 0x58620
leaq -0xc8(%rbp), %rdi
callq 0x58f00
leaq -0x98(%rbp), %rdi
callq 0xac88
leaq -0x30(%rbp), %rdi
callq 0xac88
movq -0x68(%rbp), %rdi
callq 0xab50