// File: millanek[P]evo/./process_vcf_coding_sequences.h
// Function: addAllPairwiseN_S_Nd_Sd_DifferentIndividuals(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>>>&, CDSComparisonMatrices&)
inline void addAllPairwiseN_S_Nd_Sd_DifferentIndividuals(const std::vector<string>& altCodons, std::map<std::vector<string>::size_type, int>& haveStop, CDSComparisonMatrices& p) {

    for (std::vector<std::string>::size_type j = 0; j != altCodons.size() - 1; j++) {
        if (haveStop[j] == 1 || getAminoAcid(altCodons[j]) == "Uncrecognised codon....")
            continue; // only consider this individual if it did not have a premature stop codon and there are no unrecognised letters
        for (std::vector<std::string>::size_type k = j+1; k != altCodons.size(); k++) {
            if (haveStop[k] == 1 || getAminoAcid(altCodons[k]) == "Uncrecognised codon....")
                continue;
            int d = getCodonDistance(altCodons[j],altCodons[k]);
            // std::cerr << "Got codon distance: d = " << d << std::endl;
//            double n_d_ijk = calculateNd(altCodons[j],altCodons[k], d);
//            double s_d_ijk = d - n_d_ijk;
            //std::cerr << "N_d_jk[j][k] = " << p.N_d_jk[j][k] << std::endl;
            //print_matrix(N_d_jk, std::cout);
            double n_d_ijk = calculateNd(altCodons[j],altCodons[k], d);
          //  std::cerr << "Calculated Nd; n_d_ijk[0] = " << n_d_ijk[0] << std::endl;
          //  std::cerr << "Calculated Nd; n_d_ijk[1] = " << n_d_ijk[1] << std::endl;
          //  std::cerr << "Calculated Nd; n_d_ijk[2] = " << n_d_ijk[2] << std::endl;
            double s_d_ijk = d - n_d_ijk;
            p.N_d_jk[j][k] = p.N_d_jk[j][k] + n_d_ijk;
            p.S_d_jk[j][k] = p.S_d_jk[j][k] + s_d_ijk;

//          p.N_d_jk[j][k] = p.N_d_jk[j][k] + n_d_ijk;
//          p.S_d_jk[j][k] = p.S_d_jk[j][k] + s_d_ijk;
            
            //  n_di = n_di + n_d_ijk; s_di = s_di + s_d_ijk;
            double N_ijk = calculateN(altCodons[j],altCodons[k], d, false);
            //std::cerr << "Calculated N; N_ijk = " <<N_ijk << std::endl;
            double S_ijk = (3 - N_ijk);
            p.N_jk[j][k] = p.N_jk[j][k] + N_ijk; p.S_jk[j][k] = p.S_jk[j][k] + S_ijk;
            //std::cerr << "altCodons[j] = " << altCodons[j] << "; altCodons[k] = " << altCodons[k] << std::endl;
            //std::cerr << "j = " << j << "; k = " << k << std::endl;
            //std::cerr << "d = " << d << "; n_d_ijk = " << n_d_ijk << "; N_ijk = " << N_ijk << std::endl;
            //std::cerr << "N_d_jk[j][k] = " << p.N_d_jk[j][k] << "; N_jk[j][k] = " << p.N_jk[j][k] << std::endl;
            double N_tS = calculateNtS(altCodons[j],altCodons[k], d, false);
            p.tS_N_jk[j][k] = p.tS_N_jk[j][k] + N_tS;
            p.tS_S_jk[j][k] = p.tS_S_jk[j][k] + (1 - N_tS);
            p.tV_N_jk[j][k] = p.tV_N_jk[j][k] + (N_ijk - N_tS);
            p.tV_S_jk[j][k] = p.tV_S_jk[j][k] + (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 $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
je 0xb90bf
movq -0x10(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xb7ac0
movl (%rax), %ecx
movb $0x0, -0x41(%rbp)
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0xb9(%rbp)
je 0xb8b27
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xb7da0
movq -0xc8(%rbp), %rdi
movb $0x1, -0x41(%rbp)
leaq 0x886c3(%rip), %rsi     # 0x1411cf
callq 0x2d770
movb %al, -0xba(%rbp)
jmp 0xb8b19
movb -0xba(%rbp), %al
movb %al, -0xb9(%rbp)
jmp 0xb8b27
movb -0xb9(%rbp), %al
movb %al, -0xc9(%rbp)
testb $0x1, -0x41(%rbp)
jne 0xb8b3b
jmp 0xb8b44
leaq -0x40(%rbp), %rdi
callq 0xac88
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0xb8b50
jmp 0xb8b77
jmp 0xb90ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
testb $0x1, -0x41(%rbp)
jne 0xb8b69
jmp 0xb8b72
leaq -0x40(%rbp), %rdi
callq 0xac88
jmp 0xb90c8
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
je 0xb90ac
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xb7ac0
movl (%rax), %ecx
movb $0x0, -0x81(%rbp)
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0xd9(%rbp)
je 0xb8c1d
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x52960
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xb7da0
movq -0xe8(%rbp), %rdi
movb $0x1, -0x81(%rbp)
leaq 0x885cd(%rip), %rsi     # 0x1411cf
callq 0x2d770
movb %al, -0xda(%rbp)
jmp 0xb8c0f
movb -0xda(%rbp), %al
movb %al, -0xd9(%rbp)
jmp 0xb8c1d
movb -0xd9(%rbp), %al
movb %al, -0xe9(%rbp)
testb $0x1, -0x81(%rbp)
jne 0xb8c34
jmp 0xb8c3d
leaq -0x80(%rbp), %rdi
callq 0xac88
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0xb8c49
jmp 0xb8c73
jmp 0xb909b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
testb $0x1, -0x81(%rbp)
jne 0xb8c65
jmp 0xb8c6e
leaq -0x80(%rbp), %rdi
callq 0xac88
jmp 0xb90c8
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, -0x150(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x52960
movq -0x150(%rbp), %rdi
movq %rax, %rsi
callq 0xba750
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, -0x148(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x52960
movq -0x148(%rbp), %rdi
movq %rax, %rsi
movl -0x88(%rbp), %edx
callq 0xbac40
movsd %xmm0, -0x90(%rbp)
cvtsi2sdl -0x88(%rbp), %xmm0
subsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x140(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x140(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x138(%rbp)
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x138(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, -0x130(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x52960
movq -0x130(%rbp), %rdi
movq %rax, %rsi
movl -0x88(%rbp), %edx
xorl %ecx, %ecx
callq 0xbbdf0
movsd %xmm0, -0xa0(%rbp)
movsd 0x87a45(%rip), %xmm0    # 0x140838
subsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x128(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x52960
movq -0x118(%rbp), %rdi
movq %rax, %rsi
movl -0x88(%rbp), %edx
xorl %ecx, %ecx
callq 0xbd750
movsd %xmm0, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x110(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
addq $0x78, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd 0x7933e(%rip), %xmm1    # 0x1322b8
subsd -0xb0(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
movq -0x18(%rbp), %rdi
addq $0x78, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x108(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
addq $0x90, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd -0xa0(%rbp), %xmm1
subsd -0xb0(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x18(%rbp), %rdi
addq $0x90, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0x100(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
addq $0xa8, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd (%rax), %xmm0
movsd -0xa0(%rbp), %xmm2
subsd -0xb0(%rbp), %xmm2
movsd 0x7a669(%rip), %xmm1    # 0x1336c8
subsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movq -0x18(%rbp), %rdi
addq $0xa8, %rdi
movq -0x20(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x3ec30
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xb8b83
jmp 0xb90ae
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xb8a8f
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0xab50
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)