// File: /workspace/github_c_makefile_star2_O1/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 $0x1b8, %rsp            # imm = 0x1B8
testq %rdx, %rdx
je 0x3921ac
movl %ecx, %ebp
testl %ecx, %ecx
jle 0x3921b3
movl %r8d, %r13d
testl %r8d, %r8d
js 0x3921ba
testl %r9d, %r9d
js 0x3921c1
movq 0x1f0(%rsp), %rcx
testq %rcx, %rcx
je 0x3921c8
movq %rdx, %r12
movl 0x30(%rcx), %eax
testl %eax, %eax
jne 0x3915dc
testq %rdi, %rdi
je 0x3921cf
movl %esi, %r15d
testl %esi, %esi
jle 0x3921d6
testl %eax, %eax
je 0x3915e0
movl 0x34(%rcx), %r15d
movq %rdi, 0x70(%rsp)
movq %r9, 0x50(%rsp)
movl %r13d, %esi
negl %esi
movl 0x20(%rcx), %eax
movl %eax, %edx
negl %edx
movl %esi, 0x10(%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 %r15d, %edi
movl %ebp, %esi
callq 0x2097d1
testq %rax, %rax
je 0x3921db
movq %rax, %r14
movl %r13d, 0x40(%rsp)
movq %r12, 0x60(%rsp)
movq %r15, 0x20(%rsp)
orl $0x8281001, 0xc(%rax)   # imm = 0x8281001
leal 0xe(%rbp), %r13d
movl $0x10, %edi
movq %r13, %rsi
callq 0x2094cd
movq %rax, %r15
movl $0x10, %edi
movq %r13, %rsi
callq 0x2094cd
movq %rax, %r12
movl $0x10, %edi
movq %r13, %rsi
callq 0x2094cd
testq %r15, %r15
sete %dl
testq %r12, %r12
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x3921db
movq %rax, 0x30(%rsp)
movq %r12, 0x38(%rsp)
movq 0x1f0(%rsp), %r9
cmpl $0x0, 0x30(%r9)
je 0x3916bb
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %r12
jmp 0x39174a
movq %r14, %r13
movq 0x20(%rsp), %r12
leal 0x7(%r12), %r14d
movslq %r14d, %rsi
movl $0x10, %edi
callq 0x2094cd
testq %rax, %rax
je 0x3921db
movq %rax, %rdi
testl %r12d, %r12d
movq 0x70(%rsp), %r8
jle 0x391711
movq 0x1f0(%rsp), %rax
movq 0x10(%rax), %rax
movl %r12d, %ecx
xorl %edx, %edx
movzbl (%r8,%rdx), %esi
movzwl (%rax,%rsi,4), %esi
movw %si, (%rdi,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x3916fc
movslq %r12d, %rax
movq %rdi, 0x18(%rsp)
leaq (%rdi,%rax,2), %rdi
leal 0x1(%r12), %eax
cmpl %eax, %r14d
cmovgl %r14d, %eax
movl %r12d, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movq %r13, %r14
movq 0x1f0(%rsp), %r9
movq %r14, 0xc8(%rsp)
movd %ebx, %xmm0
movl 0x40(%rsp), %ebx
movd %ebx, %xmm1
movq 0x50(%rsp), %r10
movl 0x10(%rsp), %r11d
movl %r11d, %eax
subl %r10d, %eax
subl %r10d, %eax
imull $0xfffd, %r10d, %ecx    # imm = 0xFFFD
subl %ebx, %ecx
leal (,%r10,4), %edx
movl %r11d, %esi
subl %edx, %esi
imull $0xfffb, %r10d, %edi    # imm = 0xFFFB
subl %ebx, %edi
imull $0xfffa, %r10d, %r8d    # imm = 0xFFFA
subl %ebx, %r8d
imull $0xfff9, %r10d, %edx    # imm = 0xFFF9
subl %ebx, %edx
movd %esi, %xmm3
leal 0x7(%rbp), %ebx
movd %edi, %xmm2
leal -0x1(%r12), %esi
movl %esi, 0x14(%rsp)
movd %r8d, %xmm4
leal -0x1(%rbp), %esi
movl %esi, 0x6c(%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, 0x40(%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, 0xf0(%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 %r10d, %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 %r11d, %edx
subl %r10d, %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 %r11d, %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, 0x70(%rsp)
movq 0x10(%r9), %rax
cmpl $0x2, %ebp
movl $0x1, %r12d
cmovgel %ebp, %r12d
xorl %ecx, %ecx
movq 0x60(%rsp), %rsi
movzbl (%rsi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r15,%rcx,2)
incq %rcx
cmpq %rcx, %r12
jne 0x3918c7
xorl %r13d, %r13d
movq %r13, 0x6(%r15)
movq %r13, (%r15)
movl %ebp, %r14d
leaq (%r15,%r14,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 0x10(%rsp), %eax
movl 0xc(%rsp), %edx
movq 0x50(%rsp), %rcx
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdi
movw %ax, 0xe(%rsi,%r13,2)
subl %ecx, %eax
movw %dx, 0xe(%rdi,%r13,2)
incq %r13
cmpq %r13, %r12
jne 0x391926
xorl %eax, %eax
movq 0x18(%rsp), %r9
movl 0x14(%rsp), %r10d
movw %dx, (%rsi,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x391948
leaq 0x7(%r14), %rax
movq 0x1f0(%rsp), %r11
movq 0x20(%rsp), %rcx
movw %dx, (%rsi,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
incl %ebp
cmpl %ebp, %ebx
jg 0x39196a
movw $0x0, 0xc(%rsi)
testl %ecx, %ecx
jle 0x3920e6
movdqa 0x40(%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, 0x118(%rsp)
movl %ecx, %ecx
leaq (,%r14,8), %rax
leaq -0x1(%r14), %rsi
movq %rsi, 0xc0(%rsp)
movq %rax, 0x100(%rsp)
subq %r14, %rax
addq $-0x7, %rax
movq %rax, 0xb0(%rsp)
leaq (%r14,%r14,2), %rax
leaq -0x6(,%rax,2), %rax
movq %rax, 0xa8(%rsp)
leaq -0x5(%r14,%r14,4), %rdx
movq %rdx, 0xa0(%rsp)
leaq -0x4(,%r14,4), %rdx
movq %rdx, 0x98(%rsp)
leaq -0x3(%r14,%r14,2), %rdx
movq %rdx, 0x90(%rsp)
leaq -0x2(%r14,%r14), %rdx
movq %rdx, 0x88(%rsp)
movdqa 0x263feb(%rip), %xmm14  # 0x5f5a20
movq $0x0, 0xb8(%rsp)
xorl %ebp, %ebp
movdqa 0xf0(%rsp), %xmm0
movdqa %xmm0, 0xd0(%rsp)
movdqa %xmm3, 0xe0(%rsp)
movl 0x30(%r11), %edx
movl %ebp, %eax
testl %edx, %edx
jne 0x391a6d
movswl (%r9,%rbp,2), %eax
movq %rbp, %rdi
orq $0x1, %rdi
testl %edx, %edx
je 0x391a83
cmpq %rcx, %rdi
movl %r10d, %esi
cmovbl %edi, %esi
jmp 0x391a88
movswl (%r9,%rdi,2), %esi
movl %esi, 0x28(%rsp)
movl %eax, 0x58(%rsp)
movq %rbp, %r8
orq $0x2, %r8
testl %edx, %edx
je 0x391aa7
cmpq %rcx, %r8
movl %r10d, %eax
cmovbl %r8d, %eax
jmp 0x391aac
movswl (%r9,%r8,2), %eax
movq %rbp, %rbx
orq $0x3, %rbx
testl %edx, %edx
je 0x391ac3
cmpq %rcx, %rbx
movl %r10d, %r13d
cmovbl %ebx, %r13d
jmp 0x391ac8
movswl (%r9,%rbx,2), %r13d
movq %r8, 0x60(%rsp)
movq %rbp, %r12
orq $0x4, %r12
testl %edx, %edx
je 0x391ae4
cmpq %rcx, %r12
movl %r10d, %r8d
cmovbl %r12d, %r8d
jmp 0x391ae9
movswl (%r9,%r12,2), %r8d
movq %r12, 0x130(%rsp)
movq %rbp, %rsi
orq $0x5, %rbp
testl %edx, %edx
movq %rdi, 0x20(%rsp)
je 0x391b0d
cmpq %rcx, %rbp
movl %r10d, %r12d
cmovbl %ebp, %r12d
jmp 0x391b12
movswl (%r9,%rbp,2), %r12d
movq %rsi, %rdi
orq $0x6, %rdi
testl %edx, %edx
movq %rbx, 0x138(%rsp)
movq %rbp, 0x128(%rsp)
je 0x391b39
cmpq %rcx, %rdi
movl %r10d, %r9d
cmovbl %edi, %r9d
jmp 0x391b3e
movswl (%r9,%rdi,2), %r9d
movq 0x8(%r11), %r10
movl 0x18(%r11), %ebp
movq %rsi, %rbx
orq $0x7, %rbx
testl %edx, %edx
movq %rdi, 0x108(%rsp)
je 0x391b67
cmpq %rcx, %rbx
movl 0x14(%rsp), %r11d
cmovbl %ebx, %r11d
jmp 0x391b71
movq 0x18(%rsp), %rdx
movswl (%rdx,%rbx,2), %r11d
movl 0x58(%rsp), %edx
imull %ebp, %edx
movslq %edx, %rdx
leaq (%r10,%rdx,4), %rdx
movq %rdx, 0x58(%rsp)
movl 0x28(%rsp), %edx
imull %ebp, %edx
movslq %edx, %rdx
leaq (%r10,%rdx,4), %rdx
movq %rdx, 0x28(%rsp)
imull %ebp, %eax
cltq
leaq (%r10,%rax,4), %rax
movq %rax, 0x120(%rsp)
imull %ebp, %r13d
movslq %r13d, %r13
leaq (%r10,%r13,4), %r13
imull %ebp, %r8d
movslq %r8d, %r8
leaq (%r10,%r8,4), %r8
imull %ebp, %r12d
movslq %r12d, %r12
leaq (%r10,%r12,4), %r12
imull %ebp, %r9d
movslq %r9d, %r9
leaq (%r10,%r9,4), %r9
imull %ebp, %r11d
movslq %r11d, %r11
leaq (%r10,%r11,4), %r10
movq %rsi, %rdi
leaq 0x8(%rsi), %rax
movq %rax, 0x110(%rsp)
movl %eax, %r11d
movq 0x50(%rsp), %rdx
imull %edx, %r11d
movl 0x10(%rsp), %eax
movl %eax, %ebp
subl %r11d, %ebp
movdqa 0x140(%rsp), %xmm13
movdqa %xmm13, %xmm4
movq 0x38(%rsp), %rsi
pinsrw $0x7, 0xc(%rsi), %xmm4
movw %bp, 0xc(%rsi)
imull %edx, %edi
subl %edi, %eax
pinsrw $0x7, %eax, %xmm13
movdqa %xmm14, 0x170(%rsp)
pcmpeqw 0x150(%rsp), %xmm14
xorl %r11d, %r11d
movdqa 0x263f84(%rip), %xmm8   # 0x5f5bd0
movdqa 0x40(%rsp), %xmm0
movdqa %xmm0, %xmm10
movq 0x30(%rsp), %rdx
movq 0x108(%rsp), %rdi
movswq 0xe(%r15,%r11,2), %rbp
movq 0x58(%rsp), %rax
movd (%rax,%rbp,4), %xmm1
movswq 0xc(%r15,%r11,2), %rbp
movq 0x28(%rsp), %rax
movd (%rax,%rbp,4), %xmm5
movswq 0xa(%r15,%r11,2), %rbp
movq 0x120(%rsp), %rax
movd (%rax,%rbp,4), %xmm6
movswq 0x8(%r15,%r11,2), %rbp
movd (%r13,%rbp,4), %xmm11
movswq 0x6(%r15,%r11,2), %rbp
movd (%r8,%rbp,4), %xmm12
movswq 0x4(%r15,%r11,2), %rbp
movd (%r12,%rbp,4), %xmm15
movswq 0x2(%r15,%r11,2), %rbp
movd (%r9,%rbp,4), %xmm2
movswq (%r15,%r11,2), %rbp
punpcklwd %xmm1, %xmm5    # xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
movd (%r10,%rbp,4), %xmm9
movdqa %xmm4, %xmm1
punpcklwd %xmm6, %xmm11   # xmm11 = xmm11[0],xmm6[0],xmm11[1],xmm6[1],xmm11[2],xmm6[2],xmm11[3],xmm6[3]
movdqa %xmm13, %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(%rsi,%r11,2), %xmm4
punpckldq %xmm5, %xmm11   # xmm11 = xmm11[0],xmm5[0],xmm11[1],xmm5[1]
punpcklwd %xmm12, %xmm15  # xmm15 = xmm15[0],xmm12[0],xmm15[1],xmm12[1],xmm15[2],xmm12[2],xmm15[3],xmm12[3]
punpcklwd %xmm2, %xmm9    # xmm9 = xmm9[0],xmm2[0],xmm9[1],xmm2[1],xmm9[2],xmm2[2],xmm9[3],xmm2[3]
punpckldq %xmm15, %xmm9   # xmm9 = xmm9[0],xmm15[0],xmm9[1],xmm15[1]
punpcklqdq %xmm11, %xmm9   # xmm9 = xmm9[0],xmm11[0]
paddsw %xmm1, %xmm9
psrldq $0x2, %xmm10            # xmm10 = xmm10[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdx,%r11,2), %xmm10
movdqa %xmm4, %xmm1
movdqa 0x1a0(%rsp), %xmm7
psubsw %xmm7, %xmm1
movdqa %xmm10, %xmm5
movdqa 0x190(%rsp), %xmm10
psubsw %xmm10, %xmm5
movdqa %xmm1, %xmm2
pmaxsw %xmm5, %xmm2
movdqa %xmm13, %xmm6
psubsw %xmm7, %xmm6
movdqa %xmm0, %xmm12
psubsw %xmm10, %xmm12
movdqa %xmm6, %xmm11
pmaxsw %xmm12, %xmm11
movdqa %xmm11, %xmm0
pmaxsw %xmm2, %xmm0
pmaxsw %xmm9, %xmm0
movdqa %xmm8, %xmm15
pcmpeqw 0x263e7c(%rip), %xmm15  # 0x5f5c00
movdqa %xmm15, %xmm10
pandn %xmm0, %xmm10
movdqa 0x70(%rsp), %xmm13
pand %xmm15, %xmm13
por %xmm10, %xmm13
movdqa %xmm15, %xmm10
pandn %xmm2, %xmm10
movdqa 0x40(%rsp), %xmm0
pand %xmm15, %xmm0
por %xmm0, %xmm10
cmpq $0x8, %r11
jb 0x391ded
movdqa 0xd0(%rsp), %xmm2
pminsw %xmm13, %xmm2
movdqa %xmm2, 0xd0(%rsp)
movdqa 0xe0(%rsp), %xmm2
pmaxsw %xmm13, %xmm2
movdqa %xmm2, 0xe0(%rsp)
pcmpeqw %xmm13, %xmm9
movdqa %xmm13, %xmm2
pcmpeqw %xmm10, %xmm2
movdqa 0x263ddc(%rip), %xmm7   # 0x5f5be0
psubw %xmm2, %xmm7
movdqa %xmm9, %xmm2
pandn %xmm7, %xmm2
pand 0x2657e6(%rip), %xmm9   # 0x5f7600
por %xmm2, %xmm9
pcmpgtw %xmm12, %xmm6
pand 0x265794(%rip), %xmm6   # 0x5f75c0
pcmpgtw %xmm5, %xmm1
pand 0x265798(%rip), %xmm1   # 0x5f75d0
por %xmm6, %xmm1
por %xmm9, %xmm1
pxor 0x265927(%rip), %xmm1   # 0x5f7770
movq 0xc8(%rsp), %rdx
movq 0x10(%rdx), %rbp
movq (%rbp), %rbp
cmpq %r14, %r11
jae 0x391e72
pextrw $0x7, %xmm1, %esi
movq 0xb8(%rsp), %rdx
addq %rbp, %rdx
movb %sil, (%r11,%rdx)
cmpq %rcx, 0x20(%rsp)
setae %dl
leaq -0x1(%r11), %rsi
cmpq %r14, %rsi
setae %sil
orb %dl, %sil
jne 0x391e9e
pextrw $0x6, %xmm1, %edx
movq 0xc0(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, 0x60(%rsp)
jae 0x391ed3
leaq -0x2(%r11), %rdx
cmpq $0x2, %r11
setae %sil
cmpq %r14, %rdx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x391ed3
pextrw $0x5, %xmm1, %edx
movq 0x88(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, 0x138(%rsp)
jae 0x391f0b
leaq -0x3(%r11), %rdx
cmpq $0x3, %r11
setae %sil
cmpq %r14, %rdx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x391f0b
pextrw $0x4, %xmm1, %edx
movq 0x90(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, 0x130(%rsp)
jae 0x391f43
leaq -0x4(%r11), %rdx
cmpq $0x4, %r11
setae %sil
cmpq %r14, %rdx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x391f43
pextrw $0x3, %xmm1, %edx
movq 0x98(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, 0x128(%rsp)
jae 0x391f7b
leaq -0x5(%r11), %rdx
cmpq $0x5, %r11
setae %sil
cmpq %r14, %rdx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x391f7b
pextrw $0x2, %xmm1, %edx
movq 0xa0(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, %rdi
jae 0x391fb0
leaq -0x6(%r11), %rdx
cmpq $0x6, %r11
setae %sil
cmpq %r14, %rdx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x391fb0
movd %xmm1, %edx
shrl $0x10, %edx
movq 0xa8(%rsp), %rsi
addq %rbp, %rsi
movb %dl, (%r11,%rsi)
cmpq %rcx, %rbx
jae 0x391fdc
leaq -0x7(%r11), %rdx
cmpq $0x7, %r11
setb %sil
cmpq %r14, %rdx
setge %dl
orb %sil, %dl
jne 0x391fdc
movd %xmm1, %edx
addq 0xb0(%rsp), %rbp
movb %dl, (%r11,%rbp)
pandn %xmm11, %xmm15
por %xmm15, %xmm0
movd %xmm13, %edx
movq 0x38(%rsp), %rsi
movw %dx, (%rsi,%r11,2)
movd %xmm10, %edx
movq 0x30(%rsp), %rbp
movw %dx, (%rbp,%r11,2)
movq %rbp, %rdx
movdqa %xmm8, %xmm1
pcmpeqw 0x180(%rsp), %xmm1
pand %xmm14, %xmm1
movdqa %xmm13, %xmm2
pand %xmm1, %xmm2
pandn %xmm3, %xmm1
movdqa %xmm1, %xmm3
por %xmm2, %xmm3
paddsw 0x263ba7(%rip), %xmm8   # 0x5f5be0
incq %r11
cmpq %r11, 0x118(%rsp)
jne 0x391c64
movdqa 0x170(%rsp), %xmm14
paddsw 0x263b93(%rip), %xmm14  # 0x5f5bf0
movdqa 0x70(%rsp), %xmm0
psubsw 0x160(%rsp), %xmm0
movdqa %xmm0, 0x70(%rsp)
movq 0x100(%rsp), %rdx
addq %rdx, 0xb8(%rsp)
addq %rdx, 0xc0(%rsp)
addq %rdx, 0xb0(%rsp)
addq %rdx, 0xa8(%rsp)
addq %rdx, 0xa0(%rsp)
addq %rdx, 0x98(%rsp)
addq %rdx, 0x90(%rsp)
addq %rdx, 0x88(%rsp)
movq 0x110(%rsp), %rdx
movq %rdx, %rbp
cmpq %rcx, %rdx
movq 0x1f0(%rsp), %r11
movq 0x18(%rsp), %r9
movl 0x14(%rsp), %r10d
jb 0x391a5e
movl 0xc(%rsp), %edx
jmp 0x39210b
movdqa 0x40(%rsp), %xmm0
movdqa %xmm0, %xmm3
movdqa %xmm0, 0xe0(%rsp)
movdqa 0xf0(%rsp), %xmm0
movdqa %xmm0, 0xd0(%rsp)
movl $0x8, %eax
movq 0xc8(%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 0x392118
movdqa 0x40(%rsp), %xmm0
pcmpgtw 0xd0(%rsp), %xmm0
movdqa 0xe0(%rsp), %xmm1
pcmpgtw 0xf0(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %eax
testl %eax, %eax
movl 0x6c(%rsp), %ecx
je 0x39216a
orb $0x40, 0xc(%rbx)
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r10d, %r10d
movswl %dx, %eax
movl %eax, (%rbx)
movl %r10d, 0x4(%rbx)
movl %ecx, 0x8(%rbx)
movq 0x30(%rsp), %rdi
callq 0x2094b5
movq 0x38(%rsp), %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq 0x1f0(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x3921dd
movq 0x18(%rsp), %rdi
callq 0x2094b5
jmp 0x3921dd
callq 0x1be131
jmp 0x3921db
callq 0x1be10b
jmp 0x3921db
callq 0x1be0e5
jmp 0x3921db
callq 0x1be0bf
jmp 0x3921db
callq 0x1be099
jmp 0x3921db
callq 0x1be073
jmp 0x3921db
callq 0x1be04d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop