// File: tedsharpe[P]ORFCall/ORFCall.cc
// Function: (anonymous namespace)::ORFCaller::report(std::ostream&)
void ORFCaller::report( std::ostream& os )
{
    if ( !mNAlignedReads )
        FatalErr("Not even a single read aligned.");

    auto iORFWTCodon = mRef.getORFWTCodons().begin();
    unsigned codonId = 0;

    size_t minAA = std::numeric_limits<size_t>::max();
    size_t minAAIdx = 0;
    size_t maxAA = std::numeric_limits<size_t>::min();
    size_t maxAAIdx = 0;
    size_t totAA = 0;
    os << std::setprecision(5) << std::fixed;
    os << "\nCodon\tWT\tmin%sub\tmean%\tmax%\n";
    std::vector<size_t> aaCounts;
    for ( CodonCounts const& cCounts : mCCV )
    {
        mAANamer.getAACounts(cCounts.mCounts,&aaCounts);
        size_t aaId = mAANamer.indexFor(*iORFWTCodon);
        ++iORFWTCodon;
        size_t min = std::numeric_limits<size_t>::max();
        size_t max = std::numeric_limits<size_t>::min();
        size_t tot = 0;
        size_t aa = 0;
        auto iWildType=aaCounts.begin()+aaId;
        for ( auto itr=aaCounts.begin(),end=aaCounts.end(); itr != end; ++itr )
        {
            if ( itr == iWildType ) continue;
            size_t count = *itr;
            if ( count < min ) min = count;
            if ( count > max ) max = count;
            if ( count ) ++aa;
            tot += count;
        }
        double dTot = cCounts.mCoverage/100.;
        os << ++codonId
                  << '\t' << mAANamer[aaId]
                  << '\t' << min/dTot
                  << '\t' << tot/dTot/(aaCounts.size()-1)
                  << '\t' << max/dTot
                  << '\n';
        if ( aa < minAA ) { minAA = aa; minAAIdx = codonId; }
        if ( aa > maxAA ) { maxAA = aa; maxAAIdx = codonId; }
        totAA += aa;
    }
    os << "\nRepresented non-WT AA counts:\n";
    os << "min=" << minAA << " for codon " << minAAIdx << '\n';
    os << "mean=" << 1.*totAA/mCCV.size() << '\n';
    os << "max=" << maxAA << " for codon " << maxAAIdx << '\n';

    os << "\nIndel rates:\n";
    os << 100.*mNFPIndelReads/mNAlignedReads
         << "% of aligning reads contained frame-preserving indels.\n";
    os << 100.*mNFSIndelReads/mNAlignedReads
         << "% of aligning reads contained frame-shifting indels.\n";
}

