// File: millanek[P]evo/process_vcf_massoko.cpp
// Function: getMassokoVariantCounts(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&)
MassokoCounts getMassokoVariantCounts(const std::vector<std::string>& fields) {
    MassokoCounts thisVariantCounts;
    thisVariantCounts.individualsWithVariant.assign((fields.size()-NUM_NON_GENOTYPE_COLUMNS),0);
    for (std::vector<std::string>::size_type i = NUM_NON_GENOTYPE_COLUMNS; i != fields.size(); i++) {
        if (fields[i][0] == '1') { 
            thisVariantCounts.overall++;
            if (i <= 14) { thisVariantCounts.blue++; }
            thisVariantCounts.individualsWithVariant[i- NUM_NON_GENOTYPE_COLUMNS]++;
        }
        if (fields[i][2] == '1') { 
            thisVariantCounts.overall++; 
            if (i <= 14) { thisVariantCounts.blue++; }
            thisVariantCounts.individualsWithVariant[i-NUM_NON_GENOTYPE_COLUMNS]++;
        }
        std::vector<std::string> genotypeData = split(fields[i], ':');
        
        if (atoi(genotypeData[2].c_str()) < thisVariantCounts.minimumDepthInAnIndividual) {
            thisVariantCounts.minimumDepthInAnIndividual = atoi(genotypeData[2].c_str());
        }
        
    }
    // Also get overall depth for this variant
    std::vector<std::string> info = split(fields[7], ';');
    if (info[0] == "INDEL") {
        info = split(info[1], '=');
    } else {
        info = split(info[0], '=');
    }
    thisVariantCounts.overallDepth = atoi((info.back()).c_str());
    return thisVariantCounts;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0xa5400
movq -0xa0(%rbp), %rdi
addq $0x70, %rdi
movq %rdi, -0x98(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3ffd0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
addq $-0x9, %rsi
movl $0x0, -0x18(%rbp)
leaq -0x18(%rbp), %rdx
callq 0x838d0
jmp 0xa3c88
movq $0x9, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
je 0xa3e2f
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa3d35
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpq $0xe, -0x30(%rbp)
ja 0xa3d16
movq -0xa0(%rbp), %rax
movl 0xfc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xfc(%rax)
jmp 0xa3d16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0xa3f66
movq -0xa0(%rbp), %rdi
addq $0x70, %rdi
movq -0x30(%rbp), %rsi
subq $0x9, %rsi
callq 0x4d100
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52960
movq %rax, %rdi
movl $0x2, %esi
callq 0xa670
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa3da1
movq -0xa0(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpq $0xe, -0x30(%rbp)
ja 0xa3d82
movq -0xa0(%rbp), %rax
movl 0xfc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xfc(%rax)
movq -0xa0(%rbp), %rdi
addq $0x70, %rdi
movq -0x30(%rbp), %rsi
subq $0x9, %rsi
callq 0x4d100
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52960
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
movl $0x3a, %edx
callq 0x7bbe0
jmp 0xa3dc1
leaq -0x48(%rbp), %rdi
movl $0x2, %esi
callq 0x3d940
movq %rax, %rdi
callq 0xa220
movq %rax, %rdi
callq 0xa970
movq -0xa0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xa3e15
leaq -0x48(%rbp), %rdi
movl $0x2, %esi
callq 0x3d940
movq %rax, %rdi
callq 0xa220
movq %rax, %rdi
callq 0xa970
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq -0x48(%rbp), %rdi
callq 0x3dfa0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xa3c90
movq -0x10(%rbp), %rdi
movl $0x7, %esi
callq 0x52960
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
movl $0x3b, %edx
callq 0x7bbe0
jmp 0xa3e50
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x3d940
movq %rax, %rdi
leaq 0x8f91b(%rip), %rsi     # 0x133782
callq 0x2d770
movb %al, -0xb1(%rbp)
jmp 0xa3e74
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0xa3e80
jmp 0xa3ed3
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
movl $0x3d, %edx
callq 0x7bbe0
jmp 0xa3ea1
leaq -0x60(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x50c30
leaq -0x78(%rbp), %rdi
callq 0x3dfa0
jmp 0xa3f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3dfa0
jmp 0xa3f66
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x3d940
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movl $0x3d, %edx
callq 0x7bbe0
jmp 0xa3ef6
leaq -0x60(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x50c30
leaq -0x90(%rbp), %rdi
callq 0x3dfa0
leaq -0x60(%rbp), %rdi
callq 0x5fcc0
movq %rax, %rdi
callq 0xa220
movq %rax, %rdi
callq 0xa970
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x8(%rax)
movb $0x1, -0x11(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3dfa0
testb $0x1, -0x11(%rbp)
jne 0xa3f56
movq -0xa0(%rbp), %rdi
callq 0xa5430
movq -0xa8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0xa5430
movq -0x20(%rbp), %rdi
callq 0xab50
nopl (%rax,%rax)