// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/evo_diversity_subsampling.cpp
// Function: subsamplingDxy(int, char**)
int subsamplingDxy(int argc, char** argv) {
    parseSubsamplingDxyOptions(argc, argv);
    
    // Load up the intervals file
    std::ifstream* bedFile = new std::ifstream(opt::bedFile.c_str());
    std::map<int, string> linearToGenomeMap;
    std::cerr << "Loading coordinates from the bed file " << opt::bedFile << std::endl;
    LinkedCoordsBed coords;
    if (!opt::bElements) {
        SimpleCoordsBed simpleCoords(bedFile, linearToGenomeMap);
    } else {
        coords = LinkedCoordsBed(bedFile);
    }
    std::cerr << "Done" << std::endl;
    
    // Load up the VCF file:
    std::istream* vcfFile = createReader(opt::vcfFile.c_str());
    string line; std::unordered_map<string, Counts> vcfCountsMap;
    std::unordered_map<string, double> vcfDxyMap;
    std::unordered_map<string, double> vcfInbreedingPvalMap;
    
    std::cerr << "Loading variants from the VCF file " << opt::vcfFile << std::endl;
    double totalDxySum = 0;
    while (getline(*vcfFile, line)) {
        if (line[0] == '#' && line[1] == '#') {
        
        } else if (line[0] == '#' && line[1] == 'C') {
        
        } else {
            // totalVariantNumber++;
            //std::cerr << "Variant N:" << totalVariantNumber << std::endl;
            std::vector<std::string> fields = split(line, '\t');
            string scaffold = fields[0]; string pos = fields[1];
            Counts* counts = new Counts();
            getThisVariantCountsSimple(fields, counts);
            counts->inbreedingCoefficient = calculateInbreedingCoefficient(counts->individualsWithVariant);
            counts->chiSqPvalForInbreeding = calculateChiSqPvalForInbreeding(counts->individualsWithVariant);
            if (counts->inbreedingCoefficient < 0 && counts->chiSqPvalForInbreeding < 0.05) {
                std::cerr << "filtering out:" << std::endl;
                std::cerr << scaffold+"\t"+pos << std::endl;
                std::cerr << "counts.chiSqPvalForInbreeding: " << counts->chiSqPvalForInbreeding << std::endl;
                std::cerr << "counts.inbreedingCoefficient: " << counts->inbreedingCoefficient << std::endl;
                std::cerr << std::endl;
            } else {
                vcfCountsMap[scaffold+"\t"+pos] = *counts;
                double thisVariantDxy = calculateOverallDxy(*counts);
                totalDxySum = totalDxySum + thisVariantDxy;
                vcfDxyMap[scaffold+"\t"+pos] = thisVariantDxy;
            }
            delete counts;
        }
    }
    std::cerr << "Done" << std::endl;
    
    if (!opt::bElements) {
        int totalIntervalsLength = (int)linearToGenomeMap.size();
        std::cout << "Average Dxy = " << totalDxySum/totalIntervalsLength << std::endl;
        // Prepare the output file for subsamples of Dxy values
        size_t suffixPos = opt::bedFile.find_last_of('.');
        string outDxyFileName;
        if (suffixPos != std::string::npos) {
            outDxyFileName = opt::outFolder + stripExtension(opt::bedFile) + "_DxyVals_l" + numToString(opt::subsampleLength) + ".txt";
        } else {
            outDxyFileName = opt::outFolder + opt::bedFile + "_DxyVals_l" + numToString(opt::subsampleLength) + ".txt";
        }
        //std::cerr << "into: " << AAFileName << std::endl;
        std::ofstream* outDxyFile = new std::ofstream(outDxyFileName.c_str());
        
        
        // Subsampling:
        int numSubsamplesToDo = totalIntervalsLength/opt::subsampleLength;
        std::mt19937_64 rng; // random number generator
        rng.seed();
        std::uniform_int_distribution<int> distribution(0,totalIntervalsLength);
        std::cerr << "Now running subsamples to be written into: " << outDxyFileName << std::endl;
        for (int i = 0; i < numSubsamplesToDo; i++) {
            if (i % 10000 == 0) {
                std::cerr << "Subsample " << i << " out of " << numSubsamplesToDo << std::endl;
            }
            double subsampleDxyTotal = 0;
            for (int j = 0; j < opt::subsampleLength; j++) {
                int linearIndex = distribution(rng);
                string genomeLocation = linearToGenomeMap[linearIndex];
                if (vcfDxyMap.count(genomeLocation) == 1) {
                    subsampleDxyTotal = subsampleDxyTotal + vcfDxyMap[genomeLocation];
                }
            }
            *outDxyFile << subsampleDxyTotal/opt::subsampleLength << std::endl;
        }
    } else {
        string outDxyFileName;
        size_t suffixPos = opt::bedFile.find_last_of('.');
        if (suffixPos != std::string::npos) {
            outDxyFileName = opt::outFolder + stripExtension(opt::bedFile) + "_DxyVals_perElement.txt";
        } else {
            outDxyFileName = opt::outFolder + opt::bedFile + "_DxyVals_perElement.txt";
        } std::ofstream* outDxyFile = new std::ofstream(outDxyFileName.c_str());
        
        std::cerr << "Now calculating Dxy values per element to be written out into: " << outDxyFileName << std::endl;
        std::vector<double> elementDxyValues = coords.getMeanPerElement(vcfDxyMap);
        std::cerr << "Calculations done" << std::endl;
        std::vector<string> elementNames = coords.getElementNames();
        std::vector<std::vector<string> > elementOuterBounds = coords.getElementOuterBoundaries();
        for (int i = 0; i < (int)elementDxyValues.size(); i++) {
            *outDxyFile << elementOuterBounds[i][0] << "\t" << elementOuterBounds[i][1] << "\t" << elementOuterBounds[i][2] << "\t" << elementNames[i] << "\t" << elementDxyValues[i] << std::endl;
        }
    }
    std::cerr << "Done" << std::endl;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xbd8, %rsp            # imm = 0xBD8
callq 0x284ea
movl $0x208, %edi            # imm = 0x208
callq 0x8490
movq %rax, %r14
movq 0xb60d6(%rip), %rsi     # 0xdd798
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x8890
movq %r14, 0xa8(%rsp)
leaq 0x140(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0xb58ef(%rip), %rdi     # 0xdcfe8
leaq 0x6eac0(%rip), %rsi     # 0x961c0
callq 0x8480
leaq 0xb608c(%rip), %rsi     # 0xdd798
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
andq $0x0, 0xc0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
cmpb $0x0, 0xb60bf(%rip)     # 0xdd7f8
je 0x27772
leaq 0x210(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x286f2
leaq 0xb0(%rsp), %rdi
leaq 0x210(%rsp), %rbx
movq %rbx, %rsi
callq 0x2aae2
movq %rbx, %rdi
callq 0x2a7a4
jmp 0x2778f
leaq 0x210(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x138(%rsp), %rdx
callq 0x286ca
movq 0xb5852(%rip), %rdi     # 0xdcfe8
leaq 0x6ea4a(%rip), %rsi     # 0x961e7
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0xb6007(%rip), %rsi     # 0xdd7b8
leaq 0x210(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
callq 0x21904
leaq 0x210(%rsp), %rdi
pushq $0x8
popq %rsi
callq 0x42587
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
callq 0x8978
leaq 0x108(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1d0(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movupd %xmm0, -0x8(%rax)
leaq 0x198(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movupd %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movupd %xmm0, -0x8(%rax)
leaq 0x208(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movupd %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movupd %xmm0, -0x8(%rax)
movq 0xb5784(%rip), %rdi     # 0xdcfe8
leaq 0x6e981(%rip), %rsi     # 0x961ec
callq 0x8480
leaq 0xb5f41(%rip), %rsi     # 0xdd7b8
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
leaq 0xf8(%rsp), %r14
leaq 0x210(%rsp), %r15
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x80a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x27b68
movq 0xf8(%rsp), %rax
cmpb $0x23, (%rax)
jne 0x278d9
movzbl 0x1(%rax), %eax
cmpl $0x23, %eax
je 0x278a1
cmpl $0x43, %eax
je 0x278a1
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
pushq $0x9
popq %rdx
callq 0x40349
movq 0x80(%rsp), %rsi
movq %r15, %rdi
callq 0x8600
movq 0x80(%rsp), %rsi
addq $0x20, %rsi
leaq 0x58(%rsp), %rdi
callq 0x8600
movl $0x100, %edi            # imm = 0x100
callq 0x8490
movq %rax, %r13
movq %rax, %rdi
callq 0x28746
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x40b39
movq %r13, %r12
addq $0x70, %r12
movq %r12, %rdi
callq 0x40577
movsd %xmm0, 0x58(%r13)
movq %r12, %rdi
callq 0x40617
movsd %xmm0, 0x60(%r13)
movsd 0x6e82e(%rip), %xmm1    # 0x96190
ucomisd %xmm0, %xmm1
jbe 0x27a54
xorpd %xmm0, %xmm0
ucomisd 0x58(%r13), %xmm0
jbe 0x27a54
movq 0xb5665(%rip), %rdi     # 0xdcfe8
leaq 0x6e886(%rip), %rsi     # 0x96210
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x30(%rsp), %r12
movq %r12, %rdi
leaq 0x210(%rsp), %rsi
leaq 0x72470(%rip), %rdx     # 0x99e1e
callq 0x28806
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
leaq 0x58(%rsp), %rdx
callq 0x287e7
movq 0xb5619(%rip), %rdi     # 0xdcfe8
movq %r15, %rsi
callq 0x8430
movq %rax, %rdi
callq 0x8230
leaq 0x10(%rsp), %rdi
callq 0x8978
movq %r12, %rdi
callq 0x8978
movq 0xb55f0(%rip), %rdi     # 0xdcfe8
leaq 0x6e820(%rip), %rsi     # 0x9621f
callq 0x8480
movsd 0x60(%r13), %xmm0
movq %rax, %rdi
callq 0x8750
movq %rax, %rdi
callq 0x8230
movq 0xb55c7(%rip), %rdi     # 0xdcfe8
leaq 0x6e817(%rip), %rsi     # 0x9623f
callq 0x8480
movsd 0x58(%r13), %xmm0
movq %rax, %rdi
callq 0x8750
movq %rax, %rdi
callq 0x8230
movq 0xb559e(%rip), %rdi     # 0xdcfe8
callq 0x8230
jmp 0x27b27
leaq 0x30(%rsp), %r15
movq %r15, %rdi
leaq 0x210(%rsp), %r12
movq %r12, %rsi
leaq 0x723b0(%rip), %rdx     # 0x99e1e
callq 0x28806
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
leaq 0x58(%rsp), %rdx
callq 0x287e7
leaq 0x1a0(%rsp), %rdi
movq %rbp, %rsi
callq 0x2b5d6
movq %rax, %rdi
movq %r13, %rsi
callq 0x2883e
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x8978
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8978
movq %r13, %rdi
callq 0x288eb
movsd %xmm0, 0x78(%rsp)
movq %r15, %rdi
movq %r12, %rsi
leaq 0x72346(%rip), %rdx     # 0x99e1e
callq 0x28806
movq %rbp, %rdi
movq %r15, %rsi
leaq 0x58(%rsp), %rdx
callq 0x287e7
leaq 0x168(%rsp), %rdi
movq %rbp, %rsi
callq 0x2b9f4
movsd 0x8(%rsp), %xmm0
movsd 0x78(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, (%rax)
movq %rbp, %rdi
callq 0x8978
movq %r15, %rdi
callq 0x8978
movq %r13, %rdi
callq 0x289b4
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdi
callq 0x84a0
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x210(%rsp), %r15
movq %r15, %rdi
callq 0x8978
leaq 0x80(%rsp), %rdi
callq 0x28a08
jmp 0x278a1
movq 0xb5479(%rip), %rdi     # 0xdcfe8
leaq 0x6e671(%rip), %rsi     # 0x961e7
callq 0x8480
movq %rax, %rdi
callq 0x8230
cmpb $0x0, 0xb5c6e(%rip)     # 0xdd7f8
je 0x27c2e
leaq 0x220(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xb5bed(%rip), %rdi     # 0xdd798
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
callq 0x8940
cmpq $-0x1, %rax
je 0x27d77
leaq 0xb5bd1(%rip), %rsi     # 0xdd798
leaq 0x30(%rsp), %rdi
callq 0x404d7
leaq 0xb5c00(%rip), %rsi     # 0xdd7d8
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x28aaf
leaq 0x6e6ca(%rip), %rdx     # 0x962b8
leaq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28a29
leaq 0x210(%rsp), %rdi
leaq 0x58(%rsp), %rbx
movq %rbx, %rsi
callq 0x8550
movq %rbx, %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x30(%rsp), %rdi
jmp 0x27dc7
movl 0x160(%rsp), %ebx
movq 0xb537c(%rip), %rdi     # 0xdcfb8
leaq 0x6e61b(%rip), %rsi     # 0x9625e
callq 0x8480
cvtsi2sd %ebx, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x8750
movq %rax, %rdi
callq 0x8230
leaq 0xb5b2b(%rip), %rdi     # 0xdd798
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
callq 0x8940
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
cmpq $-0x1, %rax
je 0x27f66
leaq 0xb5afe(%rip), %rsi     # 0xdd798
leaq 0xd8(%rsp), %rdi
callq 0x404d7
leaq 0xb5b2a(%rip), %rsi     # 0xdd7d8
leaq 0x80(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
callq 0x28aaf
leaq 0x6e5a3(%rip), %rdx     # 0x9626d
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x28a29
movl 0xb5816(%rip), %esi     # 0xdd4f8
leaq 0x118(%rsp), %rdi
callq 0x28ad3
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x28a48
leaq 0x85118(%rip), %rdx     # 0xace25
leaq 0x210(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28a29
leaq 0x58(%rsp), %rdi
leaq 0x210(%rsp), %r14
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x118(%rsp), %rdi
callq 0x8978
leaq 0x30(%rsp), %rdi
callq 0x8978
leaq 0x80(%rsp), %rdi
callq 0x8978
leaq 0xd8(%rsp), %rdi
jmp 0x28023
leaq 0xb5a5a(%rip), %rsi     # 0xdd7d8
leaq 0xb5a13(%rip), %rdx     # 0xdd798
leaq 0x10(%rsp), %rdi
callq 0x28b6d
leaq 0x6e522(%rip), %rdx     # 0x962b8
leaq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28a29
leaq 0x210(%rsp), %rdi
leaq 0x58(%rsp), %rbx
movq %rbx, %rsi
callq 0x8550
movq %rbx, %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %r14
movq 0x210(%rsp), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movq 0xb51f5(%rip), %rdi     # 0xdcfe8
leaq 0x6e4d6(%rip), %rsi     # 0x962d0
callq 0x8480
leaq 0x210(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
leaq 0x58(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x168(%rsp), %rdx
callq 0x28c48
movq 0xb51b0(%rip), %rdi     # 0xdcfe8
leaq 0x6e4d1(%rip), %rsi     # 0x96310
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x10(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x28eb4
leaq 0x30(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x28f56
xorl %r15d, %r15d
leaq 0x71fa4(%rip), %rbx     # 0x99e1e
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x60(%rsp), %rax
subq 0x58(%rsp), %rax
shrq $0x3, %rax
cltq
cmpq %rax, %r13
jge 0x27f3b
movq 0x30(%rsp), %rax
movq (%rax,%r12), %rsi
movq %r14, %rdi
callq 0x8430
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8480
movq 0x30(%rsp), %rcx
movq (%rcx,%r12), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8480
movq 0x30(%rsp), %rcx
movq (%rcx,%r12), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8480
movq 0x10(%rsp), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8480
movq 0x58(%rsp), %rcx
movsd (%rcx,%r13,8), %xmm0
movq %rax, %rdi
callq 0x8750
movq %rax, %rdi
callq 0x8230
incq %r13
addq $0x18, %r12
addq $0x20, %r15
jmp 0x27e80
leaq 0x30(%rsp), %rdi
callq 0x29054
leaq 0x10(%rsp), %rdi
callq 0x28a08
leaq 0x58(%rsp), %rdi
callq 0x2b43c
leaq 0x210(%rsp), %rdi
jmp 0x281ef
leaq 0xb586b(%rip), %rsi     # 0xdd7d8
leaq 0xb5824(%rip), %rdx     # 0xdd798
leaq 0x80(%rsp), %rdi
callq 0x28b6d
leaq 0x6e2e5(%rip), %rdx     # 0x9626d
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x28a29
movl 0xb5558(%rip), %esi     # 0xdd4f8
leaq 0xd8(%rsp), %rdi
callq 0x28ad3
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x28a48
leaq 0x84e5a(%rip), %rdx     # 0xace25
leaq 0x210(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28a29
leaq 0x58(%rsp), %rdi
leaq 0x210(%rsp), %r14
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0xd8(%rsp), %rdi
callq 0x8978
leaq 0x30(%rsp), %rdi
callq 0x8978
leaq 0x80(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %r14
movq 0x58(%rsp), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movl %ebx, %eax
cltd
idivl 0xb54aa(%rip)           # 0xdd4f8
movl %eax, 0x54(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x28ba6
leaq 0x210(%rsp), %rdi
movl $0x1571, %esi           # imm = 0x1571
callq 0x28bb0
movq %r14, 0xd0(%rsp)
andl $0x0, 0x30(%rsp)
movl %ebx, 0x34(%rsp)
movq 0xb4f5f(%rip), %rdi     # 0xdcfe8
leaq 0x6e1e8(%rip), %rsi     # 0x96278
callq 0x8480
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
xorl %eax, %eax
movl 0x54(%rsp), %ecx
testl %ecx, %ecx
cmovlel %eax, %ecx
movl %ecx, 0xa4(%rsp)
leaq 0x210(%rsp), %r12
leaq 0x138(%rsp), %r13
leaq 0x80(%rsp), %rbp
leaq 0x10(%rsp), %r14
leaq 0x168(%rsp), %rbx
cmpl 0xa4(%rsp), %eax
je 0x281ea
movl %eax, 0x78(%rsp)
xorl %edx, %edx
movl $0x2710, %ecx           # imm = 0x2710
divl %ecx
testl %edx, %edx
jne 0x28141
movq 0xb4ee2(%rip), %rdi     # 0xdcfe8
leaq 0x6e197(%rip), %rsi     # 0x962a4
callq 0x8480
movq %rax, %rdi
movl 0x78(%rsp), %esi
callq 0x8840
movq %rax, %rdi
leaq 0x6e187(%rip), %rsi     # 0x962af
callq 0x8480
movq %rax, %rdi
movl 0x54(%rsp), %esi
callq 0x8840
movq %rax, %rdi
callq 0x8230
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0xb53a4(%rip), %eax     # 0xdd4f8
cmpl %eax, %r15d
jge 0x281bc
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x28bf2
movl %eax, 0x80(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x28bfa
movq %r14, %rdi
movq %rax, %rsi
callq 0x8600
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b45a
cmpq $0x1, %rax
jne 0x281af
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b49c
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r14, %rdi
callq 0x8978
incl %r15d
jmp 0x2814e
cvtsi2sd %eax, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0xd0(%rsp), %rdi
callq 0x8750
movq %rax, %rdi
callq 0x8230
movl 0x78(%rsp), %eax
incl %eax
jmp 0x280e1
leaq 0x58(%rsp), %rdi
callq 0x8978
movq 0xb4ded(%rip), %rdi     # 0xdcfe8
leaq 0x6dfe5(%rip), %rsi     # 0x961e7
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x1d8(%rsp), %rdi
callq 0x21a8a
leaq 0x168(%rsp), %rdi
callq 0x21a8a
leaq 0x1a0(%rsp), %rdi
callq 0x2b26e
leaq 0xf8(%rsp), %rdi
callq 0x8978
leaq 0xb0(%rsp), %rdi
callq 0x2a7a4
leaq 0x138(%rsp), %rdi
callq 0x2b344
xorl %eax, %eax
addq $0xbd8, %rsp            # imm = 0xBD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x28283
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x8978
jmp 0x28295
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x8978
jmp 0x282a4
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
jmp 0x28480
jmp 0x28487
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x28333
jmp 0x28400
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x282d7
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x8978
jmp 0x282e9
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x8978
jmp 0x282f8
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x8978
jmp 0x2830a
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
jmp 0x28480
jmp 0x28487
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x2832e
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x8978
jmp 0x2846c
jmp 0x28400
movq %rax, %rbx
jmp 0x28458
jmp 0x283a3
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x84a0
jmp 0x2848a
jmp 0x28487
jmp 0x28400
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x84a0
jmp 0x2846c
jmp 0x28405
jmp 0x28405
jmp 0x283d4
jmp 0x28397
jmp 0x28419
jmp 0x28397
jmp 0x28419
movq %rax, %rbx
jmp 0x283e1
jmp 0x28419
jmp 0x28487
movq %rax, %rbx
jmp 0x28462
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
jmp 0x284c3
jmp 0x28405
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
callq 0x84a0
jmp 0x284e2
jmp 0x283d4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x30(%rsp), %rdi
callq 0x8978
jmp 0x2841c
movq %rax, %rbx
jmp 0x28426
movq %rax, %rbx
jmp 0x28433
jmp 0x28446
jmp 0x28487
jmp 0x28446
movq %rax, %rbx
jmp 0x2846c
movq %rax, %rbx
jmp 0x284c8
jmp 0x28446
movq %rax, %rbx
jmp 0x284d5
jmp 0x28446
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x210(%rsp), %rdi
callq 0x8978
leaq 0x80(%rsp), %rdi
callq 0x28a08
jmp 0x28494
jmp 0x28487
jmp 0x28487
movq %rax, %rbx
jmp 0x28494
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x29054
leaq 0x10(%rsp), %rdi
callq 0x28a08
leaq 0x58(%rsp), %rdi
callq 0x2b43c
leaq 0x210(%rsp), %rdi
jmp 0x2848f
jmp 0x28487
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x2848a
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x1d8(%rsp), %rdi
callq 0x21a8a
leaq 0x168(%rsp), %rdi
callq 0x21a8a
leaq 0x1a0(%rsp), %rdi
callq 0x2b26e
leaq 0xf8(%rsp), %rdi
callq 0x8978
leaq 0xb0(%rsp), %rdi
callq 0x2a7a4
leaq 0x138(%rsp), %rdi
callq 0x2b344
movq %rbx, %rdi
callq 0x8870