// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/process_vcf_utils.cpp
// Function: getThisVariantCountsSimple(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&, Counts*)
void getThisVariantCountsSimple(const std::vector<std::string>& fields, Counts* thisVariantCounts) {
    int numSamples = (int)fields.size()-NUM_NON_GENOTYPE_COLUMNS;
    thisVariantCounts->individualsWithVariant.assign(numSamples,0);
    thisVariantCounts->missingGenotypesPerIndividual.assign(numSamples,false);
    thisVariantCounts->haplotypesWithVariant.assign(numSamples*2,0);
    //std::cerr << "Fields: " << (fields.size()-NUM_NON_GENOTYPE_COLUMNS) << std::endl;
    std::vector<std::string> format = split(fields[8], ':');
    std::vector<std::string> altAlleles = split(fields[4], ',');
    const int numAltAlleles = (int)altAlleles.size();
    
    int alleleAsMissing = -1;
    if (numAltAlleles > 1) {
        string lastAlt = altAlleles.back();
        if (lastAlt == "*") {
            alleleAsMissing = numAltAlleles;
            if ((numAltAlleles - 1) > 1) {
                thisVariantCounts->bIsMultiallelic = true;
            }
        } else {
            if (numAltAlleles > 1) {
                thisVariantCounts->bIsMultiallelic = true;
            }
        }
    }
    
    // Find the position of GQ (genotype quality) in the genotypeData vector below
    if (fields[NUM_NON_GENOTYPE_COLUMNS][1] == '|') { thisVariantCounts->bPhased = true; }
    for (std::vector<std::string>::size_type i = NUM_NON_GENOTYPE_COLUMNS; i != fields.size(); i++) {
        char v1 = fields[i][0]; char v2 = fields[i][2];
        if (thisVariantCounts->bPhased == false) randomisePhase(v1,v2);
        int v1int = v1 - '0'; int v2int = v2 - '0';
        if (v1 == '.' || v2 == '.' || v1int == alleleAsMissing || v2int == alleleAsMissing) {
            thisVariantCounts->bAnyMissingGenotypes = true;
            thisVariantCounts->missingGenotypesPerIndividual[i- NUM_NON_GENOTYPE_COLUMNS] = true;
        } else {
            thisVariantCounts->haplotypesWithVariant[2*(i-NUM_NON_GENOTYPE_COLUMNS)] = v1int;
            thisVariantCounts->haplotypesWithVariant[2*(i-NUM_NON_GENOTYPE_COLUMNS)+1] = v2int;
        }
        // Multiallelic sites will be ignored in the genotype record
        if (!thisVariantCounts->bIsMultiallelic) {
            if (v1 == '1') {
                thisVariantCounts->overall++;
                thisVariantCounts->individualsWithVariant[i- NUM_NON_GENOTYPE_COLUMNS]++;
            }
            if (v2 == '1') {
                thisVariantCounts->overall++;
                thisVariantCounts->individualsWithVariant[i-NUM_NON_GENOTYPE_COLUMNS]++;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %r14
subq (%rdi), %r14
shrq $0x5, %r14
leal -0x9(%r14), %eax
leaq 0x70(%rsi), %rdi
movslq %eax, %r12
leaq 0x28(%rsp), %r13
andl $0x0, (%r13)
movq %r12, %rsi
movq %r13, %rdx
callq 0x44dfe
leaq 0xd0(%rbx), %rdi
movq %rdi, 0x20(%rsp)
movq %r12, %rsi
xorl %edx, %edx
callq 0x452c4
leaq 0xb8(%rbx), %rdi
leal -0x12(,%r14,2), %eax
movslq %eax, %rsi
andl $0x0, (%r13)
leaq 0x28(%rsp), %rdx
movq %rdi, 0x18(%rsp)
callq 0x44dfe
movl $0x100, %esi            # imm = 0x100
addq (%r15), %rsi
leaq 0x60(%rsp), %rdi
pushq $0x3a
popq %rdx
callq 0x40349
movq %r15, 0x10(%rsp)
movq (%r15), %rsi
subq $-0x80, %rsi
leaq 0x48(%rsp), %rdi
pushq $0x2c
popq %rdx
callq 0x40349
movq 0x50(%rsp), %rsi
movq %rsi, %rbp
subq 0x48(%rsp), %rbp
shrq $0x5, %rbp
cmpl $0x2, %ebp
jl 0x40c25
addq $-0x20, %rsi
leaq 0x28(%rsp), %rdi
callq 0x8600
leaq 0x70d99(%rip), %rsi     # 0xb19a6
leaq 0x28(%rsp), %rdi
callq 0x2193f
testb %al, %al
je 0x40c2a
cmpl $0x2, %ebp
jne 0x40c2d
pushq $0x2
popq %rbp
jmp 0x40c34
pushq $-0x1
popq %rbp
jmp 0x40c3e
pushq $-0x1
popq %rbp
movb $0x1, 0xf9(%rbx)
leaq 0x28(%rsp), %rdi
callq 0x8978
movq 0x10(%rsp), %rsi
movq (%rsi), %rax
movq 0x120(%rax), %rcx
cmpb $0x7c, 0x1(%rcx)
jne 0x40c57
movb $0x1, 0x68(%rbx)
movl $0x120, %r15d           # imm = 0x120
xorl %r13d, %r13d
leaq 0x9(%r13), %rcx
movq 0x8(%rsi), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rcx
je 0x40d3a
movq (%rax,%r15), %rax
movb (%rax), %r14b
movb %r14b, 0x28(%rsp)
movb 0x2(%rax), %r12b
movb %r12b, 0xf(%rsp)
cmpb $0x0, 0x68(%rbx)
jne 0x40cb1
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rsi
callq 0x4081f
movq 0x10(%rsp), %rsi
movb 0xf(%rsp), %r12b
movb 0x28(%rsp), %r14b
cmpb $0x2e, %r14b
je 0x40ce6
cmpb $0x2e, %r12b
je 0x40ce6
movsbl %r14b, %eax
addl $-0x30, %eax
cmpl %ebp, %eax
je 0x40ce6
movsbl %r12b, %ecx
addl $-0x30, %ecx
cmpl %ebp, %ecx
je 0x40ce6
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
movl %eax, (%rdx,%r13,8)
movl %ecx, 0x4(%rdx,%r13,8)
jmp 0x40d02
movb $0x1, 0xf8(%rbx)
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x439c0
orq %rdx, (%rax)
movq 0x10(%rsp), %rsi
cmpb $0x0, 0xf9(%rbx)
jne 0x40d2b
cmpb $0x31, %r14b
jne 0x40d1b
incl (%rbx)
movq 0x70(%rbx), %rax
incl (%rax,%r13,4)
cmpb $0x31, %r12b
jne 0x40d2b
incl (%rbx)
movq 0x70(%rbx), %rax
incl (%rax,%r13,4)
movq (%rsi), %rax
incq %r13
addq $0x20, %r15
jmp 0x40c60
leaq 0x48(%rsp), %rdi
callq 0x28a08
leaq 0x60(%rsp), %rdi
callq 0x28a08
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40d64
movq %rax, %rbx
jmp 0x40d71
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x28a08
leaq 0x60(%rsp), %rdi
callq 0x28a08
movq %rbx, %rdi
callq 0x8870