// File: /workspace/github_cpp_makefile_star2_O3/millanek[P]evo/process_vcf_coding_sequences.cpp
// Function: printPerGeneSummaries(std::basic_ofstream<char, std::char_traits<char>>*&, Annotation&)
void printPerGeneSummaries(std::ofstream*& stopsPerGeneSummaryFile, Annotation& wgAnnotation) {
    std::string previousGene = "";
    int numTranscripsWithStopsThisGene = 0;
    double stopAlleleFrequencySum = 0;
    std::vector<double> stopPosPctVec;
    for (std::vector<string>::size_type i = 0; i != stopsTranscriptRecord.size(); i++) {
         std::cerr << "previousGene: " << previousGene << std::endl;
        std::vector<string> oneTransctipt = split(stopsTranscriptRecord[i], '\t');
        if (geneFromTranscript(oneTransctipt[0]) == previousGene) {
            numTranscripsWithStopsThisGene++;
            stopAlleleFrequencySum += convertToDouble(oneTransctipt[3]);
            double stopPosPct = convertToDouble(oneTransctipt[1]) / convertToDouble(oneTransctipt[2]);
            stopPosPctVec.push_back(stopPosPct);
        } else {
            if (previousGene != "")
                *stopsPerGeneSummaryFile << previousGene << "\t" << numTranscripsWithStopsThisGene << "\t" << wgAnnotation.getTranscriptCount(previousGene) << "\t" << stopAlleleFrequencySum/numTranscripsWithStopsThisGene << "\t" << vector_average(stopPosPctVec) << std::endl;
            previousGene = geneFromTranscript(oneTransctipt[0]);
            numTranscripsWithStopsThisGene = 1; stopAlleleFrequencySum = convertToDouble(oneTransctipt[3]); stopPosPctVec.clear();
            double stopPosPct = convertToDouble(oneTransctipt[1]) / convertToDouble(oneTransctipt[2]);
            stopPosPctVec.push_back(stopPosPct);
        }
        
        // print the final gene
        if (i == (stopsTranscriptRecord.size() - 1)) {
            *stopsPerGeneSummaryFile << geneFromTranscript(oneTransctipt[0]) << "\t" << numTranscripsWithStopsThisGene << "\t" << wgAnnotation.getTranscriptCount(previousGene) << "\t" << stopAlleleFrequencySum/numTranscripsWithStopsThisGene << "\t" << vector_average(stopPosPctVec) << std::endl;
        }
        
        //oneTransctipt[0]
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, 0x80(%rsp)
movq %rdi, 0x88(%rsp)
leaq 0x10(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x5ee86(%rip), %rdx     # 0xcd9cb
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x28a52
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x94a06(%rip), %rax     # 0x103570
cmpq 0x949f7(%rip), %rax     # 0x103568
je 0x6f10d
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x9345d(%rip), %r13     # 0x101fe8
leaq 0x40(%rsp), %rbp
leaq 0x5ee33(%rip), %r12     # 0xcd9ca
xorl %r14d, %r14d
movl $0xe, %edx
movq %r13, %rdi
leaq 0x671d7(%rip), %rsi     # 0xd5d80
callq 0x84e0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq %r15, %rsi
shlq $0x5, %rsi
addq 0x94971(%rip), %rsi     # 0x103568
leaq 0x68(%rsp), %rdi
movl $0x9, %edx
callq 0x4d650
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3be16
movq 0x48(%rsp), %rdx
cmpq 0x8(%rsp), %rdx
jne 0x6ec3d
movq 0x40(%rsp), %rbx
testq %rdx, %rdx
je 0x6ec47
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x8490
testl %eax, %eax
sete %r13b
jmp 0x6ec4a
movq 0x40(%rsp), %rbx
xorl %r13d, %r13d
jmp 0x6ec4a
movb $0x1, %r13b
leaq 0x50(%rsp), %rax
cmpq %rax, %rbx
je 0x6ec64
movq 0x50(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x8480
testb %r13b, %r13b
je 0x6ecde
movq 0x68(%rsp), %rdi
addq $0x60, %rdi
callq 0x75d30
movsd %xmm0, 0x60(%rsp)
movq 0x93364(%rip), %r13     # 0x101fe8
movq 0x68(%rsp), %rdi
addq $0x20, %rdi
callq 0x75d30
movsd %xmm0, 0xc0(%rsp)
movq 0x68(%rsp), %rdi
addq $0x40, %rdi
callq 0x75d30
movsd 0xc0(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x6edee
movsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x6edfb
movq %rsp, %rdi
leaq 0x5ece3(%rip), %rsi     # 0xcd9cb
callq 0x8160
testl %eax, %eax
movq 0x932f2(%rip), %r13     # 0x101fe8
je 0x6ee74
movq 0x88(%rsp), %rax
movq (%rax), %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x8810
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x75eea
movq %rbx, %rdi
movl %eax, %esi
callq 0x8810
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
cvtsi2sd %r14d, %xmm1
movsd 0x38(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x8730
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x37978
movq 0xa8(%rsp), %rcx
movq 0xb0(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rcx, %rdx
je 0x6ee15
cmpq $0x1, %rax
movq %rax, %rdx
adcq $0x0, %rdx
xorpd %xmm0, %xmm0
xorl %esi, %esi
addsd (%rcx,%rsi,8), %xmm0
incq %rsi
cmpq %rsi, %rdx
jne 0x6eddf
jmp 0x6ee19
leaq 0x20(%rsp), %rdi
movq %rbp, %rdx
callq 0x79b8e
incl %r14d
movsd 0x38(%rsp), %xmm0
addsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x6ef2d
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x8730
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x6ee74
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3be16
movq %rsp, %rdi
movq %rbp, %rsi
callq 0x8540
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6eea8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rdi
addq $0x60, %rdi
callq 0x75d30
movsd %xmm0, 0x38(%rsp)
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x6eecd
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
addq $0x20, %rdi
callq 0x75d30
movsd %xmm0, 0x60(%rsp)
movq 0x68(%rsp), %rdi
addq $0x40, %rdi
callq 0x75d30
movsd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x6ef1a
movsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x6ef27
leaq 0x20(%rsp), %rdi
movq %rbp, %rdx
callq 0x79b8e
movl $0x1, %r14d
movq 0x9463c(%rip), %rax     # 0x103570
subq 0x9462d(%rip), %rax     # 0x103568
sarq $0x5, %rax
decq %rax
cmpq %rax, %r15
jne 0x6f0c9
movq 0x88(%rsp), %rax
movq (%rax), %rbx
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3be16
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x8810
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
movq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x75eea
movq %rbx, %rdi
movl %eax, %esi
callq 0x8810
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
cvtsi2sd %r14d, %xmm1
movsd 0x38(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
leaq 0x90(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x37978
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rcx, %rdx
je 0x6f04e
cmpq $0x1, %rax
movq %rax, %rdx
adcq $0x0, %rdx
xorpd %xmm0, %xmm0
xorl %esi, %esi
addsd (%rcx,%rsi,8), %xmm0
incq %rsi
cmpq %rsi, %rdx
jne 0x6f03f
jmp 0x6f052
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x8730
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x6f0ad
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6f0c9
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x68(%rsp), %rdi
callq 0x2e784
incq %r15
movq 0x94493(%rip), %rax     # 0x103570
subq 0x94484(%rip), %rax     # 0x103568
sarq $0x5, %rax
cmpq %rax, %r15
jne 0x6eb9a
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
leaq 0x10(%rsp), %rbx
je 0x6f10d
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x6f123
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6f188
jmp 0x6f188
jmp 0x6f1c2
jmp 0x6f188
jmp 0x6f188
jmp 0x6f188
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x6f18b
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
jmp 0x6f18b
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x6f195
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
jmp 0x6f195
movq %rax, %rbx
leaq 0x10(%rsp), %r14
jmp 0x6f1b6
movq %rax, %rbx
leaq 0x10(%rsp), %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6f1b6
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x68(%rsp), %rdi
callq 0x2e784
jmp 0x6f1ca
movq %rax, %rbx
leaq 0x10(%rsp), %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6f1e1
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x6f1f7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840