// File: /workspace/github_cpp_makefile_star2_O1/readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpFillOptStaticBackward(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 const&)
int dynProg::dpFillOptStaticBackward(const string& ref,const string& query,
        const boundaries& offset){
    //TODO: when changed to mallocs: use row-order traversal
    int        d = 0;
    int bandL = max(bandLeft, bandSize);
    int bandR = max(bandRight, bandSize);
    for(long i = 1; i <= L2; i++ ){
        long idx2 = i-bandL;
        long colRB = i+bandR;
        if(idx2>0){
            d = scores.scoreMatrix[size_t(ref[offset.refE-idx2+1])][size_t(query[offset.queryE-i+1])];
            M[ i ][ idx2 ] = max(M[ i-1 ][ idx2-1 ] + d, M[ i-1 ][ idx2 ] + scores.extendGap);
            idx2++;
        }
        for(long j = max( 1L, idx2); j <= min((long)L1, colRB-1); j++ ){
            d = scores.scoreMatrix[size_t(ref[offset.refE-j+1])][size_t(query[offset.queryE-i+1])];
            M[ i ][ j ] = max(M[ i-1 ][ j-1 ] + d, M[ i ][ j-1 ] + scores.extendGap);
            M[ i ][ j ] = max(M[ i ][ j ], M[ i-1 ][ j ] + scores.extendGap);
        }
        if(colRB <= L1){
            idx2 = colRB;
            d = scores.scoreMatrix[size_t(ref[offset.refE-idx2+1])][size_t(query[offset.queryE-i+1])];
            M[ i ][ idx2 ] = max(M[ i-1 ][ idx2-1 ] + d, M[ i ][ idx2-1 ] + scores.extendGap);
        }
    }
    return 0;
}

// Assembly:
cmpl $0x0, 0x24(%rdi)
jle 0x1ba07
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x30(%rdi), %eax
movl 0x28(%rdi), %r8d
cmpl %r8d, %eax
cmovlel %r8d, %eax
movl 0x2c(%rdi), %r9d
cmpl %r8d, %r9d
cmovgl %r9d, %r8d
movslq %r8d, %r8
movq %r8, -0x8(%rsp)
cltq
movq %rax, -0x10(%rsp)
movq 0x38(%rdi), %r9
leaq 0x10(%r9), %r10
movq 0x8(%rcx), %rax
movq (%rsi), %rsi
movq (%rdx), %rdx
movq (%rdi), %r8
movq %r8, -0x30(%rsp)
movq %rax, -0x20(%rsp)
movq %rsi, -0x28(%rsp)
addq %rsi, %rax
incq %rax
movq %rax, -0x18(%rsp)
movl $0x1, %r12d
movq %r12, %r13
subq -0x8(%rsp), %r13
jle 0x1b8e7
movq -0x20(%rsp), %rax
subq %r13, %rax
movq -0x28(%rsp), %rsi
movsbq 0x1(%rsi,%rax), %rax
movslq 0x14(%rcx), %rsi
subq %r12, %rsi
movsbq 0x1(%rdx,%rsi), %rsi
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq %r10, %rax
movq -0x30(%rsp), %r11
movq -0x8(%r11,%r12,8), %r8
movq (%r11,%r12,8), %r14
movl -0x4(%r8,%r13,4), %ebp
addl (%rax,%rsi,4), %ebp
movl 0xc(%r9), %eax
addl (%r8,%r13,4), %eax
cmpl %eax, %ebp
cmovgl %ebp, %eax
movl %eax, (%r14,%r13,4)
incq %r13
cmpq $0x2, %r13
movl $0x1, %eax
cmovlq %rax, %r13
movq -0x10(%rsp), %rax
leaq (%r12,%rax), %rbp
leaq -0x1(%rbp), %r15
movslq 0x20(%rdi), %rsi
cmpq %rsi, %r15
movq %rsi, %rax
cmovlq %r15, %rax
cmpq %rax, %r13
jg 0x1b990
movq -0x30(%rsp), %rax
movq -0x8(%rax,%r12,8), %r14
movq (%rax,%r12,8), %rax
movq -0x18(%rsp), %r8
subq %r13, %r8
decq %r13
movsbq (%r8), %rsi
movslq 0x14(%rcx), %r11
subq %r12, %r11
movsbq 0x1(%rdx,%r11), %r11
imulq $0x1fc, %rsi, %rsi      # imm = 0x1FC
addq %r10, %rsi
movl (%r14,%r13,4), %ebx
addl (%rsi,%r11,4), %ebx
movl 0xc(%r9), %esi
addl (%rax,%r13,4), %esi
cmpl %esi, %ebx
cmovgl %ebx, %esi
movl %esi, 0x4(%rax,%r13,4)
movl 0xc(%r9), %r11d
addl 0x4(%r14,%r13,4), %r11d
cmpl %r11d, %esi
cmovgl %esi, %r11d
movl %r11d, 0x4(%rax,%r13,4)
movslq 0x20(%rdi), %rsi
cmpq %rsi, %r15
movq %rsi, %r11
cmovlq %r15, %r11
incq %r13
decq %r8
cmpq %r11, %r13
jl 0x1b92d
cmpq %rsi, %rbp
jg 0x1b9e8
movq -0x20(%rsp), %rax
subq %rbp, %rax
movq -0x28(%rsp), %rsi
movsbq 0x1(%rsi,%rax), %rax
movslq 0x14(%rcx), %rsi
subq %r12, %rsi
movsbq 0x1(%rdx,%rsi), %rsi
imulq $0x1fc, %rax, %rax      # imm = 0x1FC
addq %r10, %rax
movq -0x30(%rsp), %r11
movq -0x8(%r11,%r12,8), %r8
movl -0x4(%r8,%rbp,4), %r8d
addl (%rax,%rsi,4), %r8d
movq (%r11,%r12,8), %rax
movl 0xc(%r9), %esi
addl -0x4(%rax,%rbp,4), %esi
cmpl %esi, %r8d
cmovgl %r8d, %esi
movl %esi, (%rax,%rbp,4)
leaq 0x1(%r12), %rax
movslq 0x24(%rdi), %rsi
cmpq %rsi, %r12
movq %rax, %r12
jl 0x1b889
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq