// File: 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
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3ffd0
movl %eax, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
je 0xba0bc
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xb7ac0
movl (%rax), %ecx
movb $0x0, -0x59(%rbp)
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0xc1(%rbp)
je 0xb9b61
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xb7da0
movq -0xd0(%rbp), %rdi
movb $0x1, -0x59(%rbp)
leaq 0x87689(%rip), %rsi     # 0x1411cf
callq 0x2d770
movb %al, -0xc2(%rbp)
jmp 0xb9b53
movb -0xc2(%rbp), %al
movb %al, -0xc1(%rbp)
jmp 0xb9b61
movb -0xc1(%rbp), %al
movb %al, -0xd1(%rbp)
testb $0x1, -0x59(%rbp)
jne 0xb9b75
jmp 0xb9b7e
leaq -0x58(%rbp), %rdi
callq 0xac88
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0xb9b8a
jmp 0xb9bb1
jmp 0xba0ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
testb $0x1, -0x59(%rbp)
jne 0xb9ba3
jmp 0xb9bac
leaq -0x58(%rbp), %rdi
callq 0xac88
jmp 0xba0c5
movq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xb7ac0
movl (%rax), %ecx
movb $0x0, -0x91(%rbp)
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0xd2(%rbp)
je 0xb9c27
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0xb7da0
movq -0xe0(%rbp), %rdi
movb $0x1, -0x91(%rbp)
leaq 0x875c3(%rip), %rsi     # 0x1411cf
callq 0x2d770
movb %al, -0xd3(%rbp)
jmp 0xb9c19
movb -0xd3(%rbp), %al
movb %al, -0xd2(%rbp)
jmp 0xb9c27
movb -0xd2(%rbp), %al
movb %al, -0xe1(%rbp)
testb $0x1, -0x91(%rbp)
jne 0xb9c3e
jmp 0xb9c4a
leaq -0x90(%rbp), %rdi
callq 0xac88
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0xb9c56
jmp 0xb9c83
jmp 0xba0ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
testb $0x1, -0x91(%rbp)
jne 0xb9c72
jmp 0xb9c7e
leaq -0x90(%rbp), %rdi
callq 0xac88
jmp 0xba0c5
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, -0x148(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq -0x148(%rbp), %rdi
movq %rax, %rsi
callq 0xba750
movl %eax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, -0x140(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq -0x140(%rbp), %rdi
movq %rax, %rsi
movl -0x98(%rbp), %edx
callq 0xbac40
movsd %xmm0, -0xa0(%rbp)
cvtsi2sdl -0x98(%rbp), %xmm0
subsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x138(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x138(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x130(%rbp)
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x130(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq -0x128(%rbp), %rdi
movq %rax, %rsi
movl -0x98(%rbp), %edx
xorl %ecx, %ecx
callq 0xbbdf0
movsd %xmm0, -0xb0(%rbp)
movsd 0x86a35(%rip), %xmm0    # 0x140838
subsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rdi
addq $0x48, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0x28(%rbp), %rdi
addq $0x48, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x118(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq %rax, -0x110(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52960
movq -0x110(%rbp), %rdi
movq %rax, %rsi
movl -0x98(%rbp), %edx
xorl %ecx, %ecx
callq 0xbd750
movsd %xmm0, -0xc0(%rbp)
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x108(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rdi
addq $0x78, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd 0x7832e(%rip), %xmm1    # 0x1322b8
subsd -0xc0(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x28(%rbp), %rdi
addq $0x78, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0x100(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rdi
addq $0x90, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd -0xb0(%rbp), %xmm1
subsd -0xc0(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movq -0x28(%rbp), %rdi
addq $0x90, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rdi
addq $0xa8, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd -0xb0(%rbp), %xmm2
subsd -0xc0(%rbp), %xmm2
movsd 0x79659(%rip), %xmm1    # 0x1336c8
subsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movq -0x28(%rbp), %rdi
addq $0xa8, %rdi
movq -0x38(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x3ec30
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xb9ae3
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0xab50
nop