// File: readmapping[P]alfalfa/src/dp.cpp
// Function: dynProg::dpBasic(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&, boundaries&, dp_type const&, outputType const&, dp_output&)
int dynProg::dpBasic( const string& ref, 
        const string&     query,
        boundaries& offset,
        const dp_type&    type,
        const outputType& oType,
        dp_output&  output){
    L1 = offset.refE-offset.refB+1;
    L2 = offset.queryE-offset.queryB+1;
    assert(L1 >=0 && L2 >= 0);
    //build matrices
    updateMatrix(type, false, false);
    M[0][0] = 0;
    for(int i = 1; i <= L2; i++)
        M[i][0] = type.freeQueryB ? 0 : scores.openGap + i*scores.extendGap;
    for(int i = 1; i <= L1; i++)
        M[0][i] = type.freeRefB ? 0 : scores.openGap + i*scores.extendGap;
    //dp
    int        d = 0;
    for(long i = 1L; i <= L2; i++ ){
        for(long j = 1L; j <= L1; j++ ){
            //here insert substitution matrix!
            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);
        }
    }
    //traceback and output
    int        i = L2, j = L1;
    //find beginPosition for traceBack and find dpScore
    int maximum = M[i][j];
    for(int idx = L1; idx >= 0; idx--){
        if(M[i][idx] > maximum){
            maximum = M[i][idx];
            j = idx;
        }
    }
    output.dpScore = M[i][j];
    //Next is for output only
    if(oType>DPSCORE){
        //Alter boundaries to return the new positions when free gaps were introduced.
        if(type.freeRefE && j < L1)
            offset.refE = offset.refB+j-1;
        //traceBack
        std::stringstream ss;
        while( i > 0 ){
            bool equal = false;
            if(j > 0 && i > 0)
                equal = ref[offset.refB+j-1] == query[offset.queryB+i-1];
            if( j > 0 && i > 0 && M[ i ][ j ] == M[ i-1 ][ j-1 ] + scores.match && equal){
                ss << '=';
                i-- ;  j-- ;
            }
            else if(j > 0 && i > 0 && M[ i ][ j ] == M[ i-1 ][ j-1 ] + scores.mismatch){
                ss << 'X';
                output.editDist++;
                i-- ;  j-- ;
            }
            else if(j > 0 && (M[ i ][ j ] == M[ i ][ j-1 ] + scores.extendGap || i==0)){
                ss << 'D';
                output.editDist++;
                j-- ;
            }
            else if(i > 0 && (M[ i ][ j ] == M[ i-1 ][ j ] + scores.extendGap || j==0)){
                ss << 'I';
                output.editDist++;
                i-- ;
            }
            else{
                cerr << "Error in dynamic programming" << endl;
                cerr << "No valid trace position found" << endl;
                cerr << "Position " << i << ", " << j << endl;
                cerr << "Scores: Current " << M[ i ][ j ] << endl;
                if(j > 0 && i > 0){
                    cerr << "Scores: Diag "    << M[ i-1 ][ j-1 ] << endl;
                    cerr << "Characters "    << ref[offset.refB+j-1] << "  " << query[offset.queryB+i-1] << endl; 
                }
                if(j > 0)
                    cerr << "Scores: Left "    << M[ i ][ j-1 ] << endl;
                if(i > 0)
                    cerr << "Scores: Up "    << M[ i-1 ][ j ] << endl;
                exit(1);
            }
        }
        //Edit Dist ouput
        if( i > 0 && !type.freeQueryB)
            output.editDist += i;
        if(j > 0 && !type.freeRefB)
            output.editDist += j;
        //Errorstring output
        if(oType == ERRORSTRING || oType == ALL){
            string errorString = ss.str();
            if(i > 0 && !type.freeQueryB)
                errorString.append(i,'I');
            else if(j > 0 && !type.freeRefB)
                errorString.append(j, 'D');
            reverse( errorString.begin(), errorString.end() );
            //create output: errorString
            int iter = 0;
            int temp;
            int errorStringLength = errorString.length();
            while(iter < errorStringLength){
                temp = iter;
                while(iter+1 < errorStringLength && errorString[iter+1]==errorString[temp])
                    iter++;
                iter++;
                output.cigarChars.push_back(errorString[temp]);
                output.cigarLengths.push_back(iter-temp);
            }
        }
    }
    if(type.freeRefB && j > 0)
        offset.refB = offset.refB+j;

    return 0;
}

