// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sw_trace_diag_sse2_128_16.c
// Function: parasail_sw_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 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;
    __m128i vTDiag;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTZero;
    __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 = 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);
    vTDiag = _mm_set1_epi16(PARASAIL_DIAG);
    vTIns = _mm_set1_epi16(PARASAIL_INS);
    vTDel = _mm_set1_epi16(PARASAIL_DEL);
    vTZero = _mm_set1_epi16(PARASAIL_ZERO);
    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_SW | 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] = 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 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))];
        __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_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);
            vNWH = _mm_max_epi16(vNWH, vZero);
            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_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);
            }
            /* trace table */
            {
                __m128i cond_zero = _mm_cmpeq_epi16(vWH, vZero);
                __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),
                        _mm_blendv_epi8_rpl(vTDiag, vTZero, cond_zero),
                        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
             * 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 $0x1e8, %rsp            # imm = 0x1E8
testq %rdx, %rdx
je 0x3b1cc8
movl %ecx, %ebp
testl %ecx, %ecx
jle 0x3b1ccf
movl %r8d, %r15d
testl %r8d, %r8d
js 0x3b1cd6
movl %r9d, %r14d
testl %r9d, %r9d
js 0x3b1cdd
movq 0x220(%rsp), %r8
testq %r8, %r8
je 0x3b1ce4
cmpl $0x0, 0x30(%r8)
je 0x3b1116
movl 0x34(%r8), %esi
jmp 0x3b1127
testq %rdi, %rdi
je 0x3b1ceb
testl %esi, %esi
jle 0x3b1cf2
movq %rdi, 0x100(%rsp)
movq %rdx, 0x110(%rsp)
movl %r15d, %eax
negl %eax
movl 0x20(%r8), %ecx
movl %ecx, %edi
negl %edi
cmpl %eax, %ecx
cmovgl %r15d, %edi
addl $0xffff8001, %edi       # imm = 0xFFFF8001
movw $0x7ffe, %bx            # imm = 0x7FFE
subw 0x1c(%r8), %bx
movl %edi, 0x4(%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, 0x120(%rsp)
movdqa %xmm0, 0xe0(%rsp)
movdqa %xmm0, 0x40(%rsp)
movdqa %xmm0, 0xd0(%rsp)
movl $0x10, %edx
movl $0x1, %ecx
movq %rsi, 0x60(%rsp)
movl %esi, %edi
movl %ebp, %esi
callq 0x20adf4
testq %rax, %rax
je 0x3b1cf7
movq %rax, %r13
movl %r15d, 0x30(%rsp)
movl %r14d, 0x50(%rsp)
orl $0x8281004, 0xc(%rax)   # imm = 0x8281004
leal 0xe(%rbp), %r12d
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a625
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a625
movq %rax, %r15
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a625
testq %r14, %r14
sete %dl
testq %r15, %r15
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x3b1cf7
movq 0x220(%rsp), %r12
cmpl $0x0, 0x30(%r12)
movq %r15, 0x18(%rsp)
movq %rax, 0x10(%rsp)
je 0x3b123b
movq %r13, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
jmp 0x3b12c3
movq 0x60(%rsp), %r15
leal 0x7(%r15), %eax
movl %eax, 0x28(%rsp)
movslq %eax, %rsi
movl $0x10, %edi
callq 0x20a625
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3b1cf7
movq %r13, 0x20(%rsp)
testl %r15d, %r15d
movq 0x8(%rsp), %rdi
movq 0x100(%rsp), %r9
jle 0x3b1299
movq 0x10(%r12), %rax
movl %r15d, %ecx
xorl %edx, %edx
movzbl (%r9,%rdx), %esi
movzwl (%rax,%rsi,4), %esi
movw %si, (%rdi,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x3b1284
movslq %r15d, %rax
leaq (%rdi,%rax,2), %rdi
leal 0x1(%r15), %eax
movl 0x28(%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 0x60(%rsp), %rax
leal 0x7(%rbp), %r15d
movd %ebx, %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)
movaps 0x278af6(%rip), %xmm0   # 0x629de0
andps 0x40(%rsp), %xmm0
movaps %xmm0, 0x190(%rsp)
movd 0x30(%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, 0x1c0(%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, 0x1b0(%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, 0x180(%rsp)
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, 0x1a0(%rsp)
movq 0x10(%r12), %rax
movl %ebp, %r13d
xorl %ecx, %ecx
movq 0x110(%rsp), %rsi
movzbl (%rsi,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r14,%rcx,2)
incq %rcx
cmpq %rcx, %r13
jne 0x3b1369
xorl %ebx, %ebx
movq %rbx, 0x6(%r14)
movq %rbx, (%r14)
leaq (%r14,%r13,2), %rdi
addq $0xe, %rdi
leal 0x1(%rbp), %eax
cmpl %eax, %r15d
cmovgl %r15d, %eax
movl %ebp, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x2(,%rcx,2), %rdx
xorl %esi, %esi
callq 0x19e090
movl 0x4(%rsp), %edi
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rdx
movw $0x0, 0xe(%rcx,%rbx,2)
movw %di, 0xe(%rdx,%rbx,2)
incq %rbx
cmpq %rbx, %r13
jne 0x3b13bd
xorl %eax, %eax
movw %di, (%rcx,%rax,2)
movw %di, (%rdx,%rax,2)
incq %rax
cmpq $0x7, %rax
jne 0x3b13d3
leaq 0x7(%r13), %rax
movq 0x60(%rsp), %rsi
movw %di, (%rcx,%rax,2)
movw %di, (%rdx,%rax,2)
incq %rax
incl %ebp
cmpl %ebp, %r15d
jg 0x3b13ed
testl %esi, %esi
jle 0x3b1bc6
leal -0x1(%rsi), %eax
movl %eax, 0x3c(%rsp)
cmpl $0x2, %r15d
movl $0x1, %eax
cmovgel %r15d, %eax
movq %rax, 0x148(%rsp)
movl %esi, %edx
movdqa 0x120(%rsp), %xmm11
movdqa 0xd0(%rsp), %xmm5
leaq (,%r13,8), %rax
movq %rax, 0x138(%rsp)
subq %r13, %rax
addq $-0x7, %rax
movq %rax, 0xa8(%rsp)
leaq -0x1(%r13), %rax
movq %rax, 0xa0(%rsp)
leaq (,%r13,2), %rax
addq %r13, %rax
leaq -0x6(%rax,%rax), %rax
movq %rax, 0x90(%rsp)
leaq -0x5(%r13,%r13,4), %rax
movq %rax, 0x88(%rsp)
leaq -0x4(,%r13,4), %rax
movq %rax, 0x80(%rsp)
leaq -0x3(%r13,%r13,2), %rax
movq %rax, 0x78(%rsp)
leaq -0x2(%r13,%r13), %rax
movq %rax, 0x70(%rsp)
movaps 0x27868d(%rip), %xmm0   # 0x629b40
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x98(%rsp)
pxor %xmm14, %xmm14
xorl %r15d, %r15d
movaps 0xf0(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movdqa 0x40(%rsp), %xmm0
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm0, %xmm9
cmpl $0x0, 0x30(%r12)
je 0x3b1564
movq %r15, %rcx
orq $0x1, %rcx
cmpq %rdx, %rcx
movl 0x3c(%rsp), %r11d
cmovael %r11d, %ecx
movq %r15, %rax
orq $0x2, %rax
cmpq %rdx, %rax
cmovael %r11d, %eax
movq %r15, %rdi
orq $0x3, %rdi
cmpq %rdx, %rdi
cmovael %r11d, %edi
movq %r15, %rsi
orq $0x4, %rsi
cmpq %rdx, %rsi
cmovael %r11d, %esi
movq %r15, %r8
orq $0x5, %r8
cmpq %rdx, %r8
cmovael %r11d, %r8d
movq %r15, %r9
orq $0x6, %r9
cmpq %rdx, %r9
cmovael %r11d, %r9d
movq %r15, %r10
orq $0x7, %r10
cmpq %rdx, %r10
cmovael %r11d, %r10d
movl %r15d, %r11d
jmp 0x3b1598
movq 0x8(%rsp), %r10
movswl (%r10,%r15,2), %r11d
movswl 0x2(%r10,%r15,2), %ecx
movswl 0x4(%r10,%r15,2), %eax
movswl 0x6(%r10,%r15,2), %edi
movswl 0x8(%r10,%r15,2), %esi
movswl 0xa(%r10,%r15,2), %r8d
movswl 0xc(%r10,%r15,2), %r9d
movswl 0xe(%r10,%r15,2), %r10d
movq 0x8(%r12), %rbx
movl 0x18(%r12), %ebp
imull %ebp, %r8d
movslq %r8d, %r8
leaq (%rbx,%r8,4), %r8
movq %r8, 0x30(%rsp)
imull %ebp, %edi
movslq %edi, %rdi
leaq (%rbx,%rdi,4), %rdi
movq %rdi, 0x28(%rsp)
imull %ebp, %ecx
movslq %ecx, %rcx
leaq (%rbx,%rcx,4), %rcx
movq %rcx, 0x178(%rsp)
imull %ebp, %r11d
movslq %r11d, %rcx
leaq (%rbx,%rcx,4), %rcx
movq %rcx, 0x170(%rsp)
imull %ebp, %eax
cltq
leaq (%rbx,%rax,4), %rax
movq %rax, 0x168(%rsp)
imull %ebp, %esi
movslq %esi, %rax
leaq (%rbx,%rax,4), %rax
movq %rax, 0x160(%rsp)
imull %ebp, %r9d
movslq %r9d, %rax
leaq (%rbx,%rax,4), %rax
movq %rax, 0x158(%rsp)
imull %ebp, %r10d
movslq %r10d, %rax
leaq (%rbx,%rax,4), %rax
movq %rax, 0x150(%rsp)
movq %r15, %r9
orq $0x1, %r9
movq %r15, %rcx
orq $0x2, %rcx
movq %r15, %r10
orq $0x3, %r10
movq %r15, %rbp
orq $0x4, %r15
movq %rbp, %r11
orq $0x5, %r11
movq %rbp, %r12
orq $0x6, %r12
movq %rbp, 0x140(%rsp)
orq $0x7, %rbp
movdqa 0x180(%rsp), %xmm0
pcmpgtw 0x50(%rsp), %xmm0
movdqa %xmm0, 0x1d0(%rsp)
movdqa 0x2786eb(%rip), %xmm1   # 0x629d70
movdqa 0x40(%rsp), %xmm10
movdqa %xmm10, %xmm4
movdqa 0x190(%rsp), %xmm12
movdqa %xmm12, %xmm2
xorl %eax, %eax
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %rdi
movdqa %xmm9, 0x110(%rsp)
movdqa %xmm5, 0x60(%rsp)
movswq 0xe(%r14,%rax,2), %rbx
movq 0x170(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm0
movswq 0xc(%r14,%rax,2), %rbx
movq 0x178(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm3
movswq 0xa(%r14,%rax,2), %rbx
movq 0x168(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm5
movswq 0x8(%r14,%rax,2), %rbx
movq 0x28(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm6
movswq 0x6(%r14,%rax,2), %rbx
movq 0x160(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm7
movswq 0x4(%r14,%rax,2), %rbx
movq 0x30(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm9
movswq 0x2(%r14,%rax,2), %rbx
movq 0x158(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm15
movswq (%r14,%rax,2), %rbx
movq 0x150(%rsp), %rsi
movd (%rsi,%rbx,4), %xmm8
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
punpcklwd %xmm5, %xmm6    # xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3]
punpckldq %xmm3, %xmm6    # xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
punpcklwd %xmm7, %xmm9    # xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1],xmm9[2],xmm7[2],xmm9[3],xmm7[3]
punpcklwd %xmm15, %xmm8   # xmm8 = xmm8[0],xmm15[0],xmm8[1],xmm15[1],xmm8[2],xmm15[2],xmm8[3],xmm15[3]
punpckldq %xmm9, %xmm8    # xmm8 = xmm8[0],xmm9[0],xmm8[1],xmm9[1]
punpcklqdq %xmm6, %xmm8    # xmm8 = xmm8[0],xmm6[0]
paddsw %xmm12, %xmm8
movdqa %xmm2, %xmm7
psrldq $0x2, %xmm7             # xmm7 = xmm7[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%r8,%rax,2), %xmm7
psrldq $0x2, %xmm4             # xmm4 = xmm4[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rdi,%rax,2), %xmm4
movdqa %xmm7, 0x100(%rsp)
movdqa 0x1c0(%rsp), %xmm3
psubsw %xmm3, %xmm7
movdqa %xmm4, %xmm9
movdqa 0x1b0(%rsp), %xmm4
psubsw %xmm4, %xmm9
movdqa %xmm7, %xmm6
pmaxsw %xmm9, %xmm6
movdqa %xmm2, %xmm0
psubsw %xmm3, %xmm0
psubsw %xmm4, %xmm10
movdqa %xmm0, %xmm12
pmaxsw %xmm10, %xmm12
pmaxsw %xmm14, %xmm8
movdqa %xmm12, %xmm3
pmaxsw %xmm6, %xmm3
pmaxsw %xmm8, %xmm3
movdqa %xmm1, %xmm5
pcmpeqw 0x2785a6(%rip), %xmm5   # 0x629da0
movdqa %xmm5, %xmm2
pandn %xmm3, %xmm2
movdqa %xmm5, %xmm4
pandn %xmm6, %xmm4
movdqa 0x40(%rsp), %xmm6
pand %xmm5, %xmm6
por %xmm6, %xmm4
movdqa %xmm11, %xmm15
cmpq $0x8, %rax
jb 0x3b1855
movdqa 0xb0(%rsp), %xmm11
pminsw %xmm2, %xmm11
movdqa %xmm11, 0xb0(%rsp)
movdqa 0xc0(%rsp), %xmm11
pmaxsw %xmm2, %xmm11
movdqa %xmm11, 0xc0(%rsp)
pcmpeqw %xmm2, %xmm8
movdqa %xmm2, %xmm13
pcmpgtw %xmm14, %xmm13
pand %xmm8, %xmm13
pand 0x279fce(%rip), %xmm13  # 0x62b840
movdqa %xmm2, %xmm14
pcmpeqw %xmm4, %xmm14
movdqa 0x2784fb(%rip), %xmm11  # 0x629d80
psubw %xmm14, %xmm11
pandn %xmm11, %xmm8
por %xmm13, %xmm8
pcmpgtw %xmm10, %xmm0
pand 0x279f5f(%rip), %xmm0   # 0x62b800
pcmpgtw %xmm9, %xmm7
pand 0x279f62(%rip), %xmm7   # 0x62b810
por %xmm0, %xmm7
por %xmm8, %xmm7
pxor 0x27a121(%rip), %xmm7   # 0x62b9e0
movq 0x20(%rsp), %rdi
movq 0x10(%rdi), %rbx
movq (%rbx), %rbx
cmpq %r13, %rax
jae 0x3b18e5
pextrw $0x7, %xmm7, %r8d
movq 0x98(%rsp), %rdi
addq %rbx, %rdi
movb %r8b, (%rax,%rdi)
cmpq %rdx, %r9
setae %dil
leaq -0x1(%rax), %r8
cmpq %r13, %r8
setae %r8b
orb %dil, %r8b
jne 0x3b1910
pextrw $0x6, %xmm7, %edi
movq 0xa0(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %rcx
pxor %xmm14, %xmm14
jae 0x3b1947
leaq -0x2(%rax), %rdi
cmpq $0x2, %rax
setae %r8b
cmpq %r13, %rdi
setl %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x3b1947
pextrw $0x5, %xmm7, %edi
movq 0x70(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %r10
jae 0x3b1979
leaq -0x3(%rax), %rdi
cmpq $0x3, %rax
setae %r8b
cmpq %r13, %rdi
setl %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x3b1979
pextrw $0x4, %xmm7, %edi
movq 0x78(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %r15
jae 0x3b19ae
leaq -0x4(%rax), %rdi
cmpq $0x4, %rax
setae %r8b
cmpq %r13, %rdi
setl %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x3b19ae
pextrw $0x3, %xmm7, %edi
movq 0x80(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %r11
jae 0x3b19e3
leaq -0x5(%rax), %rdi
cmpq $0x5, %rax
setae %r8b
cmpq %r13, %rdi
setl %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x3b19e3
pextrw $0x2, %xmm7, %edi
movq 0x88(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %r12
jae 0x3b1a1a
leaq -0x6(%rax), %rdi
cmpq $0x6, %rax
setae %r8b
cmpq %r13, %rdi
setl %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x3b1a1a
movd %xmm7, %edi
shrl $0x10, %edi
movq 0x90(%rsp), %r8
addq %rbx, %r8
movb %dil, (%rax,%r8)
cmpq %rdx, %rbp
setae %dil
cmpq $0x7, %rax
setb %r8b
orb %dil, %r8b
jne 0x3b1a3e
movd %xmm7, %edi
addq 0xa8(%rsp), %rbx
movb %dil, (%rax,%rbx)
pandn %xmm12, %xmm5
por %xmm5, %xmm6
movdqa 0x1a0(%rsp), %xmm5
pcmpgtw %xmm1, %xmm5
pand 0x1d0(%rsp), %xmm5
movdqa %xmm1, %xmm0
psraw $0xf, %xmm0
pandn %xmm5, %xmm0
movdqa %xmm2, %xmm7
pcmpeqw %xmm15, %xmm7
movdqa %xmm2, %xmm8
pcmpgtw %xmm15, %xmm8
movdqa 0x60(%rsp), %xmm10
movdqa %xmm10, %xmm5
pcmpgtw %xmm1, %xmm5
pand %xmm7, %xmm5
movdqa %xmm0, %xmm7
pand %xmm5, %xmm7
movdqa %xmm5, %xmm9
por %xmm8, %xmm5
pand %xmm0, %xmm8
pand %xmm8, %xmm3
pandn %xmm8, %xmm9
pandn %xmm15, %xmm8
movdqa %xmm3, %xmm11
por %xmm8, %xmm11
por %xmm7, %xmm9
movdqa 0x50(%rsp), %xmm3
pand %xmm9, %xmm3
pandn 0x110(%rsp), %xmm9
por %xmm3, %xmm9
pand %xmm0, %xmm5
movdqa %xmm1, %xmm0
pand %xmm5, %xmm0
pandn %xmm10, %xmm5
por %xmm0, %xmm5
movd %xmm2, %edi
movq 0x18(%rsp), %r8
movw %di, (%r8,%rax,2)
movd %xmm4, %edi
movq 0x10(%rsp), %rbx
movw %di, (%rbx,%rax,2)
movq %rbx, %rdi
paddsw 0x278265(%rip), %xmm1   # 0x629d80
incq %rax
movdqa %xmm6, %xmm10
cmpq %rax, 0x148(%rsp)
movaps 0x100(%rsp), %xmm12
jne 0x3b16ac
movdqa 0x50(%rsp), %xmm0
paddsw 0x278248(%rip), %xmm0   # 0x629d90
movdqa %xmm0, 0x50(%rsp)
movq 0x140(%rsp), %r15
addq $0x8, %r15
movq 0x138(%rsp), %rax
addq %rax, 0xa8(%rsp)
addq %rax, 0x98(%rsp)
addq %rax, 0xa0(%rsp)
addq %rax, 0x90(%rsp)
addq %rax, 0x88(%rsp)
addq %rax, 0x80(%rsp)
addq %rax, 0x78(%rsp)
addq %rax, 0x70(%rsp)
cmpq %rdx, %r15
movq 0x220(%rsp), %r12
jb 0x3b14f0
movdqa %xmm11, 0x120(%rsp)
movdqa %xmm5, 0xd0(%rsp)
movl 0x4(%rsp), %edi
jmp 0x3b1bec
movdqa 0x40(%rsp), %xmm0
movdqa %xmm0, %xmm9
movdqa %xmm0, 0xc0(%rsp)
movdqa 0xf0(%rsp), %xmm0
movdqa %xmm0, 0xb0(%rsp)
movdqa %xmm9, 0xe0(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %r15
movzwl 0x120(%rsp,%rdx,2), %esi
cmpw %di, %si
jle 0x3b1c27
movswl 0xe0(%rsp,%rdx,2), %eax
movswl 0xd0(%rsp,%rdx,2), %ecx
movl %esi, %edi
jmp 0x3b1c50
jne 0x3b1c50
movswl 0xd0(%rsp,%rdx,2), %esi
cmpl %esi, %ecx
jle 0x3b1c41
movswl 0xe0(%rsp,%rdx,2), %eax
movl %esi, %ecx
jmp 0x3b1c50
jne 0x3b1c50
movswl 0xe0(%rsp,%rdx,2), %esi
cmpl %esi, %eax
cmovgel %esi, %eax
incq %rdx
cmpl $0x8, %edx
jne 0x3b1c06
movdqa 0x40(%rsp), %xmm0
pcmpgtw 0xb0(%rsp), %xmm0
movdqa 0xc0(%rsp), %xmm1
pcmpgtw 0xf0(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %edx
testl %edx, %edx
je 0x3b1c8f
orb $0x40, 0xc(%rbx)
xorl %edi, %edi
xorl %ecx, %ecx
xorl %eax, %eax
movswl %di, %edx
movl %edx, (%rbx)
movl %eax, 0x4(%rbx)
movl %ecx, 0x8(%rbx)
movq 0x10(%rsp), %rdi
callq 0x20a60d
movq 0x18(%rsp), %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r12)
jne 0x3b1cf9
movq %r15, %rdi
callq 0x20a60d
jmp 0x3b1cf9
callq 0x1be339
jmp 0x3b1cf7
callq 0x1be313
jmp 0x3b1cf7
callq 0x1be2ed
jmp 0x3b1cf7
callq 0x1be2c7
jmp 0x3b1cf7
callq 0x1be2a1
jmp 0x3b1cf7
callq 0x1be27b
jmp 0x3b1cf7
callq 0x1be255
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop