// File: millanek[P]Dsuite/Dsuite_utils.cpp
// Function: GeneralSetCounts::getBasicCounts(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&)
void GeneralSetCounts::getBasicCounts(const std::vector<std::string>& genotypes, const std::map<size_t, string>& posToSpeciesMap) {
    // Go through the genotypes - only biallelic markers are allowed
    for (std::vector<std::string>::size_type i = 0; i != genotypes.size(); i++) {
        bool speciesDefined = true;
        std::string species; try { species = posToSpeciesMap.at(i); } catch (const std::out_of_range& oor) {
            speciesDefined = false;
        }
        // The first allele in this individual
        if (genotypes[i][0] == '1') { overall++; individualsWithVariant[i]++; }
        if (genotypes[i][2] == '1') { overall++; individualsWithVariant[i]++; }
        if (speciesDefined) {
            if (genotypes[i][0] == '1') {
                setAltCounts[species]++; setAlleleCounts[species]++;
            } else if (genotypes[i][0] == '0') {
                setAlleleCounts[species]++;
            }
            // The second allele in this individual
            if (genotypes[i][2] == '1') {
                setAltCounts[species]++; setAlleleCounts[species]++;
            } else if (genotypes[i][2] == '0') {
                setAlleleCounts[species]++;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10740
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
je 0xab22
movb $0x1, -0x21(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x87d0
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x10a70
movq %rax, -0x78(%rbp)
jmp 0xa888
movq -0x78(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x8070
jmp 0xa897
jmp 0xa8cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xab17
movq -0x50(%rbp), %rdi
callq 0x8220
movq %rax, -0x60(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x8950
jmp 0xa8cd
jmp 0xa8cf
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa925
movq -0x68(%rbp), %rdi
movl (%rdi), %eax
addl $0x1, %eax
movl %eax, (%rdi)
addq $0x2c8, %rdi            # imm = 0x2C8
movq -0x20(%rbp), %rsi
callq 0x115a0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xa925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xab17
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
movl $0x2, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa969
movq -0x68(%rbp), %rdi
movl (%rdi), %eax
addl $0x1, %eax
movl %eax, (%rdi)
addq $0x2c8, %rdi            # imm = 0x2C8
movq -0x20(%rbp), %rsi
callq 0x115a0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
testb $0x1, -0x21(%rbp)
je 0xaafd
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa9e5
movq -0x68(%rbp), %rdi
addq $0x98, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0x80(%rbp)
jmp 0xa9ae
movq -0x68(%rbp), %rdi
movq -0x80(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0xc8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0x88(%rbp)
jmp 0xa9d5
movq -0x88(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xaa33
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xaa31
movq -0x68(%rbp), %rdi
addq $0xc8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0x90(%rbp)
jmp 0xaa23
movq -0x90(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xaa33
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
movl $0x2, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xaaac
movq -0x68(%rbp), %rdi
addq $0x98, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0x98(%rbp)
jmp 0xaa72
movq -0x68(%rbp), %rdi
movq -0x98(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0xc8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0xa0(%rbp)
jmp 0xaa9c
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xaafb
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10720
movq %rax, %rdi
movl $0x2, %esi
callq 0x8640
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xaaf9
movq -0x68(%rbp), %rdi
addq $0xc8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x115c0
movq %rax, -0xa8(%rbp)
jmp 0xaaeb
movq -0xa8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xaafb
jmp 0xaafd
leaq -0x48(%rbp), %rdi
callq 0x8c08
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xa847
leaq -0x48(%rbp), %rdi
callq 0x8c08
jmp 0xab2b
addq $0xb0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x8a50
nopw %cs:(%rax,%rax)