// File: readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpFillOptStatic(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::dpFillOptStatic(const string& ref,const string& query, bool forward, 
        const boundaries& offset, const dp_type& type){
    if(!forward)
        return dpFillOptStaticBackward(ref, query, offset);
    //TODO: when changed to mallocs: use row-order traversal
    int        d = 0;
    int        local = type.local || (type.freeQueryB && type.freeRefB) ? 0 : 1;
    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){
            d = scores.scoreMatrix[size_t(ref[offset.refB+idx2-1])][size_t(query[offset.queryB+i-1])];
            M[ i ][ idx2 ] = max(M[ i-1 ][ idx2-1 ] + d, M[ i-1 ][ idx2 ] + scores.extendGap);
            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++ ){
            d = scores.scoreMatrix[size_t(ref[offset.refB+j-1])][size_t(query[offset.queryB+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);
            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 ] = max(M[ i-1 ][ idx2-1 ] + d, M[ i ][ idx2-1 ] + scores.extendGap);
            M[ i ][ idx2 ] = max(M[ i ][ idx2 ], 0 + local*M[ i ][ idx2 ]);
        }
    }
    return 0;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movb %cl, %al
movq %rdi, 0xf8(%rsp)
movq %rsi, 0xf0(%rsp)
movq %rdx, 0xe8(%rsp)
andb $0x1, %al
movb %al, 0xe7(%rsp)
movq %r8, 0xd8(%rsp)
movq %r9, 0xd0(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x50(%rsp)
testb $0x1, 0xe7(%rsp)
jne 0x3357f
movq 0x50(%rsp), %rdi
movq 0xf0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
movq 0xd8(%rsp), %rcx
callq 0x33d30
movl %eax, 0x104(%rsp)
jmp 0x33d1e
movl $0x0, 0xcc(%rsp)
movq 0xd0(%rsp), %rcx
movb $0x1, %al
testb $0x1, 0x4(%rcx)
movb %al, 0x4f(%rsp)
jne 0x335c8
movq 0xd0(%rsp), %rcx
xorl %eax, %eax
testb $0x1, 0x2(%rcx)
movb %al, 0x4e(%rsp)
je 0x335c0
movq 0xd0(%rsp), %rax
movb (%rax), %al
movb %al, 0x4e(%rsp)
movb 0x4e(%rsp), %al
movb %al, 0x4f(%rsp)
movq 0x50(%rsp), %rsi
movb 0x4f(%rsp), %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0xc8(%rsp)
movq %rsi, %rdi
addq $0x2c, %rdi
addq $0x28, %rsi
callq 0x14d40
movq 0x50(%rsp), %rsi
movl (%rax), %eax
movl %eax, 0xc4(%rsp)
movq %rsi, %rdi
addq $0x30, %rdi
addq $0x28, %rsi
callq 0x14d40
movl (%rax), %eax
movl %eax, 0xc0(%rsp)
movq $0x1, 0xb8(%rsp)
movq 0x50(%rsp), %rcx
movq 0xb8(%rsp), %rax
movslq 0x24(%rcx), %rcx
cmpq %rcx, %rax
jg 0x33d13
testb $0x1, 0xe7(%rsp)
je 0x33666
movq 0xb8(%rsp), %rax
movslq 0xc4(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x40(%rsp)
jmp 0x3368b
movq 0x50(%rsp), %rcx
movl 0x20(%rcx), %eax
subl 0x24(%rcx), %eax
cltq
addq 0xb8(%rsp), %rax
movslq 0xc4(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xb0(%rsp)
testb $0x1, 0xe7(%rsp)
je 0x336bc
movq 0xb8(%rsp), %rax
movslq 0xc0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
jmp 0x336e1
movq 0x50(%rsp), %rcx
movl 0x20(%rcx), %eax
subl 0x24(%rcx), %eax
cltq
addq 0xb8(%rsp), %rax
movslq 0xc0(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0xa8(%rsp)
cmpq $0x0, 0xb0(%rsp)
jle 0x338af
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
movq 0xf0(%rsp), %rdi
movq 0xd8(%rsp), %rax
movq (%rax), %rsi
addq 0xb0(%rsp), %rsi
subq $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 0xe8(%rsp), %rdi
movq 0xd8(%rsp), %rax
movslq 0x10(%rax), %rsi
addq 0xb8(%rsp), %rsi
subq $0x1, %rsi
callq 0x8410
movq 0x50(%rsp), %rcx
movq %rax, %rdx
movq 0x30(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xcc(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xcc(%rsp), %eax
movl %eax, 0xa4(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0xa0(%rsp)
leaq 0xa4(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x14d40
movq 0x50(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0xb0(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movl 0xc8(%rsp), %eax
movq (%rcx), %rcx
movq 0xb8(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0xb0(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
addl $0x0, %eax
movl %eax, 0x9c(%rsp)
leaq 0x9c(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x50(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0xb8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb0(%rsp)
movq $0x1, 0x88(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x1ec80
movq (%rax), %rax
movq %rax, 0x90(%rsp)
movq 0x50(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movslq 0x20(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xa8(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x1efc0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq (%rcx), %rax
jg 0x33b44
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0xf0(%rsp), %rdi
movq 0xd8(%rsp), %rax
movq (%rax), %rsi
addq 0x90(%rsp), %rsi
subq $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 0xe8(%rsp), %rdi
movq 0xd8(%rsp), %rax
movslq 0x10(%rax), %rsi
addq 0xb8(%rsp), %rsi
subq $0x1, %rsi
callq 0x8410
movq 0x50(%rsp), %rcx
movq %rax, %rdx
movq 0x18(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xcc(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xcc(%rsp), %eax
movl %eax, 0x74(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x70(%rsp)
leaq 0x74(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x14d40
movq 0x50(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x90(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x6c(%rsp)
leaq 0x6c(%rsp), %rsi
callq 0x14d40
movq 0x50(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x90(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x90(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movl 0xc8(%rsp), %eax
movq (%rcx), %rcx
movq 0xb8(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x90(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
addl $0x0, %eax
movl %eax, 0x68(%rsp)
leaq 0x68(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x50(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0xb8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x90(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x338db
movq 0x50(%rsp), %rcx
movq 0xa8(%rsp), %rax
movslq 0x20(%rcx), %rcx
cmpq %rcx, %rax
jg 0x33cf8
movq 0x50(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rcx, 0xb0(%rsp)
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, (%rsp)
movq 0xf0(%rsp), %rdi
movq 0xd8(%rsp), %rax
movq (%rax), %rsi
addq 0xb0(%rsp), %rsi
subq $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 0xe8(%rsp), %rdi
movq 0xd8(%rsp), %rax
movslq 0x10(%rax), %rsi
addq 0xb8(%rsp), %rsi
subq $0x1, %rsi
callq 0x8410
movq 0x50(%rsp), %rcx
movq %rax, %rdx
movq 0x8(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0xcc(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0xcc(%rsp), %eax
movl %eax, 0x64(%rsp)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x60(%rsp)
leaq 0x64(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x14d40
movq 0x50(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0xb0(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0xb8(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0xb0(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movl 0xc8(%rsp), %eax
movq (%rcx), %rcx
movq 0xb8(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0xb0(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
addl $0x0, %eax
movl %eax, 0x5c(%rsp)
leaq 0x5c(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0x50(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0xb8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xb0(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x33cfa
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x33628
movl $0x0, 0x104(%rsp)
movl 0x104(%rsp), %eax
addq $0x108, %rsp            # imm = 0x108
retq
nopl (%rax)