// File: /workspace/github_cpp_makefile_star2_O2/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 $0xc8, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movslq %ecx, %rcx
leaq 0xf8(%rdi), %rax
movq %rax, 0x48(%rsp)
movq %rdi, 0x18(%rsp)
leaq 0x68(%rdi), %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
leaq 0x58(%rsp), %rbp
leaq 0x78(%rsp), %r12
shlq $0x5, %rcx
movq %rcx, 0x50(%rsp)
leaq 0xa8(%rsp), %r13
leaq 0x90(%rsp), %r15
movq %rdx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
je 0xa375
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
andq $0x0, 0x60(%rsp)
movb $0x0, 0x68(%rsp)
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0xb894
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7240
movq 0x8(%rsp), %rsi
shlq $0x5, %rsi
addq (%r14), %rsi
movq %r12, %rdi
pushq $0x3a
popq %rdx
callq 0x88f1
movq 0x78(%rsp), %rsi
addq 0x50(%rsp), %rsi
movq %r13, %rdi
callq 0x7590
movq %r12, %rdi
callq 0xb80c
movq %r13, %rdi
leaq 0x2c2cf(%rip), %rsi     # 0x3652e
callq 0x813d
testb %al, %al
jne 0xa33c
movq 0x48(%rsp), %rdi
movq %rbp, %rsi
callq 0xb760
addl $0x2, (%rax)
movq %r12, %rdi
movq %r13, %rsi
pushq $0x2c
popq %rdx
callq 0x90aa
andq $0x0, 0x30(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq 0x18(%rsp), %rax
movl 0x2e0(%rax), %eax
cmpl $0x1, %eax
je 0xa2e9
cmpl $0x3, %eax
jne 0xa2f6
movq %r12, %rdi
callq 0x8940
movq %r15, %rbx
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x8a0e
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0xd618
movq %rbx, %rdi
callq 0xc17e
movq 0x10(%rsp), %rbx
jmp 0xa2f6
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0xb8ce
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0xb82e
movq 0x20(%rsp), %rcx
movsd 0x10(%rcx), %xmm0
addsd %xmm0, %xmm0
addsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x90(%rsp)
movq %rax, %rdi
movq %r15, %rsi
callq 0xd394
leaq 0x20(%rsp), %rdi
callq 0xc17e
movq %r12, %rdi
callq 0xc17e
movq %r13, %rdi
callq 0x7898
movq %rbp, %rdi
callq 0x7898
movq 0x8(%rsp), %rax
incq %rax
jmp 0xa1de
movq %rax, %rbx
cmpl $0x1, %edx
jne 0xa3cc
movq %rbx, %rdi
callq 0x7190
callq 0x76a0
movq 0x10(%rsp), %rbx
jmp 0xa344
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa3ba
jmp 0xa394
jmp 0xa38d
movq %rax, %rbx
jmp 0xa3ab
jmp 0xa394
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xc17e
leaq 0x78(%rsp), %rdi
callq 0xc17e
leaq 0xa8(%rsp), %rdi
callq 0x7898
jmp 0xa3cc
movq %rax, %rbx
jmp 0xa3cc
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xb80c
leaq 0x58(%rsp), %rdi
callq 0x7898
movq %rbx, %rdi
callq 0x7750