// File: /workspace/github_cpp_makefile_star2_O2/readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpBandFull(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::dpBandFull( 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
        std::stringstream ss;
        if(affine)
            dpTraceBackFull( i, j, output, ss, offset, true, ref, query);
        else
            dpTraceBackOptFull( i, j, type, output, ss, offset, true, ref, query);
        //Edit Dist ouput
        if( i > 0 && !type.freeQueryB)
            output.editDist += i;
        if(j > 0 && !type.freeRefB)
            output.editDist += j;
        //Errorstring output
        if(oType == ERRORSTRING || oType == ALL){
            string errorString = ss.str();
            if(i > 0 && !type.freeQueryB)
                errorString.append(i,'I');
            else if(j > 0 && !type.freeRefB)
                errorString.append(j, 'D');
            reverse( errorString.begin(), errorString.end() );
            //create output: errorString
            int iter = 0;
            int temp;
            int errorStringLength = errorString.length();
            while(iter < errorStringLength){
                temp = iter;
                while(iter+1 < errorStringLength && errorString[iter+1]==errorString[temp])
                    iter++;
                iter++;
                output.cigarChars.push_back(errorString[temp]);
                output.cigarLengths.push_back(iter-temp);
            }
        }
    }
    //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 $0x1d8, %rsp            # imm = 0x1D8
movq %r9, 0x10(%rsp)
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
movb 0x228(%rsp), %al
movl 0x220(%rsp), %ecx
movl 0x8(%r14), %edx
subl (%r14), %edx
incl %edx
movl %edx, 0x20(%rdi)
movl 0x14(%r14), %edx
subl 0x10(%r14), %edx
incl %edx
movl %edx, 0x24(%rdi)
andl $0x0, 0x28(%rdi)
movl 0x218(%rsp), %edx
movb $0x1, 0x34(%rdi)
movl %edx, 0x2c(%rdi)
movl %ecx, 0x30(%rdi)
movzbl %al, %ecx
movq %r8, %rsi
xorl %edx, %edx
callq 0x15822
movq 0x38(%r12), %rax
movl 0x8(%rax), %eax
testl %eax, %eax
movq %r14, 0x20(%rsp)
movq %r15, 0x8(%rsp)
movq %r13, 0x18(%rsp)
movl %eax, 0x28(%rsp)
je 0x18118
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %r8
movq %rbx, %r9
callq 0x15be6
jmp 0x1812f
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %r8
movq %rbx, %r9
callq 0x162b8
movq %rbx, %r15
movl 0x20(%r12), %ebx
movl 0x24(%r12), %r14d
movl 0x2c(%r12), %eax
addl %ebx, %eax
cmpl %r14d, %eax
cmovgel %r14d, %eax
leaq 0x4(%rsp), %r13
movl %eax, (%r13)
movl 0x30(%r12), %eax
addl %r14d, %eax
cmpl %ebx, %eax
cmovgel %ebx, %eax
movq %rsp, %rbp
movl %eax, (%rbp)
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x15a46
movq (%r12), %rax
movslq (%r13), %r13
movq (%rax,%r13,8), %rcx
movl (%rbp), %ebp
movslq %ebp, %rax
movl (%rcx,%rax,4), %ecx
movq 0x210(%rsp), %rdx
movl %ecx, 0x4(%rdx)
movq 0x10(%rsp), %rcx
cmpl $0x0, (%rcx)
jle 0x1822d
cmpl %r14d, %r13d
setl %cl
andb 0x3(%r15), %cl
cmpb $0x1, %cl
movq %r15, %r14
movq 0x20(%rsp), %r15
jne 0x181c9
movl 0x10(%r15), %ecx
addl %r13d, %ecx
decl %ecx
movl %ecx, 0x14(%r15)
cmpl %ebx, %ebp
setl %cl
andb 0x1(%r14), %cl
cmpb $0x1, %cl
jne 0x181e4
movq (%r15), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x8(%r15)
leaq 0x50(%rsp), %rdi
callq 0x71e0
cmpl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %rax
je 0x1823a
subq $0x8, %rsp
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x58(%rsp), %r8
movq %r12, %rdi
movq 0x218(%rsp), %rcx
movq %r15, %r9
pushq %rax
pushq 0x18(%rsp)
pushq $0x1
callq 0x16760
addq $0x20, %rsp
jmp 0x18267
movq %r15, %r14
movq 0x20(%rsp), %r15
jmp 0x1839e
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
leaq 0x50(%rsp), %r9
movq %r12, %rdi
movq %r14, %rcx
movq 0x210(%rsp), %r8
pushq %rax
pushq 0x10(%rsp)
pushq $0x1
pushq %r15
callq 0x16e84
addq $0x20, %rsp
movl 0x4(%rsp), %r13d
testl %r13d, %r13d
jle 0x18283
cmpb $0x0, 0x2(%r14)
jne 0x18283
movq 0x210(%rsp), %rax
addl %r13d, (%rax)
movl (%rsp), %ebp
testl %ebp, %ebp
jle 0x1829a
cmpb $0x0, (%r14)
jne 0x1829a
movq 0x210(%rsp), %rax
addl %ebp, (%rax)
movq 0x10(%rsp), %rax
movl (%rax), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0x18394
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x7540
testl %r13d, %r13d
jle 0x182cd
movb $0x49, %al
cmpb $0x0, 0x2(%r14)
movl %r13d, %ecx
je 0x182db
testl %ebp, %ebp
jle 0x182ea
movb $0x44, %al
cmpb $0x0, (%r14)
movl %ebp, %ecx
jne 0x182ea
movl %ecx, %esi
movzbl %al, %edx
leaq 0x30(%rsp), %rdi
callq 0x7300
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
addq %rdi, %rsi
callq 0xa101
movl %ebp, 0x18(%rsp)
movq %r13, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq 0x38(%rsp), %rbx
movq 0x210(%rsp), %r13
leaq 0x8(%r13), %r12
addq $0x20, %r13
movslq %ebx, %rbp
xorl %r15d, %r15d
cmpl %ebx, %r15d
jge 0x18377
movq 0x30(%rsp), %rax
movslq %r15d, %rcx
leaq (%rax,%rcx), %rsi
incq %rcx
movl %r15d, %r14d
cmpq %rbp, %rcx
jge 0x18350
movb (%rax,%rcx), %dl
incl %r14d
incq %rcx
cmpb (%rsi), %dl
je 0x1833c
jmp 0x18353
movl %ebx, %r14d
movq %r12, %rdi
callq 0x18cba
movl %r14d, %eax
subl %r15d, %eax
movl %eax, 0x2c(%rsp)
movq %r13, %rdi
leaq 0x2c(%rsp), %rsi
callq 0x18e08
movl %r14d, %r15d
jmp 0x18325
leaq 0x30(%rsp), %rdi
callq 0x76a8
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r13
movl 0x18(%rsp), %ebp
leaq 0x50(%rsp), %rdi
callq 0x7210
testl %r13d, %r13d
jle 0x183ae
cmpb $0x0, 0x2(%r14)
je 0x183ae
addl %r13d, 0x10(%r15)
testl %ebp, %ebp
jle 0x183bd
cmpb $0x0, (%r14)
je 0x183bd
movl %ebp, %eax
addq %rax, (%r15)
xorl %eax, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x183d5
jmp 0x183dc
movq %rax, %rbx
jmp 0x183e9
jmp 0x183dc
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x76a8
leaq 0x50(%rsp), %rdi
callq 0x7210
movq %rbx, %rdi
callq 0x75e0
nop