// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/process_vcf_coding_sequences.cpp
// Function: getStatsIUPAC(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::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, 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>>>>&, std::basic_ofstream<char, std::char_traits<char>>*&, 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&)
void getStatsIUPAC(const std::vector<std::string>& allSeqs, const std::string& refSeq, const string& transcriptName, std::vector<string>& statsThisGene, std::ofstream*& prematureStopCodonFile, const std::vector<string>& sampleNames) {
    int numSegSites = 0;
    int numNonSynAAchanges = 0;  // NUmber of non-synonymous amino-acid changes
    int numSynAAchanges = 0;  // NUmber of non-synonymous amino-acid changes
    double expectedNumNonSynAAchanges = 0;
    double expectedNumSynAAchanges = 0;
    std::vector<double> derivedAlleleFequencies;
    std::vector<double> synonymousMinorAlleleFequencies;
    std::vector<double> nonsynonymousMinorAlleleFequencies;
    int numCopies = (int)allSeqs.size()*2;
    // int numSynonymous = 0;
    // int numNonSynonymous = 0;
    // bool nonsenseMutation = false;
    if (allSeqs[0].length() != refSeq.length()) {
        std::cerr << "Error!!! allSeqs[0].length() != refSeq.length()" << std::endl;
    }
    std::vector<string> altCodons; altCodons.resize(allSeqs.size());
    std::vector<int> IUPACcounts; IUPACcounts.resize(allSeqs.size());
    for (std::vector<string>::size_type i = 0; i != altCodons.size(); i++) {
        altCodons[i] = "";
        IUPACcounts[i] = 0;
    }
    
    
    // std::cerr << "Collecting gene sequence statistics...." << std::endl;
    for (string::size_type i = 0; i != refSeq.length(); i++) {
        char refBase = refSeq[i];
        char altBase;
        int countDerived = 0;
        
        for (std::vector<std::string>::size_type j = 0; j != allSeqs.size(); j++) {
            if (allSeqs[j][i] != refBase) {
                //if (i == 2)
                //    std::cerr << sampleNames[j] << " " << allSeqs[j][i] << std::endl;
                if (isDNAonly(allSeqs[j][i])) {
                    countDerived = countDerived + 2;
                    altBase = allSeqs[j][i];
                } else {
                    countDerived++;
                    IUPACcounts[j]++;
                    altBase = disambiguateIUPAC(refBase, allSeqs[j][i]);
                }
                altCodons[j] += altBase;
            } else {
                altCodons[j] += refBase;
            }
        }
        // Find the types of mutation we are dealing with
        string refAA;
        string altAA;
        if ((i+1)%3 == 0) {
            //if (i == 2)
            //  std::cerr << "Got here; refseq length: " << refSeq.length() << " i-2:" << i-2 << std::endl;
            refAA = getAminoAcid(refSeq.substr(i-2,3));
            expectedNumNonSynAAchanges = expectedNumNonSynAAchanges + getExpectedNumberOfNonsynonymousSites(refSeq.substr(i-2,3));
            expectedNumSynAAchanges = expectedNumSynAAchanges + (3 - getExpectedNumberOfNonsynonymousSites(refSeq.substr(i-2,3)));
            //if (i == 2)
            //  std::cerr << "And here" << std::endl;
            string altAA = "";
            //if (i == 2)
            //    std::cerr << "Now going to loop through codons" << std::endl;
            int nonSyn = 0;
            int nonSynV2 = 0;
            int syn = 0;
            int numStops = 0;
            std::vector<string> haveStop;
            for (std::vector<string>::size_type j = 0; j != altCodons.size(); j++) {
                if (IUPACcounts[j] > 1) // Multiple hets in a codon under IUPAC sequence encoding
                    continue;
                altAA = getAminoAcid(altCodons[j]);
                if (altAA != refAA && altAA == "Stop") {
                    // We have a premature stop codon
                    if (isDNAonlySeq(allSeqs[j].substr(i-2,3))) {
                        haveStop.push_back(sampleNames[j]+"(hom)");
                        numStops = numStops + 2;
                    } else {
                        haveStop.push_back(sampleNames[j]+"(het)");
                        numStops++;
                    }
                } else {
                    int thisIndDistance = getCodonDistance(refSeq.substr(i-2,3),altCodons[j]);
                    if (thisIndDistance == 1) {
                        if (altAA != refAA) {
                            nonSyn++;
                            // std::cerr << "altCodons[i]: " << altCodons[j] << "refSeq.substr(i-2,3) " << refSeq.substr(i-2,3) << std::endl;
                            // std::cerr << "allSeqs[0].substr(i-2,3): " << allSeqs[j].substr(i-2,3) << std::endl;
                        }
                        if (s_mapCodonPairToSynonymous.count(refSeq.substr(i-2,3)+altCodons[j]) == 0) {
                            nonSynV2++;
                        }
                        assert(nonSyn == nonSynV2);
                        if (altAA == refAA) {
                            syn++;
                        }
                    } else {
                        // findCodonPaths(refSeq.substr(i-2,3),altCodons[j]);
                    }
                }
                altCodons[j] = ""; IUPACcounts[j] = 0;
            }
            if (numStops > 0) {
                std::string stopTranscriptDetails; stopTranscriptDetails.reserve(500);
                stopTranscriptDetails = transcriptName + "\t" + numToString((i+1)/3) + "\t" + numToString(refSeq.length()/3) + "\t" + numToString((double)numStops/(sampleNames.size()*2)) + "\t";
                for (std::vector<string>::size_type i = 0; i != haveStop.size(); i++) {
                    stopTranscriptDetails.append(haveStop[i]);
                    if (i != (haveStop.size()-1))
                        stopTranscriptDetails.append(",");
                }
                *prematureStopCodonFile << stopTranscriptDetails << std::endl;
                //print_vector(haveStop, *prematureStopCodonFile, ',');
                stopsTranscriptRecord.push_back(stopTranscriptDetails);
            }
            double NRaf;
            if (nonSyn > 0) {
                numNonSynAAchanges++;
                // std::cerr << "nonSyn: " << nonSyn << std::endl;
                NRaf = (double)nonSyn/numCopies;
                // std::cerr << "NRaf: " << NRaf << std::endl;
                if (NRaf > 0.5) {
                    nonsynonymousMinorAlleleFequencies.push_back(1-NRaf);
                } else {
                    nonsynonymousMinorAlleleFequencies.push_back(NRaf);
                }
            }
            if (syn > 0) {
                numSynAAchanges++;
                NRaf = (double)syn/numCopies;
                if (NRaf > 0.5) {
                    synonymousMinorAlleleFequencies.push_back(1-NRaf);
                } else {
                    synonymousMinorAlleleFequencies.push_back(NRaf);
                }
            }
        }
          
        if (countDerived > 0) {
            numSegSites++;
            double daf = (double)countDerived/numCopies;
            derivedAlleleFequencies.push_back(daf);
        }
        // if (i%10==0) {
        // std::cerr << "Processed " << i << "bp" << std::endl;
        // }
    }
     
    statsThisGene.push_back(numToString(refSeq.length()));
    statsThisGene.push_back(numToString(numSegSites));
    statsThisGene.push_back(numToString((double)numSegSites/refSeq.length()));
    statsThisGene.push_back(numToString(refSeq.length()/3));
    statsThisGene.push_back(numToString(numSynAAchanges));
    statsThisGene.push_back(numToString((double)numSynAAchanges/(refSeq.length()/3)));
    statsThisGene.push_back(numToString(numNonSynAAchanges));
    statsThisGene.push_back(numToString((double)numNonSynAAchanges/(refSeq.length()/3)));
    statsThisGene.push_back(numToString(vector_average(synonymousMinorAlleleFequencies)));
    statsThisGene.push_back(numToString(vector_average(nonsynonymousMinorAlleleFequencies)));
    
    // std::map<int,int> dafTable = tabulateVectorTemplate(derivedAlleleFequencies);
    // std::cerr << "Stats Done" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %r9, 0x98(%rsp)
movq %r8, 0x140(%rsp)
movq %rcx, 0x138(%rsp)
movq %rdx, 0x148(%rsp)
movq %rsi, %rbx
movq %rdi, %r13
xorpd %xmm0, %xmm0
andq $0x0, 0x190(%rsp)
movapd %xmm0, 0x180(%rsp)
andq $0x0, 0x110(%rsp)
movapd %xmm0, 0x100(%rsp)
andq $0x0, 0xf0(%rsp)
movapd %xmm0, 0xe0(%rsp)
movq (%rdi), %rax
movq 0x8(%rdi), %r14
subq %rax, %r14
movq 0x8(%rax), %rax
movq %r14, %rsi
cmpq 0x8(%rbx), %rax
je 0x59545
movq 0x83abf(%rip), %rdi     # 0xdcfe8
leaq 0x4b3e2(%rip), %rsi     # 0xa4912
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%r13), %rsi
subq (%r13), %rsi
leaq 0x70(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
sarq $0x5, %rsi
callq 0x34872
movq %rbx, 0x28(%rsp)
xorpd %xmm0, %xmm0
leaq 0xc0(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x8(%r13), %rsi
subq (%r13), %rsi
sarq $0x5, %rsi
callq 0x43aec
shrq $0x4, %r14
andl $-0x2, %r14d
xorl %r15d, %r15d
leaq 0x40882(%rip), %rbx     # 0x99e1f
xorl %r12d, %r12d
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rax, %r12
je 0x595d7
addq %r15, %rdi
movq %rbx, %rsi
callq 0x88f0
movq 0xc0(%rsp), %rax
andl $0x0, (%rax,%r12,4)
incq %r12
addq $0x20, %r15
jmp 0x595a0
cvtsi2sd %r14d, %xmm0
movsd %xmm0, 0x90(%rsp)
pushq $0x3
popq %rbp
movl $0x0, 0x3c(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x40(%rsp)
movl $0x0, 0x44(%rsp)
movq 0x28(%rsp), %r12
cmpq 0x8(%r12), %r15
je 0x59e2e
movq (%r12), %rax
movb (%rax,%r15), %bl
xorl %r14d, %r14d
movl $0x0, 0x38(%rsp)
xorl %r12d, %r12d
movq (%r13), %rax
movq 0x8(%r13), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %r12
je 0x596ae
movq (%rax,%r14), %rcx
movb (%rcx,%r15), %al
movsbl %bl, %esi
cmpb %bl, %al
jne 0x5965b
movq 0x70(%rsp), %rdi
addq %r14, %rdi
callq 0x8400
jmp 0x59685
movzbl %al, %edx
addl $-0x41, %edx
cmpl $0x13, %edx
ja 0x5968e
movl $0x80045, %edi          # imm = 0x80045
btl %edx, %edi
jae 0x5968e
addl $0x2, 0x38(%rsp)
movq 0x70(%rsp), %rdi
addq %r14, %rdi
movsbl %al, %esi
callq 0x8400
incq %r12
addq $0x20, %r14
jmp 0x59629
incl 0x38(%rsp)
movq 0xc0(%rsp), %rax
incl (%rax,%r12,4)
movsbl (%rcx,%r15), %eax
movl %esi, %edi
movl %eax, %esi
callq 0x5b666
jmp 0x59675
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movb %cl, 0x18(%rsp)
leaq 0x1a8(%rsp), %rax
movq %rax, 0x198(%rsp)
andq $0x0, 0x1a0(%rsp)
movb %cl, 0x1a8(%rsp)
leaq 0x1(%r15), %rbx
movq %rbx, %rax
xorl %edx, %edx
divq %rbp
testq %rdx, %rdx
je 0x59702
leaq 0x118(%rsp), %r12
jmp 0x59dd8
movq %rax, 0x150(%rsp)
addq $-0x2, %r15
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x84b0
leaq 0x118(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x5a79e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x8550
movq %r12, %rdi
callq 0x8978
movq %r14, %rdi
callq 0x8978
movq %r12, %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x84b0
movq %r12, %rdi
callq 0x5b6e1
movq %r12, %rdi
callq 0x8978
movq %r12, %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x84b0
movq %r12, %rdi
callq 0x5b6e1
movq %rbx, 0xb8(%rsp)
movq %r12, %rdi
callq 0x8978
movq %r12, %rdi
leaq 0x40671(%rip), %rsi     # 0x99e1f
movq %r14, %rdx
callq 0x21904
andq $0x0, 0xb0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
xorl %ebx, %ebx
movl $0x0, 0x34(%rsp)
movl $0x0, 0x4c(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x0, 0x30(%rsp)
xorl %ebp, %ebp
movq %r15, 0x158(%rsp)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %rbp
je 0x59a5f
movq 0xc0(%rsp), %rax
cmpl $0x1, (%rax,%rbp,4)
jg 0x59a53
addq %rbx, %rsi
movq %r14, %rdi
callq 0x5a79e
movq %r12, %rdi
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x311fd
testb %al, %al
je 0x598e8
movq %r12, %rdi
leaq 0x4af6d(%rip), %rsi     # 0xa47ce
callq 0x2193f
testb %al, %al
je 0x598e8
movq (%r13), %rsi
addq %rbx, %rsi
movq %r14, %rdi
movq %r15, %rdx
pushq $0x3
popq %rcx
callq 0x84b0
movq %r14, %rdi
callq 0x5b702
movq %r14, %r12
movl %eax, %r14d
movq %r12, %rdi
callq 0x8978
testb %r14b, %r14b
je 0x599ef
movq 0x98(%rsp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq %r12, %rdi
leaq 0x4b08c(%rip), %rdx     # 0xa4942
callq 0x28806
movq %r12, %r14
leaq 0xa0(%rsp), %rdi
movq %r12, %rsi
callq 0x3490e
leaq 0x118(%rsp), %r12
movq %r14, %rdi
callq 0x8978
addl $0x2, 0x30(%rsp)
jmp 0x59a33
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rdx
pushq $0x3
popq %rcx
callq 0x84b0
movq 0x70(%rsp), %rsi
addq %rbx, %rsi
movq %r14, %rdi
callq 0x5b732
movq %r14, %rdi
movl %eax, %r14d
callq 0x8978
cmpl $0x1, %r14d
jne 0x599e8
movq %r15, %r14
movq %r13, %r15
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x311fd
movl %eax, %r12d
leaq 0x160(%rsp), %r13
movq %r13, %rdi
movq 0x28(%rsp), %rsi
movq %r14, %rdx
pushq $0x3
popq %rcx
callq 0x84b0
movq 0x70(%rsp), %rdx
addq %rbx, %rdx
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x287e7
leaq 0x84bf0(%rip), %rdi     # 0xde560
movq %r14, %rsi
callq 0x31340
movq %r14, %rdi
movq %rax, %r14
movq %r15, %r13
movzbl %r12b, %eax
movl 0x34(%rsp), %r15d
addl %eax, %r15d
callq 0x8978
leaq 0x160(%rsp), %rdi
callq 0x8978
cmpq $0x1, %r14
movl 0x4c(%rsp), %eax
adcl $0x0, %eax
cmpl %eax, %r15d
jne 0x5a0b1
leaq 0x118(%rsp), %r12
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x26b06
movzbl %al, %eax
addl %eax, 0x48(%rsp)
movl %r15d, 0x34(%rsp)
movl %r15d, 0x4c(%rsp)
leaq 0x50(%rsp), %r14
movq 0x158(%rsp), %r15
jmp 0x59a33
leaq 0x50(%rsp), %r14
jmp 0x59a33
movq 0x98(%rsp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq %r12, %rdi
leaq 0x4af41(%rip), %rdx     # 0xa4948
callq 0x28806
movq %r12, %r14
leaq 0xa0(%rsp), %rdi
movq %r12, %rsi
callq 0x3490e
leaq 0x118(%rsp), %r12
movq %r14, %rdi
callq 0x8978
incl 0x30(%rsp)
movq 0x70(%rsp), %rdi
addq %rbx, %rdi
leaq 0x403dd(%rip), %rsi     # 0x99e1f
callq 0x88f0
movq 0xc0(%rsp), %rax
andl $0x0, (%rax,%rbp,4)
incq %rbp
addq $0x20, %rbx
jmp 0x597f8
cmpl $0x0, 0x30(%rsp)
pushq $0x3
popq %rbp
movq 0xb8(%rsp), %rbx
jle 0x59cf9
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
movl $0x1f4, %esi            # imm = 0x1F4
movq %r14, %rdi
callq 0x8700
leaq 0x1e8(%rsp), %rdi
movq 0x148(%rsp), %rsi
leaq 0x40370(%rip), %rdx     # 0x99e1e
callq 0x28806
leaq 0x288(%rsp), %rbx
movq %rbx, %rdi
movq 0x150(%rsp), %rsi
callq 0x554cb
leaq 0x2a8(%rsp), %r15
movq %r15, %rdi
leaq 0x1e8(%rsp), %rsi
movq %rbx, %rdx
callq 0x28a48
leaq 0x208(%rsp), %rdi
movq %r15, %rsi
leaq 0x40326(%rip), %rdx     # 0x99e1e
callq 0x28a29
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
xorl %edx, %edx
divq %rbp
leaq 0x268(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x554cb
leaq 0x2c8(%rsp), %r15
movq %r15, %rdi
leaq 0x208(%rsp), %rsi
movq %rbx, %rdx
callq 0x28a48
leaq 0x228(%rsp), %rdi
movq %r15, %rsi
leaq 0x402d3(%rip), %rdx     # 0x99e1e
callq 0x28a29
cvtsi2sdl 0x30(%rsp), %xmm0
movq 0x98(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x4, %rax
movq %rax, %xmm1
punpckldq 0x386ca(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x386d2(%rip), %xmm1    # 0x92250
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
leaq 0x248(%rsp), %rbx
movq %rbx, %rdi
callq 0x37bd4
leaq 0x2e8(%rsp), %r15
movq %r15, %rdi
leaq 0x228(%rsp), %rsi
movq %rbx, %rdx
callq 0x28a48
leaq 0x160(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x40250(%rip), %rdx     # 0x99e1e
callq 0x28a29
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8550
movq %rbx, %rdi
callq 0x8978
movq %r15, %rdi
callq 0x8978
leaq 0x248(%rsp), %rdi
callq 0x8978
leaq 0x228(%rsp), %rdi
callq 0x8978
leaq 0x2c8(%rsp), %rdi
callq 0x8978
leaq 0x268(%rsp), %rdi
callq 0x8978
leaq 0x208(%rsp), %rdi
callq 0x8978
leaq 0x2a8(%rsp), %rdi
callq 0x8978
leaq 0x288(%rsp), %rdi
callq 0x8978
leaq 0x1e8(%rsp), %rdi
callq 0x8978
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r14
je 0x59cba
addq %rbx, %rsi
leaq 0x50(%rsp), %rdi
callq 0x8920
movq 0xa8(%rsp), %rax
subq 0xa0(%rsp), %rax
sarq $0x5, %rax
decq %rax
cmpq %rax, %r14
je 0x59cb1
leaq 0x50(%rsp), %rdi
leaq 0x4ad55(%rip), %rsi     # 0xa4a01
callq 0x88e0
incq %r14
addq $0x20, %rbx
jmp 0x59c5b
movq 0x140(%rsp), %rax
movq (%rax), %rdi
leaq 0x50(%rsp), %r14
movq %r14, %rsi
callq 0x8430
movq 0xb8(%rsp), %rbx
movq %rax, %rdi
callq 0x8230
leaq 0x848af(%rip), %rdi     # 0xde598
movq %r14, %rsi
callq 0x2b0a4
movq %r14, %rdi
callq 0x8978
movl 0x34(%rsp), %eax
testl %eax, %eax
jle 0x59d5e
incl 0x40(%rsp)
cvtsi2sd %eax, %xmm0
divsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
ucomisd 0x3d8e0(%rip), %xmm0    # 0x97600
jbe 0x59d4e
movsd 0x3d8c6(%rip), %xmm1    # 0x975f0
subsd %xmm0, %xmm1
movsd %xmm1, 0x160(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x2af10
jmp 0x59d5e
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x5a406
movl 0x48(%rsp), %eax
testl %eax, %eax
jle 0x59dc3
incl 0x3c(%rsp)
cvtsi2sd %eax, %xmm0
divsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
ucomisd 0x3d87b(%rip), %xmm0    # 0x97600
jbe 0x59db3
movsd 0x3d861(%rip), %xmm1    # 0x975f0
subsd %xmm0, %xmm1
movsd %xmm1, 0x160(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x2af10
jmp 0x59dc3
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0x5a406
leaq 0xa0(%rsp), %rdi
callq 0x28a08
movq %r12, %rdi
callq 0x8978
movl 0x38(%rsp), %eax
testl %eax, %eax
jle 0x59e0a
cvtsi2sd %eax, %xmm0
divsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x118(%rsp)
leaq 0x180(%rsp), %rdi
movq %r12, %rsi
callq 0x5a406
incl 0x44(%rsp)
movq 0x28(%rsp), %r12
leaq 0x198(%rsp), %rdi
callq 0x8978
leaq 0x8(%rsp), %rdi
callq 0x8978
movq %rbx, %r15
jmp 0x59608
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x554cb
leaq 0x8(%rsp), %rsi
movq 0x138(%rsp), %rbx
movq %rbx, %rdi
callq 0x3490e
movl 0x40(%rsp), %r14d
movl 0x3c(%rsp), %r15d
movl 0x44(%rsp), %r13d
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0x28ad3
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
cvtsi2sd %r13d, %xmm0
movsd 0x8(%r12), %xmm1
unpcklps 0x383a0(%rip), %xmm1    # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x383a8(%rip), %xmm1    # 0x92250
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
leaq 0x8(%rsp), %rdi
callq 0x37bd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
movq 0x8(%r12), %rax
xorl %edx, %edx
divq %rbp
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x554cb
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x8(%rsp), %rdi
movl %r15d, %esi
callq 0x28ad3
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
cvtsi2sd %r15d, %xmm0
movq 0x8(%r12), %rax
xorl %edx, %edx
divq %rbp
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
leaq 0x8(%rsp), %rdi
callq 0x37bd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x28ad3
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
cvtsi2sd %r14d, %xmm0
movq 0x8(%r12), %rax
xorl %edx, %edx
divq %rbp
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
leaq 0x8(%rsp), %rdi
callq 0x37bd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x1d0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x2f816
leaq 0x1d0(%rsp), %rdi
callq 0x2f7e9
leaq 0x8(%rsp), %rdi
callq 0x37bd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x1d0(%rsp), %rdi
callq 0x2b43c
leaq 0x1b8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x2f816
leaq 0x1b8(%rsp), %rdi
callq 0x2f7e9
leaq 0x8(%rsp), %rdi
callq 0x37bd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3490e
leaq 0x8(%rsp), %rdi
callq 0x8978
leaq 0x1b8(%rsp), %rdi
callq 0x2b43c
leaq 0xc0(%rsp), %rdi
callq 0x2aef2
leaq 0x70(%rsp), %rdi
callq 0x28a08
leaq 0xe0(%rsp), %rdi
callq 0x2b43c
leaq 0x100(%rsp), %rdi
callq 0x2b43c
leaq 0x180(%rsp), %rdi
callq 0x2b43c
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a896(%rip), %rdi     # 0xa494e
leaq 0x4a50f(%rip), %rsi     # 0xa45ce
leaq 0x4a89b(%rip), %rcx     # 0xa4961
movl $0x2d4, %edx            # imm = 0x2D4
callq 0x82f0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8978
jmp 0x5a0e2
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
jmp 0x5a10b
jmp 0x5a2b6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8978
jmp 0x5a103
movq %rax, %rbx
leaq 0x1d0(%rsp), %rdi
callq 0x2b43c
jmp 0x5a2b9
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
jmp 0x5a14b
jmp 0x5a2b6
movq %rax, %rbx
jmp 0x5a2aa
jmp 0x5a2b6
jmp 0x5a2b6
movq %rax, %rbx
jmp 0x5a2c6
movq %rax, %rbx
jmp 0x5a2d0
jmp 0x5a271
jmp 0x5a271
movq %rax, %rbx
jmp 0x5a1fb
movq %rax, %rbx
jmp 0x5a208
jmp 0x5a276
movq %rax, %rbx
leaq 0x2e8(%rsp), %rdi
callq 0x8978
jmp 0x5a19e
movq %rax, %rbx
leaq 0x248(%rsp), %rdi
callq 0x8978
jmp 0x5a1b0
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0x8978
jmp 0x5a1c2
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
callq 0x8978
jmp 0x5a1d4
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
callq 0x8978
leaq 0x208(%rsp), %rdi
callq 0x8978
leaq 0x2a8(%rsp), %rdi
callq 0x8978
leaq 0x288(%rsp), %rdi
callq 0x8978
leaq 0x1e8(%rsp), %rdi
callq 0x8978
jmp 0x5a279
movq %rax, %rbx
jmp 0x5a1e1
movq %rax, %rbx
jmp 0x5a1ee
jmp 0x5a271
jmp 0x5a233
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x5a298
jmp 0x5a23c
jmp 0x5a23c
movq %rax, %rbx
jmp 0x5a290
jmp 0x5a23c
jmp 0x5a23c
movq %rax, %rbx
jmp 0x5a29d
jmp 0x5a271
jmp 0x5a276
jmp 0x5a271
jmp 0x5a276
jmp 0x5a276
jmp 0x5a2b6
jmp 0x5a271
jmp 0x5a271
movq %rax, %rbx
jmp 0x5a263
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8978
leaq 0x160(%rsp), %rdi
jmp 0x5a27e
jmp 0x5a271
jmp 0x5a271
movq %rax, %rbx
jmp 0x5a283
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8978
leaq 0xa0(%rsp), %rdi
callq 0x28a08
leaq 0x118(%rsp), %rdi
callq 0x8978
leaq 0x198(%rsp), %rdi
callq 0x8978
leaq 0x8(%rsp), %rdi
callq 0x8978
jmp 0x5a2b9
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x2aef2
leaq 0x70(%rsp), %rdi
callq 0x28a08
leaq 0xe0(%rsp), %rdi
callq 0x2b43c
leaq 0x100(%rsp), %rdi
callq 0x2b43c
leaq 0x180(%rsp), %rdi
callq 0x2b43c
movq %rbx, %rdi
callq 0x8870