// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_utils.cpp
// Function: GeneralSetCounts::setHWEpriorsFromAFfromGT()
void GeneralSetCounts::setHWEpriorsFromAFfromGT() {
    double AF;
    // Alternative allele frequencies
    for(std::map<string,double>::iterator it = setAAFs.begin(); it != setAAFs.end(); ++it) {
        if (it->second >= 0) AF = it->second; else AF = averageAAF; // This should be average of AFs across populations where it is known
        setHWEpriorsFromAAFfromGT[it->first][0] = pow((1-AF),2);
        setHWEpriorsFromAAFfromGT[it->first][1] = AF*(1-AF);
        setHWEpriorsFromAAFfromGT[it->first][2] = pow(AF,2);
    }
    // Derived allele frequencies
    for(std::map<string,double>::iterator it = setDAFs.begin(); it != setDAFs.end(); ++it) {
        if (it->second >= 0) AF = it->second; else AF = averageDAF; // This should be average of AFs across populations
        setHWEpriorsFromDAFfromGT[it->first][0] = pow((1-AF),2);
        setHWEpriorsFromDAFfromGT[it->first][1] = AF*(1-AF);
        setHWEpriorsFromDAFfromGT[it->first][2] = pow(AF,2);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0xf8(%rdi), %r14
leaq 0xe8(%rdi), %r13
cmpq %r13, %r14
je 0x54164
leaq 0x1e0(%rbx), %r15
leaq 0x20(%r14), %r12
movsd 0x40(%r14), %xmm0
xorpd %xmm2, %xmm2
cmpnlesd %xmm0, %xmm2
movsd 0x110(%rbx), %xmm1
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, 0x10(%rsp)
movsd 0x7b36f(%rip), %xmm0    # 0xcf440
subsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movapd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movq %r14, %rdi
callq 0x8310
movq %rax, %r14
cmpq %r13, %rax
jne 0x5409c
movq 0x130(%rbx), %r14
leaq 0x120(%rbx), %r13
cmpq %r13, %r14
je 0x5424a
leaq 0x210(%rbx), %r15
leaq 0x20(%r14), %r12
movsd 0x40(%r14), %xmm0
xorpd %xmm2, %xmm2
cmpnlesd %xmm0, %xmm2
movsd 0x148(%rbx), %xmm1
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, 0x10(%rsp)
movsd 0x7b289(%rip), %xmm0    # 0xcf440
subsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movapd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x55096
movq (%rax), %rax
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movq %r14, %rdi
callq 0x8310
movq %rax, %r14
cmpq %r13, %rax
jne 0x54182
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq