// File: readmapping[P]alfalfa/src/mapper.cpp
// Function: fullDP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned char const*, int, alignment_t*, int, signed char const*, int, int, int, int)
void fullDP(const string & S, const uint8_t * readP, int Plen, alignment_t * alignment, int fixedBand, 
        const int8_t *mat, int match, int openGap, int extendGap, int print){
    int qLen = alignment->qE - alignment->qB + 1;
    int refLen = (int)(alignment->refE - alignment->refB + 1L);
    int band = bandSizeEstimate(fixedBand, qLen, refLen, match, openGap, extendGap, alignment->alignmentScore);
    //calculate CIGAR STRING
    uint8_t *target;
    target = (uint8_t *)malloc(refLen);
    for (int i = 0; i < refLen; ++i) // convert to the nt4 encoding
        target[i] = Utils::ORDVALUE[(size_t)S[alignment->refB+i]];
    int n_cigar;
    uint32_t * cigar;
    if(print>=2) cerr << "#COSTPOSTPROC " << refLen*band << endl;
    alignment->alignmentScore = ksw_global(qLen, readP+alignment->qB, refLen, target, 5, mat, -1*openGap, -1*extendGap, band, &n_cigar, &cigar);
    alignment->setFieldsKsw(n_cigar, cigar, readP+alignment->qB, target, alignment->qB, Plen-1-alignment->qE);
    free(target);
    free(cigar);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
movl 0xb8(%rsp), %eax
movl 0xb0(%rsp), %eax
movl 0xa8(%rsp), %eax
movl 0xa0(%rsp), %eax
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl %edx, 0x74(%rsp)
movq %rcx, 0x68(%rsp)
movl %r8d, 0x64(%rsp)
movq %r9, 0x58(%rsp)
movq 0x68(%rsp), %rax
movl 0x14(%rax), %eax
movq 0x68(%rsp), %rcx
subl 0x10(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x68(%rsp), %rcx
subq (%rcx), %rax
addq $0x1, %rax
movl %eax, 0x50(%rsp)
movl 0x64(%rsp), %edi
movl 0x54(%rsp), %esi
movl 0x50(%rsp), %edx
movl 0xa0(%rsp), %ecx
movl 0xa8(%rsp), %r8d
movl 0xb0(%rsp), %r9d
movq 0x68(%rsp), %rax
movl 0x70(%rax), %eax
movl %eax, (%rsp)
callq 0x39dd0
movl %eax, 0x4c(%rsp)
movslq 0x50(%rsp), %rdi
callq 0x8560
movq %rax, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x3c712
movq 0x80(%rsp), %rdi
movq 0x68(%rsp), %rax
movq (%rax), %rsi
movslq 0x3c(%rsp), %rax
addq %rax, %rsi
callq 0x8410
movsbq (%rax), %rcx
leaq 0x420ab(%rip), %rax     # 0x7e7a0
movb (%rax,%rcx), %dl
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x3c6c3
cmpl $0x2, 0xb8(%rsp)
jl 0x3c74f
movq 0x5a8cd(%rip), %rdi     # 0x96ff0
leaq 0x414e1(%rip), %rsi     # 0x7dc0b
callq 0x8360
movq %rax, %rdi
movl 0x50(%rsp), %esi
imull 0x4c(%rsp), %esi
callq 0x8710
movq %rax, %rdi
movq 0x5a866(%rip), %rsi     # 0x96fb0
callq 0x83b0
movl 0x54(%rsp), %edi
movq 0x78(%rsp), %rsi
movq 0x68(%rsp), %rax
movslq 0x10(%rax), %rax
addq %rax, %rsi
movl 0x50(%rsp), %edx
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %r9
imull $0xffffffff, 0xa8(%rsp), %ebp # imm = 0xFFFFFFFF
imull $0xffffffff, 0xb0(%rsp), %ebx # imm = 0xFFFFFFFF
movl 0x4c(%rsp), %r11d
movl $0x5, %r8d
leaq 0x38(%rsp), %r10
leaq 0x30(%rsp), %rax
movl %ebp, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x77080
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x70(%rax)
movq 0x68(%rsp), %rdi
movl 0x38(%rsp), %esi
movq 0x30(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x68(%rsp), %rax
movslq 0x10(%rax), %rax
addq %rax, %rcx
movq 0x40(%rsp), %r8
movq 0x68(%rsp), %rax
movl 0x10(%rax), %r9d
movl 0x74(%rsp), %eax
subl $0x1, %eax
movq 0x68(%rsp), %r10
subl 0x14(%r10), %eax
movl %eax, (%rsp)
callq 0x3a320
movq 0x40(%rsp), %rdi
callq 0x8470
movq 0x30(%rsp), %rdi
callq 0x8470
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)