// File: /workspace/github_cpp_makefile_star2_O1/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 0xb606
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 0xd328
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 0x91a9
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 0xdfb6
movq %r12, %rdi
callq 0xd250
movq %r13, %rdi
leaq 0x35173(%rip), %rsi     # 0x4052e
callq 0x70f0
testl %eax, %eax
je 0xb585
movq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0xd180
addl $0x2, (%rax)
movq %r12, %rdi
movq %r13, %rsi
movl $0x2c, %edx
callq 0x9b73
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rax
movl 0x2e0(%rax), %eax
cmpl $0x1, %eax
je 0xb4fc
cmpl $0x3, %eax
jne 0xb509
movq 0x38(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x35054(%rip), %xmm0    # 0x40480
divsd %xmm0, %xmm1
movsd 0x35050(%rip), %xmm0    # 0x40488
callq 0x7730
movq 0x38(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x8(%rax), %xmm1
divsd 0x3502d(%rip), %xmm1    # 0x40480
movsd 0x3502d(%rip), %xmm0    # 0x40488
callq 0x7730
movq 0x38(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movsd 0x10(%rax), %xmm1
divsd 0x35009(%rip), %xmm1    # 0x40480
movsd 0x35009(%rip), %xmm0    # 0x40488
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 0x92ca
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x58(%rsp), %xmm0
movupd %xmm0, 0x18(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0xb4e3
subq %rdi, %rsi
callq 0x7420
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xb509
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
jmp 0xb509
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xd378
movq 0xa8(%rsp), %rdi
movq %rbp, %rsi
callq 0xd2ac
movq 0x10(%rsp), %rcx
movsd 0x10(%rcx), %xmm0
addsd %xmm0, %xmm0
addsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xb54a
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rax)
jmp 0xb557
movq %rax, %rdi
leaq 0x50(%rsp), %rdx
callq 0xf076
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb56e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb585
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xb5a1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7420
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xb5c6
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 0xb331
jmp 0xb606
movq %rax, (%rsp)
cmpl $0x1, %edx
jne 0xb68a
movq (%rsp), %rdi
callq 0x7170
callq 0x76a0
jmp 0xb5a1
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb676
jmp 0xb626
jmp 0xb626
jmp 0xb620
movq %rax, (%rsp)
jmp 0xb658
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb641
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xb658
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xb68a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7420
jmp 0xb68a
movq %rax, (%rsp)
jmp 0xb68a
movq %rax, (%rsp)
leaq 0x38(%rsp), %rdi
callq 0xd250
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xb6af
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x7420
movq (%rsp), %rdi
callq 0x7740