// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movsd 0x38(%rdi), %xmm0
ucomisd 0x954ae(%rip), %xmm0    # 0xcc718
jne 0x37279
jp 0x37279
incl 0xcb70c(%rip)           # 0x102980
jmp 0x37403
movq %rdi, %r14
movsd 0x48(%rdi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x37298
jp 0x37298
incl 0xcb6d1(%rip)           # 0x102964
jmp 0x37403
movq %rsi, %rbx
ucomisd 0x9547d(%rip), %xmm0    # 0xcc720
jne 0x372d7
jp 0x372d7
callq 0x8140
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
mulss 0x9546d(%rip), %xmm0    # 0xcc728
ucomiss 0x91d42(%rip), %xmm0    # 0xc9004
ja 0x372c9
xorps %xmm0, %xmm0
jmp 0x372d1
movsd 0x9543f(%rip), %xmm0    # 0xcc710
movsd %xmm0, 0x48(%r14)
movsd 0x40(%r14), %xmm0
ucomisd 0x9543b(%rip), %xmm0    # 0xcc720
jne 0x37319
jp 0x37319
callq 0x8140
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
mulss 0x9542b(%rip), %xmm0    # 0xcc728
ucomiss 0x91d00(%rip), %xmm0    # 0xc9004
ja 0x3730b
xorps %xmm0, %xmm0
jmp 0x37313
movsd 0x953fd(%rip), %xmm0    # 0xcc710
movsd %xmm0, 0x40(%r14)
movsd 0x38(%r14), %xmm0
ucomisd 0x953f9(%rip), %xmm0    # 0xcc720
jne 0x3735b
jp 0x3735b
callq 0x8140
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
mulss 0x953e9(%rip), %xmm0    # 0xcc728
ucomiss 0x91cbe(%rip), %xmm0    # 0xc9004
ja 0x3734d
xorps %xmm0, %xmm0
jmp 0x37355
movsd 0x953bb(%rip), %xmm0    # 0xcc710
movsd %xmm0, 0x38(%r14)
movsd 0x48(%r14), %xmm1
ucomisd 0x953a7(%rip), %xmm1    # 0xcc710
jne 0x37403
jp 0x37403
incl 0xcb5f1(%rip)           # 0x10296c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd 0x40(%r14), %xmm1
jne 0x373af
jp 0x373af
ucomisd 0x9537b(%rip), %xmm1    # 0xcc710
jne 0x373af
jp 0x373af
incl 0xcb5d1(%rip)           # 0x102970
incl 0xcb5df(%rip)           # 0x102984
movapd 0x95353(%rip), %xmm0    # 0xcc700
jmp 0x373db
ucomisd 0x95359(%rip), %xmm0    # 0xcc710
jne 0x37403
jp 0x37403
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x37403
jp 0x37403
incl 0xcb5a7(%rip)           # 0x102974
incl 0xcb5b1(%rip)           # 0x102984
movapd 0x95315(%rip), %xmm0    # 0xcc6f0
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 $0x8, %rsp
popq %rbx
popq %r14
retq