// File: /workspace/github_cpp_makefile_star2_O1/readmapping[P]alfalfa/src/mapper.cpp
// Function: alignment_t::constructCIGAR(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned char const*, int, int, signed char const*, int, int, int, int)
void alignment_t::constructCIGAR(const string& S, const uint8_t * readP, 
        int Plen, int fixedBand, const int8_t *mat, int match, int openGap, int extendGap, int print){
    //use chain to recreate succesfull alignment, but now use other method that recovers alignment
    stringstream sNM;
    editDist = 0;
    int costEx = 0; //performanceCounter
    //start with beginGap:
    if(qB){
        if(print >= 4) cerr << "clipping before start alignment: " << qB << endl;
        sNM << qB << "S";
    }
    assert(chain.size()>0);
    int qLen = qE - qB + 1;
    int refLen = (int)(refE - refB + 1L);
    int band;
    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[refB+i]];
    //before first element of chain
    if(chain[0].query > qB){
        qLen = chain[0].query - qB;
        refLen = (int)(chain[0].ref - refB);
        int n_cigar;
        uint32_t * cigar;
        band = bandSizeEstimate(fixedBand, qLen, refLen, match, openGap, extendGap, alignmentScore);
        costEx += refLen*band;
        if(print >=7 ) cerr << "dp called with dimension " << (qLen) << "x" << (refLen) << " and band " << band << endl;
        ksw_global(qLen, readP+qB, refLen, target, 5, mat, -1*openGap, -1*extendGap, band, &n_cigar, &cigar);
        editDist += recoverCIGAR4(n_cigar, cigar, readP+qB, target, sNM);
        if(print >=4 ) cerr << "current cigar " << sNM.str() << endl;
        free(cigar);        
    }
    sNM << chain[0].len << '=';
    //traverse chain
    for(size_t i = 1; i < chain.size(); i++){
        int qDist = chain[i].query - (chain[i-1].query + chain[i-1].len - 1);
        int refDist = (int) (chain[i].ref - (chain[i-1].ref + chain[i-1].len - 1L));
        if (qDist < 0 || refDist < 0) {
            if (qDist >= refDist)
                qDist -= refDist; //qDist insertions
            else
                refDist -= qDist;
        }
        if (qDist <= 0) {//minRefDist deletions //1+|qDist| matches lost of next mem
            sNM << refDist << 'D' << (chain[i].len - 1 + qDist) << '=';
            editDist += refDist;
        } else if (refDist <= 0) {
            sNM << qDist << 'I' << (chain[i].len - 1 + refDist) << '=';
            editDist += qDist;
        } else if (qDist == 1) {
            sNM << (refDist-1) << 'D' << chain[i].len << '=';
            editDist += refDist-1;
        } else if (refDist == 1) {
            sNM << (qDist-1) << 'I' << chain[i].len << '=';
            editDist += qDist-1;
        } else if (refDist == 2 && qDist==2) {
            sNM << 1 << 'X' << chain[i].len << '=';
            editDist += 1;
        } else {//both distances are positive and not equal to (1,1), otherwise seeds would not be maximal!
            qLen = chain[i].query - 1 - (chain[i-1].query + chain[i-1].len) + 1;
            refLen = (int)(chain[i].ref - 1 - (chain[i-1].ref + chain[i-1].len) + 1);
            int n_cigar;
            uint32_t * cigar;
            band = bandSizeEstimate(fixedBand, qLen, refLen, match, openGap, extendGap, alignmentScore);
            costEx += refLen*band;
            if(print >= 7) cerr << "dp called with dimension " << (qLen) << "x" << (refLen) << " and band " << band << endl;
            ksw_global(qLen, readP+chain[i-1].query + chain[i-1].len, refLen, target+(chain[i-1].ref + chain[i-1].len-refB), 5, mat, -1*openGap, -1*extendGap, band, &n_cigar, &cigar);
            editDist += recoverCIGAR4(n_cigar, cigar, readP+chain[i-1].query + chain[i-1].len, target + (chain[i-1].ref + chain[i-1].len-refB), sNM);
            sNM << chain[i].len << '=';
            free(cigar);
        }
        if(print>= 4) cerr << "current cigar " << sNM.str() << endl;
    }
    //after last element of chain
    int lastIndex = chain.size()-1;
    if(chain[lastIndex].query+chain[lastIndex].len-1 < qE){
        qLen = qE - (chain[lastIndex].query + chain[lastIndex].len) + 1;
        refLen = (int)(refE - (chain[lastIndex].ref + chain[lastIndex].len) + 1);
        int n_cigar;
        uint32_t * cigar;
        band = bandSizeEstimate(fixedBand, qLen, refLen, match, openGap, extendGap, alignmentScore);
        if(print>=7) cerr << "dp called with dimension " << (qLen) << "x" << (refLen) << " and band " << band << endl;
        costEx += refLen*band;
        ksw_global(qLen, readP+chain[lastIndex].query + chain[lastIndex].len, refLen, target+(chain[lastIndex].ref + chain[lastIndex].len-refB), 5, mat, -1*openGap, -1*extendGap, band, &n_cigar, &cigar);
        editDist += recoverCIGAR4(n_cigar, cigar, readP+chain[lastIndex].query + chain[lastIndex].len, target+(chain[lastIndex].ref + chain[lastIndex].len-refB), sNM);
        if(print>=4) cerr << "current cigar " << sNM.str() << endl;
        free(cigar);        
    }    
    //end with possible endGap
    if(Plen-1-qE){
        if(print>=4) cerr << "clipping after end alignment: " << (Plen-1-qE) << endl;
        sNM << (Plen-1-qE) << "S";
    }
    //final results:
    free(target);    
    NMtag = sNM.str();
    cigar = recoverCIGAR3from4(NMtag);
    if(print>=2) cerr << "#COSTPOSTPROC " << costEx << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %r9, 0x60(%rsp)
