// File: /workspace/github_c_makefile_star2_O1/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 $0x1a8, %rsp            # imm = 0x1A8
testq %rdx, %rdx
je 0x3471d6
movl %ecx, %r13d
testl %ecx, %ecx
jle 0x3471dd
movl %r8d, %r12d
testl %r8d, %r8d
js 0x3471e4
movl %r9d, %r14d
testl %r9d, %r9d
js 0x3471eb
movq %rdx, %rbx
movq 0x1e0(%rsp), %rdx
testq %rdx, %rdx
je 0x3471f2
movl 0x30(%rdx), %eax
testl %eax, %eax
jne 0x346625
testq %rdi, %rdi
je 0x3471f9
testl %esi, %esi
jle 0x347200
testl %eax, %eax
je 0x346628
movl 0x34(%rdx), %esi
movq %rdi, 0x10(%rsp)
movl %r12d, %eax
negl %eax
movl 0x20(%rdx), %ecx
movl %ecx, %edi
negl %edi
cmpl %eax, %ecx
cmovgl %r12d, %edi
addl $0xffff8001, %edi       # imm = 0xFFFF8001
movw $0x7ffe, %bp            # imm = 0x7FFE
subw 0x1c(%rdx), %bp
movl %edi, 0x1c(%rsp)
movd %edi, %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, 0xf0(%rsp)
movdqa %xmm0, 0x80(%rsp)
movdqa %xmm0, 0x70(%rsp)
movdqa %xmm0, 0xb0(%rsp)
movq %rsi, 0x8(%rsp)
movl %esi, %edi
movl %r13d, %esi
callq 0x209630
testq %rax, %rax
je 0x347205
movq %rax, %r15
movl %r12d, 0x50(%rsp)
movl %r14d, 0x58(%rsp)
movq %rbx, 0x60(%rsp)
orl $0x8241004, 0xc(%rax)   # imm = 0x8241004
leal 0xe(%r13), %r12d
movl $0x10, %edi
movq %r12, %rsi
callq 0x2094cd
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x2094cd
movq %rax, %rbx
movl $0x10, %edi
movq %r12, %rsi
callq 0x2094cd
testq %r14, %r14
sete %dl
movq %rbx, 0xa8(%rsp)
testq %rbx, %rbx
sete %cl
orb %dl, %cl
movq %rax, 0x68(%rsp)
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x347205
movq 0x1e0(%rsp), %rcx
cmpl $0x0, 0x30(%rcx)
je 0x346729
movq %r13, %r12
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
jmp 0x3467b2
movq 0x8(%rsp), %rbx
leal 0x7(%rbx), %r12d
movslq %r12d, %rsi
movl $0x10, %edi
callq 0x2094cd
testq %rax, %rax
je 0x347205
movl %r12d, %r10d
movq %r13, %r12
testl %ebx, %ebx
movq 0x10(%rsp), %r9
jle 0x34677c
movq 0x1e0(%rsp), %rcx
movq 0x10(%rcx), %rdi
movl %ebx, %ecx
xorl %edx, %edx
movzbl (%r9,%rdx), %esi
movzwl (%rdi,%rsi,4), %esi
movw %si, (%rax,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x346767
movslq %ebx, %rcx
movq %rax, %r13
leaq (%rax,%rcx,2), %rdi
leal 0x1(%rbx), %eax
cmpl %eax, %r10d
cmovgl %r10d, %eax
movl %ebx, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movq 0x8(%rsp), %rax
movq 0x1e0(%rsp), %rcx
movq %r13, 0x98(%rsp)
movq %r15, 0xa0(%rsp)
movq %r12, %rsi
leal 0x7(%r12), %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, 0xc0(%rsp)
movaps 0x2af458(%rip), %xmm0   # 0x5f5c40
andps 0x70(%rsp), %xmm0
movaps %xmm0, 0x160(%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 0x58(%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, 0x180(%rsp)
movd %eax, %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, 0x150(%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, 0x170(%rsp)
movq 0x10(%rcx), %rax
cmpl $0x2, %esi
movl $0x1, %r15d
cmovgel %esi, %r15d
xorl %ecx, %ecx
movq 0x60(%rsp), %rdi
movzbl (%rdi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r14,%rcx,2)
incq %rcx
cmpq %rcx, %r15
jne 0x34686d
xorl %r12d, %r12d
movq %r12, 0x6(%r14)
movq %r12, (%r14)
movq %rsi, %rcx
movl %ecx, %r13d
leaq (%r14,%r13,2), %rdi
addq $0xe, %rdi
leal 0x1(%rsi), %eax
cmpl %eax, %ebx
cmovgl %ebx, %eax
movq %rsi, 0x20(%rsp)
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movl 0x1c(%rsp), %r8d
movq 0xa8(%rsp), %rbp
movq 0x68(%rsp), %rdi
movw $0x0, 0xe(%rbp,%r12,2)
movw %r8w, 0xe(%rdi,%r12,2)
incq %r12
cmpq %r12, %r15
jne 0x3468cd
xorl %eax, %eax
movw %r8w, (%rbp,%rax,2)
movw %r8w, (%rdi,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x3468e5
leaq 0x7(%r13), %rax
movq 0x20(%rsp), %rcx
movq 0x1e0(%rsp), %r12
movq 0x8(%rsp), %rdx
movw %r8w, (%rbp,%rax,2)
movw %r8w, (%rdi,%rax,2)
incq %rax
incl %ecx
cmpl %ecx, %ebx
jg 0x34690f
movdqa 0x80(%rsp), %xmm2
testl %edx, %edx
jle 0x3470f4
movq 0x8(%r12), %rax
movq %rax, 0x100(%rsp)
leal -0x1(%rdx), %ecx
movq 0x20(%rsp), %rax
decl %eax
movq %rax, 0x20(%rsp)
cmpl $0x2, %ebx
movl $0x1, %eax
cmovgel %ebx, %eax
movq %rax, 0x138(%rsp)
movl %edx, %esi
leaq 0x1(%r13), %rax
movq %rax, 0x130(%rsp)
leaq 0x2(%r13), %rax
movq %rax, 0x128(%rsp)
leaq 0x3(%r13), %rax
movq %rax, 0x120(%rsp)
leaq 0x4(%r13), %rax
movq %rax, 0x118(%rsp)
leaq 0x5(%r13), %rax
movq %rax, 0x110(%rsp)
leaq 0x6(%r13), %rax
movq %rax, 0x108(%rsp)
movdqa 0x2af06b(%rip), %xmm3   # 0x5f5a20
xorl %ebx, %ebx
movaps 0xc0(%rsp), %xmm0
movaps %xmm0, 0xd0(%rsp)
movdqa 0x70(%rsp), %xmm0
movdqa %xmm0, 0xe0(%rsp)
movl 0x30(%r12), %r15d
movl %ebx, %eax
testl %r15d, %r15d
movq 0x98(%rsp), %rdi
jne 0x3469ee
movswl (%rdi,%rbx,2), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rax
orq $0x1, %rax
testl %r15d, %r15d
movq %rax, 0x10(%rsp)
je 0x346a11
cmpq %rsi, %rax
movl %ecx, %edx
cmovbl %eax, %edx
movl %edx, 0x48(%rsp)
jmp 0x346a19
movswl (%rdi,%rax,2), %eax
movl %eax, 0x48(%rsp)
movq %rbx, %rax
orq $0x2, %rax
testl %r15d, %r15d
movq %rax, 0x60(%rsp)
je 0x346a38
cmpq %rsi, %rax
movl %ecx, %edx
cmovbl %eax, %edx
movl %edx, 0x40(%rsp)
jmp 0x346a40
movswl (%rdi,%rax,2), %eax
movl %eax, 0x40(%rsp)
movq %rbx, %rax
orq $0x3, %rax
testl %r15d, %r15d
movq %rax, 0x58(%rsp)
je 0x346a5f
cmpq %rsi, %rax
movl %ecx, %edx
cmovbl %eax, %edx
movl %edx, 0x38(%rsp)
jmp 0x346a67
movswl (%rdi,%rax,2), %eax
movl %eax, 0x38(%rsp)
movq %rbx, %rdx
orq $0x4, %rdx
testl %r15d, %r15d
je 0x346a7d
cmpq %rsi, %rdx
movl %ecx, %eax
cmovbl %edx, %eax
jmp 0x346a81
movswl (%rdi,%rdx,2), %eax
movl %eax, 0x30(%rsp)
movq %rbx, %r8
orq $0x5, %r8
testl %r15d, %r15d
je 0x346a9c
cmpq %rsi, %r8
movl %ecx, %eax
cmovbl %r8d, %eax
jmp 0x346aa1
movswl (%rdi,%r8,2), %eax
movl %eax, 0x28(%rsp)
movq %rbx, %r9
orq $0x6, %r9
testl %r15d, %r15d
je 0x346abc
cmpq %rsi, %r9
movl %ecx, %eax
cmovbl %r9d, %eax
jmp 0x346ac1
movswl (%rdi,%r9,2), %eax
movl 0x18(%r12), %r12d
movq %rbx, %r10
orq $0x7, %r10
testl %r15d, %r15d
je 0x346ade
cmpq %rsi, %r10
movl %ecx, %r11d
cmovbl %r10d, %r11d
jmp 0x346ae3
movswl (%rdi,%r10,2), %r11d
movl 0x8(%rsp), %edi
imull %r12d, %edi
movslq %edi, %r15
movq 0x100(%rsp), %rdi
leaq (%rdi,%r15,4), %r15
movq %r15, 0x50(%rsp)
movl 0x48(%rsp), %r15d
imull %r12d, %r15d
movslq %r15d, %r15
leaq (%rdi,%r15,4), %r15
movq %r15, 0x48(%rsp)
movl 0x40(%rsp), %r15d
imull %r12d, %r15d
movslq %r15d, %r15
leaq (%rdi,%r15,4), %r15
movq %r15, 0x40(%rsp)
movl 0x38(%rsp), %r15d
imull %r12d, %r15d
movslq %r15d, %r15
leaq (%rdi,%r15,4), %r15
movq %r15, 0x38(%rsp)
movl 0x30(%rsp), %r15d
imull %r12d, %r15d
movslq %r15d, %r15
leaq (%rdi,%r15,4), %r15
movq %r15, 0x30(%rsp)
movl 0x28(%rsp), %r15d
imull %r12d, %r15d
movslq %r15d, %r15
leaq (%rdi,%r15,4), %r15
movq %r15, 0x28(%rsp)
imull %r12d, %eax
cltq
leaq (%rdi,%rax,4), %rax
movq %rax, 0x148(%rsp)
imull %r12d, %r11d
movslq %r11d, %rax
leaq (%rdi,%rax,4), %rax
movq %rax, 0x140(%rsp)
movdqa 0x150(%rsp), %xmm9
pcmpgtw %xmm3, %xmm9
xorl %r12d, %r12d
movdqa 0x2af029(%rip), %xmm4   # 0x5f5bd0
movdqa 0x70(%rsp), %xmm8
movdqa %xmm8, %xmm14
movdqa 0x160(%rsp), %xmm12
movdqa %xmm12, %xmm11
movq 0x68(%rsp), %rdi
movq %rbx, 0x8(%rsp)
movswq 0xe(%r14,%r12,2), %rax
movq 0x50(%rsp), %r11
movd (%r11,%rax,4), %xmm6
movswq 0xc(%r14,%r12,2), %rax
movq 0x48(%rsp), %r11
movd (%r11,%rax,4), %xmm10
movswq 0xa(%r14,%r12,2), %rax
movq 0x40(%rsp), %r11
movd (%r11,%rax,4), %xmm13
movswq 0x8(%r14,%r12,2), %rax
movq 0x38(%rsp), %r11
movd (%r11,%rax,4), %xmm15
movswq 0x6(%r14,%r12,2), %rax
movq 0x30(%rsp), %r11
movd (%r11,%rax,4), %xmm7
movswq 0x4(%r14,%r12,2), %rax
movq 0x28(%rsp), %r11
movd (%r11,%rax,4), %xmm0
movswq 0x2(%r14,%r12,2), %rax
movq 0x148(%rsp), %r11
movd (%r11,%rax,4), %xmm1
movswq (%r14,%r12,2), %rax
movq 0x140(%rsp), %r11
movd (%r11,%rax,4), %xmm5
punpcklwd %xmm6, %xmm10   # xmm10 = xmm10[0],xmm6[0],xmm10[1],xmm6[1],xmm10[2],xmm6[2],xmm10[3],xmm6[3]
punpcklwd %xmm13, %xmm15  # xmm15 = xmm15[0],xmm13[0],xmm15[1],xmm13[1],xmm15[2],xmm13[2],xmm15[3],xmm13[3]
punpckldq %xmm10, %xmm15  # xmm15 = xmm15[0],xmm10[0],xmm15[1],xmm10[1]
punpcklwd %xmm7, %xmm0    # xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3]
cmpq %rcx, %rbx
punpcklwd %xmm1, %xmm5    # xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1],xmm5[2],xmm1[2],xmm5[3],xmm1[3]
punpckldq %xmm0, %xmm5    # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
punpcklqdq %xmm15, %xmm5   # xmm5 = xmm5[0],xmm15[0]
paddsw %xmm12, %xmm5
movdqa %xmm11, %xmm12
psrldq $0x2, %xmm12            # xmm12 = xmm12[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rbp,%r12,2), %xmm12
setne %r11b
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,%r12,2), %xmm14
movdqa %xmm12, %xmm0
movdqa 0x190(%rsp), %xmm1
psubsw %xmm1, %xmm0
movdqa 0x180(%rsp), %xmm6
psubsw %xmm6, %xmm14
pmaxsw %xmm0, %xmm14
psubsw %xmm1, %xmm11
psubsw %xmm6, %xmm8
pmaxsw %xmm11, %xmm8
movdqa %xmm8, %xmm13
pmaxsw %xmm14, %xmm13
pmaxsw 0x24f5a3(%rip), %xmm13  # 0x596290
pmaxsw %xmm5, %xmm13
movdqa %xmm4, %xmm10
pcmpeqw 0x2aef00(%rip), %xmm10  # 0x5f5c00
movdqa %xmm10, %xmm11
pandn %xmm13, %xmm11
cmpq $0x8, %r12
jb 0x346d3e
movdqa 0xd0(%rsp), %xmm0
pminsw %xmm11, %xmm0
movdqa %xmm0, 0xd0(%rsp)
movdqa 0xe0(%rsp), %xmm0
pmaxsw %xmm11, %xmm0
movdqa %xmm0, 0xe0(%rsp)
movq 0x10(%rsp), %rdi
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %r15
movq 0x8(%rax), %rax
cmpq %r13, %r12
setae %bl
orb %bl, %r11b
pextrw $0x7, %xmm11, %r11d
jne 0x346d6b
movl %r11d, (%r15,%r12,4)
cmpq %r12, 0x20(%rsp)
jne 0x346d80
movq 0x8(%rsp), %rdi
movl %r11d, (%rax,%rdi,4)
movq 0x10(%rsp), %rdi
cmpq %rcx, %rdi
setne %r11b
leaq -0x1(%r12), %rbx
cmpq %r13, %rbx
setae %bl
orb %r11b, %bl
pextrw $0x6, %xmm11, %r11d
jne 0x346da2
movl %r11d, -0x4(%r15,%r12,4)
cmpq %rsi, %rdi
setae %bl
cmpq %r12, %r13
setne %bpl
orb %bl, %bpl
jne 0x346db8
movl %r11d, (%rax,%rdi,4)
movq 0x60(%rsp), %rdi
cmpq %rcx, %rdi
jne 0x346de9
leaq -0x2(%r12), %r11
cmpq $0x2, %r12
setae %bl
cmpq %r13, %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x346de9
pextrw $0x5, %xmm11, %r11d
movl %r11d, -0x8(%r15,%r12,4)
cmpq %rsi, %rdi
setae %r11b
cmpq %r12, 0x130(%rsp)
setne %bl
orb %r11b, %bl
movq 0xa8(%rsp), %rbp
jne 0x346e12
pextrw $0x5, %xmm11, %r11d
movl %r11d, (%rax,%rdi,4)
movq 0x58(%rsp), %rdi
cmpq %rcx, %rdi
jne 0x346e43
leaq -0x3(%r12), %r11
cmpq $0x3, %r12
setae %bl
cmpq %r13, %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x346e43
pextrw $0x4, %xmm11, %r11d
movl %r11d, -0xc(%r15,%r12,4)
cmpq %rsi, %rdi
setae %r11b
cmpq %r12, 0x128(%rsp)
setne %bl
orb %r11b, %bl
jne 0x346e64
pextrw $0x4, %xmm11, %r11d
movl %r11d, (%rax,%rdi,4)
cmpq %rcx, %rdx
jne 0x346e90
leaq -0x4(%r12), %r11
cmpq $0x4, %r12
setae %bl
cmpq %r13, %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x346e90
pextrw $0x3, %xmm11, %r11d
movl %r11d, -0x10(%r15,%r12,4)
cmpq %rsi, %rdx
setae %r11b
cmpq %r12, 0x120(%rsp)
setne %bl
orb %r11b, %bl
jne 0x346eb1
pextrw $0x3, %xmm11, %r11d
movl %r11d, (%rax,%rdx,4)
cmpq %rcx, %r8
jne 0x346edd
leaq -0x5(%r12), %r11
cmpq $0x5, %r12
setae %bl
cmpq %r13, %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x346edd
pextrw $0x2, %xmm11, %r11d
movl %r11d, -0x14(%r15,%r12,4)
cmpq %rsi, %r8
setae %r11b
cmpq %r12, 0x118(%rsp)
setne %bl
orb %r11b, %bl
jne 0x346efe
pextrw $0x2, %xmm11, %r11d
movl %r11d, (%rax,%r8,4)
cmpq %rcx, %r9
jne 0x346f2a
leaq -0x6(%r12), %r11
cmpq $0x6, %r12
setae %bl
cmpq %r13, %r11
setl %r11b
andb %bl, %r11b
cmpb $0x1, %r11b
jne 0x346f2a
pextrw $0x1, %xmm11, %r11d
movl %r11d, -0x18(%r15,%r12,4)
cmpq %rsi, %r9
setae %r11b
cmpq %r12, 0x110(%rsp)
setne %bl
orb %r11b, %bl
jne 0x346f4b
pextrw $0x1, %xmm11, %r11d
movl %r11d, (%rax,%r9,4)
cmpq %rcx, %r10
jne 0x346f73
leaq -0x7(%r12), %r11
cmpq $0x7, %r12
setb %bl
cmpq %r13, %r11
setge %r11b
orb %bl, %r11b
jne 0x346f73
pextrw $0x0, %xmm11, %r11d
movl %r11d, -0x1c(%r15,%r12,4)
cmpq %rsi, %r10
setae %r11b
cmpq %r12, 0x108(%rsp)
setne %bl
orb %r11b, %bl
jne 0x346f94
pextrw $0x0, %xmm11, %r11d
movl %r11d, (%rax,%r10,4)
movdqa %xmm10, %xmm15
pandn %xmm14, %xmm15
movdqa 0x70(%rsp), %xmm0
pand %xmm10, %xmm0
por %xmm0, %xmm15
pandn %xmm8, %xmm10
por %xmm0, %xmm10
movd %xmm11, %eax
movw %ax, (%rbp,%r12,2)
movd %xmm15, %eax
movq 0x68(%rsp), %rdi
movw %ax, (%rdi,%r12,2)
movdqa 0x170(%rsp), %xmm0
pcmpgtw %xmm4, %xmm0
pand %xmm9, %xmm0
movdqa %xmm4, %xmm8
psraw $0xf, %xmm8
pandn %xmm0, %xmm8
movdqa 0xf0(%rsp), %xmm6
movdqa %xmm11, %xmm0
pcmpeqw %xmm6, %xmm0
movdqa %xmm11, %xmm1
pcmpgtw %xmm6, %xmm1
movdqa 0xb0(%rsp), %xmm5
movdqa %xmm5, %xmm14
pcmpgtw %xmm4, %xmm14
pand %xmm0, %xmm14
movdqa %xmm14, %xmm0
movdqa %xmm8, %xmm7
pand %xmm14, %xmm7
por %xmm1, %xmm14
pand %xmm8, %xmm1
pand %xmm1, %xmm13
pandn %xmm1, %xmm0
pandn %xmm6, %xmm1
por %xmm1, %xmm13
movdqa %xmm13, 0xf0(%rsp)
por %xmm0, %xmm7
movdqa %xmm3, %xmm0
pand %xmm7, %xmm0
pandn %xmm2, %xmm7
movdqa %xmm7, %xmm2
por %xmm0, %xmm2
pand %xmm8, %xmm14
movdqa %xmm4, %xmm0
pand %xmm14, %xmm0
pandn %xmm5, %xmm14
por %xmm0, %xmm14
movdqa %xmm14, 0xb0(%rsp)
paddsw 0x2aeb42(%rip), %xmm4   # 0x5f5be0
incq %r12
movdqa %xmm15, %xmm14
movdqa %xmm10, %xmm8
cmpq %r12, 0x138(%rsp)
movq 0x8(%rsp), %rbx
jne 0x346bcc
paddsw 0x2aeb2a(%rip), %xmm3   # 0x5f5bf0
addq $0x8, %rbx
cmpq %rsi, %rbx
movq 0x1e0(%rsp), %r12
movl 0x1c(%rsp), %r8d
jb 0x3469d6
movdqa 0xe0(%rsp), %xmm1
movdqa 0xd0(%rsp), %xmm3
jmp 0x347103
movdqa 0x70(%rsp), %xmm1
movdqa 0xc0(%rsp), %xmm3
movdqa %xmm2, 0x80(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movq 0xa0(%rsp), %rbx
movzwl 0xf0(%rsp,%rdx,2), %esi
cmpw %r8w, %si
jle 0x34713d
movswl 0x80(%rsp,%rdx,2), %eax
movswl 0xb0(%rsp,%rdx,2), %ecx
movl %esi, %r8d
jmp 0x34716c
jne 0x34716c
movswl 0xb0(%rsp,%rdx,2), %esi
cmpl %esi, %ecx
jle 0x347157
movswl 0x80(%rsp,%rdx,2), %eax
movl %esi, %ecx
jmp 0x34716c
jne 0x34716c
movswl 0x80(%rsp,%rdx,2), %r9d
cmpl %r9d, %eax
cmovgl %esi, %ecx
cmovgel %r9d, %eax
incq %rdx
cmpl $0x8, %edx
jne 0x34711a
movdqa 0x70(%rsp), %xmm0
pcmpgtw %xmm3, %xmm0
pcmpgtw 0xc0(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %edx
testl %edx, %edx
je 0x34719e
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 0x2094b5
movq %rbp, %rdi
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
cmpl $0x0, 0x30(%r12)
jne 0x347207
movq 0x98(%rsp), %rdi
callq 0x2094b5
jmp 0x347207
callq 0x1b5b19
jmp 0x347205
callq 0x1b5af3
jmp 0x347205
callq 0x1b5acd
jmp 0x347205
callq 0x1b5aa7
jmp 0x347205
callq 0x1b5a81
jmp 0x347205
callq 0x1b5a5b
jmp 0x347205
callq 0x1b5a35
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq