// File: /workspace/github_cpp_makefile_star2_O3/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 $0x3f8, %rsp            # imm = 0x3F8
callq 0xbcf8d
leaq 0x140(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, 0x290(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x280(%rsp)
movq %rax, 0xf0(%rsp)
movapd %xmm0, 0xe0(%rsp)
movq %rax, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
movq 0x49182(%rip), %rsi     # 0x104148
leaq 0x250(%rsp), %rdi
leaq 0x350(%rsp), %rdx
callq 0x287de
leaq 0x250(%rsp), %rdi
movl $0x8, %esi
callq 0x500af
movq %rax, 0x2e8(%rsp)
leaq 0x260(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbb016
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r12
movq 0x4913e(%rip), %rsi     # 0x104168
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0x4913d(%rip), %rsi     # 0x104188
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r15
movq %r14, 0x30(%rsp)
movq 0x49137(%rip), %rsi     # 0x1041a8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x258(%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 0x358(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x3b8(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x388(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x130(%rsp), %rbx
leaq 0x40(%rsp), %r13
leaq 0x350(%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 0xbb18d
movq %r13, %rdi
movq %rbx, %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x40(%rsp), %rsi
addq $0x20, %rsi
leaq 0x250(%rsp), %rdi
callq 0x46fb4
movq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x3133c
movq 0x40(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3b46e
addq $0x20, %rbp
movq %rax, %rdi
movq %rbp, %rsi
callq 0x8270
movq %r13, %rdi
callq 0x2e784
jmp 0xbb0fd
movq 0x268(%rsp), %rbx
leaq 0x258(%rsp), %rax
cmpq %rax, %rbx
je 0xbb1ce
leaq 0x280(%rsp), %r14
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x3133c
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
leaq 0x258(%rsp), %rax
cmpq %rax, %rbx
jne 0xbb1aa
movq 0x46e13(%rip), %rdi     # 0x101fe8
leaq 0x25d8d(%rip), %rsi     # 0xe0f69
movl $0xa, %edx
callq 0x84e0
movq 0x288(%rsp), %rsi
subq 0x280(%rsp), %rsi
sarq $0x5, %rsi
movq 0x46de7(%rip), %rdi     # 0x101fe8
callq 0x82f0
movq %rax, %rbx
leaq 0x16b84(%rip), %rsi     # 0xd1d94
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 0x130(%rsp), %rbx
leaq 0xc0(%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 0xbb291
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3133c
jmp 0xbb254
xorpd %xmm0, %xmm0
leaq 0x1a0(%rsp), %rax
movapd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x1e0(%rsp), %r14
leaq 0x190(%rsp), %r12
leaq 0x130(%rsp), %r13
leaq 0x1d0(%rsp), %rbp
leaq 0x3e0(%rsp), %rbx
movq 0x30(%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 0xbb6ac
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r15
movq %r14, 0x1d0(%rsp)
movq 0x130(%rsp), %rsi
movq 0x138(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x2ba06
movq %rbp, %rdi
leaq 0x24b4c(%rip), %rsi     # 0xdfe90
callq 0x88c0
movq 0x48e78(%rip), %rsi     # 0x1041c8
movq 0x48e79(%rip), %rdx     # 0x1041d0
movq %rbp, %rdi
callq 0x8180
leaq 0x70(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbb387
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0xbb38f
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)
leaq 0x60(%rsp), %rdi
leaq 0x235ee(%rip), %rsi     # 0xde9a1
callq 0x88c0
leaq 0x20(%rsp), %rsi
movq %rsi, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbb3e0
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xbb3e8
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 0x471da(%rip), %esi     # 0x1025e0
leaq 0x180(%rsp), %rdi
callq 0x2e7e2
movq 0x10(%rsp), %rcx
movl $0xf, %edi
leaq 0x20(%rsp), %rax
cmpq %rax, %rcx
je 0xbb42c
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r8
movq 0x180(%rsp), %rsi
movq 0x188(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0xbb461
movl $0xf, %edi
cmpq %r12, %rsi
je 0xbb45c
movq 0x190(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xbb46d
leaq 0x10(%rsp), %rdi
callq 0x8180
jmp 0xbb47e
leaq 0x180(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x84d0
leaq 0xa8(%rsp), %rsi
movq %rsi, 0x98(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xbb4af
movq %rdx, 0x98(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa8(%rsp)
jmp 0xbb4b7
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0xa0(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x98(%rsp), %rdi
leaq 0x21c5f(%rip), %rsi     # 0xdd145
callq 0x88c0
leaq 0x50(%rsp), %rsi
movq %rsi, 0x40(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbb513
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0xbb51b
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)
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movl $0x10, %edx
callq 0x88d0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbb561
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbb586
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x180(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb5a3
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbb5bf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbb5db
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1d0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbb5f8
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r15, 0x1b8(%rsp)
movl $0x37, %edx
movq %r15, %rdi
leaq 0x24888(%rip), %rsi     # 0xdfe97
callq 0x84e0
movl $0x1, %edx
movq %r15, %rdi
leaq 0x123a7(%rip), %rsi     # 0xcd9ca
callq 0x84e0
movq %rbx, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2fc8e
movq 0x1b8(%rsp), %rsi
movq %rbx, %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x36ba0
movq %rbx, %rdi
callq 0x2e784
movq 0x1a8(%rsp), %rsi
cmpq 0x1b0(%rsp), %rsi
je 0xbb682
movq 0x1b8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x1a8(%rsp)
jmp 0xbb697
leaq 0x1a0(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xaddfa
leaq 0xe0(%rsp), %rdi
movq %r13, %rsi
callq 0x3133c
jmp 0xbb2d1
cmpq $0x0, 0x48b3c(%rip)     # 0x1041f0
je 0xbb792
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
leaq 0x48b1a(%rip), %rsi     # 0x1041e8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8740
movq %r14, 0x40(%rsp)
movq 0x46901(%rip), %rbx     # 0x101fe8
leaq 0x166b4(%rip), %rsi     # 0xd1da2
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 0x468cf(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0x38, %edi
callq 0x8470
movq %rax, 0x150(%rsp)
leaq 0x40(%rsp), %rsi
movq 0x150(%rsp), %rdi
callq 0x4675a
movq 0x46897(%rip), %rbx     # 0x101fe8
leaq 0x1064f(%rip), %rsi     # 0xcbda7
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 0x46865(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
jmp 0xbb792
movq 0xc8(%rsp), %rsi
subq 0xc0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x1d0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xb2a12
movq 0xe8(%rsp), %rsi
subq 0xe0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x180(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0xa53b6
movq 0xc8(%rsp), %rsi
subq 0xc0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x40(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x1b8(%rsp), %rdi
leaq 0x98(%rsp), %rcx
callq 0x51b5a
movq 0xe8(%rsp), %rsi
subq 0xe0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x298(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0xbd368
movq 0xc8(%rsp), %rsi
subq 0xc0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x40(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x308(%rsp), %rdi
leaq 0x98(%rsp), %rcx
callq 0x51a0c
movq 0xe8(%rsp), %rsi
subq 0xe0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x208(%rsp), %rdi
leaq 0x308(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0xbd400
movq 0xe8(%rsp), %rsi
subq 0xe0(%rsp), %rsi
movl 0x46d1f(%rip), %eax     # 0x1025e0
movl %eax, 0x3c(%rsp)
sarq $0x5, %rsi
leaq 0x40(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x238(%rsp), %rdi
leaq 0x98(%rsp), %rcx
callq 0x51b5a
movq 0xe8(%rsp), %rsi
subq 0xe0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x40(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x220(%rsp), %rdi
leaq 0x98(%rsp), %rcx
callq 0x51b5a
xorl %ecx, %ecx
movq %rcx, 0x330(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x320(%rsp)
movq %rcx, 0x110(%rsp)
movapd %xmm0, 0x100(%rsp)
leaq 0x40(%rsp), %rdx
leaq 0x50(%rsp), %rax
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movb %cl, 0x10(%rdx)
leaq 0x98(%rsp), %rdx
leaq 0xa8(%rsp), %rax
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movb %cl, 0x10(%rdx)
leaq 0x2c0(%rsp), %r14
leaq 0x10(%rsp), %rbp
leaq 0x60(%rsp), %r12
leaq 0x118(%rsp), %r13
movl $0x0, 0xbc(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x2e8(%rsp), %rbx
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x130(%rsp), %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbc8b1
movq 0x130(%rsp), %rdi
movq 0x138(%rsp), %rsi
addq %rdi, %rsi
movb $0xd, 0x10(%rsp)
movq %rbp, %rdx
callq 0x7fd35
movq %rax, %rcx
subq 0x130(%rsp), %rcx
movq %rcx, 0x138(%rsp)
movb $0x0, (%rax)
movq 0x130(%rsp), %rax
cmpb $0x23, (%rax)
jne 0xbbc9b
movzbl 0x1(%rax), %eax
cmpl $0x23, %eax
je 0xbb9a0
cmpl $0x43, %eax
jne 0xbbc9b
movq %r12, %rdi
leaq 0x130(%rsp), %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x110(%rsp), %rax
movapd 0x60(%rsp), %xmm0
movq 0x70(%rsp), %rcx
movq %rcx, 0x110(%rsp)
movapd 0x100(%rsp), %xmm1
movapd %xmm0, 0x100(%rsp)
movapd %xmm1, 0x10(%rsp)
movq %rax, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq %rbp, %rdi
callq 0x2e784
movq %r12, %rdi
callq 0x2e784
movq 0x100(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x108(%rsp), %rdx
movq %r12, %rdi
movq %rbp, %rcx
callq 0x7f67a
movq $0x0, 0x10(%rsp)
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0xbbb3d
xorl %esi, %esi
shlq $0x5, %rsi
addq %rax, %rsi
leaq 0x350(%rsp), %rdi
callq 0x3b46e
movq %rax, %rbx
leaq 0x380(%rsp), %rdi
movq %rbp, %rsi
callq 0x5d958
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8270
movq 0x10(%rsp), %rsi
incq %rsi
movq %rsi, 0x10(%rsp)
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rsi
jne 0xbbae8
movq 0x268(%rsp), %rbx
leaq 0x258(%rsp), %rax
cmpq %rax, %rbx
je 0xbc0e6
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x2ba06
leaq 0x40(%rbx), %rsi
movq %r13, %rdi
callq 0x2fc8e
leaq 0x168(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x5038c
movq 0x168(%rsp), %rax
cmpq 0x170(%rsp), %rax
jne 0xbbc2a
movl $0x29, %edx
movq 0x46434(%rip), %rdi     # 0x101fe8
leaq 0x16340(%rip), %rsi     # 0xd1efb
callq 0x84e0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x46417(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x14a63(%rip), %rsi     # 0xd064b
callq 0x84e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r15, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x168(%rsp), %rax
cmpq 0x170(%rsp), %rax
je 0xbca65
leaq 0x3b0(%rsp), %rdi
movq %rbp, %rsi
callq 0x5d9be
movq %rax, %rdi
leaq 0x168(%rsp), %rsi
callq 0x5da3a
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xbbc67
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq %r13, %rdi
callq 0x2e784
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbbc8b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8310
movq %rax, %rbx
jmp 0xbbb45
movl 0xbc(%rsp), %ecx
imull $0x26e978d5, %ecx, %eax # imm = 0x26E978D5
incl %ecx
movl %ecx, 0xbc(%rsp)
addl $0x27ef9dad, %eax       # imm = 0x27EF9DAD
rorl $0x3, %eax
cmpl $0x418936, %eax         # imm = 0x418936
ja 0xbbe0b
callq 0x82e0
subq 0x2d0(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x1322f(%rip), %xmm0    # 0xcef10
movsd %xmm0, 0x90(%rsp)
movl $0xa, %edx
movq 0x462f2(%rip), %rdi     # 0x101fe8
leaq 0x16269(%rip), %rsi     # 0xd1f66
callq 0x84e0
movq 0x462df(%rip), %rdi     # 0x101fe8
movl 0xbc(%rsp), %esi
callq 0x8810
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x19147(%rip), %rsi     # 0xd4e6e
callq 0x84e0
movq %rbx, %rdi
movsd 0x90(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x1b6af(%rip), %rsi     # 0xd73fe
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 0x46261(%rip), %rdi     # 0x101fe8
leaq 0x21c31(%rip), %rsi     # 0xdd9bf
callq 0x84e0
movq 0x4624e(%rip), %rdi     # 0x101fe8
movsd 0x2d8(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x21c14(%rip), %rsi     # 0xdd9ce
callq 0x84e0
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x8730
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x1b61f(%rip), %rsi     # 0xd73fe
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 %r12, %rdi
leaq 0x130(%rsp), %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x110(%rsp), %rax
movapd 0x60(%rsp), %xmm0
movq 0x70(%rsp), %rcx
movq %rcx, 0x110(%rsp)
movapd 0x100(%rsp), %xmm1
movapd %xmm0, 0x100(%rsp)
movapd %xmm1, 0x10(%rsp)
movq %rax, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq %rbp, %rdi
callq 0x2e784
movq %r12, %rdi
callq 0x2e784
movq 0x100(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x8270
movq 0x100(%rsp), %rsi
addq $0x20, %rsi
leaq 0x98(%rsp), %rdi
callq 0x8270
movq %r14, 0x2b0(%rsp)
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x2b0(%rsp), %rdi
callq 0x2ba06
leaq 0x2b0(%rsp), %rdi
callq 0x4d578
movsd %xmm0, 0x158(%rsp)
movq 0x2b0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbbf01
movq 0x2c0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x108(%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rcx
callq 0x7f67a
movq 0x100(%rsp), %rax
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x2ba06
movq 0x100(%rsp), %rax
leaq 0x70(%rsp), %rcx
movq %rcx, 0x60(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2ba06
movq %r12, %rdi
leaq 0x247d0(%rip), %rsi     # 0xe074e
callq 0x8160
cmpb $0x0, 0x4827e(%rip)     # 0x104208
je 0xbbf95
testl %eax, %eax
jne 0xbbfb5
jmp 0xbc100
testl %eax, %eax
je 0xbc100
cmpq $0x1, 0x18(%rsp)
ja 0xbc100
cmpq $0x1, 0x68(%rsp)
ja 0xbc100
callq 0x82e0
movq %rax, %rbx
movl $0x240, %edi            # imm = 0x240
callq 0x8470
leaq 0x119fc(%rip), %r12     # 0xcd9ca
movq %rax, %r14
movq 0x120(%rsp), %rdx
subq 0x118(%rsp), %rdx
shrq $0x5, %rdx
movq %rax, %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x7f6bc
movq %r14, %rdi
movq %r13, %rsi
leaq 0x380(%rsp), %rdx
callq 0x4d0d4
movq %r14, 0x200(%rsp)
movq 0x118(%rsp), %r14
movq 0x120(%rsp), %r15
cmpq %r14, %r15
je 0xbc05f
leaq 0x10(%r14), %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0xbc03f
movq (%r12), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%r12), %rax
addq $0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0xbc029
movq %r14, 0x120(%rsp)
leaq 0x1196b(%rip), %r12     # 0xcd9ca
cmpq %r14, 0x128(%rsp)
je 0xbc071
movq %r13, %rdi
callq 0x7fe80
callq 0x82e0
subq %rbx, %rax
cvtsi2sd %rax, %xmm0
divsd 0x12e8a(%rip), %xmm0    # 0xcef10
movsd %xmm0, 0x2d8(%rsp)
callq 0x82e0
cvtsi2sdl 0x3c(%rsp), %xmm1
movsd 0x158(%rsp), %xmm0
movsd %xmm1, 0x1f8(%rsp)
ucomisd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0xc(%rsp), %xmm1
movq %rax, 0x2e0(%rsp)
ja 0xbc1a1
ucomisd %xmm0, %xmm1
ja 0xbc1a1
movq 0xe0(%rsp), %r14
movq 0xe8(%rsp), %r15
jmp 0xbc680
callq 0x82e0
movq %rax, 0x2d0(%rsp)
movq %r12, %rdi
callq 0x2e784
jmp 0xbb9a0
movq $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
movq %rbp, %rdi
callq 0x8290
movq %r14, %r13
movq $0x0, 0x68(%rsp)
movq 0x60(%rsp), %rax
movb $0x0, (%rax)
movq %r12, %rdi
callq 0x8290
movq 0x118(%rsp), %rbx
movq 0x120(%rsp), %r14
cmpq %rbx, %r14
je 0xbc17a
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xbc162
movq (%r15), %rsi
incq %rsi
callq 0x8480
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0xbc14e
movq %rbx, 0x120(%rsp)
cmpq %rbx, 0x128(%rsp)
je 0xbc1e2
leaq 0x118(%rsp), %r15
movq %r15, %rdi
callq 0x7fe80
xorl %ebx, %ebx
movq %r13, %r14
movq %r15, %r13
jmp 0xbc86a
movsd %xmm1, 0x1f0(%rsp)
movl 0x46430(%rip), %eax     # 0x1025e0
movl %eax, 0x88(%rsp)
cmpq $0x0, 0x48031(%rip)     # 0x1041f0
je 0xbc225
movsd 0x158(%rsp), %xmm0
ucomisd 0x1f8(%rsp), %xmm0
jbe 0xbc1f4
movl 0xc(%rsp), %edx
addl %edx, 0x88(%rsp)
jmp 0xbc205
xorl %ebx, %ebx
movq %r13, %r14
leaq 0x118(%rsp), %r13
jmp 0xbc86a
xorl %edx, %edx
movsd 0x1f0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbc225
movq 0x150(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl 0x88(%rsp), %ecx
callq 0x470ac
movl %eax, 0x88(%rsp)
movq 0xe0(%rsp), %r14
movq 0xe8(%rsp), %r15
cmpq %r14, %r15
je 0xbc63b
xorps %xmm0, %xmm0
cvtsi2sdl 0x88(%rsp), %xmm0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x90(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x160(%rsp)
xorl %eax, %eax
movq %rax, %r13
movq 0xc8(%rsp), %rax
cmpq 0xc0(%rsp), %rax
je 0xbc434
movq 0x180(%rsp), %rax
leaq (,%r13,2), %r15
addq %r13, %r15
movq (%rax,%r15,8), %rax
xorl %ebp, %ebp
leaq (,%rbp,2), %r14
addq %rbp, %r14
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %rdx
movq %rdx, %rbx
subq %rcx, %rbx
shrq $0x3, %rbx
testl %ebx, %ebx
jle 0xbc2e7
movq 0x298(%rsp), %rsi
movq (%rsi,%r15,8), %rsi
movl (%rsi,%rbp,4), %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
addl %ebx, %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
divsd %xmm0, %xmm1
ucomisd 0x1043b(%rip), %xmm1    # 0xcc720
jbe 0xbc306
movq 0x208(%rsp), %rsi
movq (%rsi,%r15,8), %rsi
movabsq $0x7ff8000000000000, %rdi # imm = 0x7FF8000000000000
movq %rdi, (%rsi,%rbp,8)
jmp 0xbc40a
movsd %xmm1, 0x30(%rsp)
leaq (%rax,%r14,8), %rsi
leaq 0x338(%rsp), %rdi
callq 0x37978
movq 0x338(%rsp), %rdi
movq 0x340(%rsp), %rax
subq %rdi, %rax
je 0xbc36d
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 0xbc344
divsd 0x90(%rsp), %xmm0
movq 0x208(%rsp), %rax
movq (%rax,%r15,8), %rax
movsd %xmm0, (%rax,%rbp,8)
jmp 0xbc38c
movq 0x208(%rsp), %rax
movq (%rax,%r15,8), %rax
movsd 0x160(%rsp), %xmm0
movsd %xmm0, (%rax,%rbp,8)
testq %rdi, %rdi
je 0xbc3ad
movq 0x348(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x208(%rsp), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%rbp,8), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movq 0x298(%rsp), %rcx
leaq (,%r13,8), %rdx
leaq (%rdx,%rdx,2), %rdx
movq (%rcx,%rdx), %rcx
addl (%rcx,%rbp,4), %ebx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
divsd %xmm2, %xmm1
movsd 0x30(%rsp), %xmm2
divsd %xmm1, %xmm2
addsd 0x10324(%rip), %xmm2    # 0xcc710
mulsd %xmm0, %xmm2
movsd %xmm2, (%rax,%rbp,8)
movq 0x180(%rsp), %rax
movq (%rax,%rdx), %rax
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %rdx
cmpq %rcx, %rdx
je 0xbc414
movq %rcx, 0x8(%rax,%r14,8)
incq %rbp
movq 0xc8(%rsp), %rcx
subq 0xc0(%rsp), %rcx
sarq $0x5, %rcx
cmpq %rbp, %rcx
jne 0xbc298
movq 0x1a0(%rsp), %rax
movq (%rax,%r13,8), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq %r15, %rdi
movl 0xc(%rsp), %esi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq %r15, %rdi
movl 0x3c(%rsp), %esi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq 0x238(%rsp), %rax
movl (%rax,%r13,4), %esi
movq %r15, %rdi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq 0x220(%rsp), %rax
movl (%rax,%r13,4), %esi
movq %r15, %rdi
callq 0x8810
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq %r15, %rdi
movl 0x88(%rsp), %esi
callq 0x8810
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
leaq (,%r13,2), %rsi
addq %r13, %rsi
shlq $0x3, %rsi
addq 0x208(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x37978
movq 0x1a0(%rsp), %rax
movq (%rax,%r13,8), %rsi
leaq 0x2f0(%rsp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x5af81
movq 0x2f0(%rsp), %rdi
testq %rdi, %rdi
je 0xbc571
movq 0x300(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x1(%r13), %rax
movq 0xe0(%rsp), %r14
movq 0xe8(%rsp), %r15
movq %r15, %rcx
subq %r14, %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
jne 0xbc266
movq 0x238(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x220(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xc0(%rsp), %rax
movq 0xc8(%rsp), %rbp
movq %rbp, %rcx
movq %rax, 0x160(%rsp)
subq %rax, %rcx
movq 0x298(%rsp), %r12
sarq $0x3, %rcx
movq %rcx, 0x88(%rsp)
movq $-0x1, %rbx
xorl %eax, %eax
movq 0x30(%rsp), %rcx
movl %eax, 0x4(%rcx,%rbx,4)
movq 0x90(%rsp), %rcx
movl %eax, 0x4(%rcx,%rbx,4)
cmpq 0x160(%rsp), %rbp
je 0xbc622
movq (%r12), %rdi
xorl %esi, %esi
movq 0x88(%rsp), %rdx
callq 0x8280
incq %rbx
addq $0x18, %r12
cmpq %rbx, %r13
jne 0xbc5ee
leaq 0x10(%rsp), %rbp
leaq 0x118(%rsp), %r13
movsd 0x158(%rsp), %xmm0
ucomisd 0x1f8(%rsp), %xmm0
jbe 0xbc65f
movl 0x45f8b(%rip), %eax     # 0x1025e0
addl %eax, 0xc(%rsp)
addl %eax, 0x3c(%rsp)
jmp 0xbc680
movsd 0x1f0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xbc680
movl $0x0, 0xc(%rsp)
movl 0x45f64(%rip), %eax     # 0x1025e0
movl %eax, 0x3c(%rsp)
cmpq %r14, %r15
je 0xbc81b
movq 0x200(%rsp), %rbx
addq $0xe0, %rbx
xorl %r15d, %r15d
movq %r15, %rsi
shlq $0x5, %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x52202
movq %rbp, %r12
movsd (%rax), %xmm0
ucomisd 0x1005c(%rip), %xmm0    # 0xcc718
jne 0xbc6d1
jp 0xbc6d1
movq 0x220(%rsp), %rax
incl (%rax,%r15,4)
jmp 0xbc7ed
movsd %xmm0, 0x30(%rsp)
movq 0x238(%rsp), %rax
incl (%rax,%r15,4)
movq 0xc0(%rsp), %rsi
cmpq %rsi, 0xc8(%rsp)
je 0xbc7ed
movsd 0x1000f(%rip), %xmm0    # 0xcc710
subsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebp, %ebp
addq %r14, %rsi
movq %rbx, %rdi
callq 0x52202
movsd (%rax), %xmm0
ucomisd 0xffe9(%rip), %xmm0     # 0xcc718
jne 0xbc733
jnp 0xbc7a0
movq 0xc0(%rsp), %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x52202
movsd (%rax), %xmm1
movsd 0xffbe(%rip), %xmm0     # 0xcc710
subsd %xmm1, %xmm0
mulsd 0x90(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x168(%rsp)
movq 0x180(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rax,%r13), %rdi
movq 0x8(%rax,%r13), %rsi
cmpq 0x10(%rax,%r13), %rsi
je 0xbc7b5
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xbc7c2
movq 0x298(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
incl (%rax,%rbp,4)
jmp 0xbc7c2
leaq 0x168(%rsp), %rdx
callq 0x79b8e
incq %rbp
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x18, %r13
addq $0x20, %r14
cmpq %rax, %rbp
jne 0xbc718
incq %r15
movq 0xe0(%rsp), %r14
movq 0xe8(%rsp), %rax
subq %r14, %rax
sarq $0x5, %rax
cmpq %r15, %rax
movq %r12, %rbp
leaq 0x118(%rsp), %r13
jne 0xbc69b
callq 0x82e0
subq 0x2e0(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x126d8(%rip), %xmm0    # 0xcef10
movsd %xmm0, 0x30(%rsp)
movq 0x200(%rsp), %rbx
movq %rbx, %rdi
callq 0x7fb02
movl $0x240, %esi            # imm = 0x240
movq %rbx, %rdi
callq 0x8480
movb $0x1, %bl
leaq 0x2c0(%rsp), %r14
leaq 0x60(%rsp), %r12
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbc886
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbc8a2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r13, %rdi
callq 0x2e784
testb %bl, %bl
jmp 0xbb9a0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbc8d6
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbc8f2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x100(%rsp), %rdi
callq 0x2e784
leaq 0x320(%rsp), %rdi
callq 0x2e784
movq 0x220(%rsp), %rdi
testq %rdi, %rdi
je 0xbc929
movq 0x230(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x238(%rsp), %rdi
testq %rdi, %rdi
je 0xbc946
movq 0x248(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x208(%rsp), %rdi
callq 0x42ffa
movq 0x308(%rsp), %rdi
testq %rdi, %rdi
je 0xbc970
movq 0x318(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x298(%rsp), %rdi
callq 0x480b0
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0xbc99a
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x180(%rsp), %rdi
callq 0xa5098
leaq 0x1d0(%rsp), %rdi
callq 0x42ffa
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0xbc9d1
movq 0x1b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x380(%rsp), %rdi
callq 0x5df54
leaq 0x3b0(%rsp), %rdi
callq 0x5dfcc
leaq 0x350(%rsp), %rdi
callq 0x3c6d4
leaq 0x250(%rsp), %rdi
callq 0x3c602
leaq 0xc0(%rsp), %rdi
callq 0x2e784
leaq 0xe0(%rsp), %rdi
callq 0x2e784
leaq 0x280(%rsp), %rdi
callq 0x2e784
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0xbca51
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %eax, %eax
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x154b9(%rip), %rdi     # 0xd1f25
leaq 0x2345c(%rip), %rsi     # 0xdfecf
leaq 0x23471(%rip), %rcx     # 0xdfeeb
movl $0xaf, %edx
callq 0x82c0
jmp 0xbcd98
movq %rax, %rbx
movl $0x38, %esi
movq 0x150(%rsp), %rdi
jmp 0xbcd08
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0xbcd08
jmp 0xbcab0
movq %rax, %rdi
callq 0x288e1
jmp 0xbcd19
jmp 0xbcd19
movq %rax, %rbx
jmp 0xbce58
movq %rax, %rbx
jmp 0xbce75
movq %rax, %rbx
jmp 0xbce82
movq %rax, %rbx
jmp 0xbce9f
movq %rax, %rbx
jmp 0xbceac
movq %rax, %rbx
jmp 0xbcec9
movq %rax, %rbx
jmp 0xbced6
jmp 0xbcee5
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
jmp 0xbcb4f
jmp 0xbcb59
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0xbcb4f
jmp 0xbcb59
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r12, %rdi
jmp 0xbcb4f
jmp 0xbcb59
movq %rax, %rbx
leaq 0x260(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbcf39
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcf39
movq %rax, %rbx
jmp 0xbcf39
movq %rax, %rbx
movl $0x240, %esi            # imm = 0x240
movq %r14, %rdi
jmp 0xbcbdf
jmp 0xbcd19
movq %rax, %rbx
jmp 0xbcdb7
jmp 0xbcd19
movq %rax, %rbx
jmp 0xbcdd3
movq %rax, %rbx
movq 0x2b0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbcde0
movq 0x2c0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcde0
jmp 0xbcd98
jmp 0xbcd7a
jmp 0xbcee5
movq %rax, %rbx
movq 0x2f0(%rsp), %rdi
testq %rdi, %rdi
je 0xbcd9b
movq 0x300(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
jmp 0xbcd9b
jmp 0xbcd19
movq %rax, %rbx
jmp 0xbcd4a
movq %rax, %rbx
jmp 0xbcd57
jmp 0xbcd14
jmp 0xbcd7a
jmp 0xbcd98
jmp 0xbcd19
jmp 0xbccdb
movq %rax, %rbx
leaq 0x3e0(%rsp), %rdi
callq 0x2e784
jmp 0xbcee8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbcc50
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcc50
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbcc7a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcc7a
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r12, %rdi
je 0xbcca1
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcca1
movq %rax, %rbx
jmp 0xbccbd
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbccbd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbccde
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbccde
movq %rax, %rbx
movq 0x1d0(%rsp), %rdi
cmpq %r14, %rdi
je 0xbcd00
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbcd00
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
callq 0x8480
jmp 0xbcee8
jmp 0xbcd7a
movq %rax, %rbx
jmp 0xbcd73
movq %rax, %rbx
jmp 0xbcde0
jmp 0xbcee5
jmp 0xbcd7a
jmp 0xbcd98
movq %rax, %rbx
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xbcd4a
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x118(%rsp), %rdi
callq 0x2e784
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbcd73
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
jmp 0xbcddb
movq %rax, %rbx
jmp 0xbcf05
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2e784
jmp 0xbcf05
jmp 0xbcd98
jmp 0xbcd98
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xbcdb7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbcdd3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x118(%rsp), %rdi
callq 0x2e784
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbce05
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbce21
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x100(%rsp), %rdi
callq 0x2e784
leaq 0x320(%rsp), %rdi
callq 0x2e784
movq 0x220(%rsp), %rdi
testq %rdi, %rdi
je 0xbce58
movq 0x230(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x238(%rsp), %rdi
testq %rdi, %rdi
je 0xbce75
movq 0x248(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x208(%rsp), %rdi
callq 0x42ffa
movq 0x308(%rsp), %rdi
testq %rdi, %rdi
je 0xbce9f
movq 0x318(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x298(%rsp), %rdi
callq 0x480b0
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0xbcec9
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x180(%rsp), %rdi
callq 0xa5098
leaq 0x1d0(%rsp), %rdi
callq 0x42ffa
jmp 0xbcee8
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0xbcf05
movq 0x1b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0x380(%rsp), %rdi
callq 0x5df54
leaq 0x3b0(%rsp), %rdi
callq 0x5dfcc
leaq 0x350(%rsp), %rdi
callq 0x3c6d4
leaq 0x250(%rsp), %rdi
callq 0x3c602
leaq 0xc0(%rsp), %rdi
callq 0x2e784
leaq 0xe0(%rsp), %rdi
callq 0x2e784
leaq 0x280(%rsp), %rdi
callq 0x2e784
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0xbcf85
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840