// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/evo_abba_baba.cpp
// Function: incrementDnumDdenomSingleSequence(ThreeSetCounts&, ABBA_BABA_Freq_allResults&)
inline void incrementDnumDdenomSingleSequence(ThreeSetCounts& c, ABBA_BABA_Freq_allResults& res) {
    if (c.set1daAF == -1) {
        ABBABABAcounts::noDafInfo++;
    } else if (c.set3daAF == 0) {
        ABBABABAcounts::XXAA++;
    } else {
        if (c.set3daAF == 0.5) { c.set3daAF = sample01(0.5); } // If hets then randomly sample one of the alleles
        if (c.set2daAF == 0.5) { c.set2daAF = sample01(0.5); }
        if (c.set1daAF == 0.5) { c.set1daAF = sample01(0.5); }
        
        if (c.set3daAF == 1) {
            ABBABABAcounts::XXBA++;
            // Green et al. (2010) eq. S15.1
            if (c.set1daAF == 0 && c.set2daAF == 1) {
                ABBABABAcounts::ABBA++; ABBABABAcounts::usedVariantsCounter++;
                res.Ddenominator++; res.Dnumerator++; res.lastVarsDdenom++; res.lastVarsDnum++; res.windowDdenom++; res.windowDnum++;
            } else if (c.set1daAF == 1 && c.set2daAF == 0) {
                ABBABABAcounts::BABA++; ABBABABAcounts::usedVariantsCounter++;
                res.Ddenominator++; res.Dnumerator--; res.lastVarsDdenom++; res.lastVarsDnum--; res.windowDdenom++; res.windowDnum--;
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd 0x38(%rdi), %xmm0
ucomisd 0x6853c(%rip), %xmm0    # 0x975f8
jne 0x2f0cb
jp 0x2f0cb
incl 0xae8ea(%rip)           # 0xdd9b0
jmp 0x2f214
movq %rdi, %r14
movsd 0x48(%rdi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2f0ea
jp 0x2f0ea
incl 0xae8af(%rip)           # 0xdd994
jmp 0x2f214
movq %rsi, %rbx
ucomisd 0x6850b(%rip), %xmm0    # 0x97600
movabsq $0x3fe0000000000000, %r15 # imm = 0x3FE0000000000000
jne 0x2f11a
jp 0x2f11a
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
callq 0x2f667
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x48(%r14)
movsd 0x40(%r14), %xmm0
ucomisd 0x684d8(%rip), %xmm0    # 0x97600
jne 0x2f143
jp 0x2f143
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
callq 0x2f667
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x40(%r14)
movsd 0x38(%r14), %xmm0
ucomisd 0x684af(%rip), %xmm0    # 0x97600
jne 0x2f16c
jp 0x2f16c
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
callq 0x2f667
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x38(%r14)
movsd 0x48(%r14), %xmm1
ucomisd 0x68476(%rip), %xmm1    # 0x975f0
jne 0x2f214
jp 0x2f214
incl 0xae810(%rip)           # 0xdd99c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd 0x40(%r14), %xmm1
jne 0x2f1c0
jp 0x2f1c0
ucomisd 0x6844a(%rip), %xmm1    # 0x975f0
jne 0x2f1c0
jp 0x2f1c0
incl 0xae7f0(%rip)           # 0xdd9a0
incl 0xae7fe(%rip)           # 0xdd9b4
movapd 0x68422(%rip), %xmm0    # 0x975e0
jmp 0x2f1ec
ucomisd 0x68428(%rip), %xmm0    # 0x975f0
jne 0x2f214
jp 0x2f214
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x2f214
jp 0x2f214
incl 0xae7c6(%rip)           # 0xdd9a4
incl 0xae7d0(%rip)           # 0xdd9b4
movapd 0x683e4(%rip), %xmm0    # 0x975d0
movupd (%rbx), %xmm1
movupd 0x10(%rbx), %xmm2
movupd 0x20(%rbx), %xmm3
addpd %xmm0, %xmm1
movupd %xmm1, (%rbx)
addpd %xmm0, %xmm2
movupd %xmm2, 0x10(%rbx)
addpd %xmm0, %xmm3
movupd %xmm3, 0x20(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq