// File: millanek[P]evo/process_vcf_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++) {
        std::string species = posToSpeciesMap.at(i);
        // The first allele in this individual
        if (genotypes[i][0] == '1') {
            overall++; individualsWithVariant[i] = 1;
            setAltCounts[species]++; setAlleleCounts[species]++;
        } else if (genotypes[i][0] == '0') {
            setAlleleCounts[species]++; setRefCounts[species]++;
            individualsWithVariant[i] = 0;
        }
        // The second allele in this individual
        if (genotypes[i][2] == '1') {
            overall++;
            setAltCounts[species]++; setAlleleCounts[species]++;
            individualsWithVariant[i]++;
        } else if (genotypes[i][2] == '0') {
            setAlleleCounts[species]++; setRefCounts[species]++;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
je 0x7b519
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x83390
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0xa250
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0x7b378
movq -0x58(%rbp), %rdi
movl (%rdi), %eax
incl %eax
movl %eax, (%rdi)
addq $0x1c0, %rdi            # imm = 0x1C0
movq -0x20(%rbp), %rsi
callq 0x4d100
movq -0x58(%rbp), %rdi
movl $0x1, (%rax)
addq $0x38, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x68(%rbp)
jmp 0x7b32d
movq -0x58(%rbp), %rdi
movq -0x68(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0x68, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x70(%rbp)
jmp 0x7b34e
movq -0x70(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x7b3f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xac88
jmp 0x7b522
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x7b3f6
movq -0x58(%rbp), %rdi
addq $0x68, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x78(%rbp)
jmp 0x7b3b0
movq -0x58(%rbp), %rdi
movq -0x78(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0x8, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x80(%rbp)
jmp 0x7b3d1
movq -0x58(%rbp), %rdi
movq -0x80(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x1c0, %rdi            # imm = 0x1C0
movq -0x20(%rbp), %rsi
callq 0x4d100
movl $0x0, (%rax)
jmp 0x7b3f8
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
movl $0x2, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0x7b48c
movq -0x58(%rbp), %rdi
movl (%rdi), %eax
incl %eax
movl %eax, (%rdi)
addq $0x38, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x88(%rbp)
jmp 0x7b43a
movq -0x58(%rbp), %rdi
movq -0x88(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0x68, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x90(%rbp)
jmp 0x7b461
movq -0x58(%rbp), %rdi
movq -0x90(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x1c0, %rdi            # imm = 0x1C0
movq -0x20(%rbp), %rsi
callq 0x4d100
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x7b4ff
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
movl $0x2, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x7b4fd
movq -0x58(%rbp), %rdi
addq $0x68, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0x98(%rbp)
jmp 0x7b4c8
movq -0x58(%rbp), %rdi
movq -0x98(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
addq $0x8, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59b00
movq %rax, -0xa0(%rbp)
jmp 0x7b4ef
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x7b4ff
leaq -0x40(%rbp), %rdi
callq 0xac88
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x7b297
addq $0xa0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0xab50
nopl (%rax,%rax)