// File: /workspace/github_cpp_makefile_star2_O2/tedsharpe[P]ORFCall/ORFCall.cc
// Function: (anonymous namespace)::ORFCaller::findIndels((anonymous namespace)::Alignment const&, std::vector<unsigned char, std::allocator<unsigned char>> const&, std::vector<unsigned char, std::allocator<unsigned char>> const&)
ReadReport ORFCaller::findIndels( Alignment const& aln,
                                  Sequence const& seq,
                                  Quals const& quals )
{
    Sequence const& ref = mRef.getRef();
    Offset refStart = aln.getRefStart()-std::min(aln.getRefStart(),SW_REF_PAD);
    Sequence::const_iterator refItr(ref.begin()+refStart);
    Sequence::const_iterator refEnd(ref.begin()+
                std::min(aln.getRefEnd()+SW_REF_PAD,ref.size()));
    Sequence::const_iterator seqItr, seqEnd;
    Quals::const_iterator qualItr;

    if ( !aln.isReadRC() )
    {
        seqItr = seq.begin() + aln.getReadStart();
        seqEnd = seq.begin() + aln.getReadEnd();
        qualItr = seq.begin() + aln.getReadStart();
    }
    else
    {
        mSeqTmp.clear();
        mSeqTmp.reserve(seq.size());
        for ( auto itr = seq.rbegin(), end = seq.rend(); itr != end; ++itr )
            mSeqTmp.push_back(complement(*itr));
        seqItr = mSeqTmp.begin() + aln.getReadStart();
        seqEnd = mSeqTmp.begin() + aln.getReadEnd();
        mQualsTmp = quals;
        std::reverse(mQualsTmp.begin(),mQualsTmp.end());
        qualItr = mQualsTmp.begin() + aln.getReadStart();
    }

    auto const& blocks = mSW.align(seqItr,seqEnd,refItr,refEnd);
    auto blkItr = blocks.begin();
    if ( blkItr->mDir == SmithWatermanizer::Trace::UP )
    {
        refStart += blkItr->mLen;
        refItr += blkItr->mLen;
        ++blkItr;
    }

    AlignmentScorer alignmentScorer(mRef,refStart,mMinQ);
    std::vector<Variation> indels;
    for ( auto blkEnd(blocks.end()); blkItr != blkEnd; ++blkItr )
    {
        unsigned nnn = blkItr->mLen;
        switch ( blkItr->mDir )
        {
        case SmithWatermanizer::Trace::UP:
            if ( alignmentScorer.inORF() &&
                    qualItr[-1] >= mMinQ && qualItr[0] >= mMinQ )
                indels.push_back(Variation{VariationType::DELETION,
                                            alignmentScorer.getCodonIdx(),
                                            nnn});
            while ( nnn-- )
            {
                alignmentScorer(*refItr,NCALL,0);
                ++refItr;
            }
            break;
        case SmithWatermanizer::Trace::LEFT:
            {
                bool loQ = false;
                while ( nnn-- )
                {
                    if ( *qualItr < mMinQ )
                        loQ = true;
                    ++seqItr; ++qualItr;
                }
                if ( !loQ && alignmentScorer.inORF() )
                    indels.push_back(Variation{VariationType::INSERTION,
                                                alignmentScorer.getCodonIdx(),
                                                blkItr->mLen});
            }
            break;
        case SmithWatermanizer::Trace::DIAG:
            while ( nnn-- )
            {
                alignmentScorer(*refItr,*seqItr,*qualItr);
                ++refItr; ++seqItr; ++qualItr;
            }
            break;
        case SmithWatermanizer::Trace::DONE:
            FatalErr("found DONE block in traceback");
        }
    }
    ReadReport report = alignmentScorer.getReport();
    report.mVariations.insert(report.mVariations.end(),
                                    indels.begin(),indels.end());
    return report;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq (%rdx), %rax
movq %rcx, %rbx
movq (%rsi), %rcx
movq %rsi, %rbp
movq %rdx, %r14
movq 0x8(%rdx), %r12
xorl %esi, %esi
movq %rdi, 0x98(%rsp)
movq %rbp, 0x18(%rsp)
movq %rax, %rdx
subq $0x5, %rdx
movq 0x8(%rcx), %rdi
cmovaeq %rdx, %rsi
movq 0x10(%rcx), %rdx
leaq 0x5(%r12), %rcx
movq %rsi, 0x28(%rsp)
movq %rdi, 0x8(%rsp)
subq %rdi, %rdx
cmpq %rcx, %rdx
cmovaeq %rcx, %rdx
cmpb $0x0, 0x18(%r14)
movq %rdx, 0x40(%rsp)
je 0x72e2
movq 0x58(%rbp), %rax
leaq 0x58(%rbp), %r15
movq %r8, 0x20(%rsp)
cmpq %rax, 0x60(%rbp)
je 0x7294
movq %rax, 0x60(%rbp)
movq 0x8(%rbx), %rsi
movq %r15, %rdi
subq (%rbx), %rsi
callq 0x883e
movq (%rbx), %r12
movq 0x8(%rbx), %r13
leaq 0xb0(%rsp), %rbx
cmpq %r12, %r13
je 0x72f4
movb -0x1(%r13), %al
decq %r13
movl %eax, %ecx
xorb $0x3, %cl
cmpb $0x4, %al
movzbl %cl, %eax
pushq $0x4
popq %rcx
cmovel %ecx, %eax
movq %r15, %rdi
movq %rbx, %rsi
movb %al, 0xb0(%rsp)
callq 0x897c
jmp 0x72b2
movq (%rbx), %rbx
subq %rax, %r12
addq 0x10(%r14), %rbx
addq %rbx, %r12
movq %rbx, %r15
jmp 0x7332
movq 0x18(%rsp), %rbp
movq 0x10(%r14), %r12
movq 0x20(%rsp), %rsi
movq 0x58(%rbp), %rax
leaq 0x70(%rbp), %rdi
leaq (%rax,%r12), %r15
addq 0x8(%r14), %r12
subq (%r14), %r12
addq %rax, %r12
callq 0x9d50
movq 0x70(%rbp), %rdi
movq 0x78(%rbp), %rsi
callq 0x9e3f
movq 0x70(%rbp), %rbx
addq 0x10(%r14), %rbx
movq %r12, %r14
subq %r15, %r14
leaq 0xa0(%rbp), %rdi
leaq 0x88(%rbp), %r13
movq %r14, %rsi
movq %rdi, 0x58(%rsp)
callq 0x9e5a
movq %r13, 0x60(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x9e5a
movq 0x40(%rsp), %r13
movq 0x28(%rsp), %rcx
movq 0xb8(%rbp), %r8
movq 0xc0(%rbp), %rdi
leaq 0x1(%r14), %rax
movq %r14, 0x48(%rsp)
movabsq $0x7ffffffffffffff8, %rdx # imm = 0x7FFFFFFFFFFFFFF8
subq %rcx, %r13
movq %rdi, %r14
subq %r8, %r14
incq %r13
imulq %rax, %r13
movq %r13, %rsi
subq %r14, %rsi
jbe 0x7474
movq 0xc8(%rbp), %rax
subq %rdi, %rax
cmpq %rsi, %rax
jae 0x7491
leaq 0x7(%rdx), %rax
xorq %r14, %rax
cmpq %rsi, %rax
jb 0x7b1b
cmpq %rsi, %r14
movq %rsi, %rdi
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rsi, 0x30(%rsp)
cmovaq %r14, %rdi
addq %r14, %rdi
cmpq %rax, %rdi
cmovaeq %rax, %rdi
movq %rdi, 0x20(%rsp)
callq 0x31e0
movq 0x30(%rsp), %rsi
addq %rax, %r14
movq %rax, %rbp
movq %r14, %rdi
callq 0x8223
movq 0x18(%rsp), %rax
movq 0xb8(%rax), %r14
movq 0xc0(%rax), %rdx
subq %r14, %rdx
testq %rdx, %rdx
jle 0x7433
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3300
testq %r14, %r14
je 0x7440
movq %r14, %rdi
callq 0x31c0
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
addq %rbp, %r13
movq 0x8(%rsp), %rdx
movq %rbp, %r8
addq %rbp, %rcx
movq %rbp, 0xb8(%rax)
movq %r13, 0xc0(%rax)
movq %rcx, 0xc8(%rax)
movq 0x28(%rsp), %rcx
jmp 0x74ae
movq 0x8(%rsp), %rdx
jae 0x74ae
addq %r8, %r13
cmpq %r13, %rdi
je 0x74ae
movq 0x18(%rsp), %rax
movq %r13, 0xc0(%rax)
jmp 0x74ae
callq 0x8223
movq %rax, 0xc0(%rbp)
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rdx
movq 0xb8(%rbp), %r8
movq 0x48(%rsp), %r13
addq %rdx, 0x40(%rsp)
leaq (%rdx,%rcx), %r14
leaq 0x1(%r8), %rcx
movb $0x0, (%r8)
xorl %edx, %edx
leaq 0x1(%r8,%r13), %rax
cmpq %rdx, %r13
je 0x74d9
movb $0x2, (%rcx,%rdx)
incq %rdx
jmp 0x74cb
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rsi
movb (%r15), %dil
movb (%r14), %cl
movq (%rdx), %rdx
movq (%rsi), %r8
movw $0x301, (%rax)          # imm = 0x301
movb %dil, 0x17(%rsp)
cmpb %cl, %dil
pushq $-0x6
popq %rbp
pushq $0x4
popq %rsi
cmovel %esi, %ebp
addq $0x2, %rax
leaq 0x1(%r15), %rsi
movl $0xffffffe4, (%rdx)     # imm = 0xFFFFFFE4
movl %ebp, (%r8)
pushq $-0xe
popq %r10
pushq $-0x1f
popq %r11
xorl %r9d, %r9d
movq %rbx, 0xa0(%rsp)
leaq (%rsi,%r9), %rdi
cmpq %r12, %rdi
je 0x7589
cmpb %cl, (%rdi)
je 0x753c
leal -0x6(%r11), %edi
jmp 0x7540
leal 0x4(%r11), %edi
addl $-0xe, %ebp
addl $-0x3, %r10d
addl $0x11, %edi
cmpl %r10d, %ebp
cmovgl %ebp, %r10d
cmpb $0x2, -0x1(%rax,%r9)
cmovnel %ebp, %r10d
cmpl %r10d, %edi
setl %bl
cmovlel %r10d, %edi
cmpl %r11d, %edi
jg 0x756d
movl %r11d, %edi
xorb $0x3, %bl
movl %edi, %ebp
movb %bl, (%rax,%r9)
movl %r11d, 0x4(%rdx,%r9,4)
movl %edi, 0x4(%r8,%r9,4)
incq %r9
addl $-0x3, %r11d
jmp 0x7529
movq %r15, %rcx
subq %r12, %rcx
notq %r13
addq %r9, %rax
movl %ebp, 0x8(%rsp)
incq %rcx
movq %r13, 0x38(%rsp)
movq %rcx, 0xa8(%rsp)
pushq $0x1
popq %r10
movq %r14, %rcx
movq %rax, %rbp
movq %r15, 0x50(%rsp)
incq %rcx
cmpq 0x40(%rsp), %rcx
je 0x76da
movq 0x60(%rsp), %r9
movq 0x58(%rsp), %r11
movb (%rcx), %dl
movq %rbp, 0x20(%rsp)
movq %rcx, 0x30(%rsp)
movq (%r11), %r13
movq (%r9), %r9
cmpb %dl, 0x17(%rsp)
movb $0x1, (%rax)
pushq $-0x6
popq %rbp
pushq $0x4
popq %rcx
cmovel %ecx, %ebp
movl (%r13), %r8d
movl (%r9), %ecx
leal -0xe(%rcx), %edi
addl $-0x3, %r8d
cmpl %r8d, %edi
cmovgl %edi, %r8d
cmpl %r8d, %ebp
setge %dil
cmovlel %r8d, %ebp
addb %dil, %dil
incb %dil
movb %dil, 0x1(%rax)
movq 0xa8(%rsp), %rdi
movl %r8d, (%r13)
movl %ebp, (%r9)
xorl %r8d, %r8d
leaq (%rax,%rdi), %r15
pushq $-0xe
popq %rbx
leaq (%rsi,%r8), %rdi
cmpq %r12, %rdi
je 0x76b0
leal -0x6(%rcx), %r11d
addl $0x4, %ecx
cmpb %dl, (%rdi)
movl %ecx, %edi
movl 0x4(%r9,%r8,4), %ecx
cmovnel %r11d, %edi
addl $-0xe, %ebp
addl $-0x3, %ebx
cmpl %ebx, %ebp
cmovgl %ebp, %ebx
cmpb $0x2, 0x1(%rax,%r8)
cmovnel %ebp, %ebx
cmpb $0x1, (%r15,%r8)
leal -0xe(%rcx), %ebp
jne 0x7680
movl 0x4(%r13,%r8,4), %r11d
addl $-0x3, %r11d
cmpl %r11d, %ebp
cmovlel %r11d, %ebp
cmpl %ebx, %edi
setl %r11b
cmovlel %ebx, %edi
xorb $0x3, %r11b
cmpl %ebp, %edi
movzbl %r11b, %r11d
cmovlel %ebp, %edi
cmovll %r10d, %r11d
movb %r11b, 0x2(%rax,%r8)
movl %ebp, 0x4(%r13,%r8,4)
movl %edi, 0x4(%r9,%r8,4)
incq %r8
movl %edi, %ebp
jmp 0x7635
movl 0x8(%rsp), %ecx
movq 0x50(%rsp), %r15
leaq 0x2(%rax,%r8), %rax
cmpl %ecx, %ebp
cmovgl %ebp, %ecx
movq 0x20(%rsp), %rbp
movl %ecx, 0x8(%rsp)
movq 0x30(%rsp), %rcx
cmovgq %rax, %rbp
jmp 0x75b8
movq 0x18(%rsp), %r12
decq %rbp
movq %rbp, 0xd0(%r12)
movq 0xd8(%r12), %r13
movq 0xe0(%r12), %rbx
cmpq %r13, %rbx
je 0x770a
movq %r13, %rbx
movq %r13, 0xe0(%r12)
pushq $-0x2
popq %r9
subq 0x48(%rsp), %r9
pushq $0x1
popq %r10
movq 0x28(%rsp), %r8
movq 0x38(%rsp), %rdi
movabsq $0xfffffffffffffff, %r11 # imm = 0xFFFFFFFFFFFFFFF
movq 0xe8(%r12), %rcx
leaq -0x8(%rbx), %rax
movq %rbx, 0x8(%rsp)
xorl %r12d, %r12d
movzbl (%rbp), %ebx
movq %rbp, %rdx
movq %rdi, %rsi
cmpl $0x1, %ebx
je 0x7761
movq %r9, %rsi
cmpl $0x3, %ebx
je 0x7761
testl %ebx, %ebx
je 0x78a1
pushq $-0x1
popq %rsi
leaq (%rdx,%rsi), %rbp
incl %r12d
cmpb (%rdx,%rsi), %bl
je 0x773f
movq 0x8(%rsp), %rsi
cmpq %rcx, %rsi
je 0x7798
movq 0x18(%rsp), %rdx
movb %bl, (%rsi)
movl %r12d, 0x4(%rsi)
addq $0x8, %rsi
addq $0x8, %rax
movq %rsi, 0x8(%rsp)
movq %rsi, 0xe0(%rdx)
jmp 0x773c
movq %rbp, 0x20(%rsp)
movq %rsi, %rbp
subq %r13, %rbp
movabsq $0x7ffffffffffffff8, %rax # imm = 0x7FFFFFFFFFFFFFF8
cmpq %rax, %rbp
je 0x7b27
sarq $0x3, %rbp
cmpq %r13, %rsi
movq %r9, 0x30(%rsp)
movq %rbp, %rax
cmoveq %r10, %rax
leaq (%rax,%rbp), %r15
cmpq %r11, %r15
cmovaeq %r11, %r15
addq %rbp, %rax
cmovbq %r11, %r15
testq %r15, %r15
je 0x7811
leaq (,%r15,8), %rdi
callq 0x31e0
movq 0x8(%rsp), %rsi
movabsq $0xfffffffffffffff, %r11 # imm = 0xFFFFFFFFFFFFFFF
pushq $0x1
popq %r10
movq 0x30(%rsp), %r9
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %r8
jmp 0x7813
xorl %eax, %eax
movb %bl, (%rax,%rbp,8)
movl %r12d, 0x4(%rax,%rbp,8)
movq 0x18(%rsp), %r12
movq 0x20(%rsp), %rbp
leaq 0x8(%rax), %rbx
movq %r13, %rdx
cmpq %rsi, %rdx
je 0x7842
movq (%rdx), %rcx
addq $0x8, %rdx
movq %rcx, -0x8(%rbx)
addq $0x8, %rbx
jmp 0x782c
testq %r13, %r13
je 0x7878
movq %r13, %rdi
movq %r10, %r13
movq %rax, 0x8(%rsp)
callq 0x31c0
movq 0x8(%rsp), %rax
movq 0x30(%rsp), %r9
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %r8
movabsq $0xfffffffffffffff, %r11 # imm = 0xFFFFFFFFFFFFFFF
movq %r13, %r10
leaq (%rax,%r15,8), %rcx
movq 0x50(%rsp), %r15
movq %rax, 0xd8(%r12)
movq %rbx, 0xe0(%r12)
movq %rax, %r13
movq %rcx, 0xe8(%r12)
jmp 0x772b
movq 0x18(%rsp), %rdi
cmpq 0x8(%rsp), %r13
je 0x78ca
cmpq %rax, %r13
jae 0x78ca
movq (%r13), %rcx
movq (%rax), %rdx
movq %rdx, (%r13)
movq %rcx, (%rax)
addq $0x8, %r13
addq $-0x8, %rax
jmp 0x78ad
movq 0xd8(%rdi), %rbp
cmpb $0x1, (%rbp)
jne 0x78e4
movl 0x4(%rbp), %eax
addq $0x8, %rbp
addq %rax, %r8
addq %rax, %r14
movq (%rdi), %rsi
movzbl 0x8(%rdi), %ecx
leaq 0xb0(%rsp), %r12
movq %rdi, %rbx
movq %r8, %rdx
movq %r12, %rdi
callq 0x7c88
leaq 0x80(%rsp), %rax
vxorps %xmm0, %xmm0, %xmm0
andq $0x0, 0x10(%rax)
vmovaps %xmm0, (%rax)
movq 0xe0(%rbx), %rax
movq %rax, 0x20(%rsp)
pushq $0x4
popq %r13
movq 0xa0(%rsp), %rbx
cmpq 0x20(%rsp), %rbp
je 0x7a8e
movzbl (%rbp), %eax
cmpq $0x3, %rax
ja 0x7a7b
leaq 0x3722(%rip), %rcx      # 0xb070
movq %rbp, 0x8(%rsp)
movl 0x4(%rbp), %ebp
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xb0(%rsp), %rax
cmpq 0xc0(%rsp), %rax
jb 0x79f6
movq 0x18(%rsp), %rax
movb 0x8(%rax), %al
cmpb %al, -0x1(%rbx)
jb 0x79f6
cmpb %al, (%rbx)
jb 0x79f6
movq 0xd8(%rsp), %rax
movl $0x2, 0x68(%rsp)
subq 0xd0(%rsp), %rax
sarq $0x2, %rax
movq %rax, 0x70(%rsp)
movl %ebp, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x7e78
jmp 0x79f6
subl $0x1, %ebp
jb 0x79fb
movzbl (%r15), %edx
movzbl (%r14), %esi
movzbl (%rbx), %ecx
movq %r12, %rdi
callq 0x7d40
incq %r14
incq %r15
incq %rbx
jmp 0x79bf
movzbl (%r14), %esi
movq %r12, %rdi
movl %r13d, %edx
xorl %ecx, %ecx
callq 0x7d40
incq %r14
subl $0x1, %ebp
jae 0x79e2
movq %rbx, %r13
jmp 0x7a74
movq 0x18(%rsp), %rax
leaq (%rbx,%rbp), %r13
xorl %ecx, %ecx
xorl %edx, %edx
movb 0x8(%rax), %al
cmpl %ecx, %ebp
je 0x7a23
cmpb %al, (%rbx,%rcx)
setb %sil
incq %rcx
orb %sil, %dl
jmp 0x7a10
addq %rbp, %r15
testb $0x1, %dl
jne 0x7a74
movq 0xb0(%rsp), %rax
cmpq 0xc0(%rsp), %rax
jb 0x7a74
movq 0xd8(%rsp), %rax
movl $0x1, 0x68(%rsp)
subq 0xd0(%rsp), %rax
sarq $0x2, %rax
movq %rax, 0x70(%rsp)
movl %ebp, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x7e78
movq 0x8(%rsp), %rbp
jmp 0x7a7e
movq %rbx, %r13
addq $0x8, %rbp
movq %r13, %rbx
pushq $0x4
popq %r13
jmp 0x792e
movq 0x98(%rsp), %rbx
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x7e34
movq 0x80(%rsp), %rdx
movq 0x20(%rbx), %rsi
movq 0x88(%rsp), %rcx
movq %rbx, %r14
addq $0x18, %r14
movq %r14, %rdi
callq 0x8068
leaq 0x80(%rsp), %rdi
callq 0x7e6a
leaq 0x110(%rsp), %rdi
callq 0x7e6a
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x84f1(%rip), %rdi      # 0xfff0
leaq 0x3e4d(%rip), %rsi      # 0xb953
callq 0x31d0
movq %rax, %rdi
callq 0x3110
pushq $0x1
popq %rdi
callq 0x3210
leaq 0x3c59(%rip), %rdi      # 0xb77b
callq 0x3120
leaq 0x3b23(%rip), %rdi      # 0xb651
callq 0x3120
jmp 0x7b4a
movq %r14, %rdi
movq %rax, %rbx
callq 0x7e6a
jmp 0x7b4d
jmp 0x7b4a
jmp 0x7b4a
jmp 0x7b4a
jmp 0x7b4a
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x7e6a
leaq 0x110(%rsp), %rdi
callq 0x7e6a
movq %rbx, %rdi
callq 0x3390
nop