// File: tedsharpe[P]ORFCall/ORFCall.cc
// Function: (anonymous namespace)::AlignmentScorer::AlignmentScorer((anonymous namespace)::Reference const&, unsigned long, unsigned char)
AlignmentScorer( Reference const& ref, Offset refStart, Qual minQ )
    : mRefPos(refStart), mExonItr(ref.getORF().begin()), mNextExon{0,0},
      mWTBeg(ref.getORFWTCodons().begin()), mMinQ(minQ),
      mCodon(0), mPhase(0), mNCodonMismatches(0), mNHiQCalls(0),
      mFirstCodonCovered(0), mNMismatches(0)
    {
        while ( mExonItr->mEnd <= mRefPos )
        {
            mFirstCodonCovered += mExonItr->size();
            ++mExonItr;
        }
        mNextExon = *mExonItr;
        if ( mRefPos > mExonItr->mBegin )
            mFirstCodonCovered += mRefPos - mExonItr->mBegin;
        mPhase = mFirstCodonCovered % 3;
        mFirstCodonCovered = mFirstCodonCovered / 3;
        mWTItr = ref.getORFWTCodons().begin()+mFirstCodonCovered;
        mPlannedItr = ref.getPlannedMasks().begin()+mFirstCodonCovered;
        mCodon = *mWTItr >> ((3 - mPhase)*2);
    }

// Assembly:
subq $0x88, %rsp
movb %cl, %al
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movb %al, 0x6f(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, (%rax)
movq 0x78(%rsp), %rdi
callq 0xf550
movq %rax, %rdi
callq 0xa800
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq $0x0, 0x18(%rax)
movq 0x78(%rsp), %rdi
callq 0xc0a0
movq %rax, %rdi
callq 0x1e3c0
movq 0x28(%rsp), %rdi
movq %rax, 0x20(%rdi)
addq $0x28, %rdi
callq 0x1e3f0
movq 0x28(%rsp), %rdi
addq $0x30, %rdi
callq 0x1e410
movq 0x28(%rsp), %rdi
movb 0x6f(%rsp), %al
movb %al, 0x38(%rdi)
movl $0x0, 0x3c(%rdi)
movl $0x0, 0x40(%rdi)
movl $0x0, 0x44(%rdi)
movl $0x0, 0x48(%rdi)
movq $0x0, 0x50(%rdi)
movq $0x0, 0x58(%rdi)
addq $0x60, %rdi
movq %rdi, 0x30(%rsp)
callq 0xf560
movq 0x28(%rsp), %rdi
addq $0x8, %rdi
callq 0xc060
movq 0x28(%rsp), %rcx
movq 0x8(%rax), %rax
cmpq (%rcx), %rax
ja 0xf0c4
movq 0x28(%rsp), %rdi
addq $0x8, %rdi
callq 0xc060
movq %rax, %rdi
callq 0x9f20
movq 0x28(%rsp), %rdi
addq 0x50(%rdi), %rax
movq %rax, 0x50(%rdi)
addq $0x8, %rdi
callq 0xc070
jmp 0xf07a
movq 0x28(%rsp), %rdi
addq $0x8, %rdi
callq 0xf570
movq 0x28(%rsp), %rdi
movq (%rax), %rcx
movq %rcx, 0x10(%rdi)
movq 0x8(%rax), %rax
movq %rax, 0x18(%rdi)
movq (%rdi), %rax
movq %rax, 0x20(%rsp)
addq $0x8, %rdi
callq 0xc060
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq (%rcx), %rax
jbe 0xf132
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
movq %rax, 0x18(%rsp)
addq $0x8, %rdi
callq 0xc060
movq 0x18(%rsp), %rcx
movq %rax, %rdx
movq 0x28(%rsp), %rax
subq (%rdx), %rcx
addq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rdx
movq %rdx, 0x8(%rsp)
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulxq %rcx, %rsi, %rsi
movq 0x8(%rsp), %rdx
shrq %rsi
movl %esi, %edi
movl %edi, %esi
leal (%rsi,%rsi,2), %esi
subl %esi, %edx
movl %edx, 0x40(%rax)
movq 0x50(%rax), %rdx
mulxq %rcx, %rcx, %rcx
shrq %rcx
movq %rcx, 0x50(%rax)
movq 0x78(%rsp), %rdi
callq 0xc0a0
movq %rax, %rdi
callq 0x1e3c0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x58(%rsp)
movq 0x50(%rax), %rsi
leaq 0x58(%rsp), %rdi
callq 0x1e430
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x60(%rsp)
movq 0x60(%rsp), %rcx
movq %rcx, 0x28(%rax)
movq 0x78(%rsp), %rdi
callq 0xf580
movq %rax, 0x10(%rsp)
jmp 0xf1c7
movq 0x10(%rsp), %rdi
callq 0x1e470
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x48(%rsp)
movq 0x50(%rax), %rsi
leaq 0x48(%rsp), %rdi
callq 0x1e4a0
movq 0x28(%rsp), %rdi
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rdi)
addq $0x28, %rdi
callq 0x1e4e0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movl (%rcx), %edx
movl $0x3, %ecx
subl 0x40(%rax), %ecx
shll %ecx
shrl %cl, %edx
movl %edx, %ecx
movl %ecx, 0x3c(%rax)
addq $0x88, %rsp
retq
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
callq 0xf5a0
movq 0x40(%rsp), %rdi
callq 0x4510
nopl (%rax)