// File: millanek[P]evo/process_vcf_stats_functions.cpp
// Function: diffs_between_H1(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, FilterResult&)
void diffs_between_H1(std::vector<std::vector<double> >& H1diffs, FilterResult& result) {
    for (std::vector<std::vector<int> >::size_type i = 0; i < H1diffs.size(); i++) {
        for (int j = 0; j < i; j++) {
            const int ind_i = result.counts.haplotypesWithVariant[2*i];
            const int ind_j = result.counts.haplotypesWithVariant[2*j];
            
            if ((ind_i == 1 && ind_j == 0) || (ind_i == 0 && ind_j == 1)) {
                H1diffs[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[" << 2*i << "]=" << result.counts.haplotypesWithVariant[2*i] << std::endl;
                std::cerr << "result.counts.haplotypesWithVariant[" << 2*j << "]=" << result.counts.haplotypesWithVariant[2*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 0x9d464
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x9d451
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movq -0x18(%rbp), %rsi
shlq %rsi
callq 0x4d100
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movl -0x1c(%rbp), %eax
shll %eax
movslq %eax, %rsi
callq 0x4d100
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x1, -0x20(%rbp)
jne 0x9d30b
cmpl $0x0, -0x24(%rbp)
je 0x9d317
cmpl $0x0, -0x20(%rbp)
jne 0x9d345
cmpl $0x1, -0x24(%rbp)
jne 0x9d345
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x651e0
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3ec30
movsd 0x94f80(%rip), %xmm0    # 0x1322b8
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x9d441
cmpl $0x0, -0x20(%rbp)
jne 0x9d351
cmpl $0x0, -0x24(%rbp)
je 0x9d35d
cmpl $0x1, -0x20(%rbp)
jne 0x9d362
cmpl $0x1, -0x24(%rbp)
jne 0x9d362
jmp 0x9d43f
movq 0xfbc87(%rip), %rdi     # 0x198ff0
leaq 0xa03ef(%rip), %rsi     # 0x13d75f
callq 0xa5c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
shlq %rsi
callq 0xa140
movq %rax, %rdi
leaq 0xa03f6(%rip), %rsi     # 0x13d784
callq 0xa5c0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movq -0x18(%rbp), %rsi
shlq %rsi
callq 0x4d100
movq -0x40(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, %rdi
movq 0xfbbc1(%rip), %rsi     # 0x198f88
callq 0xa610
movq 0xfbc1d(%rip), %rdi     # 0x198ff0
leaq 0xa0385(%rip), %rsi     # 0x13d75f
callq 0xa5c0
movq %rax, %rdi
movl -0x1c(%rbp), %esi
shll %esi
callq 0xab20
movq %rax, %rdi
leaq 0xa038e(%rip), %rsi     # 0x13d784
callq 0xa5c0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
addq $0xb8, %rdi
movl -0x1c(%rbp), %eax
shll %eax
movslq %eax, %rsi
callq 0x4d100
movq -0x38(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, %rdi
movq 0xfbb58(%rip), %rsi     # 0x198f88
callq 0xa610
movl $0x1, %edi
callq 0xa700
jmp 0x9d441
jmp 0x9d443
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9d2b0
jmp 0x9d453
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x9d288
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)