// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_coding_sequences.h
// Function: addN_S_Nd_Sd_SameIndividualsH1againstH2(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::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, int, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, int>>>&, std::map<unsigned long, int, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, int>>>&, CDSComparisonMatrices&)
inline void addN_S_Nd_Sd_SameIndividualsH1againstH2(const std::vector<string>& altCodons, const std::vector<string>& altCodonsH2, std::map<std::vector<string>::size_type, int>& haveStop, std::map<std::vector<string>::size_type, int>& haveStopH2, CDSComparisonMatrices& p) {
    int numSamples = (int)altCodons.size();
    for (std::vector<std::string>::size_type j = 0; j != numSamples; j++) {
        if (haveStop[j] == 1 || getAminoAcid(altCodons[j]) == "Uncrecognised codon....")
            continue; // only consider this individual if it did not have a premature stop codon
        if (haveStopH2[j] == 1 || getAminoAcid(altCodonsH2[j]) == "Uncrecognised codon....")
            continue;
        
        int d = getCodonDistance(altCodons[j],altCodonsH2[j]);
        // Nd
        double n_d_ijk = calculateNd(altCodons[j],altCodonsH2[j], d);
        double s_d_ijk = d - n_d_ijk;
        p.N_d_jk[j][j] = p.N_d_jk[j][j] + n_d_ijk;
        p.S_d_jk[j][j] = p.S_d_jk[j][j] + s_d_ijk;
        // N
        double N_ijk = calculateN(altCodons[j],altCodonsH2[j], d, false);
        double S_ijk = (3 - N_ijk);
        p.N_jk[j][j] = p.N_jk[j][j] + N_ijk; p.S_jk[j][j] = p.S_jk[j][j] + S_ijk;
        // NtS -- for incorporating tS/tV mutation probabilities
        double N_tS = calculateNtS(altCodons[j],altCodonsH2[j], d, false);
        p.tS_N_jk[j][j] = p.tS_N_jk[j][j] + N_tS;
        p.tS_S_jk[j][j] = p.tS_S_jk[j][j] + (1 - N_tS);
        p.tV_N_jk[j][j] = p.tV_N_jk[j][j] + (N_ijk - N_tS);
        p.tV_S_jk[j][j] = p.tV_S_jk[j][j] + (2 - (N_ijk - N_tS));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %r13
movq 0x8(%rdi), %rax
subq (%rdi), %rax
shrq $0x5, %rax
movslq %eax, %rbx
xorl %esi, %esi
leaq 0x28(%rsp), %r14
movq %rsi, (%rsp)
cmpq %rbx, %rsi
je 0x5b657
movq %r15, %rdi
movq %rsp, %rsi
callq 0x5a5fe
cmpl $0x1, (%rax)
movq (%rsp), %rsi
je 0x5b64f
shlq $0x5, %rsi
addq (%r13), %rsi
movq %r14, %rdi
callq 0x5a79e
movq %r14, %rdi
leaq 0x49672(%rip), %rsi     # 0xa4ae7
callq 0x2193f
movl %eax, %r12d
movq %r14, %rdi
callq 0x8978
testb %r12b, %r12b
je 0x5b493
movq (%rsp), %rsi
jmp 0x5b64f
movq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x5a5fe
cmpl $0x1, (%rax)
movq (%rsp), %rsi
je 0x5b64f
shlq $0x5, %rsi
addq (%rbp), %rsi
movq %r14, %rdi
callq 0x5a79e
movq %r14, %rdi
leaq 0x49620(%rip), %rsi     # 0xa4ae7
callq 0x2193f
movl %eax, %r12d
movq %r14, %rdi
callq 0x8978
movq (%rsp), %rsi
testb %r12b, %r12b
jne 0x5b64f
shlq $0x5, %rsi
movq (%r13), %rdi
addq %rsi, %rdi
addq (%rbp), %rsi
callq 0x5b732
movl %eax, %r12d
movq (%rsp), %rsi
shlq $0x5, %rsi
movq (%r13), %rdi
addq %rsi, %rdi
addq (%rbp), %rsi
movl %eax, %edx
callq 0x5b840
cvtsi2sd %r12d, %xmm1
movl %r12d, %edx
movl %r12d, 0xc(%rsp)
subsd %xmm0, %xmm1
movq (%rsp), %rsi
movq %rbp, %r12
movq 0x10(%rsp), %rbp
movq (%rbp), %rax
imulq $0x18, %rsi, %rcx
movq (%rax,%rcx), %rax
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movq 0x30(%rbp), %rax
movq (%rax,%rcx), %rax
addsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%rax,%rsi,8)
shlq $0x5, %rsi
movq (%r13), %rdi
addq %rsi, %rdi
addq (%r12), %rsi
xorl %ecx, %ecx
callq 0x5c045
movapd %xmm0, %xmm2
movsd %xmm0, 0x18(%rsp)
movsd 0x48ce6(%rip), %xmm0    # 0xa4268
subsd %xmm2, %xmm0
movq (%rsp), %rsi
movq 0x18(%rbp), %rax
imulq $0x18, %rsi, %rcx
movq (%rax,%rcx), %rax
movsd (%rax,%rsi,8), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, (%rax,%rsi,8)
movq 0x48(%rbp), %rax
movq (%rax,%rcx), %rax
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
shlq $0x5, %rsi
movq (%r13), %rdi
addq %rsi, %rdi
addq (%r12), %rsi
movl 0xc(%rsp), %edx
xorl %ecx, %ecx
callq 0x5cb94
movq (%rsp), %rsi
movq 0x60(%rbp), %rax
imulq $0x18, %rsi, %rcx
movq (%rax,%rcx), %rax
movsd (%rax,%rsi,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rsi,8)
movq 0x78(%rbp), %rax
movq (%rax,%rcx), %rax
movsd 0x3bff2(%rip), %xmm1    # 0x975f0
subsd %xmm0, %xmm1
addsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%rax,%rsi,8)
movq 0x90(%rbp), %rax
movq (%rax,%rcx), %rax
movsd 0x18(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x48c37(%rip), %xmm0    # 0xa4260
subsd %xmm1, %xmm0
addsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%rax,%rsi,8)
movq 0xa8(%rbp), %rax
movq (%rax,%rcx), %rax
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movq %r12, %rbp
incq %rsi
jmp 0x5b436
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq