// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/nw_trace_diag_sse2_128_16.c
// Function: parasail_nw_trace_diag_sse2_128_16
parasail_result_t* FNAME(
        const char * const restrict _s1, const int _s1Len,
        const char * const restrict _s2, const int s2Len,
        const int open, const int gap, const parasail_matrix_t *matrix)
{
    /* declare local variables */
    int32_t N = 0;
    int32_t PAD = 0;
    int32_t PAD2 = 0;
    int32_t s1Len_PAD = 0;
    int32_t s2Len_PAD = 0;
    int16_t * restrict s1 = NULL;
    int16_t * restrict s2B = NULL;
    int16_t * restrict _H_pr = NULL;
    int16_t * restrict _F_pr = NULL;
    int16_t * restrict s2 = NULL;
    int16_t * restrict H_pr = NULL;
    int16_t * restrict F_pr = NULL;
    parasail_result_t *result = NULL;
    int32_t i = 0;
    int32_t j = 0;
    int32_t s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    int16_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vNegInf;
    __m128i vOpen;
    __m128i vGap;
    __m128i vOne;
    __m128i vN;
    __m128i vGapN;
    __m128i vNegOne;
    __m128i vI;
    __m128i vJreset;
    __m128i vMax;
    __m128i vILimit;
    __m128i vILimit1;
    __m128i vJLimit;
    __m128i vJLimit1;
    __m128i vIBoundary;
    __m128i vTDiag;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i vTDelF;

    /* validate inputs */
    PARASAIL_CHECK_NULL(_s2);
    PARASAIL_CHECK_GT0(s2Len);
    PARASAIL_CHECK_GE0(open);
    PARASAIL_CHECK_GE0(gap);
    PARASAIL_CHECK_NULL(matrix);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        PARASAIL_CHECK_NULL(_s1);
        PARASAIL_CHECK_GT0(_s1Len);
    }

    /* initialize stack variables */
    N = 8; /* number of values in vector */
    PAD = N-1;
    PAD2 = PAD*2;
    s1Len = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ? _s1Len : matrix->length;
    s1Len_PAD = s1Len+PAD;
    s2Len_PAD = s2Len+PAD;
    i = 0;
    j = 0;
    end_query = s1Len-1;
    end_ref = s2Len-1;
    NEG_LIMIT = (-open < matrix->min ? INT16_MIN + open : INT16_MIN - matrix->min) + 1;
    POS_LIMIT = INT16_MAX - matrix->max - 1;
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi16(NEG_LIMIT);
    vPosLimit = _mm_set1_epi16(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vNegInf = _mm_set1_epi16(NEG_LIMIT);
    vOpen = _mm_set1_epi16(open);
    vGap  = _mm_set1_epi16(gap);
    vOne = _mm_set1_epi16(1);
    vN = _mm_set1_epi16(N);
    vGapN = _mm_set1_epi16(gap*N);
    vNegOne = _mm_set1_epi16(-1);
    vI = _mm_set_epi16(0,1,2,3,4,5,6,7);
    vJreset = _mm_set_epi16(0,-1,-2,-3,-4,-5,-6,-7);
    vMax = vNegInf;
    vILimit = _mm_set1_epi16(s1Len);
    vILimit1 = _mm_subs_epi16(vILimit, vOne);
    vJLimit = _mm_set1_epi16(s2Len);
    vJLimit1 = _mm_subs_epi16(vJLimit, vOne);
    vIBoundary = _mm_set_epi16(
            -open-0*gap,
            -open-1*gap,
            -open-2*gap,
            -open-3*gap,
            -open-4*gap,
            -open-5*gap,
            -open-6*gap,
            -open-7*gap);
    vTDiag = _mm_set1_epi16(PARASAIL_DIAG);
    vTIns = _mm_set1_epi16(PARASAIL_INS);
    vTDel = _mm_set1_epi16(PARASAIL_DEL);
    vTDiagE = _mm_set1_epi16(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi16(PARASAIL_INS_E);
    vTDiagF = _mm_set1_epi16(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi16(PARASAIL_DEL_F);

    /* initialize result */
    result = parasail_result_new_trace(s1Len, s2Len, 16, sizeof(int8_t));
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_NW | PARASAIL_FLAG_DIAG
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_8;

    /* initialize heap variables */
    s2B= parasail_memalign_int16_t(16, s2Len+PAD2);
    _H_pr = parasail_memalign_int16_t(16, s2Len+PAD2);
    _F_pr = parasail_memalign_int16_t(16, s2Len+PAD2);
    s2 = s2B+PAD; /* will allow later for negative indices */
    H_pr = _H_pr+PAD;
    F_pr = _F_pr+PAD;

    /* validate heap variables */
    if (!s2B) return NULL;
    if (!_H_pr) return NULL;
    if (!_F_pr) return NULL;

    /* convert _s1 from char to int in range 0-23 */
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        s1 = parasail_memalign_int16_t(16, s1Len+PAD);
        if (!s1) return NULL;
        for (i=0; i<s1Len; ++i) {
            s1[i] = matrix->mapper[(unsigned char)_s1[i]];
        }
        /* pad back of s1 with dummy values */
        for (i=s1Len; i<s1Len_PAD; ++i) {
            s1[i] = 0; /* point to first matrix row because we don't care */
        }
    }

    /* convert _s2 from char to int in range 0-23 */
    for (j=0; j<s2Len; ++j) {
        s2[j] = matrix->mapper[(unsigned char)_s2[j]];
    }
    /* pad front of s2 with dummy values */
    for (j=-PAD; j<0; ++j) {
        s2[j] = 0; /* point to first matrix row because we don't care */
    }
    /* pad back of s2 with dummy values */
    for (j=s2Len; j<s2Len_PAD; ++j) {
        s2[j] = 0; /* point to first matrix row because we don't care */
    }

    /* set initial values for stored row */
    for (j=0; j<s2Len; ++j) {
        H_pr[j] = -open - j*gap;
        F_pr[j] = NEG_LIMIT;
    }
    /* pad front of stored row values */
    for (j=-PAD; j<0; ++j) {
        H_pr[j] = NEG_LIMIT;
        F_pr[j] = NEG_LIMIT;
    }
    /* pad back of stored row values */
    for (j=s2Len; j<s2Len+PAD; ++j) {
        H_pr[j] = NEG_LIMIT;
        F_pr[j] = NEG_LIMIT;
    }
    H_pr[-1] = 0; /* upper left corner */

    /* iterate over query sequence */
    for (i=0; i<s1Len; i+=N) {
        __m128i vNH = vNegInf;
        __m128i vWH = vNegInf;
        __m128i vE = vNegInf;
        __m128i vE_opn = vNegInf;
        __m128i vE_ext = vNegInf;
        __m128i vF = vNegInf;
        __m128i vF_opn = vNegInf;
        __m128i vF_ext = vNegInf;
        __m128i vJ = vJreset;
        const int * const restrict matrow0 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+0] : ((i+0 >= s1Len) ? s1Len-1 : i+0))];
        const int * const restrict matrow1 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+1] : ((i+1 >= s1Len) ? s1Len-1 : i+1))];
        const int * const restrict matrow2 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+2] : ((i+2 >= s1Len) ? s1Len-1 : i+2))];
        const int * const restrict matrow3 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+3] : ((i+3 >= s1Len) ? s1Len-1 : i+3))];
        const int * const restrict matrow4 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+4] : ((i+4 >= s1Len) ? s1Len-1 : i+4))];
        const int * const restrict matrow5 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+5] : ((i+5 >= s1Len) ? s1Len-1 : i+5))];
        const int * const restrict matrow6 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+6] : ((i+6 >= s1Len) ? s1Len-1 : i+6))];
        const int * const restrict matrow7 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+7] : ((i+7 >= s1Len) ? s1Len-1 : i+7))];
        vNH = _mm_srli_si128(vNH, 2);
        vNH = _mm_insert_epi16(vNH, H_pr[-1], 7);
        vWH = _mm_srli_si128(vWH, 2);
        vWH = _mm_insert_epi16(vWH, -open - i*gap, 7);
        H_pr[-1] = -open - (i+N)*gap;
        /* iterate over database sequence */
        for (j=0; j<s2Len+PAD; ++j) {
            __m128i vMat;
            __m128i vNWH = vNH;
            vNH = _mm_srli_si128(vWH, 2);
            vNH = _mm_insert_epi16(vNH, H_pr[j], 7);
            vF = _mm_srli_si128(vF, 2);
            vF = _mm_insert_epi16(vF, F_pr[j], 7);
            vF_opn = _mm_subs_epi16(vNH, vOpen);
            vF_ext = _mm_subs_epi16(vF, vGap);
            vF = _mm_max_epi16(vF_opn, vF_ext);
            vE_opn = _mm_subs_epi16(vWH, vOpen);
            vE_ext = _mm_subs_epi16(vE, vGap);
            vE = _mm_max_epi16(vE_opn, vE_ext);
            vMat = _mm_set_epi16(
                    matrow0[s2[j-0]],
                    matrow1[s2[j-1]],
                    matrow2[s2[j-2]],
                    matrow3[s2[j-3]],
                    matrow4[s2[j-4]],
                    matrow5[s2[j-5]],
                    matrow6[s2[j-6]],
                    matrow7[s2[j-7]]
                    );
            vNWH = _mm_adds_epi16(vNWH, vMat);
            vWH = _mm_max_epi16(vNWH, vE);
            vWH = _mm_max_epi16(vWH, vF);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi16(vJ,vNegOne);
                vWH = _mm_blendv_epi8_rpl(vWH, vIBoundary, cond);
                vF = _mm_blendv_epi8_rpl(vF, vNegInf, cond);
                vE = _mm_blendv_epi8_rpl(vE, vNegInf, cond);
            }
            /* cannot start checking sat until after J clears boundary */
            if (j > PAD) {
                vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vWH);
            }
            /* trace table */
            {
                __m128i case1 = _mm_cmpeq_epi16(vWH, vNWH);
                __m128i case2 = _mm_cmpeq_epi16(vWH, vF);
                __m128i vT = _mm_blendv_epi8_rpl(
                        _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                        vTDiag,
                        case1);
                __m128i condE = _mm_cmpgt_epi16(vE_opn, vE_ext);
                __m128i condF = _mm_cmpgt_epi16(vF_opn, vF_ext);
                __m128i vET = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, condE);
                __m128i vFT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, condF);
                vT = _mm_or_si128(vT, vET);
                vT = _mm_or_si128(vT, vFT);
                arr_store_si128(result->trace->trace_table, vT, i, s1Len, j, s2Len);
            }
            H_pr[j-7] = (int16_t)_mm_extract_epi16(vWH,0);
            F_pr[j-7] = (int16_t)_mm_extract_epi16(vF,0);
            /* as minor diagonal vector passes across table, extract
               last table value at the i,j bound */
            {
                __m128i cond_valid_I = _mm_cmpeq_epi16(vI, vILimit1);
                __m128i cond_valid_J = _mm_cmpeq_epi16(vJ, vJLimit1);
                __m128i cond_all = _mm_and_si128(cond_valid_I, cond_valid_J);
                vMax = _mm_blendv_epi8_rpl(vMax, vWH, cond_all);
            }
            vJ = _mm_adds_epi16(vJ, vOne);
        }
        vI = _mm_adds_epi16(vI, vN);
        vIBoundary = _mm_subs_epi16(vIBoundary, vGapN);
    }

    /* max in vMax */
    for (i=0; i<N; ++i) {
        int16_t value;
        value = (int16_t) _mm_extract_epi16(vMax, 7);
        if (value > score) {
            score = value;
        }
        vMax = _mm_slli_si128(vMax, 2);
    }

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi16(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi16(vSaturationCheckMax, vPosLimit)))) {
        result->flag |= PARASAIL_FLAG_SATURATED;
        score = 0;
        end_query = 0;
        end_ref = 0;
    }

    result->score = score;
    result->end_query = end_query;
    result->end_ref = end_ref;

    parasail_free(_F_pr);
    parasail_free(_H_pr);
    parasail_free(s2B);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        parasail_free(s1);
    }

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
testq %rdx, %rdx
je 0x3affe1
movl %ecx, %ebp
testl %ecx, %ecx
jle 0x3affe8
movl %r8d, %r13d
testl %r8d, %r8d
js 0x3affef
testl %r9d, %r9d
js 0x3afff6
movq 0x200(%rsp), %rcx
testq %rcx, %rcx
je 0x3afffd
movq %rdx, %r12
cmpl $0x0, 0x30(%rcx)
je 0x3af435
movl 0x34(%rcx), %r14d
jmp 0x3af449
testq %rdi, %rdi
je 0x3b0004
movl %esi, %r14d
testl %esi, %esi
jle 0x3b000b
movq %rdi, 0x60(%rsp)
movq %r9, 0x48(%rsp)
movl %r13d, %esi
negl %esi
movl 0x20(%rcx), %eax
movl %eax, %edx
negl %edx
movl %esi, 0x14(%rsp)
cmpl %esi, %eax
cmovgl %r13d, %edx
movl %edx, 0xc(%rsp)
movw $0x7ffe, %bx            # imm = 0x7FFE
subw 0x1c(%rcx), %bx
movl $0x10, %edx
movl $0x1, %ecx
movl %r14d, %edi
movl %ebp, %esi
callq 0x20adf4
testq %rax, %rax
je 0x3b0010
movq %rax, %r15
movl %r13d, 0x30(%rsp)
movq %r12, 0x50(%rsp)
movq %r14, 0x18(%rsp)
orl $0x8281001, 0xc(%rax)   # imm = 0x8281001
leal 0xe(%rbp), %r13d
movl $0x10, %edi
movq %r13, %rsi
callq 0x20a625
movq %rax, %r14
movl $0x10, %edi
movq %r13, %rsi
callq 0x20a625
movq %rax, %r12
movl $0x10, %edi
movq %r13, %rsi
callq 0x20a625
testq %r14, %r14
sete %dl
testq %r12, %r12
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x3b0010
movq %rax, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0xb8(%rsp)
movq 0x200(%rsp), %r13
cmpl $0x0, 0x30(%r13)
je 0x3af529
movq $0x0, 0x40(%rsp)
movq 0x18(%rsp), %r12
jmp 0x3af59f
movq 0x18(%rsp), %r12
leal 0x7(%r12), %r15d
movslq %r15d, %rsi
movl $0x10, %edi
callq 0x20a625
testq %rax, %rax
je 0x3b0010
testl %r12d, %r12d
movq 0x60(%rsp), %r8
jle 0x3af571
movq 0x10(%r13), %rdi
movl %r12d, %ecx
xorl %edx, %edx
movzbl (%r8,%rdx), %esi
movzwl (%rdi,%rsi,4), %esi
movw %si, (%rax,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x3af55c
movslq %r12d, %rdx
movq %rax, 0x40(%rsp)
leaq (%rax,%rdx,2), %rdi
leal 0x1(%r12), %eax
cmpl %eax, %r15d
cmovgl %r15d, %eax
movl %r12d, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movd %ebx, %xmm0
movl 0x30(%rsp), %r11d
movd %r11d, %xmm1
movq 0x48(%rsp), %r9
movl 0x14(%rsp), %r10d
movl %r10d, %eax
subl %r9d, %eax
subl %r9d, %eax
imull $0xfffd, %r9d, %ecx     # imm = 0xFFFD
subl %r11d, %ecx
leal (,%r9,4), %edx
movl %r10d, %esi
subl %edx, %esi
imull $0xfffb, %r9d, %edi     # imm = 0xFFFB
subl %r11d, %edi
imull $0xfffa, %r9d, %r8d     # imm = 0xFFFA
subl %r11d, %r8d
imull $0xfff9, %r9d, %edx     # imm = 0xFFF9
subl %r11d, %edx
movd %esi, %xmm3
leal 0x7(%rbp), %ebx
movd %edi, %xmm2
leal -0x1(%r12), %esi
movl %esi, 0x10(%rsp)
movd %r8d, %xmm4
leal -0x1(%rbp), %esi
movl %esi, 0x5c(%rsp)
movq %r12, %rsi
movl 0xc(%rsp), %r12d
addl $0xffff8001, %r12d      # imm = 0xFFFF8001
movl %r12d, 0xc(%rsp)
movd %r12d, %xmm5
pshuflw $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
movdqa %xmm5, 0x30(%rsp)
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0xe0(%rsp)
pshuflw $0x0, %xmm1, %xmm0      # xmm0 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x1a0(%rsp)
movd %r9d, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x190(%rsp)
psllw $0x3, %xmm0
movdqa %xmm0, 0x160(%rsp)
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm1      # xmm1 = xmm0[0,0,0,0]
pcmpeqd %xmm0, %xmm0
paddsw %xmm0, %xmm1
movdqa %xmm1, 0x150(%rsp)
movd %ebp, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
paddsw %xmm0, %xmm1
movdqa %xmm1, 0x180(%rsp)
movd %edx, %xmm5
movl %r10d, %edx
subl %r9d, %edx
punpcklwd %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
punpcklwd %xmm4, %xmm5    # xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3]
punpckldq %xmm2, %xmm5    # xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1]
movd %eax, %xmm0
movd %ecx, %xmm1
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movd %edx, %xmm0
movd %r10d, %xmm2
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
punpcklqdq %xmm1, %xmm5    # xmm5 = xmm5[0],xmm1[0]
movdqa %xmm5, 0x60(%rsp)
movq 0x10(%r13), %rax
movl %ebp, %r15d
xorl %ecx, %ecx
movq 0x50(%rsp), %rsi
movzbl (%rsi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r14,%rcx,2)
incq %rcx
cmpq %rcx, %r15
jne 0x3af70f
xorl %r12d, %r12d
movq %r12, 0x6(%r14)
movq %r12, (%r14)
leaq (%r14,%r15,2), %rdi
addq $0xe, %rdi
leal 0x1(%rbp), %eax
cmpl %eax, %ebx
cmovgl %ebx, %eax
movl %ebp, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movl 0x14(%rsp), %eax
movl 0xc(%rsp), %edx
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdi
movw %ax, 0xe(%rsi,%r12,2)
subl %ecx, %eax
movw %dx, 0xe(%rdi,%r12,2)
incq %r12
cmpq %r12, %r15
jne 0x3af76b
xorl %eax, %eax
movw %dx, (%rsi,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x3af783
leaq 0x7(%r15), %rax
movq 0x18(%rsp), %rcx
movw %dx, (%rsi,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
incl %ebp
cmpl %ebp, %ebx
jg 0x3af79d
movw $0x0, 0xc(%rsi)
testl %ecx, %ecx
jle 0x3aff1a
movdqa 0x30(%rsp), %xmm3
movdqa %xmm3, %xmm0
psrldq $0x2, %xmm0             # xmm0 = xmm0[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
movdqa %xmm0, 0x140(%rsp)
cmpl $0x2, %ebx
movl $0x1, %eax
cmovgel %ebx, %eax
movq %rax, 0x108(%rsp)
movl %ecx, %ecx
leaq (,%r15,8), %rax
movq %rax, 0xf8(%rsp)
subq %r15, %rax
addq $-0x7, %rax
movq %rax, 0xb0(%rsp)
leaq -0x1(%r15), %rax
movq %rax, 0xa8(%rsp)
leaq (%r15,%r15,2), %rax
leaq -0x6(%rax,%rax), %rax
movq %rax, 0x98(%rsp)
leaq -0x5(%r15,%r15,4), %rax
movq %rax, 0x90(%rsp)
leaq -0x4(,%r15,4), %rax
movq %rax, 0x88(%rsp)
leaq -0x3(%r15,%r15,2), %rax
movq %rax, 0x80(%rsp)
leaq -0x2(%r15,%r15), %rax
movq %rax, 0x78(%rsp)
movdqa 0x27a2de(%rip), %xmm15  # 0x629b40
movq $0x0, 0xa0(%rsp)
movdqa 0x27a50a(%rip), %xmm7   # 0x629d80
xorl %r8d, %r8d
movdqa 0xe0(%rsp), %xmm0
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm3, 0xd0(%rsp)
cmpl $0x0, 0x30(%r13)
je 0x3af902
movq %r8, %rdx
orq $0x1, %rdx
cmpq %rcx, %rdx
movl 0x10(%rsp), %ebx
cmovael %ebx, %edx
movq %r8, %rax
orq $0x2, %rax
cmpq %rcx, %rax
cmovael %ebx, %eax
movq %r8, %rdi
orq $0x3, %rdi
cmpq %rcx, %rdi
cmovael %ebx, %edi
movq %r8, %rsi
orq $0x4, %rsi
cmpq %rcx, %rsi
cmovael %ebx, %esi
movq %r8, %r11
orq $0x5, %r11
cmpq %rcx, %r11
cmovael %ebx, %r11d
movq %r8, %r9
orq $0x6, %r9
cmpq %rcx, %r9
cmovael %ebx, %r9d
movq %r8, %r10
orq $0x7, %r10
cmpq %rcx, %r10
cmovael %ebx, %r10d
movl %r8d, %ebx
jmp 0x3af936
movq 0x40(%rsp), %r10
movswl (%r10,%r8,2), %ebx
movswl 0x2(%r10,%r8,2), %edx
movswl 0x4(%r10,%r8,2), %eax
movswl 0x6(%r10,%r8,2), %edi
movswl 0x8(%r10,%r8,2), %esi
movswl 0xa(%r10,%r8,2), %r11d
movswl 0xc(%r10,%r8,2), %r9d
movswl 0xe(%r10,%r8,2), %r10d
movq 0x8(%r13), %r12
movl 0x18(%r13), %ebp
imull %ebp, %r11d
movslq %r11d, %r11
leaq (%r12,%r11,4), %r11
movq %r11, 0x18(%rsp)
imull %ebp, %edi
movslq %edi, %rdi
leaq (%r12,%rdi,4), %rdi
movq %rdi, 0x50(%rsp)
imull %ebp, %edx
movslq %edx, %rdx
leaq (%r12,%rdx,4), %rdx
movq %rdx, 0x138(%rsp)
imull %ebp, %ebx
movslq %ebx, %rdx
leaq (%r12,%rdx,4), %rdx
movq %rdx, 0x130(%rsp)
imull %ebp, %eax
cltq
leaq (%r12,%rax,4), %rax
movq %rax, 0x128(%rsp)
imull %ebp, %esi
movslq %esi, %rax
leaq (%r12,%rax,4), %rax
movq %rax, 0x120(%rsp)
imull %ebp, %r9d
movslq %r9d, %rax
leaq (%r12,%rax,4), %rax
movq %rax, 0x118(%rsp)
imull %ebp, %r10d
movslq %r10d, %rax
leaq (%r12,%rax,4), %rax
movq %rax, 0x110(%rsp)
leaq 0x8(%r8), %rax
movq %rax, 0x100(%rsp)
movq 0x48(%rsp), %rsi
imull %esi, %eax
movl 0x14(%rsp), %r10d
movl %r10d, %r9d
movdqa 0x140(%rsp), %xmm14
movdqa %xmm14, %xmm4
movq 0x28(%rsp), %rdx
pinsrw $0x7, 0xc(%rdx), %xmm4
subl %eax, %r9d
movl %r8d, %eax
imull %esi, %eax
subl %eax, %r10d
pinsrw $0x7, %r10d, %xmm14
movw %r9w, 0xc(%rdx)
movq %r8, %rax
orq $0x1, %rax
movq %r8, %r13
orq $0x2, %r13
movq %r8, %r12
orq $0x3, %r12
movq %r8, %r9
orq $0x4, %r9
movq %r8, %r10
orq $0x5, %r10
movq %r8, %r11
orq $0x6, %r11
orq $0x7, %r8
movdqa %xmm15, 0x170(%rsp)
pcmpeqw 0x150(%rsp), %xmm15
movdqa %xmm15, 0x1b0(%rsp)
movdqa 0x27a304(%rip), %xmm8   # 0x629d70
movdqa 0x30(%rsp), %xmm1
movdqa %xmm1, %xmm11
xorl %ebp, %ebp
movq 0x20(%rsp), %rdi
movswq 0xe(%r14,%rbp,2), %rbx
movq 0x130(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm0
movswq 0xc(%r14,%rbp,2), %rbx
movq 0x138(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm5
movswq 0xa(%r14,%rbp,2), %rbx
movq 0x128(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm6
movswq 0x8(%r14,%rbp,2), %rbx
movq 0x50(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm9
movswq 0x6(%r14,%rbp,2), %rbx
movq 0x120(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm12
movswq 0x4(%r14,%rbp,2), %rbx
movq 0x18(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm13
movswq 0x2(%r14,%rbp,2), %rbx
movq 0x118(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm2
movswq (%r14,%rbp,2), %rbx
punpcklwd %xmm0, %xmm5    # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1],xmm5[2],xmm0[2],xmm5[3],xmm0[3]
movq 0x110(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm10
movdqa %xmm4, %xmm0
punpcklwd %xmm6, %xmm9    # xmm9 = xmm9[0],xmm6[0],xmm9[1],xmm6[1],xmm9[2],xmm6[2],xmm9[3],xmm6[3]
movdqa %xmm14, %xmm4
psrldq $0x2, %xmm4             # xmm4 = xmm4[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdx,%rbp,2), %xmm4
psrldq $0x2, %xmm11            # xmm11 = xmm11[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdi,%rbp,2), %xmm11
punpckldq %xmm5, %xmm9    # xmm9 = xmm9[0],xmm5[0],xmm9[1],xmm5[1]
punpcklwd %xmm12, %xmm13  # xmm13 = xmm13[0],xmm12[0],xmm13[1],xmm12[1],xmm13[2],xmm12[2],xmm13[3],xmm12[3]
punpcklwd %xmm2, %xmm10   # xmm10 = xmm10[0],xmm2[0],xmm10[1],xmm2[1],xmm10[2],xmm2[2],xmm10[3],xmm2[3]
punpckldq %xmm13, %xmm10  # xmm10 = xmm10[0],xmm13[0],xmm10[1],xmm13[1]
punpcklqdq %xmm9, %xmm10   # xmm10 = xmm10[0],xmm9[0]
paddsw %xmm0, %xmm10
movdqa %xmm4, %xmm13
movdqa 0x1a0(%rsp), %xmm0
psubsw %xmm0, %xmm13
movdqa %xmm11, %xmm12
movdqa 0x190(%rsp), %xmm5
psubsw %xmm5, %xmm12
movdqa %xmm13, %xmm2
pmaxsw %xmm12, %xmm2
movdqa %xmm14, %xmm6
psubsw %xmm0, %xmm6
psubsw %xmm5, %xmm1
movdqa %xmm6, %xmm0
pmaxsw %xmm1, %xmm0
movdqa %xmm0, %xmm9
pmaxsw %xmm2, %xmm9
pmaxsw %xmm10, %xmm9
movdqa %xmm8, %xmm5
pcmpeqw 0x27a1e2(%rip), %xmm5   # 0x629da0
movdqa %xmm5, %xmm11
pandn %xmm9, %xmm11
movdqa 0x60(%rsp), %xmm14
pand %xmm5, %xmm14
por %xmm11, %xmm14
movdqa %xmm5, %xmm11
pandn %xmm2, %xmm11
movdqa 0x30(%rsp), %xmm9
pand %xmm5, %xmm9
por %xmm9, %xmm11
cmpq $0x8, %rbp
jb 0x3afc28
movdqa 0xc0(%rsp), %xmm2
pminsw %xmm14, %xmm2
movdqa %xmm2, 0xc0(%rsp)
movdqa 0xd0(%rsp), %xmm2
pmaxsw %xmm14, %xmm2
movdqa %xmm2, 0xd0(%rsp)
pcmpeqw %xmm14, %xmm10
movdqa %xmm14, %xmm2
pcmpeqw %xmm11, %xmm2
movdqa %xmm7, %xmm15
psubw %xmm2, %xmm7
movdqa %xmm10, %xmm2
pandn %xmm7, %xmm2
pand 0x27bbee(%rip), %xmm10  # 0x62b840
por %xmm2, %xmm10
pcmpgtw %xmm1, %xmm6
pand 0x27bb9d(%rip), %xmm6   # 0x62b800
pcmpgtw %xmm12, %xmm13
pand 0x27bb9f(%rip), %xmm13  # 0x62b810
por %xmm6, %xmm13
por %xmm10, %xmm13
pxor 0x27bd5c(%rip), %xmm13  # 0x62b9e0
movq 0xb8(%rsp), %rsi
movq 0x10(%rsi), %rbx
movq (%rbx), %rbx
cmpq %r15, %rbp
jae 0x3afcaf
pextrw $0x7, %xmm13, %edi
movq 0xa0(%rsp), %rdx
leaq (%rbx,%rdx), %rsi
movb %dil, (%rbp,%rsi)
cmpq %rcx, %rax
setae %sil
leaq -0x1(%rbp), %rdi
cmpq %r15, %rdi
setae %dil
orb %sil, %dil
jne 0x3afcdd
pextrw $0x6, %xmm13, %esi
movq 0xa8(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r13
movdqa %xmm15, %xmm7
jae 0x3afd17
leaq -0x2(%rbp), %rsi
cmpq $0x2, %rbp
setae %dil
cmpq %r15, %rsi
setl %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x3afd17
pextrw $0x5, %xmm13, %esi
movq 0x78(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r12
jae 0x3afd4f
leaq -0x3(%rbp), %rsi
cmpq $0x3, %rbp
setae %dil
cmpq %r15, %rsi
setl %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x3afd4f
pextrw $0x4, %xmm13, %esi
movq 0x80(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r9
jae 0x3afd87
leaq -0x4(%rbp), %rsi
cmpq $0x4, %rbp
setae %dil
cmpq %r15, %rsi
setl %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x3afd87
pextrw $0x3, %xmm13, %esi
movq 0x88(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r10
jae 0x3afdbf
leaq -0x5(%rbp), %rsi
cmpq $0x5, %rbp
setae %dil
cmpq %r15, %rsi
setl %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x3afdbf
pextrw $0x2, %xmm13, %esi
movq 0x90(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r11
jae 0x3afdf9
leaq -0x6(%rbp), %rsi
cmpq $0x6, %rbp
setae %dil
cmpq %r15, %rsi
setl %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x3afdf9
movd %xmm13, %esi
shrl $0x10, %esi
movq 0x98(%rsp), %rdx
leaq (%rbx,%rdx), %rdi
movb %sil, (%rbp,%rdi)
cmpq %rcx, %r8
setae %sil
cmpq $0x7, %rbp
setb %dil
orb %sil, %dil
jne 0x3afe1f
movd %xmm13, %esi
addq 0xb0(%rsp), %rbx
movb %sil, (%rbp,%rbx)
pandn %xmm0, %xmm5
por %xmm5, %xmm9
movd %xmm14, %esi
movq 0x28(%rsp), %rdx
movw %si, (%rdx,%rbp,2)
movd %xmm11, %esi
movq 0x20(%rsp), %rdi
movw %si, (%rdi,%rbp,2)
movdqa %xmm8, %xmm0
pcmpeqw 0x180(%rsp), %xmm0
pand 0x1b0(%rsp), %xmm0
movdqa %xmm14, %xmm1
pand %xmm0, %xmm1
pandn %xmm3, %xmm0
movdqa %xmm0, %xmm3
por %xmm1, %xmm3
paddsw %xmm7, %xmm8
incq %rbp
movdqa %xmm9, %xmm1
cmpq %rbp, 0x108(%rsp)
jne 0x3afa7e
movdqa 0x170(%rsp), %xmm15
paddsw 0x279ef2(%rip), %xmm15  # 0x629d90
movdqa 0x60(%rsp), %xmm0
psubsw 0x160(%rsp), %xmm0
movdqa %xmm0, 0x60(%rsp)
movq 0xf8(%rsp), %rax
addq %rax, 0xb0(%rsp)
addq %rax, 0xa0(%rsp)
addq %rax, 0xa8(%rsp)
addq %rax, 0x98(%rsp)
addq %rax, 0x90(%rsp)
addq %rax, 0x88(%rsp)
addq %rax, 0x80(%rsp)
addq %rax, 0x78(%rsp)
movq 0x100(%rsp), %rax
movq %rax, %r8
cmpq %rcx, %rax
movq 0x200(%rsp), %r13
jb 0x3af894
movl 0xc(%rsp), %edx
jmp 0x3aff44
movdqa 0x30(%rsp), %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, 0xd0(%rsp)
movdqa 0xe0(%rsp), %xmm0
movdqa %xmm0, 0xc0(%rsp)
movq 0x20(%rsp), %rdi
movl $0x8, %eax
movq 0xb8(%rsp), %rbx
pextrw $0x7, %xmm3, %ecx
cmpw %dx, %cx
cmovlel %edx, %ecx
movl %ecx, %edx
pslldq $0x2, %xmm3             # xmm3 = zero,zero,xmm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
decl %eax
jne 0x3aff51
movdqa 0x30(%rsp), %xmm0
pcmpgtw 0xc0(%rsp), %xmm0
movdqa 0xd0(%rsp), %xmm1
pcmpgtw 0xe0(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %eax
testl %eax, %eax
movl 0x5c(%rsp), %ecx
je 0x3affa8
orb $0x40, 0xc(%rbx)
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x0, 0x10(%rsp)
movswl %dx, %eax
movl %eax, (%rbx)
movl 0x10(%rsp), %eax
movl %eax, 0x4(%rbx)
movl %ecx, 0x8(%rbx)
callq 0x20a60d
movq 0x28(%rsp), %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r13)
jne 0x3b0012
movq 0x40(%rsp), %rdi
callq 0x20a60d
jmp 0x3b0012
callq 0x1be125
jmp 0x3b0010
callq 0x1be0ff
jmp 0x3b0010
callq 0x1be0d9
jmp 0x3b0010
callq 0x1be0b3
jmp 0x3b0010
callq 0x1be08d
jmp 0x3b0010
callq 0x1be067
jmp 0x3b0010
callq 0x1be041
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop