// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/nw_diag_sse2_128_16.c
// Function: parasail_nw_rowcol_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 = 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 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;

    /* 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);

    /* initialize result */
#ifdef PARASAIL_TABLE
    result = parasail_result_new_table1(s1Len, s2Len);
#else
#ifdef PARASAIL_ROWCOL
    result = parasail_result_new_rowcol1(s1Len, s2Len);
#else
    result = parasail_result_new();
#endif
#endif
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_NW | PARASAIL_FLAG_DIAG
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_8;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* 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 vF = 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 = _mm_max_epi16(
                    _mm_subs_epi16(vNH, vOpen),
                    _mm_subs_epi16(vF, vGap));
            vE = _mm_max_epi16(
                    _mm_subs_epi16(vWH, vOpen),
                    _mm_subs_epi16(vE, vGap));
            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);
            }
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vWH, i, s1Len, j, s2Len);
#endif
#ifdef PARASAIL_ROWCOL
            arr_store_rowcol(result->rowcols->score_row, result->rowcols->score_col, vWH, i, s1Len, j, s2Len);
#endif
            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 $0x1a8, %rsp            # imm = 0x1A8
testq %rdx, %rdx
je 0x35b956
movl %ecx, %ebp
testl %ecx, %ecx
jle 0x35b95d
movl %r8d, %r15d
testl %r8d, %r8d
js 0x35b964
testl %r9d, %r9d
js 0x35b96b
movq 0x1e0(%rsp), %rcx
testq %rcx, %rcx
je 0x35b972
cmpl $0x0, 0x30(%rcx)
je 0x35ad92
movl 0x34(%rcx), %r14d
jmp 0x35ada6
testq %rdi, %rdi
je 0x35b979
movl %esi, %r14d
testl %esi, %esi
jle 0x35b980
movq %rdi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq %r9, 0x48(%rsp)
movl %r15d, %esi
negl %esi
movl 0x20(%rcx), %eax
movl %eax, %edx
negl %edx
movl %esi, 0xc(%rsp)
cmpl %esi, %eax
cmovgl %r15d, %edx
movl %edx, (%rsp)
movw $0x7ffe, %bx            # imm = 0x7FFE
subw 0x1c(%rcx), %bx
movl %r14d, %edi
movl %ebp, %esi
callq 0x20ac53
testq %rax, %rax
je 0x35b985
movq %rax, %r12
movl %r15d, 0x30(%rsp)
movq %r14, 0x10(%rsp)
orl $0x8241001, 0xc(%rax)   # imm = 0x8241001
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, %r15
movl $0x10, %edi
movq %r13, %rsi
callq 0x20a625
testq %r14, %r14
sete %dl
movq %r15, 0x28(%rsp)
testq %r15, %r15
sete %cl
orb %dl, %cl
movq %rax, 0x20(%rsp)
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x35b985
movq 0x1e0(%rsp), %r13
cmpl $0x0, 0x30(%r13)
je 0x35ae73
movq $0x0, 0x40(%rsp)
movq 0x10(%rsp), %r15
jmp 0x35aeed
movq 0x10(%rsp), %r15
leal 0x7(%r15), %eax
movl %eax, 0x50(%rsp)
movslq %eax, %rsi
movl $0x10, %edi
callq 0x20a625
testq %rax, %rax
je 0x35b985
testl %r15d, %r15d
movq 0x60(%rsp), %r8
jle 0x35aebe
movq 0x10(%r13), %rdi
movl %r15d, %ecx
xorl %edx, %edx
movzbl (%r8,%rdx), %esi
movzwl (%rdi,%rsi,4), %esi
movw %si, (%rax,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x35aea9
movslq %r15d, %rdx
movq %rax, 0x40(%rsp)
leaq (%rax,%rdx,2), %rdi
leal 0x1(%r15), %eax
movl 0x50(%rsp), %ecx
cmpl %eax, %ecx
cmovgl %ecx, %eax
movl %r15d, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movq %r12, 0x70(%rsp)
movd %ebx, %xmm0
movl 0x30(%rsp), %r11d
movd %r11d, %xmm1
movq 0x48(%rsp), %r9
movl 0xc(%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(%r15), %esi
movl %esi, 0x4(%rsp)
movd %r8d, %xmm4
leal -0x1(%rbp), %esi
movl %esi, 0x8(%rsp)
movq %r15, %rsi
movl (%rsp), %r15d
addl $0xffff8001, %r15d      # imm = 0xFFFF8001
movl %r15d, (%rsp)
movd %r15d, %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, 0x90(%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, 0x190(%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, 0x180(%rsp)
psllw $0x3, %xmm0
movdqa %xmm0, 0x150(%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, 0x140(%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, 0x170(%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 0x58(%rsp), %rsi
movzbl (%rsi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r14,%rcx,2)
incq %rcx
cmpq %rcx, %r15
jne 0x35b05f
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 0xc(%rsp), %eax
movl (%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 0x35b0ba
xorl %eax, %eax
movq %rsi, %rcx
movw %dx, (%rcx,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x35b0d5
leaq 0x7(%r15), %rax
movq 0x70(%rsp), %r12
movw %dx, (%rcx,%rax,2)
movw %dx, (%rdi,%rax,2)
incq %rax
incl %ebp
cmpl %ebp, %ebx
jg 0x35b0ef
movw $0x0, 0xc(%rcx)
movq 0x10(%rsp), %rcx
testl %ecx, %ecx
jle 0x35b898
movq 0x8(%r13), %rax
movq %rax, 0xa8(%rsp)
movdqa 0x30(%rsp), %xmm0
movdqa %xmm0, %xmm1
psrldq $0x2, %xmm1             # xmm1 = xmm1[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
movdqa %xmm1, 0x130(%rsp)
movl 0x8(%rsp), %eax
movq %rax, 0xf0(%rsp)
cmpl $0x2, %ebx
movl $0x1, %eax
cmovgel %ebx, %eax
movq %rax, 0xe8(%rsp)
movl %ecx, %esi
movl 0x4(%rsp), %edx
leaq 0x1(%r15), %rax
movq %rax, 0xe0(%rsp)
leaq 0x2(%r15), %rax
movq %rax, 0xd8(%rsp)
leaq 0x3(%r15), %rax
movq %rax, 0xd0(%rsp)
leaq 0x4(%r15), %rax
movq %rax, 0xc8(%rsp)
leaq 0x5(%r15), %rax
movq %rax, 0xc0(%rsp)
leaq 0x6(%r15), %rax
movq %rax, 0xb8(%rsp)
movdqa 0x2ce993(%rip), %xmm11  # 0x629b40
xorl %ebp, %ebp
movdqa %xmm0, %xmm2
movdqa 0x90(%rsp), %xmm1
movdqa %xmm0, 0x80(%rsp)
cmpl $0x0, 0x30(%r13)
je 0x35b235
movq %rbp, %rcx
orq $0x1, %rcx
cmpq %rsi, %rcx
movl 0x4(%rsp), %ebx
cmovael %ebx, %ecx
movq %rbp, %rax
orq $0x2, %rax
cmpq %rsi, %rax
cmovael %ebx, %eax
movq %rbp, %r8
orq $0x3, %r8
cmpq %rsi, %r8
cmovael %ebx, %r8d
movq %rbp, %rdi
orq $0x4, %rdi
cmpq %rsi, %rdi
cmovael %ebx, %edi
movq %rbp, %r11
orq $0x5, %r11
cmpq %rsi, %r11
cmovael %ebx, %r11d
movq %rbp, %r9
orq $0x6, %r9
cmpq %rsi, %r9
cmovael %ebx, %r9d
movq %rbp, %r10
orq $0x7, %r10
cmpq %rsi, %r10
cmovael %ebx, %r10d
movl %ebp, 0x18(%rsp)
jmp 0x35b26d
movq 0x40(%rsp), %r10
movswl (%r10,%rbp,2), %eax
movl %eax, 0x18(%rsp)
movswl 0x2(%r10,%rbp,2), %ecx
movswl 0x4(%r10,%rbp,2), %eax
movswl 0x6(%r10,%rbp,2), %r8d
movswl 0x8(%r10,%rbp,2), %edi
movswl 0xa(%r10,%rbp,2), %r11d
movswl 0xc(%r10,%rbp,2), %r9d
movswl 0xe(%r10,%rbp,2), %r10d
movq %rbp, %rbx
movl 0x18(%r13), %ebp
imull %ebp, %r11d
movslq %r11d, %r11
movq 0xa8(%rsp), %r13
leaq (,%r11,4), %r11
addq %r13, %r11
movq %r11, 0x58(%rsp)
imull %ebp, %r8d
movslq %r8d, %r8
leaq (,%r8,4), %r8
addq %r13, %r8
movq %r8, 0x10(%rsp)
imull %ebp, %ecx
movslq %ecx, %rcx
leaq (,%rcx,4), %rcx
addq %r13, %rcx
movq %rcx, 0x50(%rsp)
movl 0x18(%rsp), %ecx
imull %ebp, %ecx
movslq %ecx, %rcx
leaq (,%rcx,4), %rcx
addq %r13, %rcx
movq %rcx, 0x18(%rsp)
imull %ebp, %eax
cltq
leaq (,%rax,4), %rax
addq %r13, %rax
movq %rax, 0x128(%rsp)
imull %ebp, %edi
movslq %edi, %rax
leaq (,%rax,4), %rax
addq %r13, %rax
movq %rax, 0x120(%rsp)
imull %ebp, %r9d
movslq %r9d, %rax
leaq (,%rax,4), %rax
addq %r13, %rax
movq %rax, 0x118(%rsp)
imull %ebp, %r10d
movslq %r10d, %rax
leaq (,%rax,4), %rax
addq %r13, %rax
movq %rax, 0x110(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0xb0(%rsp)
movq 0x48(%rsp), %rdi
imull %edi, %eax
movl 0xc(%rsp), %r9d
movl %r9d, %ecx
subl %eax, %ecx
movdqa 0x130(%rsp), %xmm10
movdqa %xmm10, %xmm9
movq 0x28(%rsp), %r8
pinsrw $0x7, 0xc(%r8), %xmm9
movw %cx, 0xc(%r8)
movl %ebx, %eax
imull %edi, %eax
movl %r9d, %ecx
subl %eax, %ecx
pinsrw $0x7, %ecx, %xmm10
movq %r8, %rcx
movq %rbx, %rax
orq $0x1, %rax
movq %rax, 0x78(%rsp)
movq %rbx, %rax
orq $0x2, %rax
movq %rax, 0x108(%rsp)
movq %rbx, %rax
orq $0x3, %rax
movq %rax, 0x100(%rsp)
movq %rbx, %rax
orq $0x4, %rax
movq %rax, 0xf8(%rsp)
movq %rbx, %r9
orq $0x5, %r9
movq %rbx, %r10
orq $0x6, %r10
movq %rbx, %r11
orq $0x7, %r11
movdqa %xmm11, 0x160(%rsp)
pcmpeqw 0x140(%rsp), %xmm11
movdqa 0x2ce975(%rip), %xmm12  # 0x629d70
movdqa 0x30(%rsp), %xmm13
movdqa %xmm13, %xmm14
xorl %r13d, %r13d
movq 0x20(%rsp), %rdi
movswq 0xe(%r14,%r13,2), %rax
movq 0x18(%rsp), %r8
movd (%r8,%rax,4), %xmm15
movswq 0xc(%r14,%r13,2), %rax
movq 0x50(%rsp), %r8
movd (%r8,%rax,4), %xmm8
movswq 0xa(%r14,%r13,2), %rax
movq 0x128(%rsp), %r8
movd (%r8,%rax,4), %xmm5
movswq 0x8(%r14,%r13,2), %rax
movq 0x10(%rsp), %r8
movd (%r8,%rax,4), %xmm3
movswq 0x6(%r14,%r13,2), %rax
movq 0x120(%rsp), %r8
movd (%r8,%rax,4), %xmm4
movswq 0x4(%r14,%r13,2), %rax
movq 0x58(%rsp), %r8
movd (%r8,%rax,4), %xmm6
movswq 0x2(%r14,%r13,2), %rax
movq 0x118(%rsp), %r8
movd (%r8,%rax,4), %xmm7
movswq (%r14,%r13,2), %rax
movq 0x110(%rsp), %r8
movd (%r8,%rax,4), %xmm0
punpcklwd %xmm15, %xmm8   # xmm8 = xmm8[0],xmm15[0],xmm8[1],xmm15[1],xmm8[2],xmm15[2],xmm8[3],xmm15[3]
punpcklwd %xmm5, %xmm3    # xmm3 = xmm3[0],xmm5[0],xmm3[1],xmm5[1],xmm3[2],xmm5[2],xmm3[3],xmm5[3]
punpckldq %xmm8, %xmm3    # xmm3 = xmm3[0],xmm8[0],xmm3[1],xmm8[1]
punpcklwd %xmm4, %xmm6    # xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3]
movq %rbx, %r8
cmpq %rdx, %rbx
setne %bpl
punpcklwd %xmm7, %xmm0    # xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3]
punpckldq %xmm6, %xmm0    # xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
punpcklqdq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0]
paddsw %xmm9, %xmm0
movdqa %xmm10, %xmm9
psrldq $0x2, %xmm9             # xmm9 = xmm9[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rcx,%r13,2), %xmm9
psrldq $0x2, %xmm14            # xmm14 = xmm14[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdi,%r13,2), %xmm14
movdqa %xmm9, %xmm3
movdqa 0x190(%rsp), %xmm4
psubsw %xmm4, %xmm3
movdqa 0x180(%rsp), %xmm5
psubsw %xmm5, %xmm14
pmaxsw %xmm3, %xmm14
psubsw %xmm4, %xmm10
psubsw %xmm5, %xmm13
pmaxsw %xmm10, %xmm13
movdqa %xmm13, %xmm3
pmaxsw %xmm14, %xmm3
pmaxsw %xmm0, %xmm3
movdqa %xmm12, %xmm15
pcmpeqw 0x2ce860(%rip), %xmm15  # 0x629da0
movdqa %xmm15, %xmm0
pandn %xmm3, %xmm0
movdqa 0x60(%rsp), %xmm10
pand %xmm15, %xmm10
por %xmm0, %xmm10
cmpq $0x8, %r13
jb 0x35b57c
pminsw %xmm10, %xmm1
movdqa 0x80(%rsp), %xmm0
pmaxsw %xmm10, %xmm0
movdqa %xmm0, 0x80(%rsp)
movq 0x78(%rsp), %rdi
movq 0x10(%r12), %rax
movq (%rax), %r12
movq 0x8(%rax), %rax
cmpq %r15, %r13
setae %bl
orb %bl, %bpl
pextrw $0x7, %xmm10, %ebp
jne 0x35b5a5
movswl %bp, %ebx
movl %ebx, (%r12,%r13,4)
cmpq %r13, 0xf0(%rsp)
jne 0x35b5b6
movswl %bp, %ebx
movl %ebx, (%rax,%r8,4)
cmpq %rdx, %rdi
setne %bl
leaq -0x1(%r13), %rbp
cmpq %r15, %rbp
setae %bpl
orb %bl, %bpl
pextrw $0x6, %xmm10, %ebp
jne 0x35b5da
movswl %bp, %ebx
movl %ebx, -0x4(%r12,%r13,4)
cmpq %rsi, %rdi
setae %bl
cmpq %r13, %r15
setne %cl
orb %bl, %cl
jne 0x35b5f0
movswl %bp, %ecx
movl %ecx, (%rax,%rdi,4)
movq 0x108(%rsp), %rdi
cmpq %rdx, %rdi
jne 0x35b623
leaq -0x2(%r13), %rcx
cmpq $0x2, %r13
setae %bl
cmpq %r15, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x35b623
pextrw $0x5, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, -0x8(%r12,%r13,4)
cmpq %rsi, %rdi
setae %cl
cmpq %r13, 0xe0(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b644
pextrw $0x5, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, (%rax,%rdi,4)
movq 0x100(%rsp), %rdi
cmpq %rdx, %rdi
jne 0x35b677
leaq -0x3(%r13), %rcx
cmpq $0x3, %r13
setae %bl
cmpq %r15, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x35b677
pextrw $0x4, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, -0xc(%r12,%r13,4)
cmpq %rsi, %rdi
setae %cl
cmpq %r13, 0xd8(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b698
pextrw $0x4, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, (%rax,%rdi,4)
movq 0xf8(%rsp), %rdi
cmpq %rdx, %rdi
jne 0x35b6cb
leaq -0x4(%r13), %rcx
cmpq $0x4, %r13
setae %bl
cmpq %r15, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x35b6cb
pextrw $0x3, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, -0x10(%r12,%r13,4)
cmpq %rsi, %rdi
setae %cl
cmpq %r13, 0xd0(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b6ec
pextrw $0x3, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, (%rax,%rdi,4)
cmpq %rdx, %r9
jne 0x35b717
leaq -0x5(%r13), %rcx
cmpq $0x5, %r13
setae %bl
cmpq %r15, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x35b717
pextrw $0x2, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, -0x14(%r12,%r13,4)
cmpq %rsi, %r9
setae %cl
cmpq %r13, 0xc8(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b739
pextrw $0x2, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, (%rax,%r9,4)
cmpq %rdx, %r10
jne 0x35b764
leaq -0x6(%r13), %rcx
cmpq $0x6, %r13
setae %bl
cmpq %r15, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x35b764
pextrw $0x1, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, -0x18(%r12,%r13,4)
cmpq %rsi, %r10
setae %cl
cmpq %r13, 0xc0(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b786
pextrw $0x1, %xmm10, %ecx
movswl %cx, %ecx
movl %ecx, (%rax,%r10,4)
cmpq %rdx, %r11
setne %cl
cmpq $0x7, %r13
setb %bl
orb %cl, %bl
movd %xmm10, %ebp
jne 0x35b7a4
movswl %bp, %ecx
movl %ecx, -0x1c(%r12,%r13,4)
cmpq %rsi, %r11
setae %cl
cmpq %r13, 0xb8(%rsp)
setne %bl
orb %cl, %bl
jne 0x35b7c0
movswl %bp, %ecx
movl %ecx, (%rax,%r11,4)
movdqa %xmm15, %xmm0
pandn %xmm14, %xmm0
movdqa 0x30(%rsp), %xmm3
pand %xmm15, %xmm3
por %xmm3, %xmm0
pandn %xmm13, %xmm15
por %xmm3, %xmm15
movq 0x28(%rsp), %rcx
movw %bp, (%rcx,%r13,2)
movd %xmm0, %eax
movq 0x20(%rsp), %rdi
movw %ax, (%rdi,%r13,2)
movdqa %xmm12, %xmm3
pcmpeqw 0x170(%rsp), %xmm3
pand %xmm11, %xmm3
movdqa %xmm10, %xmm4
pand %xmm3, %xmm4
pandn %xmm2, %xmm3
movdqa %xmm3, %xmm2
por %xmm4, %xmm2
paddsw 0x2ce554(%rip), %xmm12  # 0x629d80
incq %r13
movdqa %xmm0, %xmm14
movdqa %xmm15, %xmm13
cmpq %r13, 0xe8(%rsp)
movq 0x70(%rsp), %r12
movq %r8, %rbx
jne 0x35b40f
movdqa 0x160(%rsp), %xmm11
paddsw 0x2ce52e(%rip), %xmm11  # 0x629d90
movdqa 0x60(%rsp), %xmm0
psubsw 0x150(%rsp), %xmm0
movdqa %xmm0, 0x60(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, %rbp
cmpq %rsi, %rax
movq 0x1e0(%rsp), %r13
jb 0x35b1c5
movl (%rsp), %edx
jmp 0x35b8b5
movdqa 0x30(%rsp), %xmm2
movdqa %xmm2, 0x80(%rsp)
movdqa 0x90(%rsp), %xmm1
movq 0x20(%rsp), %rdi
movl $0x8, %eax
movq 0x40(%rsp), %rbx
pextrw $0x7, %xmm2, %ecx
cmpw %dx, %cx
cmovlel %edx, %ecx
movl %ecx, %edx
pslldq $0x2, %xmm2             # xmm2 = zero,zero,xmm2[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
decl %eax
jne 0x35b8bf
movdqa 0x30(%rsp), %xmm0
pcmpgtw %xmm1, %xmm0
movdqa 0x80(%rsp), %xmm1
pcmpgtw 0x90(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %eax
testl %eax, %eax
je 0x35b915
orb $0x40, 0xc(%r12)
xorl %edx, %edx
movl $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movswl %dx, %eax
movl %eax, (%r12)
movl 0x4(%rsp), %eax
movl %eax, 0x4(%r12)
movl 0x8(%rsp), %eax
movl %eax, 0x8(%r12)
callq 0x20a60d
movq 0x28(%rsp), %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r13)
jne 0x35b988
movq %rbx, %rdi
callq 0x20a60d
jmp 0x35b988
callq 0x1b58f9
jmp 0x35b985
callq 0x1b58d3
jmp 0x35b985
callq 0x1b58ad
jmp 0x35b985
callq 0x1b5887
jmp 0x35b985
callq 0x1b5861
jmp 0x35b985
callq 0x1b583b
jmp 0x35b985
callq 0x1b5815
xorl %r12d, %r12d
movq %r12, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)