// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_fst.cpp
// Function: calculateDxy(SetCounts const&, int, int)
double calculateDxy(const SetCounts& thisVarCounts, const int n1, const int n2) {
    double Dxy;
    int sumKij = 0;
    for (std::vector<std::string>::size_type i = 0; i != n1/2; i++) {
        for (std::vector<std::string>::size_type j = 0; j != n2/2; j++) {
            if (thisVarCounts.set1individualsWithVariant[i] == 0 && thisVarCounts.set2individualsWithVariant[j] == 0) {
            } else if (thisVarCounts.set1individualsWithVariant[i] == 1 && thisVarCounts.set2individualsWithVariant[j] == 0) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 0 && thisVarCounts.set2individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 1 && thisVarCounts.set2individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 2 && thisVarCounts.set2individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 1 && thisVarCounts.set2individualsWithVariant[j] == 2) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 2 && thisVarCounts.set2individualsWithVariant[j] == 2) {
            } else if (thisVarCounts.set1individualsWithVariant[i] == 2 && thisVarCounts.set2individualsWithVariant[j] == 0) {
                sumKij = sumKij + 4;
            } else if (thisVarCounts.set1individualsWithVariant[i] == 0 && thisVarCounts.set2individualsWithVariant[j] == 2) {
                sumKij = sumKij + 4;
            }
        }
    }
    Dxy = (double)sumKij/(n1*n2);
    return Dxy;
}

// Assembly:
leal 0x1(%rsi), %eax
xorpd %xmm0, %xmm0
cmpl $0x3, %eax
jb 0x8e164
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %eax
shrl $0x1f, %eax
addl %esi, %eax
sarl %eax
cltq
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movslq %ecx, %rcx
leal 0x1(%rdx), %r8d
movq 0x90(%rdi), %r9
movq 0xa8(%rdi), %rdi
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpl $0x3, %r8d
jae 0x8e0c9
incq %r10
cmpq %rax, %r10
jne 0x8e0b6
jmp 0x8e158
movl (%r9,%r10,4), %ebx
xorl %r14d, %r14d
testl %ebx, %ebx
jne 0x8e0db
cmpl $0x0, (%rdi,%r14,4)
je 0x8e11a
cmpl $0x1, %ebx
jne 0x8e0e7
cmpl $0x0, (%rdi,%r14,4)
je 0x8e116
testl %ebx, %ebx
jne 0x8e0f2
cmpl $0x1, (%rdi,%r14,4)
je 0x8e116
cmpl $0x1, %ebx
jne 0x8e0fe
cmpl $0x1, (%rdi,%r14,4)
je 0x8e116
cmpl $0x2, %ebx
jne 0x8e10a
cmpl $0x1, (%rdi,%r14,4)
je 0x8e116
cmpl $0x1, %ebx
jne 0x8e124
cmpl $0x2, (%rdi,%r14,4)
jne 0x8e124
addl $0x2, %r11d
incq %r14
cmpq %r14, %rcx
jne 0x8e0d0
jmp 0x8e0bc
cmpl $0x2, %ebx
jne 0x8e13c
cmpl $0x2, (%rdi,%r14,4)
je 0x8e11a
cmpl $0x2, %ebx
jne 0x8e13c
cmpl $0x0, (%rdi,%r14,4)
je 0x8e152
testl %ebx, %ebx
jne 0x8e11a
cmpl $0x2, (%rdi,%r14,4)
leal 0x4(%r11), %ebp
cmovnel %r11d, %ebp
movl %ebp, %r11d
jmp 0x8e11a
addl $0x4, %r11d
jmp 0x8e11a
xorps %xmm0, %xmm0
cvtsi2sd %r11d, %xmm0
popq %rbx
popq %r14
popq %rbp
imull %esi, %edx
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
retq