// File: /workspace/github_cpp_makefile_star2_O3/readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpFillStatic(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&, bool, boundaries const&, dp_type const&)
int dynProg::dpFillStatic(const string& ref,const string& query, bool forward,
        const boundaries& offset, const dp_type& type){
    if(!forward)
        return dpFillStaticBackward(ref, query, offset);
    int        d = 0;
    int        local = type.local || (type.freeQueryB && type.freeRefB) ? 0 : 1;//TODO: remove because this will never happen (speed up)
    int bandL = max(bandLeft, bandSize);
    int bandR = max(bandRight, bandSize);
    for(long i = 1; i <= L2; i++ ){
        long idx2 = forward ? i-bandL : L1 - L2 + i - bandL;
        long colRB = forward ? i+bandR : L1 - L2 + i + bandR;
        if(idx2>0){//left value undefined
            d = scores.scoreMatrix[size_t (ref[offset.refB+idx2-1])][size_t (query[offset.queryB+i-1])];
            M[ i ][ idx2 ] = M[ i-1 ][ idx2-1 ] + d;
            UP[i][idx2] = max(M[ i-1 ][ idx2 ] + scores.extendGap + scores.openGap, UP[i-1][idx2]+scores.extendGap);
            M[ i ][ idx2 ] = max(M[ i ][ idx2 ] , UP[i][idx2]);
            //fill in generic value for gapLeft, such that it is defined, but not chosen in next step
            LEFT[i][idx2] = M[ i ][ idx2 ] + scores.extendGap + 2*scores.openGap;
            M[ i ][ idx2 ] = max(M[ i ][ idx2 ], 0 + local*M[ i ][ idx2 ]);
            idx2++;
        }
        for(long j = max( 1L, idx2); j <= min((long)L1, colRB-1); j++ ){
            //here insert substitution matrix!
            d = scores.scoreMatrix[size_t(ref[offset.refB+j-1])][size_t(query[offset.queryB+i-1])];
            UP[i][j] = max(M[ i-1 ][ j ] + scores.extendGap + scores.openGap, UP[i-1][j]+scores.extendGap);
            M[i][j] = M[ i-1 ][ j-1 ] + d;
            LEFT[i][j] = max(M[ i ][ j-1 ] + scores.extendGap + scores.openGap, LEFT[i][j-1]+scores.extendGap);
            M[i][j] = max(M[i][j], LEFT[i][j]);
            M[i][j] = max(M[i][j], UP[i][j]);
            M[ i ][ j ] = max(M[ i ][ j ], 0 + local*M[ i ][ j ]);
        }
        if(colRB <= L1){
            idx2 = colRB;
            d = scores.scoreMatrix[size_t(ref[offset.refB+idx2-1])][size_t(query[offset.queryB+i-1])];
            M[ i ][ idx2 ] = M[ i-1 ][ idx2-1 ] + d;
            LEFT[i][idx2] = max(M[ i ][ idx2-1 ] + scores.extendGap + scores.openGap, LEFT[i][idx2-1]+scores.extendGap);
            M[ i ][ idx2 ] = max(M[ i ][ idx2 ], LEFT[i][idx2]);
            //fill in generic value for gapUp, such that it is defined, but not chosen in next step
            UP[i][idx2] = M[ i ][ idx2 ] + scores.extendGap + 2*scores.openGap;
            M[ i ][ idx2 ] = max(M[ i ][ idx2 ], 0 + local*M[ i ][ idx2 ]);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
testl %ecx, %ecx
je 0x1b03c
xorl %r13d, %r13d
cmpb $0x0, 0x4(%r9)
jne 0x1acf8
movl $0x1, %r13d
cmpb $0x1, 0x2(%r9)
jne 0x1acf8
movzbl (%r9), %r13d
xorl $0x1, %r13d
cmpl $0x0, 0x24(%rdi)
jle 0x1b044
movl 0x30(%rdi), %eax
movl 0x28(%rdi), %ecx
cmpl %ecx, %eax
cmovlel %ecx, %eax
movl 0x2c(%rdi), %r9d
cmpl %ecx, %r9d
cmovgl %r9d, %ecx
movslq %ecx, %rcx
movq %rcx, 0x60(%rsp)
cltq
movq %rax, 0x58(%rsp)
movq 0x38(%rdi), %r10
leaq 0x10(%r10), %rbx
movq (%r8), %rax
movq (%rsi), %rcx
leaq (%rcx,%rax), %rsi
leaq -0x1(%rcx,%rax), %rax
movq %rax, 0x30(%rsp)
movq (%rdx), %rax
movq (%rdi), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rdi), %rcx
movq %rcx, 0x10(%rsp)
movq 0x10(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movq %rax, 0x28(%rsp)
decq %rax
movq %rax, 0x48(%rsp)
movl $0x1, %r14d
movq %r8, 0x68(%rsp)
movl %r13d, 0x24(%rsp)
movq %rbx, 0x50(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x68(%rsp), %r11
movq %r14, %rbp
subq 0x60(%rsp), %rbp
jle 0x1ae38
movq 0x30(%rsp), %rax
movsbq (%rax,%rbp), %rax
movslq 0x10(%r8), %rcx
movq 0x28(%rsp), %rdx
addq %r14, %rdx
movsbq -0x1(%rcx,%rdx), %rcx
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq %rbx, %rax
movq 0x18(%rsp), %r8
movq -0x8(%r8,%r14,8), %rdx
movl -0x4(%rdx,%rbp,4), %r9d
addl (%rax,%rcx,4), %r9d
movq (%r8,%r14,8), %rcx
movl %r9d, (%rcx,%rbp,4)
movl 0xc(%r10), %eax
movl (%rdx,%rbp,4), %edx
addl %eax, %edx
movq 0x10(%rsp), %r8
movq -0x8(%r8,%r14,8), %r9
addl (%r9,%rbp,4), %eax
addl 0x8(%r10), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movq (%r8,%r14,8), %rdx
movl %eax, (%rdx,%rbp,4)
movl (%rcx,%rbp,4), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%rcx,%rbp,4)
addl 0xc(%r10), %eax
movl 0x8(%r10), %edx
leal (%rax,%rdx,2), %eax
movq 0x8(%rsp), %rdx
movq (%rdx,%r14,8), %rdx
movl %eax, (%rdx,%rbp,4)
movl (%rcx,%rbp,4), %eax
movl %eax, %edx
imull %r13d, %edx
cmpl %edx, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%rbp,4)
incq %rbp
cmpq $0x2, %rbp
movl $0x1, %eax
cmovlq %rax, %rbp
movq 0x58(%rsp), %rax
movq %r14, 0x38(%rsp)
addq %r14, %rax
movq %rax, 0x70(%rsp)
leaq -0x1(%rax), %r9
movslq 0x20(%rdi), %rax
cmpq %rax, %r9
movq %rax, %rcx
cmovlq %r9, %rcx
cmpq %rcx, %rbp
movl 0x24(%rsp), %r13d
movq 0x50(%rsp), %rbx
jg 0x1af70
movq 0x48(%rsp), %rax
movq 0x38(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0x18(%rsp), %rax
movq -0x8(%rax,%rcx,8), %rdx
movq (%rax,%rcx,8), %r12
movq 0x10(%rsp), %rax
movq -0x8(%rax,%rcx,8), %r8
movq %r8, 0x78(%rsp)
movq (%rax,%rcx,8), %r14
movq 0x8(%rsp), %rax
movq (%rax,%rcx,8), %rcx
decq %rbp
movsbq (%rsi,%rbp), %rax
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
movl 0xc(%r10), %r8d
movl 0x4(%rdx,%rbp,4), %esi
addl %r8d, %esi
addl 0x8(%r10), %esi
addq %rbx, %rax
movq 0x78(%rsp), %r15
addl 0x4(%r15,%rbp,4), %r8d
cmpl %r8d, %esi
cmovgl %esi, %r8d
movslq 0x10(%r11), %rsi
movq 0x80(%rsp), %r15
movsbq (%r15,%rsi), %rsi
movl (%rax,%rsi,4), %eax
movl %r8d, 0x4(%r14,%rbp,4)
addl (%rdx,%rbp,4), %eax
movl %eax, 0x4(%r12,%rbp,4)
movl 0xc(%r10), %eax
movl (%r12,%rbp,4), %esi
addl %eax, %esi
addl 0x8(%r10), %esi
addl (%rcx,%rbp,4), %eax
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, 0x4(%rcx,%rbp,4)
movl 0x4(%r12,%rbp,4), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, 0x4(%r12,%rbp,4)
movl 0x4(%r14,%rbp,4), %esi
cmpl %esi, %eax
cmovlel %esi, %eax
movl %eax, %esi
imull %r13d, %esi
cmpl %esi, %eax
cmovgl %eax, %esi
movl %esi, 0x4(%r12,%rbp,4)
movslq 0x20(%rdi), %rax
cmpq %rax, %r9
movq %rax, %rsi
cmovlq %r9, %rsi
incq %rbp
cmpq %rsi, %rbp
movq 0x40(%rsp), %rsi
jl 0x1aebe
movq 0x70(%rsp), %r14
cmpq %rax, %r14
movq %r11, %r8
movq 0x38(%rsp), %r9
jg 0x1b029
movq 0x30(%rsp), %rax
movsbq (%rax,%r14), %rax
movslq 0x10(%r8), %rcx
movq 0x28(%rsp), %rdx
addq %r9, %rdx
movsbq -0x1(%rcx,%rdx), %rdx
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq %rbx, %rax
movq 0x18(%rsp), %rcx
movq -0x8(%rcx,%r9,8), %rsi
movq (%rcx,%r9,8), %rcx
movl -0x4(%rsi,%r14,4), %esi
addl (%rax,%rdx,4), %esi
movl %esi, (%rcx,%r14,4)
movl 0xc(%r10), %eax
movl -0x4(%rcx,%r14,4), %edx
addl %eax, %edx
addl 0x8(%r10), %edx
movq 0x8(%rsp), %rsi
movq (%rsi,%r9,8), %rsi
addl -0x4(%rsi,%r14,4), %eax
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%rsi,%r14,4)
movq 0x40(%rsp), %rsi
movl (%rcx,%r14,4), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%rcx,%r14,4)
addl 0xc(%r10), %eax
movl 0x8(%r10), %edx
leal (%rax,%rdx,2), %eax
movq 0x10(%rsp), %rdx
movq (%rdx,%r9,8), %rdx
movl %eax, (%rdx,%r14,4)
movl (%rcx,%r14,4), %eax
movl %eax, %edx
imull %r13d, %edx
cmpl %edx, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%r14,4)
leaq 0x1(%r9), %r14
movslq 0x24(%rdi), %rcx
cmpq %rcx, %r9
jl 0x1ad8c
jmp 0x1b044
movq %r8, %rcx
callq 0x1b058
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq