// File: 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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10740
movq %rax, %rcx
movq -0x108(%rbp), %rax
cmpq %rcx, %rax
je 0xdf69
movb $0x1, -0x29(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x87d0
movq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x10a70
movq %rax, -0x110(%rbp)
jmp 0xdc57
movq -0x110(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x8070
jmp 0xdc69
jmp 0xdca1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xdf5e
movq -0x58(%rbp), %rdi
callq 0x8220
movq %rax, -0x68(%rbp)
movb $0x0, -0x29(%rbp)
callq 0x8950
jmp 0xdc9f
jmp 0xdca1
testb $0x1, -0x29(%rbp)
je 0xdf2a
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x10720
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
movl $0x3a, %edx
callq 0xaef0
jmp 0xdcce
movslq -0x1c(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x10b10
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x8250
jmp 0xdcef
leaq -0xa0(%rbp), %rdi
callq 0x10760
leaq 0x7a834(%rip), %rsi     # 0x88536
leaq -0x88(%rbp), %rdi
callq 0x9ab0
movb %al, -0x111(%rbp)
jmp 0xdd16
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0xdd22
jmp 0xdd70
movl $0x4, -0xa4(%rbp)
jmp 0xdf02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xdf5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x10760
jmp 0xdf5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xdf1c
movq -0x100(%rbp), %rdi
addq $0xf8, %rdi
leaq -0x50(%rbp), %rsi
callq 0x10360
movq %rax, -0x120(%rbp)
jmp 0xdd90
movq -0x120(%rbp), %rax
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
leaq -0xc0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x2c, %edx
callq 0xbdd0
jmp 0xddb8
leaq -0xd8(%rbp), %rdi
callq 0x10800
movq -0x100(%rbp), %rax
movl 0x2e0(%rax), %eax
movl %eax, -0x124(%rbp)
subl $0x1, %eax
je 0xde83
jmp 0xdde2
movl -0x124(%rbp), %eax
subl $0x2, %eax
je 0xde81
jmp 0xddf3
movl -0x124(%rbp), %eax
subl $0x3, %eax
jne 0xde9a
jmp 0xde04
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0xafd0
movq -0x100(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rcx
callq 0xb1f0
jmp 0xde37
leaq -0xd8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x10b30
leaq -0xf0(%rbp), %rdi
callq 0x10930
jmp 0xde9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x10930
leaq -0xc0(%rbp), %rdi
callq 0x10930
jmp 0xdf1c
jmp 0xde9a
leaq -0xd8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x10b60
jmp 0xde98
jmp 0xde9a
movq -0x100(%rbp), %rdi
addq $0x68, %rdi
leaq -0x50(%rbp), %rsi
callq 0x10850
movq %rax, -0x138(%rbp)
jmp 0xdeb7
leaq -0xd8(%rbp), %rdi
callq 0xaf70
movq -0x138(%rbp), %rdi
movsd %xmm0, -0xf8(%rbp)
leaq -0xf8(%rbp), %rsi
callq 0x117b0
jmp 0xdee0
leaq -0xd8(%rbp), %rdi
callq 0x10930
leaq -0xc0(%rbp), %rdi
callq 0x10930
movl $0x0, -0xa4(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x8c08
movl -0xa4(%rbp), %eax
testl %eax, %eax
jne 0xdf34
jmp 0xdf1a
jmp 0xdf2a
leaq -0x88(%rbp), %rdi
callq 0x8c08
jmp 0xdf5e
movl $0x0, -0xa4(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x8c08
movl -0xa4(%rbp), %eax
testl %eax, %eax
je 0xdf4b
jmp 0xdf49
jmp 0xdf4d
jmp 0xdf4d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xdc0d
leaq -0x50(%rbp), %rdi
callq 0x8c08
jmp 0xdf72
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x8a50
nopl (%rax,%rax)