// File: millanek[P]Dsuite/Dsuite_utils.cpp
// Function: GeneralSetCountsWithSplits::getSplitCountsNew(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::map<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&)
void GeneralSetCountsWithSplits::getSplitCountsNew(const std::vector<std::string>& genotypes, const std::map<size_t, string>& posToSpeciesMap) {
    
    getBasicCountsWithSplitsNew(genotypes, posToSpeciesMap);
    
    // If at least one of the outgroup individuals has non-missing data
    // Find out what is the "ancestral allele" - i.e. the one more common in the outgroup
    try {
        if (setAlleleCounts.at("Outgroup") > 0) {
            if ((double)vector_sum(setGenotypes.at("Outgroup"))/setGenotypes.at("Outgroup").size() < 0.5) { AAint = AncestralAlleleRef; }
            else { AAint = AncestralAlleleAlt; } 
        }
    } catch (std::out_of_range& e) { AAint = -1; }
    
    // Now fill in the allele frequencies
    double totalAAF = 0; int numNonZeroCounts = 0;
    for(std::map<string,std::vector<int>>::iterator it = setGenotypes.begin(); it != setGenotypes.end(); ++it) {
        if (it->first == "") {
            std::cerr << "it->first " << it->first << "\t"; print_vector(it->second, std::cerr); std::cerr << std::endl;
        }
        std::vector<int> thisSetGenotypes = setGenotypes.at(it->first);
        std::vector<double> thisSetIndividualAFs = setIndividualAFs.at(it->first);
        
        if (thisSetGenotypes.size() > 0) {
            numNonZeroCounts++;
            double thisAAF = (double)vector_sum(thisSetGenotypes)/thisSetGenotypes.size();
           // print_vector(thisSetGenotypes, std::cerr);
           // std::cerr << "thisAAF: " << thisAAF << std::endl;
            setAAFs[it->first] = thisAAF; totalAAF += thisAAF;
            
            // Take care of the splits by random sampling with replacement:
            std::random_device rd;     // only used once to initialise (seed) engine
            std::mt19937 rng(rd());    // random-number engine used (Mersenne-Twister in this case)
            std::uniform_int_distribution<int> uni(0,((int)thisSetGenotypes.size() - 1)); // guaranteed unbiased
            std::uniform_int_distribution<int> uniAFs(0,((int)thisSetIndividualAFs.size() - 1)); // guaranteed unbiased
            
         /*   std::vector<int> thisSetGenotypesSampledSplit1; std::vector<int> thisSetGenotypesSampledSplit2;
            for (int i = 0; i < thisSetGenotypes.size(); i++) {
                int random_pos_s1 = uni(rng);
                int random_pos_s2 = uni(rng);
                thisSetGenotypesSampledSplit1.push_back(thisSetGenotypes[random_pos_s1]);
                thisSetGenotypesSampledSplit2.push_back(thisSetGenotypes[random_pos_s2]);
            }
          */
            
            std::vector<double> thisSetIndividualAFsSampledSplit1; std::vector<double> thisSetIndividualAFsSampledSplit2;
            for (int i = 0; i < thisSetIndividualAFs.size(); i++) {
                int random_pos_s1 = uniAFs(rng);
                int random_pos_s2 = uniAFs(rng);
                thisSetIndividualAFsSampledSplit1.push_back(thisSetIndividualAFs[random_pos_s1]);
                thisSetIndividualAFsSampledSplit2.push_back(thisSetIndividualAFs[random_pos_s2]);
            }
            
          //  double thisAAFsplit1 = vector_average(thisSetGenotypesSampledSplit1);
          //  double thisAAFsplit2 = vector_average(thisSetGenotypesSampledSplit2);
            double thisAAFsplit1 = vector_average(thisSetIndividualAFsSampledSplit1);
            double thisAAFsplit2 = vector_average(thisSetIndividualAFsSampledSplit2);
            setAAFsplit1[it->first] = thisAAFsplit1; setAAFsplit2[it->first] = thisAAFsplit2;
            
            // Count correction as in admixtools
         //   double ya = vector_sum(thisSetGenotypes); double yb = thisSetGenotypes.size() - vector_sum(thisSetGenotypes);
         //   double yt = (double)thisSetGenotypes.size();
         //   double h = ya * yb / (yt * (yt - 1.0));
            //std::cerr << "it->first: " << it->first << std::endl;
            //std::cerr << "ya: " << ya << " ; yb: " << yb << " ; yt: " << yt << std::endl;
            //std::cerr << "h: " << h << " ; h / yt: " << h / yt << std::endl;
            
          //  setCorrectionFactors[it->first] = h / yt;
            
           // std::cerr << "it->first " << it->first << std::endl;
            try {
            if (AAint == AncestralAlleleRef) { // Ancestral allele seems to be the ref, so derived is alt
                setDAFs[it->first] = thisAAF;
                setDAFsplit1[it->first] = thisAAFsplit1; setDAFsplit2[it->first] = thisAAFsplit2;
            } else if (AAint == AncestralAlleleAlt) { // Ancestral allele seems to be alt, so derived is ref
                setDAFs[it->first] = (1 - thisAAF);
                setDAFsplit1[it->first] = 1 - thisAAFsplit1;
                setDAFsplit2[it->first] = 1 - thisAAFsplit2;
            }
                } catch (std::out_of_range& e) { std::cerr << "The trouble was here" << it->first << std::endl; }
        }
    }
    averageAAF = totalAAF/numNonZeroCounts;
    if (AAint == AncestralAlleleRef) averageDAF = averageAAF;
    else if (AAint == AncestralAlleleAlt) averageDAF = (1 - averageAAF);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2ac0, %rsp           # imm = 0x2AC0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2908(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xe0c0
movq -0x2908(%rbp), %rax
addq $0xc8, %rax
movq %rax, -0x2900(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x28f8(%rbp)
callq 0x8a60
movq -0x28f8(%rbp), %rdx
leaq 0x7a5a1(%rip), %rsi     # 0x88aa2
leaq -0x38(%rbp), %rdi
callq 0x9a00
jmp 0xe50c
movq -0x2900(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x10360
movq %rax, -0x2910(%rbp)
jmp 0xe525
movq -0x2910(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2914(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8c08
leaq -0x39(%rbp), %rdi
callq 0x8610
movl -0x2914(%rbp), %eax
cmpl $0x0, %eax
jle 0xe90d
movq -0x2908(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2928(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x2920(%rbp)
callq 0x8a60
movq -0x2920(%rbp), %rdx
leaq 0x7a51a(%rip), %rsi     # 0x88aa2
leaq -0x88(%rbp), %rdi
callq 0x9a00
jmp 0xe596
movq -0x2928(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x11850
movq %rax, -0x2930(%rbp)
jmp 0xe5b2
movq -0x2930(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x118f0
jmp 0xe5c4
leaq -0x68(%rbp), %rdi
callq 0x117e0
movsd %xmm0, -0x2938(%rbp)
jmp 0xe5d7
movq -0x2908(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2948(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x2940(%rbp)
callq 0x8a60
movq -0x2940(%rbp), %rdx
leaq 0x7a498(%rip), %rsi     # 0x88aa2
leaq -0xb0(%rbp), %rdi
callq 0x9a00
jmp 0xe618
movq -0x2948(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x11850
movq %rax, -0x2950(%rbp)
jmp 0xe634
movq -0x2950(%rbp), %rdi
callq 0x119e0
movsd -0x2938(%rbp), %xmm0
movq %rax, %xmm1
movaps 0x79e2c(%rip), %xmm2    # 0x88480
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x79e30(%rip), %xmm2    # 0x88490
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x2958(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x8c08
leaq -0xb1(%rbp), %rdi
callq 0x8610
leaq -0x68(%rbp), %rdi
callq 0x11a00
leaq -0x88(%rbp), %rdi
callq 0x8c08
leaq -0x89(%rbp), %rdi
callq 0x8610
movsd -0x2958(%rbp), %xmm1
movsd 0x79dec(%rip), %xmm0    # 0x884b0
ucomisd %xmm1, %xmm0
jbe 0xe8fd
movq -0x2908(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0xe90b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe704
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8c08
leaq -0x39(%rbp), %rdi
callq 0x8610
jmp 0xe78c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe780
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe76b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe75f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x8c08
leaq -0xb1(%rbp), %rdi
callq 0x8610
leaq -0x68(%rbp), %rdi
callq 0x11a00
leaq -0x88(%rbp), %rdi
callq 0x8c08
leaq -0x89(%rbp), %rdi
callq 0x8610
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xf258
movq -0x48(%rbp), %rdi
callq 0x8220
movq %rax, %rcx
movq -0x2908(%rbp), %rax
movq %rcx, -0xc0(%rbp)
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
callq 0x8950
movq -0x2908(%rbp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
addq $0x8, %rdi
callq 0x11a60
movq %rax, -0xd8(%rbp)
movq -0x2908(%rbp), %rdi
addq $0x8, %rdi
callq 0x11ac0
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x11a90
testb $0x1, %al
jne 0xe821
jmp 0xf1df
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq %rax, %rdi
leaq 0x7cb32(%rip), %rsi     # 0x8b369
callq 0x9ab0
testb $0x1, %al
jne 0xe845
jmp 0xe92f
movq 0xb07a4(%rip), %rdi     # 0xbeff0
movq %rdi, -0x2960(%rbp)
leaq 0x79e58(%rip), %rsi     # 0x886b2
callq 0x8590
movq %rax, -0x2978(%rbp)
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x2970(%rbp)
callq 0x11af0
movq -0x2978(%rbp), %rdi
movq %rax, %rsi
callq 0x8520
movq %rax, %rdi
leaq 0x7cad6(%rip), %rsi     # 0x8b368
callq 0x8590
movq -0x2970(%rbp), %rdi
callq 0x11af0
movq %rax, %rsi
addq $0x20, %rsi
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x2968(%rbp)
callq 0x118f0
movq -0x2968(%rbp), %rdi
movq -0x2960(%rbp), %rsi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x11b10
jmp 0xe8dc
leaq -0xf8(%rbp), %rdi
callq 0x11a00
movq 0xb0701(%rip), %rdi     # 0xbeff0
movq 0xb066a(%rip), %rsi     # 0xbef60
callq 0x85f0
jmp 0xe92f
movq -0x2908(%rbp), %rax
movl $0x1, 0x4(%rax)
jmp 0xe90d
jmp 0xe7c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x11a00
jmp 0xf258
movq -0x2908(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2998(%rbp)
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x2990(%rbp)
callq 0x11af0
movq -0x2998(%rbp), %rdi
movq %rax, %rsi
callq 0x11850
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x118f0
movq -0x2908(%rbp), %rax
movq -0x2990(%rbp), %rdi
addq $0x38, %rax
movq %rax, -0x2988(%rbp)
callq 0x11af0
movq -0x2988(%rbp), %rdi
movq %rax, %rsi
callq 0x11c20
movq %rax, -0x2980(%rbp)
jmp 0xe9a8
movq -0x2980(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x110a0
jmp 0xe9bd
leaq -0x110(%rbp), %rdi
callq 0x119e0
cmpq $0x0, %rax
jbe 0xf19c
movl -0xcc(%rbp), %eax
incl %eax
movl %eax, -0xcc(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x118f0
jmp 0xe9f6
leaq -0x148(%rbp), %rdi
callq 0x117e0
movsd %xmm0, -0x29a0(%rbp)
jmp 0xea0c
leaq -0x110(%rbp), %rdi
callq 0x119e0
movsd -0x29a0(%rbp), %xmm0
movq %rax, %xmm1
movaps 0x79a54(%rip), %xmm2    # 0x88480
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x79a58(%rip), %xmm2    # 0x88490
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x29c0(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x11a00
movsd -0x29c0(%rbp), %xmm0
movq -0x2908(%rbp), %rax
movsd %xmm0, -0x130(%rbp)
movsd -0x130(%rbp), %xmm0
movsd %xmm0, -0x29b8(%rbp)
addq $0x1e8, %rax            # imm = 0x1E8
movq %rax, -0x29b0(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x29b0(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x29a8(%rbp)
jmp 0xeab7
movq -0x29a8(%rbp), %rax
movsd -0x29b8(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x130(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
leaq -0x14d0(%rbp), %rdi
callq 0x111c0
jmp 0xeaf4
leaq -0x14d0(%rbp), %rdi
callq 0x11260
movl %eax, -0x29c4(%rbp)
jmp 0xeb08
movl -0x29c4(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x2858(%rbp), %rdi
callq 0x11280
jmp 0xeb20
leaq -0x110(%rbp), %rdi
callq 0x119e0
movl %eax, %edx
decl %edx
leaq -0x2860(%rbp), %rdi
xorl %esi, %esi
callq 0x112b0
jmp 0xeb40
leaq -0x128(%rbp), %rdi
callq 0x10e50
movl %eax, %edx
decl %edx
leaq -0x2868(%rbp), %rdi
xorl %esi, %esi
callq 0x112b0
jmp 0xeb60
leaq -0x2880(%rbp), %rdi
callq 0x10800
leaq -0x2898(%rbp), %rdi
callq 0x10800
movl $0x0, -0x289c(%rbp)
movslq -0x289c(%rbp), %rax
movq %rax, -0x29d0(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x10e50
movq %rax, %rcx
movq -0x29d0(%rbp), %rax
cmpq %rcx, %rax
jae 0xecbc
leaq -0x2868(%rbp), %rdi
leaq -0x2858(%rbp), %rsi
callq 0x112e0
movl %eax, -0x29d4(%rbp)
jmp 0xebca
movl -0x29d4(%rbp), %eax
movl %eax, -0x28a0(%rbp)
leaq -0x2868(%rbp), %rdi
leaq -0x2858(%rbp), %rsi
callq 0x112e0
movl %eax, -0x29d8(%rbp)
jmp 0xebf1
movl -0x29d8(%rbp), %eax
movl %eax, -0x28a4(%rbp)
movslq -0x28a0(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x107e0
movq %rax, %rsi
leaq -0x2880(%rbp), %rdi
callq 0x10f70
jmp 0xec21
movslq -0x28a4(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x107e0
movq %rax, %rsi
leaq -0x2898(%rbp), %rdi
callq 0x10f70
jmp 0xec45
jmp 0xec47
movl -0x289c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x289c(%rbp)
jmp 0xeb82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf1d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x11a00
jmp 0xf1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf18e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf176
leaq -0x28c8(%rbp), %rdi
leaq -0x2880(%rbp), %rsi
callq 0x110a0
jmp 0xecd1
leaq -0x28c8(%rbp), %rdi
callq 0x10fe0
movsd %xmm0, -0x29e0(%rbp)
jmp 0xece7
leaq -0x28c8(%rbp), %rdi
callq 0x10930
movsd -0x29e0(%rbp), %xmm0
movsd %xmm0, -0x28b0(%rbp)
leaq -0x28e8(%rbp), %rdi
leaq -0x2898(%rbp), %rsi
callq 0x110a0
jmp 0xed18
leaq -0x28e8(%rbp), %rdi
callq 0x10fe0
movsd %xmm0, -0x29e8(%rbp)
jmp 0xed2e
leaq -0x28e8(%rbp), %rdi
callq 0x10930
movsd -0x29e8(%rbp), %xmm0
movq -0x2908(%rbp), %rax
movsd %xmm0, -0x28d0(%rbp)
movsd -0x28b0(%rbp), %xmm0
movsd %xmm0, -0x2a00(%rbp)
addq $0x3a8, %rax            # imm = 0x3A8
movq %rax, -0x29f8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x29f8(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x29f0(%rbp)
jmp 0xed92
movq -0x2908(%rbp), %rax
movq -0x29f0(%rbp), %rcx
movsd -0x2a00(%rbp), %xmm0
movsd %xmm0, (%rcx)
movsd -0x28d0(%rbp), %xmm0
movsd %xmm0, -0x2a18(%rbp)
addq $0x3d8, %rax            # imm = 0x3D8
movq %rax, -0x2a10(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a10(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a08(%rbp)
jmp 0xeded
movq -0x2908(%rbp), %rax
movq -0x2a08(%rbp), %rcx
movsd -0x2a18(%rbp), %xmm0
movsd %xmm0, (%rcx)
cmpl $0x0, 0x4(%rax)
jne 0xf014
movq -0x2908(%rbp), %rax
movsd -0x130(%rbp), %xmm0
movsd %xmm0, -0x2a30(%rbp)
addq $0x220, %rax            # imm = 0x220
movq %rax, -0x2a28(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a28(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a20(%rbp)
jmp 0xee59
movq -0x2908(%rbp), %rax
movq -0x2a20(%rbp), %rcx
movsd -0x2a30(%rbp), %xmm0
movsd %xmm0, (%rcx)
movsd -0x28b0(%rbp), %xmm0
movsd %xmm0, -0x2a48(%rbp)
addq $0x408, %rax            # imm = 0x408
movq %rax, -0x2a40(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a40(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a38(%rbp)
jmp 0xeeb4
movq -0x2908(%rbp), %rax
movq -0x2a38(%rbp), %rcx
movsd -0x2a48(%rbp), %xmm0
movsd %xmm0, (%rcx)
movsd -0x28d0(%rbp), %xmm0
movsd %xmm0, -0x2a60(%rbp)
addq $0x438, %rax            # imm = 0x438
movq %rax, -0x2a58(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a58(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a50(%rbp)
jmp 0xef0f
movq -0x2a50(%rbp), %rax
movsd -0x2a60(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0xf15c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x28c8(%rbp), %rdi
callq 0x10930
jmp 0xf176
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x28e8(%rbp), %rdi
callq 0x10930
jmp 0xf176
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xf176
movq -0x48(%rbp), %rdi
callq 0x8220
movq %rax, -0x28f0(%rbp)
movq 0xb005c(%rip), %rdi     # 0xbeff0
leaq 0x79722(%rip), %rsi     # 0x886bd
callq 0x8590
movq %rax, -0x2a68(%rbp)
jmp 0xefa9
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a68(%rbp), %rdi
movq %rax, %rsi
callq 0x8520
movq %rax, -0x2a70(%rbp)
jmp 0xefcd
movq -0x2a70(%rbp), %rdi
movq 0xaff85(%rip), %rsi     # 0xbef60
callq 0x85f0
jmp 0xefe2
callq 0x8950
jmp 0xefe9
jmp 0xefeb
leaq -0x2898(%rbp), %rdi
callq 0x10930
leaq -0x2880(%rbp), %rdi
callq 0x10930
leaq -0x14d0(%rbp), %rdi
callq 0x11310
jmp 0xf19c
movq -0x2908(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jne 0xf15a
movq -0x2908(%rbp), %rax
movsd -0x130(%rbp), %xmm1
movsd 0x7946c(%rip), %xmm0    # 0x884a8
subsd %xmm1, %xmm0
movsd %xmm0, -0x2a88(%rbp)
addq $0x220, %rax            # imm = 0x220
movq %rax, -0x2a80(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a80(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a78(%rbp)
jmp 0xf079
movq -0x2908(%rbp), %rax
movq -0x2a78(%rbp), %rcx
movsd -0x2a88(%rbp), %xmm0
movsd %xmm0, (%rcx)
movsd -0x28b0(%rbp), %xmm1
movsd 0x79405(%rip), %xmm0    # 0x884a8
subsd %xmm1, %xmm0
movsd %xmm0, -0x2aa0(%rbp)
addq $0x408, %rax            # imm = 0x408
movq %rax, -0x2a98(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2a98(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2a90(%rbp)
jmp 0xf0e0
movq -0x2908(%rbp), %rax
movq -0x2a90(%rbp), %rcx
movsd -0x2aa0(%rbp), %xmm0
movsd %xmm0, (%rcx)
movsd -0x28d0(%rbp), %xmm1
movsd 0x7939e(%rip), %xmm0    # 0x884a8
subsd %xmm1, %xmm0
movsd %xmm0, -0x2ab8(%rbp)
addq $0x438, %rax            # imm = 0x438
movq %rax, -0x2ab0(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x11af0
movq -0x2ab0(%rbp), %rdi
movq %rax, %rsi
callq 0x104b0
movq %rax, -0x2aa8(%rbp)
jmp 0xf147
movq -0x2aa8(%rbp), %rax
movsd -0x2ab8(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0xf15c
jmp 0xefeb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x8950
jmp 0xf174
jmp 0xf176
leaq -0x2898(%rbp), %rdi
callq 0x10930
leaq -0x2880(%rbp), %rdi
callq 0x10930
leaq -0x14d0(%rbp), %rdi
callq 0x11310
jmp 0xf1c5
leaq -0x128(%rbp), %rdi
callq 0x10930
leaq -0x110(%rbp), %rdi
callq 0x11a00
leaq -0xd8(%rbp), %rdi
callq 0x11cc0
jmp 0xe7ee
leaq -0x128(%rbp), %rdi
callq 0x10930
leaq -0x110(%rbp), %rdi
callq 0x11a00
jmp 0xf258
movq -0x2908(%rbp), %rax
movsd -0xc8(%rbp), %xmm0
cvtsi2sdl -0xcc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x218(%rax)
cmpl $0x0, 0x4(%rax)
jne 0xf221
movq -0x2908(%rbp), %rax
movsd 0x218(%rax), %xmm0
movsd %xmm0, 0x250(%rax)
jmp 0xf24f
movq -0x2908(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jne 0xf24d
movq -0x2908(%rbp), %rax
movsd 0x7926b(%rip), %xmm0    # 0x884a8
subsd 0x218(%rax), %xmm0
movsd %xmm0, 0x250(%rax)
jmp 0xf24f
addq $0x2ac0, %rsp           # imm = 0x2AC0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x8a50
movq %rax, %rdi
callq 0x9d40
nopl (%rax)