// File: /workspace/github_cpp_makefile_star2_O3/millanek[P]Dsuite/Dsuite_utils.cpp
// Function: GeneralSetCountsWithSplits::getBasicCountsFromLikelihoodsOrProbabilities(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::map<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&, int)
void GeneralSetCountsWithSplits::getBasicCountsFromLikelihoodsOrProbabilities(const std::vector<std::string>& genotypes, const std::map<size_t, string>& posToSpeciesMap, const int likelihoodsOrProbabilitiesTagPosition) {
    
    // Go through the genotypes - only biallelic markers are allowed
    for (std::vector<string>::size_type i = 0; i != genotypes.size(); i++) {
        bool speciesDefined = true;
        string species; try { species = posToSpeciesMap.at(i); } catch (const std::out_of_range& oor) {
            speciesDefined = false;
        }
        
        if (speciesDefined) {
            string thisLikelihoodsOrProbabilitiesString = split(genotypes[i], ':')[likelihoodsOrProbabilitiesTagPosition];
            if (thisLikelihoodsOrProbabilitiesString == ".") continue;
            else {
                setAlleleProbCounts.at(species) += 2;
                std::vector<double> thisLikelihoodsOrProbabilities = splitToDouble(thisLikelihoodsOrProbabilitiesString,',');
                std::vector<double> thisProbabilities;
                switch (likelihoodsProbabilitiesType)
                {
                    case LikelihoodsProbabilitiesPL:
                        transformFromPhred(thisLikelihoodsOrProbabilities);
                     // print_vector(thisLikelihoodsOrProbabilities, std::cerr);
                        thisProbabilities = probabilitiesFromLikelihoods(thisLikelihoodsOrProbabilities,species);
                        break;
                    case LikelihoodsProbabilitiesGL: break;
                    case LikelihoodsProbabilitiesGP:
                        thisProbabilities = thisLikelihoodsOrProbabilities;
                        break;
                }
                setIndividualExpectedGenotypes[species].push_back(getExpectedGenotype(thisProbabilities));
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, 0x30(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0xb5b6
movq %rdx, %rbx
movq %rsi, %r14
movslq %ecx, %r15
movq 0x30(%rsp), %rax
leaq 0xf8(%rax), %rcx
movq %rcx, 0xb0(%rsp)
addq $0x68, %rax
movq %rax, 0xa8(%rsp)
leaq 0x88(%rsp), %rbp
leaq 0x38(%rsp), %r12
shlq $0x5, %r15
leaq 0x68(%rsp), %r13
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq $0x0, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0xd286
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7210
movq 0x8(%rsp), %rsi
shlq $0x5, %rsi
addq (%r14), %rsi
movq %r12, %rdi
movl $0x3a, %edx
callq 0x91c1
movq 0x38(%rsp), %rax
leaq 0x78(%rsp), %rcx
movq %rcx, 0x68(%rsp)
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xdf1c
movq %r12, %rdi
callq 0xd1ac
movq %r13, %rdi
leaq 0x36213(%rip), %rsi     # 0x4157e
callq 0x70f0
testl %eax, %eax
je 0xb535
movq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0xd0dc
addl $0x2, (%rax)
movq %r12, %rdi
movq %r13, %rsi
movl $0x2c, %edx
callq 0x9b89
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rax
movl 0x2e0(%rax), %eax
cmpl $0x1, %eax
je 0xb4ac
cmpl $0x3, %eax
jne 0xb4b9
movq 0x38(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x360a4(%rip), %xmm0    # 0x41480
divsd %xmm0, %xmm1
movsd 0x360a0(%rip), %xmm0    # 0x41488
callq 0x7730
movq 0x38(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x8(%rax), %xmm1
divsd 0x3607d(%rip), %xmm1    # 0x41480
movsd 0x3607d(%rip), %xmm0    # 0x41488
callq 0x7730
movq 0x38(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movsd 0x10(%rax), %xmm1
divsd 0x36059(%rip), %xmm1    # 0x41480
movsd 0x36059(%rip), %xmm0    # 0x41488
callq 0x7730
movq 0x38(%rsp), %rax
movsd %xmm0, 0x10(%rax)
leaq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x92e2
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movapd 0x50(%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0xb4b9
subq %rdi, %rsi
callq 0x7420
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xb4b9
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
jmp 0xb4b9
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xd2d0
movq 0xa8(%rsp), %rdi
movq %rbp, %rsi
callq 0xd20a
movq 0x10(%rsp), %rdi
movsd 0x10(%rdi), %xmm0
addsd %xmm0, %xmm0
addsd 0x8(%rdi), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xb4fa
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rax)
jmp 0xb511
movq %rax, %rdi
leaq 0x50(%rsp), %rdx
callq 0xf234
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb51e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb535
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xb551
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7420
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xb576
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x7420
movq 0x8(%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jne 0xb2e1
jmp 0xb5b6
movq %rax, (%rsp)
cmpl $0x1, %edx
jne 0xb63a
movq (%rsp), %rdi
callq 0x7170
callq 0x76a0
jmp 0xb551
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb626
jmp 0xb5d6
jmp 0xb5d6
jmp 0xb5d0
movq %rax, (%rsp)
jmp 0xb608
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb5f1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb608
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xb63a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7420
jmp 0xb63a
movq %rax, (%rsp)
jmp 0xb63a
movq %rax, (%rsp)
leaq 0x38(%rsp), %rdi
callq 0xd1ac
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xb65f
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x7420
movq (%rsp), %rdi
callq 0x7740