// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x28(%rsp)
movl %r8d, 0xc(%rsp)
movq %rcx, %r14
movl %edx, 0x14(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x18(%rsp)
movl 0x14(%rcx), %ebp
movl 0x10(%rcx), %eax
movl %eax, 0x10(%rsp)
subl %eax, %ebp
movl 0x8(%rcx), %ebx
movq (%rcx), %r12
subl %r12d, %ebx
incl %ebx
movl 0x70(%rcx), %eax
movq %rax, 0x20(%rsp)
movslq %ebx, %r13
movq %r13, %rdi
callq 0x7430
movq %rax, %r15
movq 0x18(%rsp), %rax
addq (%rax), %r12
xorl %eax, %eax
testl %r13d, %r13d
movl $0x0, %ecx
cmovgl %ebx, %ecx
leaq 0x1c8db(%rip), %rdx     # 0x36bf0
cmpq %rax, %rcx
je 0x1a32c
movsbq (%r12,%rax), %rsi
movb (%rsi,%rdx), %sil
movb %sil, (%r15,%rax)
incq %rax
jmp 0x1a315
incl %ebp
subq $0x8, %rsp
movl 0x14(%rsp), %edi
movl %ebp, %esi
movl %ebx, %edx
movl 0x88(%rsp), %ecx
movl 0x90(%rsp), %r8d
movl 0x98(%rsp), %r9d
pushq 0x28(%rsp)
callq 0x18fac
popq %rcx
popq %rdx
movl %eax, %r13d
cmpl $0x1, 0x98(%rsp)
movl 0x10(%rsp), %eax
jle 0x1a39a
movq 0x2fc74(%rip), %rdi     # 0x49fe8
leaq 0x1c9f0(%rip), %rsi     # 0x36d6b
callq 0x72b0
movl %r13d, %esi
imull %ebx, %esi
movq %rax, %rdi
callq 0x75c0
movq %rax, %rdi
callq 0x7160
movl 0x10(%r14), %eax
movslq %eax, %rsi
movq 0x30(%rsp), %r12
addq %r12, %rsi
movl 0x88(%rsp), %eax
negl %eax
movl 0x90(%rsp), %ecx
movq %rcx, %r10
negl %r10d
subq $0x8, %rsp
leaq 0x44(%rsp), %r11
pushq $0x5
popq %r8
movl %ebp, %edi
movl %ebx, %edx
movq %r15, %rcx
movq 0x30(%rsp), %r9
leaq 0x48(%rsp), %rbx
pushq %rbx
pushq %r11
movq %r11, %rbp
pushq %r13
pushq %r10
pushq %rax
callq 0x311f5
addq $0x30, %rsp
movl %eax, 0x70(%r14)
movl (%rbp), %esi
movq (%rbx), %rdx
movslq 0x10(%r14), %r9
addq %r9, %r12
movl 0x14(%r14), %eax
notl %eax
addl 0x14(%rsp), %eax
subq $0x8, %rsp
movq %r14, %rdi
movq %r12, %rcx
movq %r15, %r8
pushq %rax
callq 0x192f2
popq %rax
popq %rcx
movq %r15, %rdi
callq 0x7360
movq (%rbx), %rdi
callq 0x7360
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq