// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/evo_distanceToOutgroups.cpp
// Function: DistOutMain(int, char**)
int DistOutMain(int argc, char** argv) {
    parseDistOutOptions(argc, argv);
    string line; // for reading the input files
    
    // 1) Dividing up and assigning the populations
    std::vector<string> populations; // Will hold the names of all populations
    std::vector<string> outgroups; // Will hold the names of the outgroup populations
    std::vector<string> ingroups; // Will hold the names of the ingroup populations
    
    std::istream* vcfFile = createReader(opt::vcfFile.c_str());
    std::ifstream* setsFile = new std::ifstream(opt::setsFile.c_str());
    std::ifstream* outgroupFile = new std::ifstream(opt::outgroupFile.c_str());
    std::ifstream* ingroupFile = new std::ifstream(opt::ingroupFile.c_str());
    
    std::map<string, std::vector<string>> popToIDsMap;
    std::map<string, string> IDsToPopMap;
    std::map<string, std::vector<size_t>> popToPosMap;
    std::map<size_t, string> posToPopMap;
    
    // Get the sample sets
    while (getline(*setsFile, line)) {
        // std::cerr << line << std::endl;
        std::vector<string> ID_Pop = split(line, '\t');
        popToIDsMap[ID_Pop[1]].push_back(ID_Pop[0]);
        IDsToPopMap[ID_Pop[0]] = ID_Pop[1];
        //std::cerr << ID_Species[1] << "\t" << ID_Species[0] << std::endl;
    }
    
    // Get a vector of set names (usually populations/species)
    for(std::map<string,std::vector<string>>::iterator it = popToIDsMap.begin(); it != popToIDsMap.end(); ++it) {
        populations.push_back(it->first);
        // std::cerr << it->first << std::endl;
    } std::cerr << "There are " << populations.size() << " populations " << std::endl;
    
    
    // find the ingroups
    while (getline(*ingroupFile,line)) {
        ingroups.push_back(line);
    }
    
    // Get the outgroups
    std::vector<std::ofstream*> outFilesFixedWindow;
    while (getline(*outgroupFile,line)) {
        // std::cerr << line << std::endl;
        std::ofstream* outFileFixedWindow = new std::ofstream(line + "_DIST_" + opt::runName + "_FW" + numToString(opt::fixedWindowSize) + ".txt");
        *outFileFixedWindow << "chr\twStart\twEnd\tSNPs_used\tSNPs_missing\tAccessibleSizeBP" << "\t"; print_vector(ingroups, *outFileFixedWindow);
        //outFile->setf(std::ios_base::fixed); // Avoid scientific notation in the coordinates
        outFilesFixedWindow.push_back(outFileFixedWindow);
        outgroups.push_back(line);
    }
    
    
    // 2) Loading the accessible genome bad file:
    AccessibleGenome* ag;
    if (!opt::accesibleGenBedFile.empty()) {
       std::ifstream* accessibleGenomeBed = new std::ifstream(opt::accesibleGenBedFile);
       std::cerr << "Loading the accessible genome annotation" << std::endl;
       ag = new AccessibleGenome(accessibleGenomeBed);
       std::cerr << "Done" << std::endl;
   }
     // int numAccessibleBP = ag->getAccessibleBPinRegion(sc, i, i+opt::accessibleGenBedWindow);
    
    
    // 3) Praparing the containers to hold the results
    // 3a) for per-SNP results
    std::vector<std::vector<double>> initVectorFixed(ingroups.size());
    std::vector<std::vector<std::vector<double>>> DxyFixedWindowPerSNP(outgroups.size(),initVectorFixed);
    // 3b) for calculated Dxy values
    std::vector<int> ingroupsMissingInit(ingroups.size(),0);
    std::vector<std::vector<int>> missingDist(outgroups.size(),ingroupsMissingInit);
    
    // 3b) for calculated Dxy values
    std::vector<double> ingroupsResultInit(ingroups.size(),0.0);
    std::vector<std::vector<double>> DxyFixedWindowAveraged(outgroups.size(),ingroupsResultInit);
    
    
    // 4) Going through the VCF
    // 4a) Preparing useful variables
    int currentWindowStart = 0; int currentWindowEnd = currentWindowStart + opt::fixedWindowSize;
    int totalVariantNumber = 0;
    std::vector<int> usedVars(outgroups.size(),0); // Will count the number of used variants for each outgroup
    std::vector<int> missingVars(outgroups.size(),0); // Will count the number of missing variants for each outgroup
    std::vector<string> sampleNames; std::vector<std::string> fields;
    int reportProgressEvery = 1000; string chr; string coord; double coordDouble;
    std::clock_t start; std::clock_t startGettingCounts; std::clock_t startCalculation;
    double durationOverall; double durationGettingCounts; double durationCalculation;
    // 4b) Looping through the file
    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> sampleNames(fields.begin()+NUM_NON_GENOTYPE_COLUMNS,fields.end());
            // print_vector_stream(sampleNames, std::cerr);
            for (std::vector<std::string>::size_type i = 0; i != sampleNames.size(); i++) {
                posToPopMap[i] = IDsToPopMap[sampleNames[i]];
            }
            // 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 = popToIDsMap.begin(); it != popToIDsMap.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());
                }
                popToPosMap[sp] = spPos;
            }
            start = std::clock();
            //  std::cerr << " " << std::endl;
            //  std::cerr << "Outgroup at pos: "; print_vector_stream(speciesToPosMap["Outgroup"], std::cerr);
            //  std::cerr << "telvit at pos: "; print_vector_stream(speciesToPosMap["telvit"], std::cerr);
        } else {
            totalVariantNumber++;
            if (totalVariantNumber % reportProgressEvery == 0) {
                durationOverall = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
                std::cerr << "Processed " << totalVariantNumber << " variants in " << durationOverall << "secs" << std::endl;
                std::cerr << "GettingCounts " << durationGettingCounts << " calculation " << durationCalculation << "secs" << std::endl;
            }
            fields = split(line, '\t'); chr = fields[0]; coord = fields[1]; coordDouble = stringToDouble(coord);
            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]; bool ignoreSite = false;
            if (altAllele == "*") ignoreSite = true;
            if (!opt::allowIndels) {
                if (refAllele.length() > 1 || altAllele.length() > 1) ignoreSite = true;
            }
            if (ignoreSite) {
                refAllele.clear(); refAllele.shrink_to_fit(); altAllele.clear(); altAllele.shrink_to_fit();
                genotypes.clear(); genotypes.shrink_to_fit(); continue;
            }
            
            startGettingCounts = std::clock();
            GeneralSetCounts* c = new GeneralSetCounts(popToPosMap, (int)genotypes.size());
            c->getSetVariantCountsSimple(genotypes, posToPopMap);
            genotypes.clear(); genotypes.shrink_to_fit();
            durationGettingCounts = ( std::clock() - startGettingCounts ) / (double) CLOCKS_PER_SEC;
            // std::cerr << "Here:" << totalVariantNumber << std::endl;
            
            startCalculation = std::clock();
            
           // for (std::vector<std::string>::size_type i = 0; i != populations.size(); i++) {
           //     allPs[i] = c->setAAFs.at(populations[i]);
           // }
            // durationFirstLoop = ( std::clock() - startCalculation ) / (double) CLOCKS_PER_SEC;
            
            
            
            // Check if we are still in the same physical window...
            if (coordDouble > currentWindowEnd || coordDouble < currentWindowStart) {
                // Find the number of accessible BPs in this window:
                int accessibleInThisWindow = opt::fixedWindowSize;
                if (!opt::accesibleGenBedFile.empty()) {
                    if (coordDouble > currentWindowEnd) {
                        accessibleInThisWindow = ag->getAccessibleBPinRegion(chr, currentWindowStart, currentWindowStart + opt::fixedWindowSize);
                    } else if (coordDouble < currentWindowStart) {
                        accessibleInThisWindow = ag->getAccessibleBPinRegion(chr, 0, opt::fixedWindowSize);
                    }
                }
                
                for (int i = 0; i != outgroups.size(); i++) {
                    for (int j = 0; j != ingroups.size(); j++) {
                        int nSNPs = (int)DxyFixedWindowPerSNP[i][j].size();
                        if (nSNPs > 0) {
                            double missingProportion = (double)missingDist[i][j]/(nSNPs + missingDist[i][j]);
                            if (missingProportion > 0.5) {
                                DxyFixedWindowAveraged[i][j] = NAN;
                            } else {
                                DxyFixedWindowAveraged[i][j] = vector_average_withRegion(DxyFixedWindowPerSNP[i][j], accessibleInThisWindow);
                                // Scale by the number of SNPs missing for the ingroup
                                double nonMissingProportion = (double)nSNPs/(nSNPs + missingDist[i][j]);
                                double scalingFactor = 1 + (missingProportion / nonMissingProportion);
                                DxyFixedWindowAveraged[i][j] = DxyFixedWindowAveraged[i][j] * scalingFactor;
                            }
                        } else {
                            DxyFixedWindowAveraged[i][j] = NAN;
                        }
                        DxyFixedWindowPerSNP[i][j].clear();
                    }
                    
                    *outFilesFixedWindow[i] << chr << "\t" << currentWindowStart << "\t" << currentWindowEnd << "\t" << usedVars[i] << "\t" << missingVars[i] << "\t" << accessibleInThisWindow << "\t";
                    print_vector(DxyFixedWindowAveraged[i], *outFilesFixedWindow[i]);
                }
                
                // Reset missing data counters for the next window
                for (int i = 0; i != outgroups.size(); i++) {
                    usedVars[i] = 0; missingVars[i] = 0;
                    for (int j = 0; j != ingroups.size(); j++) {
                        missingDist[i][j] = 0;
                    }
                }
                
                if (coordDouble > currentWindowEnd) {
                    currentWindowStart = currentWindowStart + opt::fixedWindowSize; currentWindowEnd = currentWindowEnd + opt::fixedWindowSize;
                } else if (coordDouble < currentWindowStart) {
                    currentWindowStart = 0; currentWindowEnd = 0 + opt::fixedWindowSize;
                }
            }
            
            // std::cerr << coord << "\t";
            // print_vector_stream(SNPgeneDetails, std::cerr);
            
            // Now calculate Dxy per SNP:
            double AFout;
            for (int i = 0; i != outgroups.size(); i++) {
                AFout = c->setAAFs.at(outgroups[i]);
                if (AFout == -1) {
                    missingVars[i]++;
                    // for (int j = 0; j != ingroups.size(); j++) { missingDist[i][j]++; }
                    continue;  // If the outgroup has entirely missing data, just move on to the next one
                }
                usedVars[i]++;
                for (int j = 0; j != ingroups.size(); j++) {
                    double AFin = c->setAAFs.at(ingroups[j]);
                    if (AFin != -1) {
                        double thisSNPdxy = DxyPerSNPfromAFs(AFout, c->setAAFs.at(ingroups[j]));
                        DxyFixedWindowPerSNP[i][j].push_back(thisSNPdxy);
                    } else {
                        missingDist[i][j]++;
                    }
                    
                }
            }
            durationCalculation = ( std::clock() - startCalculation ) / (double) CLOCKS_PER_SEC;
            delete c;
        }
    }
    
    return 0;
    
    
    
    
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
callq 0xbdf6a
leaq 0x128(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, 0x270(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x260(%rsp)
movq %rax, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movq %rax, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
movq 0x5117a(%rip), %rsi     # 0x10d138
leaq 0x230(%rsp), %rdi
leaq 0x330(%rsp), %rdx
callq 0x286de
leaq 0x230(%rsp), %rdi
movl $0x8, %esi
callq 0x53224
movq %rax, 0x2c8(%rsp)
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc00e
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r12
movq 0x51136(%rip), %rsi     # 0x10d158
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0x51135(%rip), %rsi     # 0x10d178
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r15
movq %r14, 0x38(%rsp)
movq 0x5112f(%rip), %rsi     # 0x10d198
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x238(%rsp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x338(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x398(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x368(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x118(%rsp), %rbx
leaq 0x60(%rsp), %r13
leaq 0x330(%rsp), %r14
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbc185
movq %r13, %rdi
movq %rbx, %rsi
movl $0x9, %edx
callq 0x50624
movq 0x60(%rsp), %rsi
addq $0x20, %rsi
leaq 0x230(%rsp), %rdi
callq 0x49f44
movq 0x60(%rsp), %rsi
movq %rax, %rdi
callq 0x33db0
movq 0x60(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3e394
addq $0x20, %rbp
movq %rax, %rdi
movq %rbp, %rsi
callq 0x8270
movq %r13, %rdi
callq 0x3123c
jmp 0xbc0f5
movq 0x248(%rsp), %rbx
leaq 0x238(%rsp), %rax
cmpq %rax, %rbx
je 0xbc1c6
leaq 0x260(%rsp), %r14
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x33db0
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
leaq 0x238(%rsp), %rax
cmpq %rax, %rbx
jne 0xbc1a2
movq 0x4ee1b(%rip), %rdi     # 0x10afe8
leaq 0x2dd1d(%rip), %rsi     # 0xe9ef1
movl $0xa, %edx
callq 0x84e0
movq 0x268(%rsp), %rsi
subq 0x260(%rsp), %rsi
sarq $0x5, %rsi
movq 0x4edef(%rip), %rdi     # 0x10afe8
callq 0x82f0
movq %rax, %rbx
leaq 0x1c04c(%rip), %rsi     # 0xd8254
movl $0xd, %edx
movq %rax, %rdi
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x118(%rsp), %rbx
leaq 0xb0(%rsp), %r14
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbc289
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33db0
jmp 0xbc24c
xorpd %xmm0, %xmm0
leaq 0x180(%rsp), %rax
movapd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x1c0(%rsp), %r14
leaq 0x148(%rsp), %r12
leaq 0x118(%rsp), %r13
leaq 0x1b0(%rsp), %rbp
leaq 0x3c0(%rsp), %rbx
movq 0x38(%rsp), %r15
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbc6a9
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r15
movq %r14, 0x1b0(%rsp)
movq 0x118(%rsp), %rsi
movq 0x120(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x2e45c
movq %rbp, %rdi
leaq 0x2cadc(%rip), %rsi     # 0xe8e18
callq 0x88c0
movq 0x50e70(%rip), %rsi     # 0x10d1b8
movq 0x50e71(%rip), %rdx     # 0x10d1c0
movq %rbp, %rdi
callq 0x8180
leaq 0x50(%rsp), %rsi
movq %rsi, 0x40(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbc37f
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xbc387
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x40(%rsp), %rdi
leaq 0x2b57e(%rip), %rsi     # 0xe7929
callq 0x88c0
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbc3d8
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xbc3e0
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x4f1e2(%rip), %esi     # 0x10b5e0
leaq 0x138(%rsp), %rdi
callq 0x31297
movq 0x10(%rsp), %rcx
movl $0xf, %esi
leaq 0x20(%rsp), %rax
cmpq %rax, %rcx
je 0xbc424
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %r8
movq 0x140(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0xbc456
movl $0xf, %esi
cmpq %r12, 0x138(%rsp)
je 0xbc451
movq 0x148(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xbc46a
movq 0x138(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x8180
jmp 0xbc47b
leaq 0x138(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x84d0
leaq 0x98(%rsp), %rsi
movq %rsi, 0x88(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xbc4ac
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0xbc4b4
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x90(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x88(%rsp), %rdi
leaq 0x28672(%rip), %rsi     # 0xe4b55
callq 0x88c0
leaq 0x70(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbc510
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0xbc518
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
movl $0x10, %edx
callq 0x88d0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbc55e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xbc583
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc5a0
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbc5bc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbc5d8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbc5f5
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r15, 0x198(%rsp)
movl $0x37, %edx
movq %r15, %rdi
leaq 0x2c813(%rip), %rsi     # 0xe8e1f
callq 0x84e0
movl $0x1, %edx
movq %r15, %rdi
leaq 0x1565e(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x3273a
movq 0x198(%rsp), %rsi
movq %rbx, %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x39979
movq %rbx, %rdi
callq 0x3123c
movq 0x188(%rsp), %rsi
cmpq 0x190(%rsp), %rsi
je 0xbc67f
movq 0x198(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x188(%rsp)
jmp 0xbc694
leaq 0x180(%rsp), %rdi
leaq 0x198(%rsp), %rdx
callq 0xaec6a
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0x33db0
jmp 0xbc2c9
cmpq $0x0, 0x50b2f(%rip)     # 0x10d1e0
je 0xbc78f
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
leaq 0x50b0d(%rip), %rsi     # 0x10d1d8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8740
movq %r14, 0x60(%rsp)
movq 0x4e904(%rip), %rbx     # 0x10afe8
leaq 0x1bb77(%rip), %rsi     # 0xd8262
movl $0x28, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4e8d2(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0x38, %edi
callq 0x8470
movq %rax, 0x158(%rsp)
leaq 0x60(%rsp), %rsi
movq 0x158(%rsp), %rdi
callq 0x496da
movq 0x4e89a(%rip), %rbx     # 0x10afe8
leaq 0x11922(%rip), %rsi     # 0xce077
movl $0x4, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4e868(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
jmp 0xbc78f
movq 0xb8(%rsp), %rsi
subq 0xb0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x1b0(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xb3924
movq 0xd8(%rsp), %rsi
subq 0xd0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x138(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0xa5f2a
movq 0xb8(%rsp), %rsi
subq 0xb0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x60(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x198(%rsp), %rdi
leaq 0x88(%rsp), %rcx
callq 0x54c54
movq 0xd8(%rsp), %rsi
subq 0xd0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x278(%rsp), %rdi
leaq 0x198(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0xbe344
movq 0xb8(%rsp), %rsi
subq 0xb0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x60(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x2e8(%rsp), %rdi
leaq 0x88(%rsp), %rcx
callq 0x54ba6
movq 0xd8(%rsp), %rsi
subq 0xd0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x218(%rsp), %rdi
leaq 0x2e8(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0xbe3dc
movq 0xd8(%rsp), %rsi
subq 0xd0(%rsp), %rsi
movl 0x4ed21(%rip), %r15d    # 0x10b5e0
sarq $0x5, %rsi
leaq 0x60(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x200(%rsp), %rdi
leaq 0x88(%rsp), %rcx
callq 0x54c54
movq 0xd8(%rsp), %rsi
subq 0xd0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x60(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x1e8(%rsp), %rdi
leaq 0x88(%rsp), %rcx
callq 0x54c54
xorl %ecx, %ecx
movq %rcx, 0x310(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x300(%rsp)
movq %rcx, 0x110(%rsp)
movapd %xmm0, 0x100(%rsp)
leaq 0x60(%rsp), %rdx
leaq 0x70(%rsp), %rax
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movb %cl, 0x10(%rdx)
leaq 0x88(%rsp), %rdx
leaq 0x98(%rsp), %rax
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movb %cl, 0x10(%rdx)
leaq 0x2a0(%rsp), %r14
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rbp
movl $0x0, 0xac(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x2c8(%rsp), %rbx
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x118(%rsp), %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbd88b
movq 0x118(%rsp), %rdi
movq 0x120(%rsp), %rsi
addq %rdi, %rsi
movb $0xd, 0x10(%rsp)
movq %r12, %rdx
callq 0x80103
movq %rax, %rcx
subq 0x118(%rsp), %rcx
movq %rcx, 0x120(%rsp)
movb $0x0, (%rax)
movq 0x118(%rsp), %rax
movb (%rax), %cl
cmpb $0x23, %cl
jne 0xbca31
cmpb $0x23, 0x1(%rax)
je 0xbc992
cmpb $0x23, %cl
jne 0xbca31
cmpb $0x43, 0x1(%rax)
je 0xbd5fe
movl 0xac(%rsp), %ecx
imull $0x26e978d5, %ecx, %eax # imm = 0x26E978D5
incl %ecx
movl %ecx, 0xac(%rsp)
addl $0x27ef9dad, %eax       # imm = 0x27EF9DAD
rorl $0x3, %eax
cmpl $0x418936, %eax         # imm = 0x418936
ja 0xbcba1
callq 0x82e0
subq 0x2b0(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x18771(%rip), %xmm0    # 0xd51e8
movsd %xmm0, 0x80(%rsp)
movl $0xa, %edx
movq 0x4e55c(%rip), %rdi     # 0x10afe8
leaq 0x1b993(%rip), %rsi     # 0xd8426
callq 0x84e0
movq 0x4e549(%rip), %rdi     # 0x10afe8
movl 0xac(%rsp), %esi
callq 0x8810
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x1e871(%rip), %rsi     # 0xdb32e
callq 0x84e0
movq %rbx, %rdi
movsd 0x80(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x21889(%rip), %rsi     # 0xde36e
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0xe, %edx
movq 0x4e4cb(%rip), %rdi     # 0x10afe8
leaq 0x288ab(%rip), %rsi     # 0xe53cf
callq 0x84e0
movq 0x4e4b8(%rip), %rdi     # 0x10afe8
movsd 0x2b8(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x2888e(%rip), %rsi     # 0xe53de
callq 0x84e0
movq %rbx, %rdi
movsd 0x38(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x217f9(%rip), %rsi     # 0xde36e
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq %rbp, %rdi
leaq 0x118(%rsp), %rsi
movl $0x9, %edx
callq 0x50624
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movapd 0x100(%rsp), %xmm0
movq 0x110(%rsp), %rax
movups 0x40(%rsp), %xmm1
movaps %xmm1, 0x100(%rsp)
movq 0x50(%rsp), %rcx
movq %rcx, 0x110(%rsp)
movapd 0x10(%rsp), %xmm1
movapd %xmm0, 0x10(%rsp)
movq %rax, 0x20(%rsp)
movupd %xmm1, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r12, %rdi
callq 0x3123c
movq %rbp, %rdi
callq 0x3123c
movq 0x100(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x8270
movq 0x100(%rsp), %rsi
addq $0x20, %rsi
leaq 0x88(%rsp), %rdi
callq 0x8270
movq %r14, 0x290(%rsp)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x290(%rsp), %rdi
callq 0x2e45c
leaq 0x290(%rsp), %rdi
callq 0x5054c
movsd %xmm0, 0x160(%rsp)
movq 0x290(%rsp), %rdi
cmpq %r14, %rdi
je 0xbcca1
movq 0x2a0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x108(%rsp), %rdx
leaq 0xe8(%rsp), %rdi
movq %r12, %rcx
callq 0x7fa48
movq 0x100(%rsp), %rax
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2e45c
movq 0x100(%rsp), %rax
leaq 0x50(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x2e45c
movq %rbp, %rdi
leaq 0x2c9b3(%rip), %rsi     # 0xe96d6
callq 0x8160
testl %eax, %eax
sete %r13b
cmpb $0x0, 0x504c3(%rip)     # 0x10d1f8
jne 0xbcd55
testl %eax, %eax
sete %al
cmpq $0x2, 0x18(%rsp)
setae %cl
cmpq $0x2, 0x48(%rsp)
setae %r13b
orb %cl, %r13b
orb %al, %r13b
testb %r13b, %r13b
je 0xbce0f
movq $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
movq %r12, %rdi
callq 0x8290
movq %r14, %r12
movq $0x0, 0x48(%rsp)
movq 0x40(%rsp), %rax
movb $0x0, (%rax)
movq %rbp, %rdi
callq 0x8290
movq 0xe8(%rsp), %rbx
movq 0xf0(%rsp), %r14
cmpq %rbx, %r14
je 0xbcde3
movl %r15d, %ebp
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xbcdc3
movq (%r15), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0xbcdaf
movq %rbx, 0xf0(%rsp)
movl %ebp, %r15d
leaq 0x40(%rsp), %rbp
movq 0xf8(%rsp), %rax
cmpq 0xf0(%rsp), %rax
je 0xbce02
leaq 0xe8(%rsp), %rdi
callq 0x8024a
movq %r12, %r14
leaq 0x10(%rsp), %r12
jmp 0xbd5b1
movb %r13b, 0xf(%rsp)
movl %r15d, 0xa8(%rsp)
callq 0x82e0
movq %rax, %rbx
movl $0x240, %edi            # imm = 0x240
callq 0x8470
movq %rax, %r14
movq 0xf0(%rsp), %rdx
subq 0xe8(%rsp), %rdx
shrq $0x5, %rdx
movq %rax, %rdi
leaq 0x390(%rsp), %rsi
callq 0x7fa8a
leaq 0xe8(%rsp), %rsi
movq %r14, %rdi
leaq 0x360(%rsp), %rdx
callq 0x500d0
movq %r14, 0x1e0(%rsp)
movq 0xe8(%rsp), %r14
movq 0xf0(%rsp), %r15
cmpq %r14, %r15
je 0xbcec2
leaq 0x10(%r14), %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0xbcea4
movq (%r12), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%r12), %rax
addq $0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0xbce8e
movq %r14, 0xf0(%rsp)
leaq 0x10(%rsp), %r12
movq 0xf8(%rsp), %rax
cmpq 0xf0(%rsp), %rax
je 0xbcee1
leaq 0xe8(%rsp), %rdi
callq 0x8024a
callq 0x82e0
subq %rbx, %rax
cvtsi2sd %rax, %xmm0
divsd 0x182f2(%rip), %xmm0    # 0xd51e8
movsd %xmm0, 0x2b8(%rsp)
callq 0x82e0
movl 0xa8(%rsp), %r15d
cvtsi2sd %r15d, %xmm1
movsd 0x160(%rsp), %xmm0
movsd %xmm1, 0x1d8(%rsp)
ucomisd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x34(%rsp), %xmm1
movq %rax, 0x2c0(%rsp)
ja 0xbcf44
ucomisd %xmm0, %xmm1
jbe 0xbd3c0
movsd %xmm1, 0x1d0(%rsp)
movl 0x4e68d(%rip), %eax     # 0x10b5e0
movl %eax, 0x30(%rsp)
cmpq $0x0, 0x50281(%rip)     # 0x10d1e0
je 0xbcfaa
movsd 0x160(%rsp), %xmm0
ucomisd 0x1d8(%rsp), %xmm0
jbe 0xbcf7f
movl 0x34(%rsp), %edx
addl %edx, 0x30(%rsp)
jmp 0xbcf90
xorl %edx, %edx
movsd 0x1d0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbcfaa
movq 0x158(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl 0x30(%rsp), %ecx
callq 0x4a03c
movl %eax, 0x30(%rsp)
movq 0xd8(%rsp), %r12
movq 0xd0(%rsp), %rax
subq %rax, %r12
je 0xbd2dd
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
xorl %r14d, %r14d
movq 0xb8(%rsp), %rax
cmpq 0xb0(%rsp), %rax
je 0xbd182
xorl %r13d, %r13d
movq 0x138(%rsp), %rax
leaq (%r14,%r14,2), %rbp
movq (%rax,%rbp,8), %rax
leaq (,%r13,2), %r12
addq %r13, %r12
movq 0x8(%rax,%r12,8), %rbx
subq (%rax,%r12,8), %rbx
shrq $0x3, %rbx
testl %ebx, %ebx
jle 0xbd04b
movq 0x278(%rsp), %rcx
movq (%rcx,%rbp,8), %rcx
movl (%rcx,%r13,4), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
addl %ebx, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm0, %xmm1
ucomisd 0x12407(%rip), %xmm1    # 0xcf450
jbe 0xbd06a
movq 0x218(%rsp), %rax
movq (%rax,%rbp,8), %rax
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
movq %rcx, (%rax,%r13,8)
jmp 0xbd143
movsd %xmm1, 0x38(%rsp)
leaq (%rax,%r12,8), %rsi
leaq 0x318(%rsp), %rdi
callq 0x3a864
movq 0x318(%rsp), %rdi
movq 0x320(%rsp), %rax
subq %rdi, %rax
je 0xbd0b7
sarq $0x3, %rax
cmpq $0x1, %rax
adcq $0x0, %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rdi,%rcx,8), %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0xbd0a8
jmp 0xbd0bb
xorpd %xmm0, %xmm0
divsd 0x80(%rsp), %xmm0
movq 0x218(%rsp), %rax
movq (%rax,%rbp,8), %rax
movsd %xmm0, (%rax,%r13,8)
testq %rdi, %rdi
je 0xbd0eb
movq 0x328(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movq 0x278(%rsp), %rax
leaq (,%r14,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx), %rax
addl (%rax,%r13,4), %ebx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm0
movsd 0x38(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x12315(%rip), %xmm1    # 0xcf440
movq 0x218(%rsp), %rax
movq (%rax,%rcx), %rax
mulsd (%rax,%r13,8), %xmm1
movsd %xmm1, (%rax,%r13,8)
movq 0x138(%rsp), %rax
movq (%rax,%rbp,8), %rcx
movq (%rcx,%r12,8), %rax
cmpq %rax, 0x8(%rcx,%r12,8)
je 0xbd162
leaq (%rcx,%r12,8), %rcx
movq %rax, 0x8(%rcx)
incq %r13
movq 0xb8(%rsp), %rax
subq 0xb0(%rsp), %rax
sarq $0x5, %rax
cmpq %r13, %rax
jne 0xbcff1
movq 0x180(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x84e0
leaq 0x14ada(%rip), %rbx     # 0xd1c7e
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
movq %r13, %rdi
movl 0x34(%rsp), %esi
callq 0x8810
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
movq %r13, %rdi
movl %r15d, %esi
callq 0x8810
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
movq 0x200(%rsp), %rax
movl (%rax,%r14,4), %esi
movq %r13, %rdi
callq 0x8810
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
movq 0x1e8(%rsp), %rax
movl (%rax,%r14,4), %esi
movq %r13, %rdi
callq 0x8810
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
movq %r13, %rdi
movl 0x30(%rsp), %esi
callq 0x8810
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x84e0
leaq (%r14,%r14,2), %rsi
shlq $0x3, %rsi
addq 0x218(%rsp), %rsi
leaq 0x2d0(%rsp), %rdi
callq 0x3a864
movq 0x180(%rsp), %rax
movq (%rax,%r14,8), %rsi
leaq 0x2d0(%rsp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x5ae16
movq 0x2d0(%rsp), %rdi
testq %rdi, %rdi
je 0xbd2bb
movq 0x2e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
incq %r14
movq 0xd8(%rsp), %r12
subq 0xd0(%rsp), %r12
sarq $0x5, %r12
cmpq %r14, %r12
jne 0xbcfd8
jmp 0xbd2e1
sarq $0x5, %r12
testq %r12, %r12
je 0xbd35b
movq 0x200(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x1e8(%rsp), %r13
movq 0xb0(%rsp), %rbp
movq 0xb8(%rsp), %rbx
movq %rbx, %rax
subq %rbp, %rax
movq 0x278(%rsp), %r15
sarq $0x3, %rax
movq %rax, 0x80(%rsp)
xorl %r14d, %r14d
xorl %eax, %eax
movq 0x38(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
movl %eax, (%r13,%r14,4)
cmpq %rbp, %rbx
je 0xbd34f
movq (%r15), %rdi
xorl %esi, %esi
movq 0x80(%rsp), %rdx
callq 0x8280
incq %r14
addq $0x18, %r15
cmpq %r14, %r12
jne 0xbd328
movsd 0x160(%rsp), %xmm0
ucomisd 0x1d8(%rsp), %xmm0
jbe 0xbd390
movl 0x4e26b(%rip), %eax     # 0x10b5e0
addl %eax, 0x34(%rsp)
movl 0xa8(%rsp), %r15d
addl %eax, %r15d
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rbp
jmp 0xbd3c0
movsd 0x1d0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movl 0xa8(%rsp), %r15d
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rbp
jbe 0xbd3c0
movl $0x0, 0x34(%rsp)
movl 0x4e220(%rip), %r15d    # 0x10b5e0
movq 0xd0(%rsp), %rax
cmpq %rax, 0xd8(%rsp)
je 0xbd564
movq 0x1e0(%rsp), %rbx
addq $0xe0, %rbx
xorl %r14d, %r14d
movq %r14, %rsi
shlq $0x5, %rsi
addq %rax, %rsi
movq %rbx, %rdi
callq 0x551e8
movsd (%rax), %xmm0
ucomisd 0x12042(%rip), %xmm0    # 0xcf448
jne 0xbd41b
jp 0xbd41b
movq 0x1e8(%rsp), %rax
incl (%rax,%r14,4)
jmp 0xbd537
movsd %xmm0, 0x38(%rsp)
movq 0x200(%rsp), %rax
incl (%rax,%r14,4)
movq 0xb0(%rsp), %rsi
cmpq %rsi, 0xb8(%rsp)
je 0xbd537
movsd 0x11ff5(%rip), %xmm0    # 0xcf440
subsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
addq %r12, %rsi
movq %rbx, %rdi
callq 0x551e8
movsd (%rax), %xmm0
ucomisd 0x11fcf(%rip), %xmm0    # 0xcf448
jne 0xbd47d
jnp 0xbd4ea
movq 0xb0(%rsp), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0x551e8
movsd (%rax), %xmm1
movsd 0x11fa4(%rip), %xmm0    # 0xcf440
subsd %xmm1, %xmm0
mulsd 0x80(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x168(%rsp)
movq 0x138(%rsp), %rax
leaq (%r14,%r14,2), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rax,%r13), %rdi
movq 0x8(%rax,%r13), %rsi
cmpq 0x10(%rax,%r13), %rsi
je 0xbd4ff
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xbd50c
movq 0x278(%rsp), %rax
leaq (%r14,%r14,2), %rcx
movq (%rax,%rcx,8), %rax
incl (%rax,%rbp,4)
jmp 0xbd50c
leaq 0x168(%rsp), %rdx
callq 0x79f34
incq %rbp
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x18, %r13
addq $0x20, %r12
cmpq %rax, %rbp
jne 0xbd462
incq %r14
movq 0xd0(%rsp), %rax
movq 0xd8(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r14, %rcx
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rbp
jne 0xbd3e8
callq 0x82e0
subq 0x2c0(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x17c67(%rip), %xmm0    # 0xd51e8
movsd %xmm0, 0x38(%rsp)
movq 0x1e0(%rsp), %rbx
movq %rbx, %rdi
callq 0x7fed0
movl $0x240, %esi            # imm = 0x240
movq %rbx, %rdi
callq 0x8480
leaq 0x2a0(%rsp), %r14
movb 0xf(%rsp), %r13b
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbd5cd
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbd5e9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x3123c
testb %r13b, %r13b
jmp 0xbc992
movq %rbp, %rdi
leaq 0x118(%rsp), %rsi
movl $0x9, %edx
callq 0x50624
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movapd 0x100(%rsp), %xmm0
movq 0x110(%rsp), %rax
movups 0x40(%rsp), %xmm1
movaps %xmm1, 0x100(%rsp)
movq 0x50(%rsp), %rcx
movq %rcx, 0x110(%rsp)
movapd 0x10(%rsp), %xmm1
movapd %xmm0, 0x10(%rsp)
movq %rax, 0x20(%rsp)
movupd %xmm1, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %r12, %rdi
callq 0x3123c
movq %rbp, %rdi
callq 0x3123c
movq 0x100(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x108(%rsp), %rdx
movq %rbp, %rdi
movq %r12, %rcx
callq 0x7fa48
movq $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rax
cmpq %rax, 0x48(%rsp)
je 0xbd705
xorl %esi, %esi
shlq $0x5, %rsi
addq %rax, %rsi
leaq 0x330(%rsp), %rdi
callq 0x3e394
movq %rax, %rbx
leaq 0x360(%rsp), %rdi
movq %r12, %rsi
callq 0x5d80c
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8270
movq 0x10(%rsp), %rsi
incq %rsi
movq %rsi, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rsi
jne 0xbd6b0
movq 0x248(%rsp), %rbx
leaq 0x238(%rsp), %rax
cmpq %rax, %rbx
je 0xbd871
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2e45c
leaq 0x40(%rbx), %rsi
leaq 0xe8(%rsp), %r13
movq %r13, %rdi
callq 0x3273a
leaq 0x168(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x53501
movq 0x168(%rsp), %rax
cmpq 0x170(%rsp), %rax
jne 0xbd7fb
movl $0x29, %edx
movq 0x4d864(%rip), %rdi     # 0x10afe8
leaq 0x1ac30(%rip), %rsi     # 0xd83bb
callq 0x84e0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x4d847(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x19967(%rip), %rsi     # 0xd711f
callq 0x84e0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r13, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x168(%rsp), %rax
cmpq 0x170(%rsp), %rax
je 0xbda3f
leaq 0x390(%rsp), %rdi
movq %r12, %rsi
callq 0x5d872
movq %rax, %rdi
leaq 0x168(%rsp), %rsi
callq 0x5d8ee
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xbd838
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x3123c
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbd861
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
jmp 0xbd70d
callq 0x82e0
movq %rax, 0x2b0(%rsp)
movq %rbp, %rdi
callq 0x3123c
jmp 0xbc992
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xbd8b0
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbd8cc
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x100(%rsp), %rdi
callq 0x3123c
leaq 0x300(%rsp), %rdi
callq 0x3123c
movq 0x1e8(%rsp), %rdi
testq %rdi, %rdi
je 0xbd903
movq 0x1f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0xbd920
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x218(%rsp), %rdi
callq 0x45f06
movq 0x2e8(%rsp), %rdi
testq %rdi, %rdi
je 0xbd94a
movq 0x2f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x278(%rsp), %rdi
callq 0x4b0a4
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0xbd974
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x138(%rsp), %rdi
callq 0xa5bb6
leaq 0x1b0(%rsp), %rdi
callq 0x45f06
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0xbd9ab
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x360(%rsp), %rdi
callq 0x5ddda
leaq 0x390(%rsp), %rdi
callq 0x5de52
leaq 0x330(%rsp), %rdi
callq 0x3f5f4
leaq 0x230(%rsp), %rdi
callq 0x3f522
leaq 0xb0(%rsp), %rdi
callq 0x3123c
leaq 0xd0(%rsp), %rdi
callq 0x3123c
leaq 0x260(%rsp), %rdi
callq 0x3123c
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0xbda2b
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %eax, %eax
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a99f(%rip), %rdi     # 0xd83e5
leaq 0x2b40a(%rip), %rsi     # 0xe8e57
leaq 0x2b41f(%rip), %rcx     # 0xe8e73
movl $0xaf, %edx
callq 0x82c0
jmp 0xbdd4b
jmp 0xbdd4b
jmp 0xbdd75
movq %rax, %rbx
jmp 0xbdb85
movq %rax, %rbx
jmp 0xbdb92
jmp 0xbdaa4
movq %rax, %rbx
movl $0x38, %esi
movq 0x158(%rsp), %rdi
jmp 0xbdd3d
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0xbdd3d
movq %rax, %rbx
jmp 0xbdbae
jmp 0xbdaae
movq %rax, %rdi
callq 0x287e1
movq %rax, %rbx
movl $0x240, %esi            # imm = 0x240
movq %r14, %rdi
jmp 0xbdc29
movq %rax, %rbx
jmp 0xbde35
movq %rax, %rbx
jmp 0xbde52
movq %rax, %rbx
jmp 0xbde5f
movq %rax, %rbx
jmp 0xbde7c
movq %rax, %rbx
jmp 0xbde89
movq %rax, %rbx
jmp 0xbdea6
movq %rax, %rbx
jmp 0xbdeb3
jmp 0xbdec2
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
jmp 0xbdb53
jmp 0xbdb5d
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0xbdb53
jmp 0xbdb5d
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r12, %rdi
jmp 0xbdb53
jmp 0xbdb5d
movq %rax, %rbx
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbdf16
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdf16
movq %rax, %rbx
jmp 0xbdf16
movq %rax, %rbx
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xbdb85
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x3123c
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbdbae
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x40(%rsp), %rdi
jmp 0xbddb8
movq %rax, %rbx
movq 0x290(%rsp), %rdi
cmpq %r14, %rdi
je 0xbddbd
movq 0x2a0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbddbd
movq %rax, %rbx
jmp 0xbdd94
jmp 0xbdd4b
jmp 0xbdd75
jmp 0xbdd4b
movq %rax, %rbx
jmp 0xbddb0
jmp 0xbdd57
jmp 0xbdec2
movq %rax, %rbx
movq 0x2d0(%rsp), %rdi
testq %rdi, %rdi
je 0xbdd78
movq 0x2e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
jmp 0xbdd78
jmp 0xbdd4b
jmp 0xbdd75
jmp 0xbdd57
jmp 0xbdd4b
jmp 0xbdd10
movq %rax, %rbx
leaq 0x3c0(%rsp), %rdi
callq 0x3123c
jmp 0xbdec5
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbdc85
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdc85
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xbdcaf
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdcaf
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0xbdcd6
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdcd6
movq %rax, %rbx
jmp 0xbdcf2
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbdcf2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbdd13
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdd13
movq %rax, %rbx
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbdd35
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbdd35
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
callq 0x8480
jmp 0xbdec5
jmp 0xbdd57
jmp 0xbdd75
movq %rax, %rbx
jmp 0xbddbd
jmp 0xbdec2
jmp 0xbdd57
movq %rax, %rbx
jmp 0xbdee2
jmp 0xbdd75
jmp 0xbdd75
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3123c
jmp 0xbdee2
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbdd94
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbddb0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x3123c
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xbdde2
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbddfe
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x100(%rsp), %rdi
callq 0x3123c
leaq 0x300(%rsp), %rdi
callq 0x3123c
movq 0x1e8(%rsp), %rdi
testq %rdi, %rdi
je 0xbde35
movq 0x1f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0xbde52
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x218(%rsp), %rdi
callq 0x45f06
movq 0x2e8(%rsp), %rdi
testq %rdi, %rdi
je 0xbde7c
movq 0x2f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x278(%rsp), %rdi
callq 0x4b0a4
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0xbdea6
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x138(%rsp), %rdi
callq 0xa5bb6
leaq 0x1b0(%rsp), %rdi
callq 0x45f06
jmp 0xbdec5
movq %rax, %rbx
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0xbdee2
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x360(%rsp), %rdi
callq 0x5ddda
leaq 0x390(%rsp), %rdi
callq 0x5de52
leaq 0x330(%rsp), %rdi
callq 0x3f5f4
leaq 0x230(%rsp), %rdi
callq 0x3f522
leaq 0xb0(%rsp), %rdi
callq 0x3123c
leaq 0xd0(%rsp), %rdi
callq 0x3123c
leaq 0x260(%rsp), %rdi
callq 0x3123c
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0xbdf62
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840