// Assembly:
subq $0x348, %rsp            # imm = 0x348
movq 0x350(%rsp), %rax
movq %rdi, 0x340(%rsp)
movq %rsi, 0x338(%rsp)
movq %rdx, 0x330(%rsp)
movq %rcx, 0x328(%rsp)
movq %r8, 0x320(%rsp)
movq %r9, 0x318(%rsp)
movq 0x340(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
movq 0x328(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x328(%rsp), %rcx
subq (%rcx), %rax
addq $0x1, %rax
movl %eax, 0x20(%rdi)
movq 0x328(%rsp), %rax
movl 0x14(%rax), %eax
movq 0x328(%rsp), %rcx
subl 0x10(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x24(%rdi)
movq 0x320(%rsp), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x31920
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl $0x0, (%rax)
movl $0x1, 0x314(%rsp)
movq 0xf0(%rsp), %rcx
movl 0x314(%rsp), %eax
cmpl 0x24(%rcx), %eax
jg 0x381c3
movq 0x320(%rsp), %rax
testb $0x1, 0x2(%rax)
je 0x38166
xorl %eax, %eax
movl %eax, 0xec(%rsp)
jmp 0x3818d
movq 0xf0(%rsp), %rdx
movq 0x38(%rdx), %rax
movl 0x8(%rax), %eax
movl 0x314(%rsp), %ecx
movq 0x38(%rdx), %rdx
imull 0xc(%rdx), %ecx
addl %ecx, %eax
movl %eax, 0xec(%rsp)
movq 0xf0(%rsp), %rax
movl 0xec(%rsp), %ecx
movq (%rax), %rax
movslq 0x314(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movl 0x314(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x314(%rsp)
jmp 0x38139
movl $0x1, 0x310(%rsp)
movq 0xf0(%rsp), %rcx
movl 0x310(%rsp), %eax
cmpl 0x20(%rcx), %eax
jg 0x38257
movq 0x320(%rsp), %rax
testb $0x1, (%rax)
je 0x381fa
xorl %eax, %eax
movl %eax, 0xe8(%rsp)
jmp 0x38221
movq 0xf0(%rsp), %rdx
movq 0x38(%rdx), %rax
movl 0x8(%rax), %eax
movl 0x310(%rsp), %ecx
movq 0x38(%rdx), %rdx
imull 0xc(%rdx), %ecx
addl %ecx, %eax
movl %eax, 0xe8(%rsp)
movq 0xf0(%rsp), %rax
movl 0xe8(%rsp), %edx
movq (%rax), %rax
movq (%rax), %rax
movslq 0x310(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x310(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x310(%rsp)
jmp 0x381ce
movl $0x0, 0x30c(%rsp)
movq $0x1, 0x300(%rsp)
movq 0xf0(%rsp), %rcx
movq 0x300(%rsp), %rax
movslq 0x24(%rcx), %rcx
cmpq %rcx, %rax
jg 0x3849e
movq $0x1, 0x2f8(%rsp)
movq 0xf0(%rsp), %rcx
movq 0x2f8(%rsp), %rax
movslq 0x20(%rcx), %rcx
cmpq %rcx, %rax
jg 0x38483
movq 0xf0(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x10, %rax
movq %rax, 0xd8(%rsp)
movq 0x338(%rsp), %rdi
movq 0x328(%rsp), %rax
movq (%rax), %rsi
addq 0x2f8(%rsp), %rsi
subq $0x1, %rsi
callq 0x8410
movq %rax, %rcx
movq 0xd8(%rsp), %rax
movsbq (%rcx), %rcx
imulq $0x1fc, %rcx, %rcx      # imm = 0x1FC
addq %rcx, %rax
movq %rax, 0xe0(%rsp)
movq 0x330(%rsp), %rdi
movq 0x328(%rsp), %rax
movslq 0x10(%rax), %rsi
addq 0x300(%rsp), %rsi
subq $0x1, %rsi
callq 0x8410
movq 0xf0(%rsp), %rcx
movq %rax, %rdx
movq 0xe0(%rsp), %rax
movsbq (%rdx), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, 0x30c(%rsp)
movq (%rcx), %rax
movq 0x300(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x2f8(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
addl 0x30c(%rsp), %eax
movl %eax, 0x2f4(%rsp)
movq (%rcx), %rax
movq 0x300(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x2f8(%rsp), %rdx
subq $0x1, %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x2f0(%rsp)
leaq 0x2f4(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x14d40
movq 0xf0(%rsp), %rcx
movl (%rax), %esi
movq (%rcx), %rax
movq 0x300(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x2f8(%rsp), %rdx
movl %esi, (%rax,%rdx,4)
movq (%rcx), %rax
movq 0x300(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movq 0x2f8(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq (%rcx), %rax
movq 0x300(%rsp), %rdx
subq $0x1, %rdx
movq (%rax,%rdx,8), %rax
movq 0x2f8(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x38(%rcx), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0x2ec(%rsp)
leaq 0x2ec(%rsp), %rsi
callq 0x14d40
movq %rax, %rcx
movq 0xf0(%rsp), %rax
movl (%rcx), %edx
movq (%rax), %rax
movq 0x300(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x2f8(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x2f8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2f8(%rsp)
jmp 0x38297
jmp 0x38485
movq 0x300(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x300(%rsp)
jmp 0x3826e
movq 0xf0(%rsp), %rax
movl 0x24(%rax), %ecx
movl %ecx, 0x2e8(%rsp)
movl 0x20(%rax), %ecx
movl %ecx, 0x2e4(%rsp)
movq (%rax), %rcx
movslq 0x2e8(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0x2e4(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x2e0(%rsp)
movl 0x20(%rax), %eax
movl %eax, 0x2dc(%rsp)
cmpl $0x0, 0x2dc(%rsp)
jl 0x38569
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2dc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x2e0(%rsp), %eax
jle 0x38551
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2dc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x2e0(%rsp)
movl 0x2dc(%rsp), %eax
movl %eax, 0x2e4(%rsp)
jmp 0x38553
movl 0x2dc(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2dc(%rsp)
jmp 0x384e5
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movq 0x350(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x318(%rsp), %rax
cmpl $0x0, (%rax)
jle 0x38fdb
movq 0x320(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x385ef
movq 0xf0(%rsp), %rcx
movl 0x2e4(%rsp), %eax
cmpl 0x20(%rcx), %eax
jge 0x385ef
movq 0x328(%rsp), %rax
movq (%rax), %rcx
movslq 0x2e4(%rsp), %rax
addq %rax, %rcx
subq $0x1, %rcx
movq 0x328(%rsp), %rax
movq %rcx, 0x8(%rax)
leaq 0x150(%rsp), %rdi
callq 0x8260
cmpl $0x0, 0x2e8(%rsp)
jle 0x38cf4
movb $0x0, 0x14f(%rsp)
cmpl $0x0, 0x2e4(%rsp)
jle 0x38697
cmpl $0x0, 0x2e8(%rsp)
jle 0x38697
movq 0x338(%rsp), %rdi
movq 0x328(%rsp), %rax
movq (%rax), %rsi
movslq 0x2e4(%rsp), %rax
addq %rax, %rsi
subq $0x1, %rsi
callq 0x8410
movsbl (%rax), %eax
movl %eax, 0xd4(%rsp)
movq 0x330(%rsp), %rdi
movq 0x328(%rsp), %rax
movl 0x10(%rax), %eax
addl 0x2e8(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8410
movq %rax, %rcx
movl 0xd4(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, 0x14f(%rsp)
cmpl $0x0, 0x2e4(%rsp)
jle 0x38761
cmpl $0x0, 0x2e8(%rsp)
jle 0x38761
movq 0xf0(%rsp), %rdx
movq (%rdx), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq (%rdx), %rcx
movl 0x2e8(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rcx
movl 0x2e4(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movl (%rcx,%rsi,4), %ecx
movq 0x38(%rdx), %rdx
addl (%rdx), %ecx
cmpl %ecx, %eax
jne 0x38761
testb $0x1, 0x14f(%rsp)
je 0x38761
leaq 0x160(%rsp), %rdi
movl $0x3d, %esi
callq 0x8440
jmp 0x38721
movl 0x2e8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e8(%rsp)
movl 0x2e4(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e4(%rsp)
jmp 0x38cef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x38fcc
cmpl $0x0, 0x2e4(%rsp)
jle 0x38818
cmpl $0x0, 0x2e8(%rsp)
jle 0x38818
movq 0xf0(%rsp), %rdx
movq (%rdx), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq (%rdx), %rcx
movl 0x2e8(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rcx
movl 0x2e4(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movl (%rcx,%rsi,4), %ecx
movq 0x38(%rdx), %rdx
addl 0x4(%rdx), %ecx
cmpl %ecx, %eax
jne 0x38818
leaq 0x160(%rsp), %rdi
movl $0x58, %esi
callq 0x8440
jmp 0x387e2
movq 0x350(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl 0x2e8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e8(%rsp)
movl 0x2e4(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e4(%rsp)
jmp 0x38ced
cmpl $0x0, 0x2e4(%rsp)
jle 0x388b5
movq 0xf0(%rsp), %rdx
movq (%rdx), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq (%rdx), %rcx
movslq 0x2e8(%rsp), %rsi
movq (%rcx,%rsi,8), %rcx
movl 0x2e4(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movl (%rcx,%rsi,4), %ecx
movq 0x38(%rdx), %rdx
addl 0xc(%rdx), %ecx
cmpl %ecx, %eax
je 0x3887c
cmpl $0x0, 0x2e8(%rsp)
jne 0x388b5
leaq 0x160(%rsp), %rdi
movl $0x44, %esi
callq 0x8440
jmp 0x38890
movq 0x350(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl 0x2e4(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e4(%rsp)
jmp 0x38ceb
cmpl $0x0, 0x2e8(%rsp)
jle 0x38952
movq 0xf0(%rsp), %rdx
movq (%rdx), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq (%rdx), %rcx
movl 0x2e8(%rsp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rcx,%rsi,8), %rcx
movslq 0x2e4(%rsp), %rsi
movl (%rcx,%rsi,4), %ecx
movq 0x38(%rdx), %rdx
addl 0xc(%rdx), %ecx
cmpl %ecx, %eax
je 0x38919
cmpl $0x0, 0x2e4(%rsp)
jne 0x38952
leaq 0x160(%rsp), %rdi
movl $0x49, %esi
callq 0x8440
jmp 0x3892d
movq 0x350(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl 0x2e8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2e8(%rsp)
jmp 0x38ce9
movq 0x5e697(%rip), %rdi     # 0x96ff0
leaq 0x44f38(%rip), %rsi     # 0x7d898
callq 0x8360
movq %rax, 0xc8(%rsp)
jmp 0x3896f
movq 0xc8(%rsp), %rdi
movq 0x5e632(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38985
movq 0x5e664(%rip), %rdi     # 0x96ff0
leaq 0x44f22(%rip), %rsi     # 0x7d8b5
callq 0x8360
movq %rax, 0xc0(%rsp)
jmp 0x389a2
movq 0xc0(%rsp), %rdi
movq 0x5e5ff(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x389b8
movq 0x5e631(%rip), %rdi     # 0x96ff0
leaq 0x44f0d(%rip), %rsi     # 0x7d8d3
callq 0x8360
movq %rax, 0xb8(%rsp)
jmp 0x389d5
movq 0xb8(%rsp), %rdi
movl 0x2e8(%rsp), %esi
callq 0x8710
movq %rax, 0xb0(%rsp)
jmp 0x389f3
movq 0xb0(%rsp), %rdi
leaq 0x44edb(%rip), %rsi     # 0x7d8dd
callq 0x8360
movq %rax, 0xa8(%rsp)
jmp 0x38a11
movq 0xa8(%rsp), %rdi
movl 0x2e4(%rsp), %esi
callq 0x8710
movq %rax, 0xa0(%rsp)
jmp 0x38a2f
movq 0xa0(%rsp), %rdi
movq 0x5e572(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38a45
movq 0x5e5a4(%rip), %rdi     # 0x96ff0
leaq 0x44e8d(%rip), %rsi     # 0x7d8e0
callq 0x8360
movq %rax, 0x98(%rsp)
jmp 0x38a62
movq 0x98(%rsp), %rdi
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x8710
movq %rax, 0x90(%rsp)
jmp 0x38a9b
movq 0x90(%rsp), %rdi
movq 0x5e506(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38ab1
cmpl $0x0, 0x2e4(%rsp)
jle 0x38bff
cmpl $0x0, 0x2e8(%rsp)
jle 0x38bff
movq 0x5e51c(%rip), %rdi     # 0x96ff0
leaq 0x44e16(%rip), %rsi     # 0x7d8f1
callq 0x8360
movq %rax, 0x88(%rsp)
jmp 0x38aea
movq 0x88(%rsp), %rdi
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movl 0x2e8(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x2e4(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
callq 0x8710
movq %rax, 0x80(%rsp)
jmp 0x38b2b
movq 0x80(%rsp), %rdi
movq 0x5e476(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38b41
movq 0x5e4a8(%rip), %rdi     # 0x96ff0
leaq 0x44db0(%rip), %rsi     # 0x7d8ff
callq 0x8360
movq %rax, 0x78(%rsp)
jmp 0x38b5b
movq 0x338(%rsp), %rdi
movq 0x328(%rsp), %rax
movq (%rax), %rax
movslq 0x2e4(%rsp), %rcx
leaq -0x1(%rax,%rcx), %rsi
callq 0x8410
movq 0x78(%rsp), %rdi
movsbl (%rax), %esi
callq 0x8440
movq %rax, 0x70(%rsp)
jmp 0x38b94
movq 0x70(%rsp), %rdi
leaq 0x44d99(%rip), %rsi     # 0x7d939
callq 0x8360
movq %rax, 0x68(%rsp)
jmp 0x38bac
movq 0x330(%rsp), %rdi
movq 0x328(%rsp), %rax
movl 0x10(%rax), %edx
movl 0x2e8(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0x1(%rax,%rcx), %eax
movslq %eax, %rsi
callq 0x8410
movq 0x68(%rsp), %rdi
movsbl (%rax), %esi
callq 0x8440
movq %rax, 0x60(%rsp)
jmp 0x38bea
movq 0x60(%rsp), %rdi
movq 0x5e3ba(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38bfd
jmp 0x38bff
cmpl $0x0, 0x2e4(%rsp)
jle 0x38c6f
movq 0x5e3e0(%rip), %rdi     # 0x96ff0
leaq 0x44cfe(%rip), %rsi     # 0x7d915
callq 0x8360
movq %rax, 0x58(%rsp)
jmp 0x38c23
movq 0x58(%rsp), %rdi
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movslq 0x2e8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x2e4(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
callq 0x8710
movq %rax, 0x50(%rsp)
jmp 0x38c5a
movq 0x50(%rsp), %rdi
movq 0x5e34a(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38c6d
jmp 0x38c6f
cmpl $0x0, 0x2e8(%rsp)
jle 0x38cdf
movq 0x5e370(%rip), %rdi     # 0x96ff0
leaq 0x44c9c(%rip), %rsi     # 0x7d923
callq 0x8360
movq %rax, 0x48(%rsp)
jmp 0x38c93
movq 0x48(%rsp), %rdi
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movl 0x2e8(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq 0x2e4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x8710
movq %rax, 0x40(%rsp)
jmp 0x38cca
movq 0x40(%rsp), %rdi
movq 0x5e2da(%rip), %rsi     # 0x96fb0
callq 0x83b0
jmp 0x38cdd
jmp 0x38cdf
movl $0x1, %edi
callq 0x84a0
jmp 0x38ceb
jmp 0x38ced
jmp 0x38cef
jmp 0x385fc
cmpl $0x0, 0x2e8(%rsp)
jle 0x38d1f
movq 0x320(%rsp), %rax
testb $0x1, 0x2(%rax)
jne 0x38d1f
movl 0x2e8(%rsp), %ecx
movq 0x350(%rsp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
cmpl $0x0, 0x2e4(%rsp)
jle 0x38d49
movq 0x320(%rsp), %rax
testb $0x1, (%rax)
jne 0x38d49
movl 0x2e4(%rsp), %ecx
movq 0x350(%rsp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x318(%rsp), %rax
cmpl $0x3, (%rax)
je 0x38d67
movq 0x318(%rsp), %rax
cmpl $0x4, (%rax)
jne 0x38fbd
leaq 0x118(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x8350
jmp 0x38d7e
cmpl $0x0, 0x2e8(%rsp)
jle 0x38dda
movq 0x320(%rsp), %rax
testb $0x1, 0x2(%rax)
jne 0x38dda
movslq 0x2e8(%rsp), %rsi
leaq 0x118(%rsp), %rdi
movl $0x49, %edx
callq 0x83d0
jmp 0x38db2
jmp 0x38e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x8858
jmp 0x38fcc
cmpl $0x0, 0x2e4(%rsp)
jle 0x38e0f
movq 0x320(%rsp), %rax
testb $0x1, (%rax)
jne 0x38e0f
movslq 0x2e4(%rsp), %rsi
leaq 0x118(%rsp), %rdi
movl $0x44, %edx
callq 0x83d0
jmp 0x38e0d
jmp 0x38e0f
jmp 0x38e11
leaq 0x118(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x8310
movq 0x38(%rsp), %rdi
movq %rax, 0x110(%rsp)
callq 0x81e0
movq %rax, 0x108(%rsp)
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0xe110
jmp 0x38e54
movl $0x0, 0x104(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x8630
movl %eax, 0xfc(%rsp)
movl 0x104(%rsp), %eax
cmpl 0xfc(%rsp), %eax
jge 0x38fb0
movl 0x104(%rsp), %eax
movl %eax, 0x100(%rsp)
movl 0x104(%rsp), %ecx
addl $0x1, %ecx
xorl %eax, %eax
cmpl 0xfc(%rsp), %ecx
movb %al, 0x37(%rsp)
jge 0x38f0b
movl 0x104(%rsp), %eax
incl %eax
movslq %eax, %rsi
leaq 0x118(%rsp), %rdi
callq 0x8830
movq %rax, 0x28(%rsp)
jmp 0x38ece
movq 0x28(%rsp), %rax
movsbl (%rax), %eax
movl %eax, 0x1c(%rsp)
movslq 0x100(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x8830
movq %rax, 0x20(%rsp)
jmp 0x38ef6
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, 0x37(%rsp)
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0x38f15
jmp 0x38f2b
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0x38e95
movl 0x104(%rsp), %eax
incl %eax
movl %eax, 0x104(%rsp)
movq 0x350(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movslq 0x100(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x8830
movq %rax, 0x10(%rsp)
jmp 0x38f68
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x39060
jmp 0x38f79
movq 0x350(%rsp), %rdi
addq $0x20, %rdi
movl 0x104(%rsp), %eax
movl 0x100(%rsp), %ecx
subl %ecx, %eax
movl %eax, 0xf8(%rsp)
leaq 0xf8(%rsp), %rsi
callq 0x390d0
jmp 0x38fab
jmp 0x38e73
leaq 0x118(%rsp), %rdi
callq 0x8858
leaq 0x150(%rsp), %rdi
callq 0x8290
jmp 0x38fdb
leaq 0x150(%rsp), %rdi
callq 0x8290
jmp 0x3901d
movq 0x320(%rsp), %rax
testb $0x1, (%rax)
je 0x39013
cmpl $0x0, 0x2e4(%rsp)
jle 0x39013
movq 0x328(%rsp), %rax
movq (%rax), %rcx
movslq 0x2e4(%rsp), %rax
addq %rax, %rcx
movq 0x328(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
addq $0x348, %rsp            # imm = 0x348
retq
movq 0x140(%rsp), %rdi
callq 0x8730
nopw (%rax,%rax)