// File: /workspace/github_cpp_makefile_star2_O1/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 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x62e1e(%rip), %rdx     # 0xd1c7f
leaq 0x40(%rsp), %rdi
movq %rdx, %rsi
callq 0x28952
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x9d6e1(%rip), %rax     # 0x10c568
cmpq 0x9d6d2(%rip), %rax     # 0x10c560
je 0x6f42c
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x68(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x62dcc(%rip), %r12     # 0xd1c7e
xorl %r14d, %r14d
movl $0xe, %edx
movq 0x9c127(%rip), %rdi     # 0x10afe8
leaq 0x6de28(%rip), %rsi     # 0xdccf0
callq 0x84e0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x9c10a(%rip), %rdi     # 0x10afe8
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 0x9d645(%rip), %rsi     # 0x10c560
movq %r13, %rdi
movl $0x9, %edx
callq 0x50624
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3ed36
movq 0x28(%rsp), %rdx
cmpq 0x48(%rsp), %rdx
jne 0x6ef5c
testq %rdx, %rdx
je 0x6ef60
movq 0x40(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x8490
testl %eax, %eax
sete %bl
jmp 0x6ef62
xorl %ebx, %ebx
jmp 0x6ef62
movb $0x1, %bl
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6ef7e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
testb %bl, %bl
je 0x6eff0
movq 0x68(%rsp), %rdi
addq $0x60, %rdi
callq 0x760de
movsd %xmm0, 0x60(%rsp)
movq 0x68(%rsp), %rdi
addq $0x20, %rdi
callq 0x760de
movsd %xmm0, 0xc0(%rsp)
movq 0x68(%rsp), %rdi
addq $0x40, %rdi
callq 0x760de
movsd 0xc0(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x6f0fc
movsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x6f107
leaq 0x40(%rsp), %rdi
leaq 0x62c83(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
je 0x6f199
movq 0x88(%rsp), %rax
movq (%rax), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%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
leaq 0x40(%rsp), %rsi
callq 0x76282
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 0x18(%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
movq %rsp, %rsi
callq 0x3a864
movq 0xa8(%rsp), %rcx
movq 0xb0(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rcx, %rdx
je 0x6f121
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 0x6f0ed
jmp 0x6f125
movq %rsp, %rdi
movq %rbp, %rdx
callq 0x79f34
incl %r14d
movsd 0x18(%rsp), %xmm0
addsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x6f251
xorpd %xmm0, %xmm0
movq %rax, %xmm1
punpckldq 0x5b06e(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5b076(%rip), %xmm1    # 0xca1b0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %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 0x6f199
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3ed36
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x8540
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6f1cf
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rdi
addq $0x60, %rdi
callq 0x760de
movsd %xmm0, 0x18(%rsp)
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x6f1f3
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rdi
addq $0x20, %rdi
callq 0x760de
movsd %xmm0, 0x60(%rsp)
movq 0x68(%rsp), %rdi
addq $0x40, %rdi
callq 0x760de
movsd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x6f240
movsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x6f24b
movq %rsp, %rdi
movq %rbp, %rdx
callq 0x79f34
movl $0x1, %r14d
movq 0x9d310(%rip), %rax     # 0x10c568
subq 0x9d301(%rip), %rax     # 0x10c560
sarq $0x5, %rax
decq %rax
cmpq %rax, %r15
jne 0x6f406
movq 0x88(%rsp), %rax
movq (%rax), %rbx
movq 0x68(%rsp), %rsi
movq %rbp, %rdi
callq 0x3ed36
movq 0x20(%rsp), %rsi
movq 0x28(%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
leaq 0x40(%rsp), %rsi
callq 0x76282
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 0x18(%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
movq %rsp, %rsi
callq 0x3a864
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq %rcx, %rdx
je 0x6f372
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 0x6f363
jmp 0x6f376
xorpd %xmm0, %xmm0
movq %rax, %xmm1
punpckldq 0x5ae1d(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5ae25(%rip), %xmm1    # 0xca1b0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %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 0x6f3ea
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6f406
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r13, %rdi
callq 0x3123c
incq %r15
movq 0x9d150(%rip), %rax     # 0x10c568
subq 0x9d141(%rip), %rax     # 0x10c560
sarq $0x5, %rax
cmpq %rax, %r15
jne 0x6eeb5
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6f442
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6f45e
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6f4bb
jmp 0x6f4bb
jmp 0x6f4eb
jmp 0x6f4bb
jmp 0x6f4bb
jmp 0x6f4bb
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x6f4df
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
jmp 0x6f4da
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x6f4c3
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
jmp 0x6f4c3
movq %rax, %rbx
jmp 0x6f4df
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6f4df
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x68(%rsp), %rdi
callq 0x3123c
jmp 0x6f4ee
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6f504
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6f520
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840