// File: 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 %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
addq $0xe0, %rdi
callq 0x84460
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rdi
addq $0xe0, %rdi
callq 0x844c0
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x84490
testb $0x1, %al
jne 0x82391
jmp 0x824d4
leaq -0x18(%rbp), %rdi
callq 0x844f0
movsd 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x823bd
leaq -0x18(%rbp), %rdi
callq 0x844f0
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x823ce
movq -0x38(%rbp), %rax
movsd 0x110(%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0xafee2(%rip), %xmm0    # 0x1322b8
subsd -0x10(%rbp), %xmm0
movl $0x2, %edi
callq 0x835c0
movq -0x38(%rbp), %rax
movsd %xmm0, -0x60(%rbp)
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x68(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x844f0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3ec30
movsd -0x60(%rbp), %xmm0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movsd %xmm0, (%rcx)
movsd -0x10(%rbp), %xmm0
movsd 0xafe82(%rip), %xmm1    # 0x1322b8
subsd -0x10(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x58(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x844f0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
movl $0x1, %esi
callq 0x3ec30
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
movl $0x2, %edi
callq 0x835c0
movq -0x38(%rbp), %rax
movsd %xmm0, -0x40(%rbp)
addq $0x1e0, %rax            # imm = 0x1E0
movq %rax, -0x48(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x844f0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
movl $0x2, %esi
callq 0x3ec30
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x18(%rbp), %rdi
callq 0x84510
jmp 0x82367
movq -0x38(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
callq 0x84460
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
callq 0x844c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x84490
testb $0x1, %al
jne 0x82512
jmp 0x82667
leaq -0x28(%rbp), %rdi
callq 0x844f0
movsd 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x8253e
leaq -0x28(%rbp), %rdi
callq 0x844f0
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x8254f
movq -0x38(%rbp), %rax
movsd 0x148(%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0xafd61(%rip), %xmm0    # 0x1322b8
subsd -0x10(%rbp), %xmm0
movl $0x2, %edi
callq 0x835c0
movq -0x38(%rbp), %rax
movsd %xmm0, -0x90(%rbp)
addq $0x210, %rax            # imm = 0x210
movq %rax, -0x98(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x844f0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3ec30
movsd -0x90(%rbp), %xmm0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movsd %xmm0, (%rcx)
movsd -0x10(%rbp), %xmm0
movsd 0xafcf5(%rip), %xmm1    # 0x1322b8
subsd -0x10(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
addq $0x210, %rax            # imm = 0x210
movq %rax, -0x88(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x844f0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
movl $0x1, %esi
callq 0x3ec30
movsd -0x80(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
movl $0x2, %edi
callq 0x835c0
movq -0x38(%rbp), %rax
movsd %xmm0, -0x70(%rbp)
addq $0x210, %rax            # imm = 0x210
movq %rax, -0x78(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x844f0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x84380
movq %rax, %rdi
movl $0x2, %esi
callq 0x3ec30
movsd -0x70(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x28(%rbp), %rdi
callq 0x84510
jmp 0x824e8
addq $0xa0, %rsp
popq %rbp
retq