// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %r13
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
movq %rsi, %r14
shrq $0x5, %rbx
leal -0x9(%rbx), %eax
leaq 0x70(%rsi), %rdi
movslq %eax, %r15
xorl %ebp, %ebp
leaq 0x18(%rsp), %r12
movl %ebp, (%r12)
movq %r15, %rsi
movq %r12, %rdx
callq 0x56106
leaq 0xd0(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5680c
leaq 0xb8(%r14), %rdi
leal -0x12(,%rbx,2), %eax
movslq %eax, %rsi
movl %ebp, (%r12)
leaq 0x18(%rsp), %rdx
movq %rdi, 0x10(%rsp)
callq 0x56106
movl $0x100, %esi            # imm = 0x100
addq (%r13), %rsi
leaq 0x50(%rsp), %rdi
movl $0x3a, %edx
callq 0x4d650
movq %r13, (%rsp)
movq (%r13), %rsi
subq $-0x80, %rsi
leaq 0x38(%rsp), %rdi
movl $0x2c, %edx
callq 0x4d650
movq 0x40(%rsp), %rax
movq %rax, %r12
subq 0x38(%rsp), %r12
shrq $0x5, %r12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %r12d
jl 0x4e266
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x2ba06
leaq 0x9252a(%rip), %rsi     # 0xe074e
leaq 0x18(%rsp), %rdi
callq 0x8160
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x4e245
movl $0x2, %ebp
movl %r12d, %ecx
cmpl $0x2, %r12d
je 0x4e24f
movb $0x1, 0xf9(%r14)
movl %ecx, %ebp
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x4e266
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %r8
movq (%r8), %rax
movq 0x120(%rax), %rcx
cmpb $0x7c, 0x1(%rcx)
jne 0x4e27f
movb $0x1, 0x68(%r14)
movq 0x8(%r8), %rcx
subq %rax, %rcx
cmpq $0x120, %rcx            # imm = 0x120
je 0x4e3c6
movl $0x120, %r13d           # imm = 0x120
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %r12d, %r12d
addq $0x3f, %rcx
movq %rcx, 0x8(%rsp)
movq (%rax,%r13), %rax
movb (%rax), %r15b
movb 0x2(%rax), %bl
cmpb $0x0, 0x68(%r14)
jne 0x4e2e8
cmpb %bl, %r15b
je 0x4e2e8
callq 0x8140
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x82047(%rip), %xmm0    # 0xd0320
ucomisd 0x7e43f(%rip), %xmm0    # 0xcc720
jbe 0x4e2ef
movl %r15d, %eax
jmp 0x4e2f4
movl %ebx, %eax
movl %r15d, %ebx
jmp 0x4e2f8
movl %ebx, %eax
movl %r15d, %ebx
movq (%rsp), %r8
cmpb $0x2e, %bl
je 0x4e328
cmpb $0x2e, %al
je 0x4e328
movsbl %bl, %ecx
addl $-0x30, %ecx
cmpl %ebp, %ecx
je 0x4e328
movsbl %al, %edx
addl $-0x30, %edx
cmpl %ebp, %edx
je 0x4e328
movq 0x10(%rsp), %rsi
movq (%rsi), %rsi
movl %ecx, (%rsi,%r12,8)
movl %edx, 0x4(%rsi,%r12,8)
jmp 0x4e376
movb $0x1, 0xf8(%r14)
leaq 0x3f(%r12), %rdx
testq %r12, %r12
cmovnsq %r12, %rdx
sarq $0x6, %rdx
shlq $0x3, %rdx
addq 0xd0(%r14), %rdx
movq %r12, %rcx
andq 0x8(%rsp), %rcx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rcx
setbe %sil
movl $0x1, %edi
movl %r12d, %ecx
shlq %cl, %rdi
orq %rdi, -0x8(%rdx,%rsi,8)
cmpb $0x0, 0xf9(%r14)
jne 0x4e39f
cmpb $0x31, %bl
jne 0x4e390
incl (%r14)
movq 0x70(%r14), %rcx
incl (%rcx,%r12,4)
cmpb $0x31, %al
jne 0x4e39f
incl (%r14)
movq 0x70(%r14), %rax
incl (%rax,%r12,4)
movq (%r8), %rax
movq 0x8(%r8), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
leaq 0x1(%r12), %rdx
addq $0xa, %r12
addq $0x20, %r13
cmpq %rcx, %r12
movq %rdx, %r12
jne 0x4e2af
leaq 0x38(%rsp), %rdi
callq 0x2e784
leaq 0x50(%rsp), %rdi
callq 0x2e784
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2e784
jmp 0x4e3fb
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2e784
movq %rbx, %rdi
callq 0x8840