// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %r10
testl %ecx, %ecx
je 0x15c1d
movl $0x0, 0xc(%rsp)
cmpb $0x0, 0x4(%r9)
jne 0x15c43
cmpb $0x1, 0x2(%r9)
jne 0x15c3c
movzbl (%r9), %eax
xorl $0x1, %eax
jmp 0x15c3f
movq %r10, %rsi
movq %r8, %rcx
callq 0x15f74
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movl 0x2c(%rdi), %eax
movl 0x28(%rdi), %ecx
cmpl %ecx, %eax
cmovlel %ecx, %eax
movl 0x30(%rdi), %esi
cmpl %ecx, %esi
cmovgl %esi, %ecx
cltq
movq %rax, 0x58(%rsp)
movslq %ecx, %rax
movq %rax, 0x50(%rsp)
movq 0x38(%rdi), %rax
movq %rax, 0x40(%rsp)
leaq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
movq (%r8), %rax
movq (%r10), %rcx
leaq -0x1(%rcx,%rax), %rax
movq %rax, 0x30(%rsp)
movq (%rdx), %rax
movq %rax, 0x28(%rsp)
movq (%rdi), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %rcx
movq %rdx, 0x68(%rsp)
movq %r10, 0x60(%rsp)
movq %r8, 0x48(%rsp)
movslq 0x24(%rdi), %rax
cmpq %rax, %rcx
jg 0x15c28
movq %rcx, %rbp
subq 0x58(%rsp), %rbp
jle 0x15d82
movq 0x30(%rsp), %rax
movsbq (%rax,%rbp), %rax
movslq 0x10(%r8), %r9
movq 0x28(%rsp), %rsi
addq %rcx, %rsi
movsbq -0x1(%r9,%rsi), %r9
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq 0x38(%rsp), %rax
movq 0x20(%rsp), %rbx
movq -0x8(%rbx,%rcx,8), %rsi
movl -0x4(%rsi,%rbp,4), %r11d
addl (%rax,%r9,4), %r11d
movq (%rbx,%rcx,8), %r9
movl %r11d, (%r9,%rbp,4)
movq 0x40(%rsp), %rbx
movl 0xc(%rbx), %eax
movl (%rsi,%rbp,4), %esi
addl %eax, %esi
movq 0x18(%rsp), %r14
movq -0x8(%r14,%rcx,8), %r11
addl (%r11,%rbp,4), %eax
addl 0x8(%rbx), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movq (%r14,%rcx,8), %rsi
movl %eax, (%rsi,%rbp,4)
movl (%r9,%rbp,4), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, (%r9,%rbp,4)
addl 0xc(%rbx), %eax
movl 0x8(%rbx), %esi
leal (%rax,%rsi,2), %eax
movq 0x10(%rsp), %rsi
movq (%rsi,%rcx,8), %rsi
movl %eax, (%rsi,%rbp,4)
movl (%r9,%rbp,4), %eax
movl %eax, %esi
imull 0xc(%rsp), %esi
cmpl %esi, %eax
cmovgl %eax, %esi
movl %esi, (%r9,%rbp,4)
leaq -0x1(%rcx), %rsi
incq %rbp
jmp 0x15d86
leaq -0x1(%rcx), %rsi
cmpq $0x2, %rbp
pushq $0x1
popq %rax
cmovlq %rax, %rbp
movq 0x50(%rsp), %rax
leaq (%rcx,%rax), %rax
movq %rax, 0x70(%rsp)
leaq -0x1(%rax), %r9
movq 0x38(%rdi), %r11
leaq 0x10(%r11), %rax
movq %rax, 0x80(%rsp)
movq (%r8), %rax
movq (%r10), %r8
leaq -0x1(%r8,%rax), %rax
movq %rax, 0x78(%rsp)
movq (%rdx), %rax
leaq (%rax,%rcx), %r13
decq %r13
movq (%rdi), %r12
movq 0x8(%rdi), %r15
movq 0x10(%rdi), %r10
movslq 0x20(%rdi), %rax
cmpq %rax, %r9
movq %rax, %rdx
cmovlq %r9, %rdx
cmpq %rdx, %rbp
jg 0x15ea7
movq %rdi, %r14
movq 0x78(%rsp), %rax
movsbq (%rax,%rbp), %rax
movq (%r12,%rsi,8), %rdx
movl 0xc(%r11), %r8d
movl (%rdx,%rbp,4), %ebx
addl %r8d, %ebx
movq (%r15,%rsi,8), %rdi
addl (%rdi,%rbp,4), %r8d
movq 0x48(%rsp), %rdi
movslq 0x10(%rdi), %rdi
movsbq (%r13,%rdi), %rdi
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq 0x80(%rsp), %rax
addl 0x8(%r11), %ebx
movl (%rax,%rdi,4), %eax
cmpl %r8d, %ebx
cmovgl %ebx, %r8d
movq (%r15,%rcx,8), %rdi
movl %r8d, (%rdi,%rbp,4)
addl -0x4(%rdx,%rbp,4), %eax
movq (%r12,%rcx,8), %rdx
movl %eax, (%rdx,%rbp,4)
movl 0xc(%r11), %eax
movl -0x4(%rdx,%rbp,4), %r8d
addl %eax, %r8d
addl 0x8(%r11), %r8d
movq (%r10,%rcx,8), %rbx
addl -0x4(%rbx,%rbp,4), %eax
cmpl %eax, %r8d
cmovgl %r8d, %eax
movl %eax, (%rbx,%rbp,4)
movl (%rdx,%rbp,4), %r8d
cmpl %eax, %r8d
cmovgl %r8d, %eax
movl %eax, (%rdx,%rbp,4)
movl (%rdi,%rbp,4), %r8d
cmpl %r8d, %eax
jg 0x15e8d
movl %r8d, %eax
movl %eax, %edi
imull 0xc(%rsp), %edi
cmpl %edi, %eax
cmovgl %eax, %edi
movl %edi, (%rdx,%rbp,4)
incq %rbp
movq %r14, %rdi
jmp 0x15dd8
movq 0x70(%rsp), %r11
cmpq %rax, %r11
movq 0x48(%rsp), %r8
jg 0x15f61
movq 0x30(%rsp), %rax
movsbq (%rax,%r11), %rax
movslq 0x10(%r8), %rdx
movq 0x28(%rsp), %rsi
addq %rcx, %rsi
movsbq -0x1(%rdx,%rsi), %rdx
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq 0x38(%rsp), %rax
movq 0x20(%rsp), %rsi
movq -0x8(%rsi,%rcx,8), %r9
movq (%rsi,%rcx,8), %rsi
movl -0x4(%r9,%r11,4), %r9d
addl (%rax,%rdx,4), %r9d
movl %r9d, (%rsi,%r11,4)
movq 0x40(%rsp), %r10
movl 0xc(%r10), %eax
movl -0x4(%rsi,%r11,4), %edx
addl %eax, %edx
addl 0x8(%r10), %edx
movq 0x10(%rsp), %r9
movq (%r9,%rcx,8), %r9
addl -0x4(%r9,%r11,4), %eax
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%r9,%r11,4)
movl (%rsi,%r11,4), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%rsi,%r11,4)
addl 0xc(%r10), %eax
movl 0x8(%r10), %edx
leal (%rax,%rdx,2), %eax
movq 0x18(%rsp), %rdx
movq (%rdx,%rcx,8), %rdx
movl %eax, (%rdx,%r11,4)
movl (%rsi,%r11,4), %eax
movl %eax, %edx
imull 0xc(%rsp), %edx
cmpl %edx, %eax
cmovgl %eax, %edx
movl %edx, (%rsi,%r11,4)
incq %rcx
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %r10
jmp 0x15cbb
nop