// File: millanek[P]evo/process_vcf_stats_functions.cpp
// Function: diffs_between_AllH(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, FilterResult&)
void diffs_between_AllH(std::vector<std::vector<double> >& AllHdiffs, FilterResult& result) {
    for (std::vector<std::vector<int> >::size_type i = 0; i < AllHdiffs.size(); i++) {
        for (int j = 0; j < i; j++) {
            const int ind_i = result.counts.haplotypesWithVariant[i];
            const int ind_j = result.counts.haplotypesWithVariant[j];
            
            if ((ind_i == 1 && ind_j == 0) || (ind_i == 0 && ind_j == 1)) {
                AllHdiffs[i][j]++;
            } else if ((ind_i == 0 && ind_j == 0) || (ind_i == 1 && ind_j == 1)) { // one is hom for reference allele the other is hom for alternative allele
                
            } else {
                std::cerr << "result.counts.haplotypesWithVariant[" << i << "]=" << result.counts.haplotypesWithVariant[i] << std::endl;
                std::cerr << "result.counts.haplotypesWithVariant[" << j << "]=" << result.counts.haplotypesWithVariant[j] << std::endl;
                exit(EXIT_FAILURE);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x651b0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0x9d651
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x9d63e
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movq -0x18(%rbp), %rsi
callq 0x4d100
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x4d100
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x1, -0x20(%rbp)
jne 0x9d504
cmpl $0x0, -0x24(%rbp)
je 0x9d510
cmpl $0x0, -0x20(%rbp)
jne 0x9d53e
cmpl $0x1, -0x24(%rbp)
jne 0x9d53e
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3ec30
movsd 0x94d87(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x9d62e
cmpl $0x0, -0x20(%rbp)
jne 0x9d54a
cmpl $0x0, -0x24(%rbp)
je 0x9d556
cmpl $0x1, -0x20(%rbp)
jne 0x9d55b
cmpl $0x1, -0x24(%rbp)
jne 0x9d55b
jmp 0x9d62c
movq 0xfba8e(%rip), %rdi     # 0x198ff0
leaq 0xa01f6(%rip), %rsi     # 0x13d75f
callq 0xa5c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0xa140
movq %rax, %rdi
leaq 0xa0200(%rip), %rsi     # 0x13d784
callq 0xa5c0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movq -0x18(%rbp), %rsi
callq 0x4d100
movq -0x40(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, %rdi
movq 0xfb9ce(%rip), %rsi     # 0x198f88
callq 0xa610
movq 0xfba2a(%rip), %rdi     # 0x198ff0
leaq 0xa0192(%rip), %rsi     # 0x13d75f
callq 0xa5c0
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0xab20
movq %rax, %rdi
leaq 0xa019d(%rip), %rsi     # 0x13d784
callq 0xa5c0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x4d100
movq -0x38(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, %rdi
movq 0xfb96b(%rip), %rsi     # 0x198f88
callq 0xa610
movl $0x1, %edi
callq 0xa700
jmp 0x9d62e
jmp 0x9d630
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9d4b0
jmp 0x9d640
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x9d488
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)