// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %r9, 0x18(%rsp)
movq %rcx, %r14
movl %edx, 0x4(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
movl 0x78(%rsp), %edi
movl 0x70(%rsp), %edx
movl 0x14(%rcx), %eax
subl 0x10(%rcx), %eax
leal 0x1(%rax), %r9d
movl 0x8(%rcx), %r12d
movq (%rcx), %rbx
subl %ebx, %r12d
leal 0x1(%r12), %r13d
subl %r12d, %eax
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
cmpl %r9d, %r13d
movl %r9d, %ecx
cmovll %r13d, %ecx
imull %edx, %ecx
movl %edi, %eax
subl 0x70(%r14), %eax
addl %ecx, %eax
xorl %r10d, %r10d
subl 0x80(%rsp), %r10d
movl %r9d, (%rsp)
movl %r9d, %ecx
sarl %ecx
imull %edx, %ecx
cltd
idivl %r10d
movl %eax, %r15d
incl %r15d
addl %edi, %ecx
movl %ecx, %eax
cltd
movq %r10, 0x10(%rsp)
idivl %r10d
addl %esi, %eax
incl %eax
cmpl %eax, %r15d
cmovgel %eax, %r15d
cmpl %r8d, %r15d
cmovgel %r8d, %r15d
leal 0x3(%rsi), %eax
cmpl %r15d, %eax
cmovgl %eax, %r15d
movslq %r13d, %rdi
callq 0x7430
movq %rax, %rbp
cmpl $0x7ffffffe, %r12d      # imm = 0x7FFFFFFE
ja 0x2079a
movq 0x8(%rsp), %rax
addq (%rax), %rbx
cmpl $0x2, %r13d
movl $0x1, %eax
cmovgel %r13d, %eax
xorl %ecx, %ecx
leaq 0x2447c(%rip), %rdx     # 0x44c00
movsbq (%rbx,%rcx), %rsi
movb (%rsi,%rdx), %sil
movb %sil, (%rbp,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x20784
cmpl $0x1, 0x88(%rsp)
jle 0x207f8
movq 0x3383d(%rip), %rbx     # 0x53fe8
leaq 0x245f9(%rip), %rsi     # 0x44dab
movl $0xe, %edx
movq %rbx, %rdi
callq 0x7340
movl %r15d, %esi
imull %r13d, %esi
movq %rbx, %rdi
callq 0x75d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movslq 0x10(%r14), %rsi
movq 0x20(%rsp), %rbx
addq %rbx, %rsi
movl 0x78(%rsp), %eax
negl %eax
subq $0x8, %rsp
leaq 0x38(%rsp), %r10
leaq 0x34(%rsp), %r12
movl 0x8(%rsp), %edi
movl %r13d, %edx
movq %rbp, %rcx
movl $0x5, %r8d
movq 0x20(%rsp), %r9
pushq %r10
movq %r10, %r13
pushq %r12
pushq %r15
pushq 0x30(%rsp)
pushq %rax
callq 0x7fdf
addq $0x30, %rsp
movl %eax, 0x70(%r14)
movl (%r12), %esi
movq (%r13), %rdx
movslq 0x10(%r14), %r9
addq %r9, %rbx
movl 0x14(%r14), %eax
notl %eax
addl 0x4(%rsp), %eax
subq $0x8, %rsp
movq %r14, %rdi
movq %rbx, %rcx
movq %rbp, %r8
pushq %rax
callq 0x1f2c4
addq $0x10, %rsp
movq %rbp, %rdi
callq 0x7380
movq (%r13), %rdi
callq 0x7380
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq