// File: /workspace/github_cpp_makefile_star2_O1/readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpBandScore(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, boundaries&, dp_type const&, outputType const&, dp_output&, int, int, bool)
int dynProg::dpBandScore( const string& ref, 
        const string&     query,
        boundaries& offset,
        const dp_type&    type,
        const outputType& oType,
        dp_output&  output, 
        int bandL, 
        int bandR, 
        bool print){
    L1 = offset.refE-offset.refB+1;
    L2 = offset.queryE-offset.queryB+1;
    bandSize = 0;
    banded = true;
    bandLeft = bandL;
    bandRight = bandR;
    assert(L1 >=0 && L2 >= 0 && bandLeft >0 && bandRight > 0);
    //build matrices
    updateMatrix(type, false, print);
    bool affine = scores.openGap != 0;
    //dp
    if(affine)
        dpFillStatic( ref, query, true, offset, type);
    else
        dpFillOptStatic( ref, query, true, offset, type);
    //traceback and output
    int        i = min(L2,L1+bandLeft), j = min(L1,L2+bandRight);
    //find beginPosition for traceBack and find dpScore
    findTraceBackPosStatic(&i,&j,type);
    output.dpScore = M[i][j];
    
    //Next is for output only
    if(oType>DPSCORE){
        //Alter boundaries to return the new positions when free gaps were introduced.
        if(type.freeQueryE && i < L2)
            offset.queryE = offset.queryB+i-1;
        if(type.freeRefE && j < L1)
            offset.refE = offset.refB+j-1;
        //traceBack
        dpTraceBackScore( i, j, offset, output, ref, query);
        //Edit Dist ouput
        if( i > 0 && !type.freeQueryB)
            output.editDist += i;
        if(j > 0 && !type.freeRefB)
            output.editDist += j;
    }
    //change boundaries for local and freeGap types to return changed free boundaries.
    if(type.freeQueryB && i > 0)
        offset.queryB = offset.queryB+i;
    if(type.freeRefB && j > 0)
        offset.refB = offset.refB+j;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x28(%rsp)
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r13
movb 0x88(%rsp), %al
movl 0x80(%rsp), %ecx
movl 0x8(%rbx), %edx
subl (%rbx), %edx
movl 0x78(%rsp), %esi
incl %edx
movl %edx, 0x20(%rdi)
movl 0x14(%rbx), %edx
subl 0x10(%rbx), %edx
incl %edx
movl %edx, 0x24(%rdi)
movl $0x0, 0x28(%rdi)
movb $0x1, 0x34(%rdi)
movl %esi, 0x2c(%rdi)
movl %ecx, 0x30(%rdi)
movzbl %al, %ecx
movq %r8, %rsi
xorl %edx, %edx
callq 0x1aa00
movq 0x38(%r13), %rax
cmpl $0x0, 0x8(%rax)
movq %rbx, 0x30(%rsp)
movq %r15, 0x20(%rsp)
movq %r12, 0x18(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl $0x1, %ecx
movq %rbx, %r8
movq %r14, %r9
je 0x1e2f1
callq 0x1af00
jmp 0x1e2f6
callq 0x1b5ca
movq %r14, %rbx
movl 0x20(%r13), %ebp
movl 0x24(%r13), %r14d
movl 0x2c(%r13), %eax
addl %ebp, %eax
cmpl %r14d, %eax
cmovgel %r14d, %eax
leaq 0x14(%rsp), %r12
movl %eax, (%r12)
movl 0x30(%r13), %eax
addl %r14d, %eax
cmpl %ebp, %eax
cmovgel %ebp, %eax
leaq 0x10(%rsp), %r15
movl %eax, (%r15)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1acd2
movq (%r13), %rax
movslq (%r12), %rcx
movq (%rax,%rcx,8), %rdx
movslq (%r15), %rax
movl (%rdx,%rax,4), %edx
movq 0x70(%rsp), %rsi
movl %edx, 0x4(%rsi)
movq 0x28(%rsp), %rdx
cmpl $0x0, (%rdx)
movq 0x30(%rsp), %r12
jle 0x1e3f4
cmpl %r14d, %ecx
setl %dl
andb 0x3(%rbx), %dl
cmpb $0x1, %dl
jne 0x1e385
movl 0x10(%r12), %edx
addl %edx, %ecx
decl %ecx
movl %ecx, 0x14(%r12)
cmpl %ebp, %eax
setl %cl
andb 0x1(%rbx), %cl
cmpb $0x1, %cl
jne 0x1e3a1
movq (%r12), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x8(%r12)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
leaq 0x14(%rsp), %r15
leaq 0x10(%rsp), %rdx
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rcx
movq 0x70(%rsp), %r8
movq 0x20(%rsp), %r9
callq 0x1e0dc
movl (%r15), %eax
testl %eax, %eax
jle 0x1e3e0
cmpb $0x0, 0x2(%rbx)
jne 0x1e3e0
movq 0x70(%rsp), %rcx
addl %eax, (%rcx)
movl 0x10(%rsp), %eax
testl %eax, %eax
jle 0x1e3f4
cmpb $0x0, (%rbx)
jne 0x1e3f4
movq 0x70(%rsp), %rcx
addl %eax, (%rcx)
movl 0x14(%rsp), %eax
testl %eax, %eax
setg %cl
andb 0x2(%rbx), %cl
cmpb $0x1, %cl
jne 0x1e40a
addl %eax, 0x10(%r12)
movl 0x10(%rsp), %eax
testl %eax, %eax
setg %cl
andb (%rbx), %cl
cmpb $0x1, %cl
jne 0x1e420
movl %eax, %eax
addq %rax, (%r12)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop