// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sw_diag_sse2_128_16.c
// Function: parasail_sw_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 vNegInf0;
    __m128i vOpen;
    __m128i vGap;
    __m128i vZero;
    __m128i vOne;
    __m128i vN;
    __m128i vNegOne;
    __m128i vI;
    __m128i vJreset;
    __m128i vMaxH;
    __m128i vEndI;
    __m128i vEndJ;
    __m128i vILimit;
    __m128i vJLimit;

    /* 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 = 0;
    end_ref = 0;
    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);
    vNegInf0 = _mm_srli_si128(vNegInf, 2); /* shift in a 0 */
    vOpen = _mm_set1_epi16(open);
    vGap  = _mm_set1_epi16(gap);
    vZero = _mm_set1_epi16(0);
    vOne = _mm_set1_epi16(1);
    vN = _mm_set1_epi16(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);
    vMaxH = vNegInf;
    vEndI = vNegInf;
    vEndJ = vNegInf;
    vILimit = _mm_set1_epi16(s1Len);
    vJLimit = _mm_set1_epi16(s2Len);

    /* 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_SW | 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] = 0;
        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;
    }

    /* iterate over query sequence */
    for (i=0; i<s1Len; i+=N) {
        __m128i vNH = vNegInf0;
        __m128i vWH = vNegInf0;
        __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))];
        __m128i vIltLimit = _mm_cmplt_epi16(vI, vILimit);
        /* 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);
            vWH = _mm_max_epi16(vWH, vZero);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi16(vJ,vNegOne);
                vWH = _mm_andnot_si128(cond, vWH);
                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
             * max values within the i,j bounds */
            {
                __m128i cond_valid_J = _mm_and_si128(
                        _mm_cmpgt_epi16(vJ, vNegOne),
                        _mm_cmplt_epi16(vJ, vJLimit));
                __m128i cond_valid_IJ = _mm_and_si128(cond_valid_J, vIltLimit);
                __m128i cond_eq = _mm_cmpeq_epi16(vWH, vMaxH);
                __m128i cond_max = _mm_cmpgt_epi16(vWH, vMaxH);
                __m128i cond_all = _mm_and_si128(cond_max, cond_valid_IJ);
                __m128i cond_Jlt = _mm_cmplt_epi16(vJ, vEndJ);
                vMaxH = _mm_blendv_epi8_rpl(vMaxH, vWH, cond_all);
                vEndI = _mm_blendv_epi8_rpl(vEndI, vI, cond_all);
                vEndJ = _mm_blendv_epi8_rpl(vEndJ, vJ, cond_all);
                cond_all = _mm_and_si128(cond_Jlt, cond_eq);
                cond_all = _mm_and_si128(cond_all, cond_valid_IJ);
                vEndI = _mm_blendv_epi8_rpl(vEndI, vI, cond_all);
                vEndJ = _mm_blendv_epi8_rpl(vEndJ, vJ, cond_all);
            }
            vJ = _mm_adds_epi16(vJ, vOne);
        }
        vI = _mm_adds_epi16(vI, vN);
    }

    /* alignment ending position */
    {
        int16_t *t = (int16_t*)&vMaxH;
        int16_t *i = (int16_t*)&vEndI;
        int16_t *j = (int16_t*)&vEndJ;
        int32_t k;
        for (k=0; k<N; ++k, ++t, ++i, ++j) {
            if (*t > score) {
                score = *t;
                end_query = *i;
                end_ref = *j;
            }
            else if (*t == score) {
                if (*j < end_ref) {
                    end_query = *i;
                    end_ref = *j;
                }
                else if (*j == end_ref && *i < end_query) {
                    end_query = *i;
                    end_ref = *j;
                }
            }
        }
    }

    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 0x35d6a7
movl %ecx, %r13d
testl %ecx, %ecx
jle 0x35d6ae
movl %r8d, %r12d
testl %r8d, %r8d
js 0x35d6b5
movl %r9d, %r14d
testl %r9d, %r9d
js 0x35d6bc
movq 0x200(%rsp), %r8
testq %r8, %r8
je 0x35d6c3
cmpl $0x0, 0x30(%r8)
je 0x35cb13
movl 0x34(%r8), %ebx
jmp 0x35cb26
testq %rdi, %rdi
je 0x35d6ca
movl %esi, %ebx
testl %esi, %esi
jle 0x35d6d1
movq %rdi, 0x10(%rsp)
movq %rdx, (%rsp)
movl %r12d, %eax
negl %eax
movl 0x20(%r8), %ecx
movl %ecx, %esi
negl %esi
cmpl %eax, %ecx
cmovgl %r12d, %esi
addl $0xffff8001, %esi       # imm = 0xFFFF8001
movw $0x7ffe, %bp            # imm = 0x7FFE
subw 0x1c(%r8), %bp
movl %esi, 0x1c(%rsp)
movd %esi, %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, 0xd0(%rsp)
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x60(%rsp)
movdqa %xmm0, 0x80(%rsp)
movl %ebx, %edi
movl %r13d, %esi
callq 0x20ac53
testq %rax, %rax
je 0x35d6d6
movq %rax, %r15
movl %r12d, 0x48(%rsp)
movl %r14d, 0x50(%rsp)
orl $0x8241004, 0xc(%rax)   # imm = 0x8241004
leal 0xe(%r13), %r12d
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a625
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a625
movl $0x10, %edi
movq %r12, %rsi
movq %rax, %r12
callq 0x20a625
testq %r14, %r14
sete %dl
testq %r12, %r12
sete %cl
orb %dl, %cl
movq %rax, 0x58(%rsp)
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x35d6d6
movq 0x200(%rsp), %rax
cmpl $0x0, 0x30(%rax)
je 0x35cc1c
movq %rbx, 0x20(%rsp)
movq %r15, 0x38(%rsp)
xorl %ecx, %ecx
jmp 0x35ccaf
leal 0x7(%rbx), %eax
movl %eax, 0x40(%rsp)
movslq %eax, %rsi
movl $0x10, %edi
callq 0x20a625
testq %rax, %rax
je 0x35d6d6
movq %rax, %r8
movq %r15, 0x38(%rsp)
movq %rbx, 0x20(%rsp)
testl %ebx, %ebx
movq 0x10(%rsp), %rdi
jle 0x35cc76
movq 0x200(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x20(%rsp), %ecx
xorl %edx, %edx
movzbl (%rdi,%rdx), %esi
movzwl (%rax,%rsi,4), %esi
movw %si, (%r8,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x35cc61
movq 0x20(%rsp), %rcx
movslq %ecx, %rax
leaq (%r8,%rax,2), %rdi
leal 0x1(%rcx), %eax
movl 0x40(%rsp), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
movq %r8, %rbx
callq 0x19e090
movq %rbx, %rcx
movq 0x200(%rsp), %rax
movq (%rsp), %rsi
movq %rcx, 0x70(%rsp)
leal 0x7(%r13), %ebx
movd %ebp, %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, 0xa0(%rsp)
movaps 0x2cd106(%rip), %xmm0   # 0x629de0
andps 0x60(%rsp), %xmm0
movaps %xmm0, 0x170(%rsp)
movd 0x48(%rsp), %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, 0x1a0(%rsp)
movd 0x50(%rsp), %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)
movd 0x20(%rsp), %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, 0x160(%rsp)
movd %r13d, %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)
movq 0x10(%rax), %rax
movq %r13, 0x8(%rsp)
movl %r13d, %r13d
xorl %ecx, %ecx
movzbl (%rsi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r14,%rcx,2)
incq %rcx
cmpq %rcx, %r13
jne 0x35cd58
xorl %r15d, %r15d
movq %r15, 0x6(%r14)
movq %r15, (%r14)
leaq (%r14,%r13,2), %rdi
addq $0xe, %rdi
movq 0x8(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl %eax, %ebx
cmovgl %ebx, %eax
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movl 0x1c(%rsp), %r8d
movq 0x58(%rsp), %rdi
movw $0x0, 0xe(%r12,%r15,2)
movw %r8w, 0xe(%rdi,%r15,2)
incq %r15
cmpq %r15, %r13
jne 0x35cdaa
xorl %eax, %eax
movw %r8w, (%r12,%rax,2)
movw %r8w, (%rdi,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x35cdc2
leaq 0x7(%r13), %rax
movq 0x8(%rsp), %rcx
movq 0x200(%rsp), %r11
movw %r8w, (%r12,%rax,2)
movw %r8w, (%rdi,%rax,2)
incq %rax
incl %ecx
cmpl %ecx, %ebx
jg 0x35cde6
movq 0x20(%rsp), %rcx
testl %ecx, %ecx
jle 0x35d5c3
movq 0x8(%r11), %rax
movq %rax, 0xe8(%rsp)
movq 0x8(%rsp), %rax
decl %eax
movq %rax, 0x8(%rsp)
cmpl $0x2, %ebx
movl $0x1, %eax
cmovgel %ebx, %eax
movq %rax, 0x120(%rsp)
leal -0x1(%rcx), %edx
movl %ecx, %esi
movdqa 0xd0(%rsp), %xmm7
movdqa 0x80(%rsp), %xmm2
leaq 0x1(%r13), %rax
movq %rax, 0x118(%rsp)
leaq 0x2(%r13), %rax
movq %rax, 0x110(%rsp)
leaq 0x3(%r13), %rax
movq %rax, 0x108(%rsp)
leaq 0x4(%r13), %rax
movq %rax, 0x100(%rsp)
leaq 0x5(%r13), %rax
movq %rax, 0xf8(%rsp)
movq %r13, (%rsp)
leaq 0x6(%r13), %rax
movq %rax, 0xf0(%rsp)
movaps 0x2ccca5(%rip), %xmm0   # 0x629b40
movaps %xmm0, 0x20(%rsp)
xorl %ebp, %ebp
movdqa 0xa0(%rsp), %xmm0
movdqa %xmm0, 0xb0(%rsp)
movdqa 0x60(%rsp), %xmm4
movdqa %xmm4, 0xc0(%rsp)
movq %r12, 0x128(%rsp)
cmpl $0x0, 0x30(%r11)
je 0x35cf35
movq %rbp, %rcx
orq $0x1, %rcx
cmpq %rsi, %rcx
cmovael %edx, %ecx
movq %rbp, %rax
orq $0x2, %rax
cmpq %rsi, %rax
cmovael %edx, %eax
movq %rbp, %r8
orq $0x3, %r8
cmpq %rsi, %r8
cmovael %edx, %r8d
movq %rbp, %rdi
orq $0x4, %rdi
cmpq %rsi, %rdi
cmovael %edx, %edi
movq %rbp, %rbx
orq $0x5, %rbx
cmpq %rsi, %rbx
cmovael %edx, %ebx
movq %rbp, %r9
orq $0x6, %r9
cmpq %rsi, %r9
cmovael %edx, %r9d
movq %rbp, %r10
orq $0x7, %r10
cmpq %rsi, %r10
cmovael %edx, %r10d
movl %ebp, %r13d
jmp 0x35cf69
movq 0x70(%rsp), %r10
movswl (%r10,%rbp,2), %r13d
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), %ebx
movswl 0xc(%r10,%rbp,2), %r9d
movswl 0xe(%r10,%rbp,2), %r10d
movl 0x18(%r11), %r11d
imull %r11d, %ebx
movslq %ebx, %rbx
movq 0xe8(%rsp), %r15
leaq (%r15,%rbx,4), %rbx
movq %rbx, 0x50(%rsp)
imull %r11d, %r8d
movslq %r8d, %r8
leaq (%r15,%r8,4), %r8
movq %r8, 0x48(%rsp)
imull %r11d, %ecx
movslq %ecx, %rcx
leaq (%r15,%rcx,4), %rcx
movq %rcx, 0x40(%rsp)
imull %r11d, %r13d
movslq %r13d, %rcx
leaq (%r15,%rcx,4), %rcx
movq %rcx, 0x158(%rsp)
imull %r11d, %eax
cltq
leaq (%r15,%rax,4), %rax
movq %rax, 0x150(%rsp)
imull %r11d, %edi
movslq %edi, %rax
leaq (%r15,%rax,4), %rax
movq %rax, 0x148(%rsp)
imull %r11d, %r9d
movslq %r9d, %rax
leaq (%r15,%rax,4), %rax
movq %rax, 0x140(%rsp)
imull %r11d, %r10d
movslq %r10d, %rax
leaq (%r15,%rax,4), %rax
movq %rax, 0x138(%rsp)
movq %rbp, %rax
orq $0x1, %rax
movq %rax, 0x78(%rsp)
movq %rbp, %rax
orq $0x2, %rax
movq %rax, 0x10(%rsp)
movq %rbp, %rcx
orq $0x3, %rcx
movq %rbp, %r8
orq $0x4, %r8
movq %rbp, %r9
orq $0x5, %r9
movq %rbp, %r13
orq $0x6, %r13
movq %rbp, %r10
orq $0x7, %r10
movdqa 0x160(%rsp), %xmm0
pcmpgtw 0x20(%rsp), %xmm0
movdqa %xmm0, 0x1b0(%rsp)
movdqa 0x2ccd11(%rip), %xmm8   # 0x629d70
movdqa 0x60(%rsp), %xmm15
movdqa %xmm15, %xmm10
movdqa 0x170(%rsp), %xmm14
movdqa %xmm14, %xmm13
xorl %eax, %eax
movq 0x58(%rsp), %rdi
movq %r10, 0x130(%rsp)
movq %r9, %r10
movq %r8, %r9
movq %rcx, %r8
movswq 0xe(%r14,%rax,2), %r11
movq 0x158(%rsp), %rcx
movd (%rcx,%r11,4), %xmm3
movswq 0xc(%r14,%rax,2), %r11
movq 0x40(%rsp), %rcx
movd (%rcx,%r11,4), %xmm12
movswq 0xa(%r14,%rax,2), %r11
movq 0x150(%rsp), %rcx
movd (%rcx,%r11,4), %xmm9
movswq 0x8(%r14,%rax,2), %r11
movq 0x48(%rsp), %rcx
movd (%rcx,%r11,4), %xmm0
movswq 0x6(%r14,%rax,2), %r11
movq 0x148(%rsp), %rcx
movd (%rcx,%r11,4), %xmm1
movswq 0x4(%r14,%rax,2), %r11
movq 0x50(%rsp), %rcx
movd (%rcx,%r11,4), %xmm5
movswq 0x2(%r14,%rax,2), %r11
movq 0x140(%rsp), %rcx
movd (%rcx,%r11,4), %xmm11
movswq (%r14,%rax,2), %r11
movq 0x138(%rsp), %rcx
movd (%rcx,%r11,4), %xmm6
punpcklwd %xmm3, %xmm12   # xmm12 = xmm12[0],xmm3[0],xmm12[1],xmm3[1],xmm12[2],xmm3[2],xmm12[3],xmm3[3]
punpcklwd %xmm9, %xmm0    # xmm0 = xmm0[0],xmm9[0],xmm0[1],xmm9[1],xmm0[2],xmm9[2],xmm0[3],xmm9[3]
punpckldq %xmm12, %xmm0   # xmm0 = xmm0[0],xmm12[0],xmm0[1],xmm12[1]
punpcklwd %xmm1, %xmm5    # xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
cmpq %rdx, %rbp
punpcklwd %xmm11, %xmm6   # xmm6 = xmm6[0],xmm11[0],xmm6[1],xmm11[1],xmm6[2],xmm11[2],xmm6[3],xmm11[3]
punpckldq %xmm5, %xmm6    # xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1]
punpcklqdq %xmm0, %xmm6    # xmm6 = xmm6[0],xmm0[0]
paddsw %xmm14, %xmm6
movdqa %xmm13, %xmm14
psrldq $0x2, %xmm14            # xmm14 = xmm14[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%r12,%rax,2), %xmm14
setne %r11b
psrldq $0x2, %xmm10            # xmm10 = xmm10[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdi,%rax,2), %xmm10
movdqa %xmm14, %xmm0
movdqa 0x1a0(%rsp), %xmm1
psubsw %xmm1, %xmm0
movdqa 0x190(%rsp), %xmm3
psubsw %xmm3, %xmm10
pmaxsw %xmm0, %xmm10
psubsw %xmm1, %xmm13
psubsw %xmm3, %xmm15
pmaxsw %xmm13, %xmm15
movdqa %xmm15, %xmm3
pmaxsw %xmm10, %xmm3
pmaxsw 0x2ccba5(%rip), %xmm3   # 0x629d60
pmaxsw %xmm6, %xmm3
movdqa %xmm8, %xmm6
pcmpeqw 0x2ccbd4(%rip), %xmm6   # 0x629da0
movdqa %xmm6, %xmm13
pandn %xmm3, %xmm13
cmpq $0x8, %rax
jb 0x35d20a
movdqa 0xb0(%rsp), %xmm0
pminsw %xmm13, %xmm0
movdqa %xmm0, 0xb0(%rsp)
movdqa 0xc0(%rsp), %xmm0
pmaxsw %xmm13, %xmm0
movdqa %xmm0, 0xc0(%rsp)
movq 0x78(%rsp), %rdi
movq 0x38(%rsp), %rbx
movq 0x10(%rbx), %r15
movq (%r15), %r12
movq 0x8(%r15), %r15
cmpq (%rsp), %rax
setae %bl
orb %bl, %r11b
pextrw $0x7, %xmm13, %r11d
jne 0x35d235
movl %r11d, (%r12,%rax,4)
cmpq %rax, 0x8(%rsp)
jne 0x35d240
movl %r11d, (%r15,%rbp,4)
movq %rbp, %rcx
cmpq %rdx, %rdi
setne %r11b
leaq -0x1(%rax), %rbx
movq (%rsp), %rbp
cmpq %rbp, %rbx
setae %bl
orb %r11b, %bl
pextrw $0x6, %xmm13, %r11d
jne 0x35d268
movl %r11d, -0x4(%r12,%rax,4)
cmpq %rsi, %rdi
setae %bl
cmpq %rax, %rbp
setne %bpl
orb %bl, %bpl
jne 0x35d27e
movl %r11d, (%r15,%rdi,4)
cmpq %rdx, 0x10(%rsp)
jne 0x35d2ac
leaq -0x2(%rax), %r11
cmpq $0x2, %rax
setae %bl
cmpq (%rsp), %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x35d2ac
pextrw $0x5, %xmm13, %r11d
movl %r11d, -0x8(%r12,%rax,4)
cmpq %rsi, 0x10(%rsp)
setae %r11b
cmpq %rax, 0x118(%rsp)
setne %bl
orb %r11b, %bl
movq 0x58(%rsp), %rdi
movq %rcx, %rbp
jne 0x35d2dc
pextrw $0x5, %xmm13, %r11d
movq 0x10(%rsp), %rcx
movl %r11d, (%r15,%rcx,4)
movq %r8, %rcx
cmpq %rdx, %r8
jne 0x35d30b
leaq -0x3(%rax), %r11
cmpq $0x3, %rax
setae %bl
cmpq (%rsp), %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x35d30b
pextrw $0x4, %xmm13, %r11d
movl %r11d, -0xc(%r12,%rax,4)
cmpq %rsi, %rcx
setae %r11b
cmpq %rax, 0x110(%rsp)
setne %bl
orb %r11b, %bl
movq %r9, %r8
jne 0x35d32f
pextrw $0x4, %xmm13, %r11d
movl %r11d, (%r15,%rcx,4)
cmpq %rdx, %r8
movq %r10, %r9
jne 0x35d35e
leaq -0x4(%rax), %r11
cmpq $0x4, %rax
setae %bl
cmpq (%rsp), %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x35d35e
pextrw $0x3, %xmm13, %r11d
movl %r11d, -0x10(%r12,%rax,4)
cmpq %rsi, %r8
setae %r11b
cmpq %rax, 0x108(%rsp)
setne %bl
orb %r11b, %bl
movq 0x130(%rsp), %r10
jne 0x35d387
pextrw $0x3, %xmm13, %r11d
movl %r11d, (%r15,%r8,4)
cmpq %rdx, %r9
jne 0x35d3b3
leaq -0x5(%rax), %r11
cmpq $0x5, %rax
setae %bl
cmpq (%rsp), %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x35d3b3
pextrw $0x2, %xmm13, %r11d
movl %r11d, -0x14(%r12,%rax,4)
cmpq %rsi, %r9
setae %r11b
cmpq %rax, 0x100(%rsp)
setne %bl
orb %r11b, %bl
jne 0x35d3d4
pextrw $0x2, %xmm13, %r11d
movl %r11d, (%r15,%r9,4)
cmpq %rdx, %r13
jne 0x35d400
leaq -0x6(%rax), %r11
cmpq $0x6, %rax
setae %bl
cmpq (%rsp), %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x35d400
pextrw $0x1, %xmm13, %r11d
movl %r11d, -0x18(%r12,%rax,4)
cmpq %rsi, %r13
setae %r11b
cmpq %rax, 0xf8(%rsp)
setne %bl
orb %r11b, %bl
jne 0x35d421
pextrw $0x1, %xmm13, %r11d
movl %r11d, (%r15,%r13,4)
cmpq %rdx, %r10
setne %r11b
cmpq $0x7, %rax
setb %bl
orb %r11b, %bl
jne 0x35d43f
pextrw $0x0, %xmm13, %r11d
movl %r11d, -0x1c(%r12,%rax,4)
cmpq %rsi, %r10
setae %r11b
cmpq %rax, 0xf0(%rsp)
setne %bl
movd %xmm13, %r12d
orb %r11b, %bl
jne 0x35d463
movzwl %r12w, %r11d
movl %r11d, (%r15,%r10,4)
movdqa %xmm6, %xmm12
pandn %xmm10, %xmm12
movdqa 0x60(%rsp), %xmm0
pand %xmm6, %xmm0
por %xmm0, %xmm12
pandn %xmm15, %xmm6
por %xmm0, %xmm6
movdqa 0x180(%rsp), %xmm0
pcmpgtw %xmm8, %xmm0
pand 0x1b0(%rsp), %xmm0
movdqa %xmm8, %xmm10
psraw $0xf, %xmm10
pandn %xmm0, %xmm10
movdqa %xmm13, %xmm0
pcmpeqw %xmm7, %xmm0
movdqa %xmm13, %xmm1
pcmpgtw %xmm7, %xmm1
movdqa %xmm2, %xmm15
pcmpgtw %xmm8, %xmm15
pand %xmm0, %xmm15
movdqa %xmm10, %xmm0
pand %xmm15, %xmm0
movdqa %xmm15, %xmm5
por %xmm1, %xmm15
pand %xmm10, %xmm1
pand %xmm1, %xmm3
pandn %xmm1, %xmm5
pandn %xmm7, %xmm1
movdqa %xmm3, %xmm7
por %xmm1, %xmm7
por %xmm0, %xmm5
movdqa 0x20(%rsp), %xmm0
pand %xmm5, %xmm0
pandn %xmm4, %xmm5
movdqa %xmm5, %xmm4
por %xmm0, %xmm4
pand %xmm10, %xmm15
movdqa %xmm8, %xmm0
pand %xmm15, %xmm0
pandn %xmm2, %xmm15
movdqa %xmm15, %xmm2
por %xmm0, %xmm2
movq 0x128(%rsp), %r11
movw %r12w, (%r11,%rax,2)
movq %r11, %r12
movd %xmm12, %r11d
movw %r11w, (%rdi,%rax,2)
paddsw 0x2cc82c(%rip), %xmm8   # 0x629d80
incq %rax
movdqa %xmm12, %xmm10
movdqa %xmm6, %xmm15
cmpq %rax, 0x120(%rsp)
jne 0x35d089
movdqa 0x20(%rsp), %xmm0
paddsw 0x2cc813(%rip), %xmm0   # 0x629d90
movdqa %xmm0, 0x20(%rsp)
addq $0x8, %rbp
cmpq %rsi, %rbp
movq 0x200(%rsp), %r11
jb 0x35cecb
movdqa %xmm7, 0xd0(%rsp)
movdqa %xmm2, 0x80(%rsp)
movl 0x1c(%rsp), %r8d
movdqa 0xc0(%rsp), %xmm1
movdqa 0xb0(%rsp), %xmm2
jmp 0x35d5da
movdqa 0x60(%rsp), %xmm0
movdqa %xmm0, %xmm4
movdqa %xmm0, %xmm1
movdqa 0xa0(%rsp), %xmm2
movdqa %xmm4, 0x90(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x38(%rsp), %rbx
movzwl 0xd0(%rsp,%rdx,2), %esi
cmpw %r8w, %si
jle 0x35d611
movswl 0x90(%rsp,%rdx,2), %eax
movswl 0x80(%rsp,%rdx,2), %ecx
movl %esi, %r8d
jmp 0x35d63a
jne 0x35d63a
movswl 0x80(%rsp,%rdx,2), %esi
cmpl %esi, %ecx
jle 0x35d62b
movswl 0x90(%rsp,%rdx,2), %eax
movl %esi, %ecx
jmp 0x35d63a
jne 0x35d63a
movswl 0x90(%rsp,%rdx,2), %esi
cmpl %esi, %eax
cmovgel %esi, %eax
incq %rdx
cmpl $0x8, %edx
jne 0x35d5ee
movdqa 0x60(%rsp), %xmm0
pcmpgtw %xmm2, %xmm0
pcmpgtw 0xa0(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %edx
testl %edx, %edx
je 0x35d66c
orb $0x40, 0xc(%rbx)
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %eax, %eax
movswl %r8w, %edx
movl %edx, (%rbx)
movl %eax, 0x4(%rbx)
movl %ecx, 0x8(%rbx)
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq 0x200(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x35d6d8
movq 0x70(%rsp), %rdi
callq 0x20a60d
jmp 0x35d6d8
callq 0x1b5b0d
jmp 0x35d6d6
callq 0x1b5ae7
jmp 0x35d6d6
callq 0x1b5ac1
jmp 0x35d6d6
callq 0x1b5a9b
jmp 0x35d6d6
callq 0x1b5a75
jmp 0x35d6d6
callq 0x1b5a4f
jmp 0x35d6d6
callq 0x1b5a29
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)