// File: millanek[P]evo/./process_vcf_fst.h
// Function: calculateOverallDxy(Counts const&)
inline double calculateOverallDxy(const Counts& thisVarCounts) {
    double Dxy;
    int numSamples = (int)thisVarCounts.individualsWithVariant.size();
    int sumKij = 0;
    for (std::vector<std::string>::size_type i = 0; i != numSamples - 1; i++) {
        for (std::vector<std::string>::size_type j = i+1; j != numSamples; j++) {
            if (thisVarCounts.individualsWithVariant[i] == 0 && thisVarCounts.individualsWithVariant[j] == 0) {
            } else if (thisVarCounts.individualsWithVariant[i] == 1 && thisVarCounts.individualsWithVariant[j] == 0) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.individualsWithVariant[i] == 0 && thisVarCounts.individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.individualsWithVariant[i] == 1 && thisVarCounts.individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.individualsWithVariant[i] == 2 && thisVarCounts.individualsWithVariant[j] == 1) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.individualsWithVariant[i] == 1 && thisVarCounts.individualsWithVariant[j] == 2) {
                sumKij = sumKij + 2;
            } else if (thisVarCounts.individualsWithVariant[i] == 2 && thisVarCounts.individualsWithVariant[j] == 2) {
            } else if (thisVarCounts.individualsWithVariant[i] == 2 && thisVarCounts.individualsWithVariant[j] == 0) {
                sumKij = sumKij + 4;
            } else if (thisVarCounts.individualsWithVariant[i] == 0 && thisVarCounts.individualsWithVariant[j] == 2) {
                sumKij = sumKij + 4;
            }
        }
    }
    Dxy = (double)sumKij/(2*(numSamples*(numSamples-1)));
    return Dxy;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
callq 0x467f0
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
je 0x3dec1
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
je 0x3deae
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3dccf
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3dccf
jmp 0x3de9b
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3dd09
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3dd09
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de99
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3dd43
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3dd43
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de97
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3dd7d
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3dd7d
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de95
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3ddb7
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3ddb7
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de93
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x1, (%rax)
jne 0x3ddf1
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3ddf1
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de91
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3de1f
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3de1f
jmp 0x3de8f
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3de56
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3de56
movl -0x18(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de8d
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x20(%rbp), %rsi
callq 0x48250
cmpl $0x0, (%rax)
jne 0x3de8b
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
callq 0x48250
cmpl $0x2, (%rax)
jne 0x3de8b
movl -0x18(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x18(%rbp)
jmp 0x3de8d
jmp 0x3de8f
jmp 0x3de91
jmp 0x3de93
jmp 0x3de95
jmp 0x3de97
jmp 0x3de99
jmp 0x3de9b
jmp 0x3de9d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x3dc8d
jmp 0x3deb0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3dc6b
cvtsi2sdl -0x18(%rbp), %xmm0
movl -0x14(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
shll %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)