movl %r8d, 0x4c(%rsp)
movl %ecx, %r12d
movq %rdx, 0x50(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x71e0
movl $0x0, 0x6c(%rbx)
cmpl $0x0, 0x10(%rbx)
je 0x1f778
cmpl $0x4, 0x278(%rsp)
jl 0x1f754
movq 0x348de(%rip), %rdi     # 0x53fe8
leaq 0x25625(%rip), %rsi     # 0x44d36
movl $0x21, %edx
callq 0x7340
movl 0x10(%rbx), %esi
movq 0x348c3(%rip), %rdi     # 0x53fe8
callq 0x75d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0xb0(%rsp), %rdi
movl 0x10(%rbx), %esi
callq 0x75d0
leaq 0x25e36(%rip), %rsi     # 0x455a1
movl $0x1, %edx
movq %rax, %rdi
callq 0x7340
movl 0x8(%rbx), %r15d
movq %rbx, 0x8(%rsp)
movq (%rbx), %rbx
subl %ebx, %r15d
leal 0x1(%r15), %ebp
movslq %ebp, %rdi
callq 0x7430
cmpl $0x7ffffffe, %r15d      # imm = 0x7FFFFFFE
ja 0x1f7cb
movq (%r14), %r8
addq %rbx, %r8
cmpl $0x2, %ebp
movl $0x1, %ecx
cmovgel %ebp, %ecx
xorl %edx, %edx
leaq 0x2544a(%rip), %rsi     # 0x44c00
movsbq (%r8,%rdx), %rdi
movb (%rdi,%rsi), %dil
movb %dil, (%rax,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x1f7b6
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rbp
movq 0xe8(%rbp), %rax
movl 0x8(%rax), %r14d
xorl %r13d, %r13d
subl 0x10(%rbp), %r14d
jle 0x1fa27
movq %rbp, %rsi
movl (%rax), %ebp
subl %ebx, %ebp
movl %ebp, %eax
subl %r14d, %eax
movl %r14d, %edx
cmovll %ebp, %edx
negl %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl 0x260(%rsp), %r8d
imull %r8d, %edx
movl 0x268(%rsp), %eax
movq %rax, %rdi
subl 0x70(%rsi), %eax
addl %edx, %eax
movl 0x270(%rsp), %ebx
negl %ebx
cltd
idivl %ebx
movl %eax, %r13d
incl %r13d
movl %r14d, %eax
sarl %eax
imull %r8d, %eax
addl %edi, %eax
cltd
idivl %ebx
addl %ecx, %eax
incl %eax
cmpl %eax, %r13d
cmovgel %eax, %r13d
leal 0x3(%rcx), %eax
movl 0x4c(%rsp), %ecx
cmpl %ecx, %r13d
cmovgel %ecx, %r13d
cmpl %r13d, %eax
cmovgl %eax, %r13d
cmpl $0x7, 0x278(%rsp)
jl 0x1f905
movq 0x34770(%rip), %rdi     # 0x53fe8
leaq 0x254d9(%rip), %rsi     # 0x44d58
movl $0x19, %edx
callq 0x7340
movq 0x34758(%rip), %rdi     # 0x53fe8
movl %r14d, %esi
callq 0x75d0
movq %rax, %r15
leaq 0x21599(%rip), %rsi     # 0x40e3b
movl $0x1, %edx
movq %rax, %rdi
callq 0x7340
movq %r15, %rdi
movl %ebp, %esi
callq 0x75d0
movq %rax, %r15
leaq 0x254af(%rip), %rsi     # 0x44d72
movl $0xa, %edx
movq %rax, %rdi
callq 0x7340
movq %r15, %rdi
movl %r13d, %esi
callq 0x75d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x8(%rsp), %rax
movslq 0x10(%rax), %rsi
addq 0x50(%rsp), %rsi
movl 0x268(%rsp), %eax
negl %eax
subq $0x8, %rsp
leaq 0x48(%rsp), %r10
leaq 0x3c(%rsp), %r11
movl %r14d, %edi
movl %ebp, %edx
movq 0x40(%rsp), %rcx
movl $0x5, %r8d
movq 0x68(%rsp), %r9
pushq %r10
pushq %r11
pushq %r13
pushq %rbx
pushq %rax
callq 0x7fdf
addq $0x30, %rsp
movl 0x34(%rsp), %edi
movq 0x40(%rsp), %rsi
movq 0x8(%rsp), %rax
movslq 0x10(%rax), %rdx
addq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %r8
movq 0x38(%rsp), %rcx
callq 0x1f0a6
movq 0x8(%rsp), %rcx
addl %eax, 0x6c(%rcx)
cmpl $0x4, 0x278(%rsp)
jl 0x1fa14
movq 0x34652(%rip), %rdi     # 0x53fe8
leaq 0x253e0(%rip), %rsi     # 0x44d7d
movl $0xe, %edx
callq 0x7340
leaq 0xb8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x7540
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x3461e(%rip), %rdi     # 0x53fe8
callq 0x7340
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1fa14
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
imull %ebp, %r13d
movq 0x40(%rsp), %rdi
callq 0x7380
movq 0x8(%rsp), %rbp
leaq 0xb0(%rsp), %rdi
movq 0xe8(%rbp), %rax
movl 0xc(%rax), %esi
callq 0x75d0
leaq 0x10(%rsp), %rsi
movb $0x3d, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x7340
movq %r13, 0x58(%rsp)
movl %r12d, 0x6c(%rsp)
movq 0xe8(%rbp), %rax
movq 0xf0(%rbp), %rcx
subq %rax, %rcx
cmpq $0x11, %rcx
jb 0x1ffb0
movl 0x270(%rsp), %ecx
negl %ecx
movq %rcx, 0x70(%rsp)
movl 0x268(%rsp), %ecx
negl %ecx
movq %rcx, 0x78(%rsp)
movl $0x1, %r13d
xorl %ebx, %ebx
movl 0x18(%rax,%rbx), %ebp
movl 0xc(%rax,%rbx), %ecx
movl 0x8(%rax,%rbx), %edx
addl %ecx, %edx
subl %edx, %ebp
movq 0x10(%rax,%rbx), %r14
addq (%rax,%rbx), %rcx
movl %r14d, %r12d
subl %ecx, %r12d
incl %r12d
movl %ebp, %eax
incl %eax
js 0x1fac9
testl %r12d, %r12d
jns 0x1fad4
movl %eax, %r15d
subl %r12d, %r15d
jge 0x1fad7
subl %eax, %r12d
movl %eax, %r15d
testl %r15d, %r15d
jle 0x1fb4a
testl %r12d, %r12d
jle 0x1fbaf
cmpl $0x1, %r15d
jne 0x1fc0d
decl %r12d
leaq 0xb0(%rsp), %rdi
movl %r12d, %esi
callq 0x75d0
movq 0x8(%rsp), %rbp
movb $0x44, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
movq 0xe8(%rbp), %rcx
movl 0x1c(%rcx,%rbx), %esi
movq %rax, %rdi
callq 0x75d0
movb $0x3d, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
jmp 0x1fba6
leaq 0xb0(%rsp), %rdi
movl %r12d, %esi
callq 0x75d0
movq 0x8(%rsp), %rbp
movb $0x44, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
movq 0xe8(%rbp), %rcx
movl 0x1c(%rcx,%rbx), %ecx
leal (%r15,%rcx), %esi
decl %esi
movq %rax, %rdi
callq 0x75d0
movb $0x3d, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
addl %r12d, 0x6c(%rbp)
jmp 0x1fc74
leaq 0xb0(%rsp), %rdi
movl %r15d, %esi
callq 0x75d0
movq 0x8(%rsp), %rbp
movb $0x49, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
movq 0xe8(%rbp), %rcx
movl 0x1c(%rcx,%rbx), %ecx
leal (%r12,%rcx), %esi
decl %esi
movq %rax, %rdi
callq 0x75d0
movb $0x3d, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
jmp 0x1fc70
cmpl $0x1, %r12d
jne 0x1fd35
decl %r15d
leaq 0xb0(%rsp), %rdi
movl %r15d, %esi
callq 0x75d0
movq 0x8(%rsp), %rbp
movb $0x49, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
movq 0xe8(%rbp), %rcx
movl 0x1c(%rcx,%rbx), %esi
movq %rax, %rdi
callq 0x75d0
movb $0x3d, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
addl %r15d, 0x6c(%rbp)
cmpl $0x4, 0x278(%rsp)
jl 0x1fd08
movl $0xe, %edx
movq 0x3435a(%rip), %rdi     # 0x53fe8
leaq 0x250e8(%rip), %rsi     # 0x44d7d
callq 0x7340
leaq 0x10(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x7540
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x3432b(%rip), %rdi     # 0x53fe8
callq 0x7340
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1fd08
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
incq %r13
movq 0xe8(%rbp), %rax
movq 0xf0(%rbp), %rcx
subq %rax, %rcx
movq %rcx, %rdx
sarq $0x4, %rdx
addq $0x10, %rbx
cmpq %rdx, %r13
jb 0x1fa9c
jmp 0x1ffb0
cmpl $0x2, %r15d
jne 0x1fda1
cmpl $0x2, %r12d
jne 0x1fda1
leaq 0xb0(%rsp), %rdi
movl $0x1, %esi
callq 0x75d0
movq 0x8(%rsp), %rbp
movb $0x58, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
movq 0xe8(%rbp), %rcx
movl 0x1c(%rcx,%rbx), %esi
movq %rax, %rdi
callq 0x75d0
movb $0x3d, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x7340
incl 0x6c(%rbp)
jmp 0x1fc74
subl %ecx, %r14d
movl %r14d, %edx
subl %ebp, %edx
movl %ebp, %eax
cmovll %r14d, %eax
negl %edx
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
movl 0x260(%rsp), %edi
imull %edi, %eax
movl 0x268(%rsp), %edx
movq %rdx, %rsi
addl %esi, %eax
movq 0x8(%rsp), %rdx
subl 0x70(%rdx), %eax
cltd
movq 0x70(%rsp), %r8
idivl %r8d
movl %eax, %r12d
incl %r12d
movl %ebp, %eax
sarl %eax
imull %edi, %eax
addl %esi, %eax
cltd
idivl %r8d
addl %ecx, %eax
incl %eax
cmpl %eax, %r12d
cmovgel %eax, %r12d
leal 0x3(%rcx), %eax
movl 0x4c(%rsp), %ecx
cmpl %ecx, %r12d
cmovgel %ecx, %r12d
cmpl %r12d, %eax
cmovgl %eax, %r12d
cmpl $0x7, 0x278(%rsp)
jl 0x1feb4
movl $0x19, %edx
movq 0x341bc(%rip), %rdi     # 0x53fe8
leaq 0x24f25(%rip), %rsi     # 0x44d58
callq 0x7340
movq 0x341a9(%rip), %rdi     # 0x53fe8
movl %ebp, %esi
callq 0x75d0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x20fe3(%rip), %rsi     # 0x40e3b
callq 0x7340
movq %r15, %rdi
movl %r14d, %esi
callq 0x75d0
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x24ef8(%rip), %rsi     # 0x44d72
callq 0x7340
movq %r15, %rdi
movl %r12d, %esi
callq 0x75d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x8(%rsp), %rdx
movq 0xe8(%rdx), %rax
movslq 0x8(%rax,%rbx), %rsi
addq 0x50(%rsp), %rsi
movslq 0xc(%rax,%rbx), %rcx
addq %rcx, %rsi
addq (%rax,%rbx), %rcx
subq (%rdx), %rcx
addq 0x38(%rsp), %rcx
subq $0x8, %rsp
movl %ebp, %edi
movl %r14d, %edx
movl $0x5, %r8d
movq 0x68(%rsp), %r9
leaq 0x18(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
pushq %r12
pushq 0x90(%rsp)
pushq 0xa0(%rsp)
callq 0x7fdf
addq $0x30, %rsp
movl 0x40(%rsp), %edi
movq 0x8(%rsp), %r8
movq 0xe8(%r8), %rax
movslq 0x8(%rax,%rbx), %rdx
addq 0x50(%rsp), %rdx
movslq 0xc(%rax,%rbx), %rcx
addq %rcx, %rdx
addq (%rax,%rbx), %rcx
movq 0x10(%rsp), %rsi
subq (%r8), %rcx
addq 0x38(%rsp), %rcx
leaq 0xa0(%rsp), %r8
callq 0x1f0a6
movq 0x8(%rsp), %rcx
addl %eax, 0x6c(%rcx)
movq 0xe8(%rcx), %rax
movl 0x1c(%rax,%rbx), %esi
leaq 0xb0(%rsp), %rdi
callq 0x75d0
movb $0x3d, 0x34(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x34(%rsp), %rsi
callq 0x7340
imull %r14d, %r12d
addl 0x58(%rsp), %r12d
movq 0x10(%rsp), %rdi
callq 0x7380
movq %r12, 0x58(%rsp)
movq 0x8(%rsp), %rbp
jmp 0x1fc74
shlq $0x1c, %rcx
movabsq $-0x100000000, %rbx     # imm = 0xFFFFFFFF00000000
addq %rcx, %rbx
movq %rbx, %rsi
sarq $0x1c, %rsi
movl 0xc(%rax,%rsi), %ecx
movl 0x8(%rax,%rsi), %edi
addl %ecx, %edi
movl 0x14(%rbp), %edx
subl %edi, %edx
jge 0x1ffe3
movq 0x58(%rsp), %r13
jmp 0x2027a
addq %rsi, %rax
movq %rbp, %rdi
leal 0x1(%rdx), %ebp
movl 0x8(%rdi), %esi
addl (%rax), %ecx
movl %esi, %eax
subl %ecx, %eax
negl %ecx
leal (%rsi,%rcx), %r12d
incl %r12d
subl %eax, %edx
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
cmpl %ebp, %r12d
movl %ebp, %edx
cmovll %r12d, %edx
movl 0x268(%rsp), %eax
movq %rax, %rsi
subl 0x70(%rdi), %eax
movl 0x260(%rsp), %r8d
imull %r8d, %edx
addl %edx, %eax
movl 0x270(%rsp), %edx
movq %rdx, %rdi
negl %edi
cltd
idivl %edi
movl %eax, %r13d
incl %r13d
movl %ebp, %eax
sarl %eax
imull %r8d, %eax
addl %esi, %eax
cltd
movq %rdi, %r15
idivl %edi
addl %ecx, %eax
incl %eax
cmpl %eax, %r13d
cmovgel %eax, %r13d
leal 0x3(%rcx), %eax
movl 0x4c(%rsp), %ecx
cmpl %ecx, %r13d
cmovgel %ecx, %r13d
cmpl %r13d, %eax
cmovgl %eax, %r13d
cmpl $0x7, 0x278(%rsp)
jl 0x20112
movq 0x33f63(%rip), %rdi     # 0x53fe8
leaq 0x24ccc(%rip), %rsi     # 0x44d58
movl $0x19, %edx
callq 0x7340
movq 0x33f4b(%rip), %rdi     # 0x53fe8
movl %ebp, %esi
callq 0x75d0
movq %rax, %r14
leaq 0x20d8d(%rip), %rsi     # 0x40e3b
movl $0x1, %edx
movq %rax, %rdi
callq 0x7340
movq %r14, %rdi
movl %r12d, %esi
callq 0x75d0
movq %rax, %r14
leaq 0x24ca2(%rip), %rsi     # 0x44d72
movl $0xa, %edx
movq %rax, %rdi
callq 0x7340
movq %r14, %rdi
movl %r13d, %esi
callq 0x75d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
sarq $0x20, %rbx
movq 0x8(%rsp), %rdx
movq 0xe8(%rdx), %rax
shlq $0x4, %rbx
movslq 0x8(%rax,%rbx), %rsi
addq 0x50(%rsp), %rsi
movslq 0xc(%rax,%rbx), %rcx
addq %rcx, %rsi
addq (%rax,%rbx), %rcx
subq (%rdx), %rcx
addq 0x38(%rsp), %rcx
movl 0x268(%rsp), %eax
movq %rax, %r11
negl %r11d
subq $0x8, %rsp
leaq 0x48(%rsp), %rax
leaq 0x3c(%rsp), %r10
movl %ebp, %edi
movl %r12d, %edx
movl $0x5, %r8d
movq 0x68(%rsp), %r9
pushq %rax
pushq %r10
pushq %r13
pushq %r15
pushq %r11
callq 0x7fdf
addq $0x30, %rsp
movl 0x34(%rsp), %edi
movq 0x40(%rsp), %rsi
movq 0x8(%rsp), %r8
movq 0xe8(%r8), %rax
movslq 0x8(%rax,%rbx), %rcx
movq 0x50(%rsp), %rdx
addq %rcx, %rdx
movslq 0xc(%rax,%rbx), %r9
addq %r9, %rdx
addq (%rax,%rbx), %r9
subq (%r8), %r9
movq 0x38(%rsp), %rcx
addq %r9, %rcx
leaq 0xa0(%rsp), %r8
callq 0x1f0a6
movq 0x8(%rsp), %rbp
addl %eax, 0x6c(%rbp)
cmpl $0x4, 0x278(%rsp)
jl 0x20267
movq 0x33e04(%rip), %rdi     # 0x53fe8
leaq 0x24b92(%rip), %rsi     # 0x44d7d
movl $0xe, %edx
callq 0x7340
leaq 0xb8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x7540
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x33dd0(%rip), %rdi     # 0x53fe8
callq 0x7340
movq 0x8(%rsp), %rbp
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x20267
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
imull %r12d, %r13d
addl 0x58(%rsp), %r13d
movq 0x40(%rsp), %rdi
callq 0x7380
movl 0x6c(%rsp), %ebx
decl %ebx
cmpl 0x14(%rbp), %ebx
je 0x2030c
cmpl $0x4, 0x278(%rsp)
jl 0x202e6
movq 0x33d4e(%rip), %rdi     # 0x53fe8
leaq 0x24aeb(%rip), %rsi     # 0x44d8c
movl $0x1e, %edx
callq 0x7340
movl %ebx, %esi
subl 0x14(%rbp), %esi
movq 0x33d31(%rip), %rdi     # 0x53fe8
callq 0x75d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
subl 0x14(%rbp), %ebx
leaq 0xb0(%rsp), %rdi
movl %ebx, %esi
callq 0x75d0
leaq 0x252a2(%rip), %rsi     # 0x455a1
movl $0x1, %edx
movq %rax, %rdi
callq 0x7340
movq 0x38(%rsp), %rdi
callq 0x7380
leaq 0xb8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x7540
leaq 0x78(%rbp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x73c0
movq (%r14), %rdi
leaq 0x20(%rsp), %rbx
cmpq %rbx, %rdi
je 0x20353
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x78(%rbp), %rsi
movq 0x80(%rbp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xc1f4
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x1eeee
addq $0x20, %rbp
leaq 0x10(%rsp), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x73c0
movq (%r14), %rdi
cmpq %rbx, %rdi
je 0x203b5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x203d2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x72f0
cmpl $0x2, 0x278(%rsp)
jl 0x2042d
movq 0x33c05(%rip), %rdi     # 0x53fe8
leaq 0x249c1(%rip), %rsi     # 0x44dab
movl $0xe, %edx
callq 0x7340
movq 0x33bed(%rip), %rdi     # 0x53fe8
movl %r13d, %esi
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
movq 0x33b64(%rip), %rsi     # 0x53f98
leaq 0xa0(%rsp), %rdi
callq 0x7210
leaq 0x120(%rsp), %rdi
callq 0x7100
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x204c1
jmp 0x204c1
jmp 0x20484
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x204c4
movq 0x90(%rsp), %rsi
jmp 0x204b7
jmp 0x204c1
jmp 0x204c1
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x204ad
jmp 0x204c1
jmp 0x204c1
jmp 0x204c1
jmp 0x204c1
jmp 0x204c1
jmp 0x204c1
jmp 0x204c1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x204c4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x204c4
movq %rax, %rbx
movq 0x33acd(%rip), %rsi     # 0x53f98
leaq 0xa0(%rsp), %rdi
callq 0x7210
leaq 0x120(%rsp), %rdi
callq 0x7100
movq %rbx, %rdi
callq 0x7600
nop