// File: 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:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movq 0xc0(%rsp), %rsi
movq %rsi, 0x38(%rsp)
movl $0x0, 0xa4(%rsp)
movq %rsi, %rdi
addq $0x2c, %rdi
addq $0x28, %rsi
callq 0x14d40
movq 0x38(%rsp), %rsi
movl (%rax), %eax
movl %eax, 0xa0(%rsp)
movq %rsi, %rdi
addq $0x30, %rdi
addq $0x28, %rsi
callq 0x14d40
movl (%rax), %eax
movl %eax, 0x9c(%rsp)
movq $0x1, 0x90(%rsp)
movq 0x38(%rsp), %rcx
movq 0x90(%rsp), %rax
movslq 0x24(%rcx), %rcx
cmpq %rcx, %rax
jg 0x34295
movq 0x90(%rsp), %rax
movslq 0xa0(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rax
movslq 0x9c(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x88(%rsp)
jle 0x33f40
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rsi
subq 0x88(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq %rax, %rcx
movq 0x28(%rsp), %rax
movsbq (%rcx), %rcx
imulq $0x1fc, %rcx, %rcx      # imm = 0x1FC
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rax
movslq 0x14(%rax), %rsi
subq 0x90(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq 0x38(%rsp), %rcx
movq %rax, %rdx
movq 0x30(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xa4(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x88(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xa4(%rsp), %eax
movl %eax, 0x7c(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x88(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x78(%rsp)
leaq 0x7c(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x38(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0x90(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movq $0x1, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x1ec80
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x38(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movslq 0x20(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x80(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x1efc0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq (%rcx), %rax
jg 0x34137
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rsi
subq 0x70(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq %rax, %rcx
movq 0x10(%rsp), %rax
movsbq (%rcx), %rcx
imulq $0x1fc, %rcx, %rcx      # imm = 0x1FC
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rax
movslq 0x14(%rax), %rsi
subq 0x90(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq 0x38(%rsp), %rcx
movq %rax, %rdx
movq 0x18(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xa4(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x70(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xa4(%rsp), %eax
movl %eax, 0x54(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x70(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x50(%rsp)
leaq 0x54(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x14d40
movq 0x38(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x70(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x70(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x70(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x4c(%rsp)
leaq 0x4c(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x38(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0x90(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x70(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x33f63
movq 0x38(%rsp), %rcx
movq 0x80(%rsp), %rax
movslq 0x20(%rcx), %rcx
cmpq %rcx, %rax
jg 0x3427a
movq 0x38(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %rcx, 0x88(%rsp)
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, (%rsp)
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rsi
subq 0x88(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq %rax, %rcx
movq (%rsp), %rax
movsbq (%rcx), %rcx
imulq $0x1fc, %rcx, %rcx      # imm = 0x1FC
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rax
movslq 0x14(%rax), %rsi
subq 0x90(%rsp), %rsi
addq $0x1, %rsi
callq 0x8410
movq 0x38(%rsp), %rcx
movq %rax, %rdx
movq 0x8(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xa4(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x88(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xa4(%rsp), %eax
movl %eax, 0x48(%rsp)
movq (%rcx), %rax
movq 0x90(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x88(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x44(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x44(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x38(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0x90(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x88(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x3427c
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x33db2
xorl %eax, %eax
addq $0xc8, %rsp
retq
nop