// Assembly:
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, 0x1d0(%rsp)
movq %rsi, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0xe0(%rsp)
cmpq $0x0, 0x38(%rax)
jne 0x70aa
movq 0x25f6b(%rip), %rdi     # 0x2cff0
leaq 0x1ad52(%rip), %rsi     # 0x21dde
callq 0x4290
movq %rax, %rdi
movq 0x25f0d(%rip), %rsi     # 0x2cfa8
callq 0x42b0
movl $0x1, %edi
callq 0x42f0
movq 0xe0(%rsp), %rax
movq (%rax), %rdi
callq 0xc0a0
movq %rax, %rdi
callq 0x1e3c0
movq %rax, 0x1c0(%rsp)
movl $0x0, 0x1bc(%rsp)
callq 0x20c30
movq %rax, 0x1b0(%rsp)
movq $0x0, 0x1a8(%rsp)
callq 0x20c40
movq %rax, 0x1a0(%rsp)
movq $0x0, 0x198(%rsp)
movq $0x0, 0x190(%rsp)
movq 0x1c8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movl $0x5, %edi
callq 0x20c50
movq 0xd8(%rsp), %rdi
movl %eax, 0x18c(%rsp)
movl 0x18c(%rsp), %esi
callq 0x4460
movq %rax, %rdi
leaq 0x19b1e(%rip), %rsi     # 0x20c70
callq 0x40e0
movq 0x1c8(%rsp), %rdi
leaq 0x1ac98(%rip), %rsi     # 0x21dfe
callq 0x4290
leaq 0x170(%rsp), %rdi
callq 0x1fe70
movq 0xe0(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rdi
callq 0x145b0
movq %rax, 0x160(%rsp)
movq 0x168(%rsp), %rdi
callq 0x16950
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x14620
testb $0x1, %al
jne 0x71d4
jmp 0x763f
leaq 0x160(%rsp), %rdi
callq 0x16980
movq %rax, %rcx
movq 0xe0(%rsp), %rax
movq %rcx, 0x150(%rsp)
movq 0x10(%rax), %rdi
movq 0x150(%rsp), %rsi
leaq 0x170(%rsp), %rdx
callq 0x169f0
jmp 0x720f
movq 0xe0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xc8(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x1e4e0
movq 0xc8(%rsp), %rdi
movl (%rax), %esi
callq 0x16ad0
movq %rax, 0xd0(%rsp)
jmp 0x7249
movq 0xd0(%rsp), %rax
movq %rax, 0x138(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x1e580
callq 0x20c30
movq %rax, 0x130(%rsp)
callq 0x20c40
movq %rax, 0x128(%rsp)
movq $0x0, 0x120(%rsp)
movq $0x0, 0x118(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x1fe80
movq %rax, 0x108(%rsp)
movq 0x138(%rsp), %rsi
leaq 0x108(%rsp), %rdi
callq 0x20c90
movq %rax, 0x110(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x1fe80
movq %rax, 0x100(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x1feb0
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x1fee0
testb $0x1, %al
jne 0x7312
jmp 0x73fd
leaq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x20cd0
testb $0x1, %al
jne 0x732d
jmp 0x7358
jmp 0x73eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x1ff50
jmp 0x7872
leaq 0x100(%rsp), %rdi
callq 0x1ff20
movq (%rax), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
cmpq 0x130(%rsp), %rax
jae 0x7392
movq 0xf0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0xf0(%rsp), %rax
cmpq 0x128(%rsp), %rax
jbe 0x73b4
movq 0xf0(%rsp), %rax
movq %rax, 0x128(%rsp)
cmpq $0x0, 0xf0(%rsp)
je 0x73d3
movq 0x118(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x118(%rsp)
movq 0xf0(%rsp), %rax
addq 0x120(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x1ff30
jmp 0x72f4
movq 0x150(%rsp), %rax
vcvtusi2sdq 0x210(%rax), %xmm0, %xmm0
vmovsd 0x19bf4(%rip), %xmm1    # 0x21008
vdivsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0xe8(%rsp)
movq 0x1c8(%rsp), %rdi
movl 0x1bc(%rsp), %esi
incl %esi
movl %esi, 0x1bc(%rsp)
callq 0x4350
movq %rax, 0xc0(%rsp)
jmp 0x7448
movq 0xc0(%rsp), %rdi
movl $0x9, %esi
callq 0x42e0
movq %rax, 0xb8(%rsp)
jmp 0x7464
movq 0xe0(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x138(%rsp), %rsi
callq 0x16af0
movb %al, 0xb7(%rsp)
jmp 0x7486
movq 0xb8(%rsp), %rdi
movb 0xb7(%rsp), %al
movsbl %al, %esi
callq 0x42e0
movq %rax, 0xa8(%rsp)
jmp 0x74a7
movq 0xa8(%rsp), %rdi
movl $0x9, %esi
callq 0x42e0
movq %rax, 0xa0(%rsp)
jmp 0x74c3
movq 0xa0(%rsp), %rdi
vcvtusi2sdq 0x130(%rsp), %xmm0, %xmm0
vmovsd 0xe8(%rsp), %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x98(%rsp)
jmp 0x74ef
movq 0x98(%rsp), %rdi
movl $0x9, %esi
callq 0x42e0
movq %rax, 0x90(%rsp)
jmp 0x750b
vcvtusi2sdq 0x120(%rsp), %xmm0, %xmm0
vmovsd 0xe8(%rsp), %xmm1
vdivsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0x80(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x20240
vmovsd 0x80(%rsp), %xmm0
movq 0x90(%rsp), %rdi
decq %rax
vcvtusi2sd %rax, %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x88(%rsp)
jmp 0x7563
movq 0x88(%rsp), %rdi
movl $0x9, %esi
callq 0x42e0
movq %rax, 0x78(%rsp)
jmp 0x757c
movq 0x78(%rsp), %rdi
vcvtusi2sdq 0x128(%rsp), %xmm0, %xmm0
vmovsd 0xe8(%rsp), %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x70(%rsp)
jmp 0x75a2
movq 0x70(%rsp), %rdi
movl $0xa, %esi
callq 0x42e0
jmp 0x75b3
movq 0x118(%rsp), %rax
cmpq 0x1b0(%rsp), %rax
jae 0x75e4
movq 0x118(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movl 0x1bc(%rsp), %eax
movq %rax, 0x1a8(%rsp)
movq 0x118(%rsp), %rax
cmpq 0x1a0(%rsp), %rax
jbe 0x7615
movq 0x118(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movl 0x1bc(%rsp), %eax
movq %rax, 0x198(%rsp)
movq 0x118(%rsp), %rax
addq 0x190(%rsp), %rax
movq %rax, 0x190(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x14670
jmp 0x71b6
movq 0x1c8(%rsp), %rdi
leaq 0x1a7ce(%rip), %rsi     # 0x21e1c
callq 0x4290
jmp 0x7655
movq 0x1c8(%rsp), %rdi
leaq 0x1a7d8(%rip), %rsi     # 0x21e3c
callq 0x4290
movq %rax, 0x68(%rsp)
jmp 0x7670
movq 0x68(%rsp), %rdi
movq 0x1b0(%rsp), %rsi
callq 0x4070
movq %rax, 0x60(%rsp)
jmp 0x7689
movq 0x60(%rsp), %rdi
leaq 0x1a25f(%rip), %rsi     # 0x218f4
callq 0x4290
movq %rax, 0x58(%rsp)
jmp 0x76a1
movq 0x58(%rsp), %rdi
movq 0x1a8(%rsp), %rsi
callq 0x4070
movq %rax, 0x50(%rsp)
jmp 0x76ba
movq 0x50(%rsp), %rdi
movl $0xa, %esi
callq 0x42e0
jmp 0x76cb
movq 0x1c8(%rsp), %rdi
leaq 0x1a767(%rip), %rsi     # 0x21e41
callq 0x4290
movq %rax, 0x48(%rsp)
jmp 0x76e6
movq 0xe0(%rsp), %rdi
vcvtusi2sdq 0x190(%rsp), %xmm0, %xmm0
vmovsd %xmm0, 0x38(%rsp)
addq $0x18, %rdi
callq 0x16b20
vmovsd 0x38(%rsp), %xmm0
movq 0x48(%rsp), %rdi
vcvtusi2sd %rax, %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x40(%rsp)
jmp 0x7726
movq 0x40(%rsp), %rdi
movl $0xa, %esi
callq 0x42e0
jmp 0x7737
movq 0x1c8(%rsp), %rdi
leaq 0x1a701(%rip), %rsi     # 0x21e47
callq 0x4290
movq %rax, 0x30(%rsp)
jmp 0x7752
movq 0x30(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x4070
movq %rax, 0x28(%rsp)
jmp 0x776b
movq 0x28(%rsp), %rdi
leaq 0x1a17d(%rip), %rsi     # 0x218f4
callq 0x4290
movq %rax, 0x20(%rsp)
jmp 0x7783
movq 0x20(%rsp), %rdi
movq 0x198(%rsp), %rsi
callq 0x4070
movq %rax, 0x18(%rsp)
jmp 0x779c
movq 0x18(%rsp), %rdi
movl $0xa, %esi
callq 0x42e0
jmp 0x77ad
movq 0x1c8(%rsp), %rdi
leaq 0x1a690(%rip), %rsi     # 0x21e4c
callq 0x4290
jmp 0x77c3
movq 0xe0(%rsp), %rax
movq 0x1c8(%rsp), %rdi
vcvtusi2sdq 0x40(%rax), %xmm0, %xmm0
vmovsd 0x19826(%rip), %xmm1    # 0x21008
vmulsd %xmm1, %xmm0, %xmm0
vcvtusi2sdq 0x38(%rax), %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x10(%rsp)
jmp 0x77fd
movq 0x10(%rsp), %rdi
leaq 0x1a652(%rip), %rsi     # 0x21e5b
callq 0x4290
jmp 0x7810
movq 0xe0(%rsp), %rax
movq 0x1c8(%rsp), %rdi
vcvtusi2sdq 0x48(%rax), %xmm0, %xmm0
vmovsd 0x197d9(%rip), %xmm1    # 0x21008
vmulsd %xmm1, %xmm0, %xmm0
vcvtusi2sdq 0x38(%rax), %xmm1, %xmm1
vdivsd %xmm1, %xmm0, %xmm0
callq 0x4580
movq %rax, 0x8(%rsp)
jmp 0x784a
movq 0x8(%rsp), %rdi
leaq 0x1a63d(%rip), %rsi     # 0x21e93
callq 0x4290
jmp 0x785d
leaq 0x170(%rsp), %rdi
callq 0x1ff50
addq $0x1d8, %rsp            # imm = 0x1D8
retq
movq 0x148(%rsp), %rdi
callq 0x4510
nop