// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/nw_trace_striped_sse2_128_16.c
// Function: parasail_nw_trace_striped_profile_sse2_128_16
parasail_result_t* PNAME(
        const parasail_profile_t * const restrict profile,
        const char * const restrict s2, const int s2Len,
        const int open, const int gap)
{
    /* declare local variables */
    int32_t i = 0;
    int32_t j = 0;
    int32_t k = 0;
    int32_t s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    const parasail_matrix_t *matrix = NULL;
    int32_t segWidth = 0;
    int32_t segLen = 0;
    int32_t offset = 0;
    int32_t position = 0;
    __m128i* restrict vProfile = NULL;
    __m128i* restrict pvHStore = NULL;
    __m128i* restrict pvHLoad = NULL;
    __m128i* restrict pvE = NULL;
    __m128i* restrict pvEaStore = NULL;
    __m128i* restrict pvEaLoad = NULL;
    __m128i* restrict pvHT = NULL;
    int16_t* restrict boundary = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    int16_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    parasail_result_t *result = NULL;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTDiag;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i vTDelF;
    __m128i vTMask;
    __m128i vFTMask;

    /* validate inputs */
    PARASAIL_CHECK_NULL(profile);
    PARASAIL_CHECK_NULL(profile->profile16.score);
    PARASAIL_CHECK_NULL(profile->matrix);
    PARASAIL_CHECK_GT0(profile->s1Len);
    PARASAIL_CHECK_NULL(s2);
    PARASAIL_CHECK_GT0(s2Len);
    PARASAIL_CHECK_GE0(open);
    PARASAIL_CHECK_GE0(gap);

    /* initialize stack variables */
    i = 0;
    j = 0;
    k = 0;
    s1Len = profile->s1Len;
    end_query = s1Len-1;
    end_ref = s2Len-1;
    matrix = profile->matrix;
    segWidth = 8; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    vProfile = (__m128i*)profile->profile16.score;
    vGapO = _mm_set1_epi16(open);
    vGapE = _mm_set1_epi16(gap);
    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;
    vTIns  = _mm_set1_epi16(PARASAIL_INS);
    vTDel  = _mm_set1_epi16(PARASAIL_DEL);
    vTDiag = _mm_set1_epi16(PARASAIL_DIAG);
    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);
    vTMask = _mm_set1_epi16(PARASAIL_ZERO_MASK);
    vFTMask = _mm_set1_epi16(PARASAIL_F_MASK);

    /* initialize result */
    result = parasail_result_new_trace(segLen, s2Len, 16, sizeof(__m128i));
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_NW | PARASAIL_FLAG_STRIPED
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_8;

    /* initialize heap variables */
    pvHStore = parasail_memalign___m128i(16, segLen);
    pvHLoad = parasail_memalign___m128i(16, segLen);
    pvE = parasail_memalign___m128i(16, segLen);
    pvEaStore = parasail_memalign___m128i(16, segLen);
    pvEaLoad = parasail_memalign___m128i(16, segLen);
    pvHT = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_int16_t(16, s2Len+1);

    /* validate heap variables */
    if (!pvHStore) return NULL;
    if (!pvHLoad) return NULL;
    if (!pvE) return NULL;
    if (!pvEaStore) return NULL;
    if (!pvEaLoad) return NULL;
    if (!pvHT) return NULL;
    if (!boundary) return NULL;

    /* initialize H and E */
    {
        int32_t index = 0;
        for (i=0; i<segLen; ++i) {
            int32_t segNum = 0;
            __m128i_16_t h;
            __m128i_16_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = -open-gap*(segNum*segLen+i);
                h.v[segNum] = tmp < INT16_MIN ? INT16_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT16_MIN ? INT16_MIN : tmp;
            }
            _mm_store_si128(&pvHStore[index], h.m);
            _mm_store_si128(&pvE[index], e.m);
            _mm_store_si128(&pvEaStore[index], e.m);
            ++index;
        }
    }

    /* initialize uppder boundary */
    {
        boundary[0] = 0;
        for (i=1; i<=s2Len; ++i) {
            int64_t tmp = -open-gap*(i-1);
            boundary[i] = tmp < INT16_MIN ? INT16_MIN : tmp;
        }
    }

    for (i=0; i<segLen; ++i) {
        arr_store(result->trace->trace_table, vTDiagE, i, segLen, 0);
    }

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vEF_opn;
        __m128i vE;
        __m128i vE_ext;
        __m128i vF;
        __m128i vF_ext;
        __m128i vFa;
        __m128i vFa_ext;
        __m128i vH;
        __m128i vH_dag;
        const __m128i* vP = NULL;

        /* Initialize F value to -inf.  Any errors to vH values will be
         * corrected in the Lazy_F loop.  */
        vF = vNegLimit;

        /* load final segment of pvHStore and shift left by 2 bytes */
        vH = _mm_load_si128(&pvHStore[segLen - 1]);
        vH = _mm_slli_si128(vH, 2);

        /* insert upper boundary condition */
        vH = _mm_insert_epi16(vH, boundary[j], 0);

        /* Correct part of the vProfile */
        vP = vProfile + matrix->mapper[(unsigned char)s2[j]] * segLen;

        /* Swap the 2 H buffers. */
        SWAP(pvHLoad, pvHStore)
        SWAP(pvEaLoad, pvEaStore)

        /* inner loop to process the query sequence */
        for (i=0; i<segLen; ++i) {
            vE = _mm_load_si128(pvE + i);

            /* Get max from vH, vE and vF. */
            vH_dag = _mm_adds_epi16(vH, _mm_load_si128(vP + i));
            vH = _mm_max_epi16(vH_dag, vE);
            vH = _mm_max_epi16(vH, vF);
            /* Save vH values. */
            _mm_store_si128(pvHStore + i, vH);
            vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vE);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vF);

            {
                __m128i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                __m128i case1 = _mm_cmpeq_epi16(vH, vH_dag);
                __m128i case2 = _mm_cmpeq_epi16(vH, vF);
                __m128i vT = _mm_blendv_epi8_rpl(
                        _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                        vTDiag, case1);
                _mm_store_si128(pvHT + i, vT);
                vT = _mm_or_si128(vT, vTAll);
                arr_store(result->trace->trace_table, vT, i, segLen, j);
            }

            vEF_opn = _mm_subs_epi16(vH, vGapO);

            /* Update vE value. */
            vE_ext = _mm_subs_epi16(vE, vGapE);
            vE = _mm_max_epi16(vEF_opn, vE_ext);
            _mm_store_si128(pvE + i, vE);
            {
                __m128i vEa = _mm_load_si128(pvEaLoad + i);
                __m128i vEa_ext = _mm_subs_epi16(vEa, vGapE);
                vEa = _mm_max_epi16(vEF_opn, vEa_ext);
                _mm_store_si128(pvEaStore + i, vEa);
                if (j+1<s2Len) {
                    __m128i cond = _mm_cmpgt_epi16(vEF_opn, vEa_ext);
                    __m128i vT = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, cond);
                    arr_store(result->trace->trace_table, vT, i, segLen, j+1);
                }
            }

            /* Update vF value. */
            vF_ext = _mm_subs_epi16(vF, vGapE);
            vF = _mm_max_epi16(vEF_opn, vF_ext);
            if (i+1<segLen) {
                __m128i vTAll = arr_load(result->trace->trace_table, i+1, segLen, j);
                __m128i cond = _mm_cmpgt_epi16(vEF_opn, vF_ext);
                __m128i vT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, cond);
                vT = _mm_or_si128(vT, vTAll);
                arr_store(result->trace->trace_table, vT, i+1, segLen, j);
            }

            /* Load the next vH. */
            vH = _mm_load_si128(pvHLoad + i);
        }


        /* Lazy_F loop: has been revised to disallow adjecent insertion and
         * then deletion, so don't update E(i, i), learn from SWPS3 */
        vFa_ext = vF_ext;
        vFa = vF;
        for (k=0; k<segWidth; ++k) {
            int64_t tmp = boundary[j+1]-open;
            int16_t tmp2 = tmp < INT16_MIN ? INT16_MIN : tmp;
            __m128i vHp = _mm_load_si128(&pvHLoad[segLen - 1]);
            vHp = _mm_slli_si128(vHp, 2);
            vHp = _mm_insert_epi16(vHp, boundary[j], 0);
            vEF_opn = _mm_slli_si128(vEF_opn, 2);
            vEF_opn = _mm_insert_epi16(vEF_opn, tmp2, 0);
            vF_ext = _mm_slli_si128(vF_ext, 2);
            vF_ext = _mm_insert_epi16(vF_ext, NEG_LIMIT, 0);
            vF = _mm_slli_si128(vF, 2);
            vF = _mm_insert_epi16(vF, tmp2, 0);
            vFa_ext = _mm_slli_si128(vFa_ext, 2);
            vFa_ext = _mm_insert_epi16(vFa_ext, NEG_LIMIT, 0);
            vFa = _mm_slli_si128(vFa, 2);
            vFa = _mm_insert_epi16(vFa, tmp2, 0);
            for (i=0; i<segLen; ++i) {
                vH = _mm_load_si128(pvHStore + i);
                vH = _mm_max_epi16(vH,vF);
                _mm_store_si128(pvHStore + i, vH);
                vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vH);
                vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vH);
                {
                    __m128i vTAll;
                    __m128i vT;
                    __m128i case1;
                    __m128i case2;
                    __m128i cond;
                    vHp = _mm_adds_epi16(vHp, _mm_load_si128(vP + i));
                    case1 = _mm_cmpeq_epi16(vH, vHp);
                    case2 = _mm_cmpeq_epi16(vH, vF);
                    cond = _mm_andnot_si128(case1,case2);
                    vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                    vT = _mm_load_si128(pvHT + i);
                    vT = _mm_blendv_epi8_rpl(vT, vTDel, cond);
                    _mm_store_si128(pvHT + i, vT);
                    vTAll = _mm_and_si128(vTAll, vTMask);
                    vTAll = _mm_or_si128(vTAll, vT);
                    arr_store(result->trace->trace_table, vTAll, i, segLen, j);
                }
                /* Update vF value. */
                {
                    __m128i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                    __m128i cond = _mm_cmpgt_epi16(vEF_opn, vFa_ext);
                    __m128i vT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, cond);
                    vTAll = _mm_and_si128(vTAll, vFTMask);
                    vTAll = _mm_or_si128(vTAll, vT);
                    arr_store(result->trace->trace_table, vTAll, i, segLen, j);
                }
                vEF_opn = _mm_subs_epi16(vH, vGapO);
                vF_ext = _mm_subs_epi16(vF, vGapE);
                {
                    __m128i vEa = _mm_load_si128(pvEaLoad + i);
                    __m128i vEa_ext = _mm_subs_epi16(vEa, vGapE);
                    vEa = _mm_max_epi16(vEF_opn, vEa_ext);
                    _mm_store_si128(pvEaStore + i, vEa);
                    if (j+1<s2Len) {
                        __m128i cond = _mm_cmpgt_epi16(vEF_opn, vEa_ext);
                        __m128i vT = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, cond);
                        arr_store(result->trace->trace_table, vT, i, segLen, j+1);
                    }
                }
                if (! _mm_movemask_epi8(
                            _mm_or_si128(
                                _mm_cmpgt_epi16(vF_ext, vEF_opn),
                                _mm_cmpeq_epi16(vF_ext, vEF_opn))))
                    goto end;
                /*vF = _mm_max_epi16(vEF_opn, vF_ext);*/
                vF = vF_ext;
                vFa_ext = _mm_subs_epi16(vFa, vGapE);
                vFa = _mm_max_epi16(vEF_opn, vFa_ext);
                vHp = _mm_load_si128(pvHLoad + i);
            }
        }
end:
        {
        }
    }

    /* extract last value from the last column */
    {
        __m128i vH = _mm_load_si128(pvHStore + offset);
        for (k=0; k<position; ++k) {
            vH = _mm_slli_si128 (vH, 2);
        }
        score = (int16_t) _mm_extract_epi16 (vH, 7);
    }

    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(boundary);
    parasail_free(pvHT);
    parasail_free(pvEaLoad);
    parasail_free(pvEaStore);
    parasail_free(pvE);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, (%rsp)
movq %rsi, 0x68(%rsp)
testq %rdi, %rdi
je 0x3bc2d5
movq 0x30(%rdi), %rax
movq %rax, 0xa8(%rsp)
testq %rax, %rax
je 0x3bc2dc
movq 0x10(%rdi), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x3bc2e3
movl 0x8(%rdi), %r14d
testl %r14d, %r14d
jle 0x3bc2ea
cmpq $0x0, 0x68(%rsp)
je 0x3bc2f1
movl %edx, %r9d
testl %edx, %edx
jle 0x3bc2f8
cmpl $0x0, (%rsp)
js 0x3bc2ff
testl %r8d, %r8d
js 0x3bc306
movq %r8, 0x28(%rsp)
leal -0x1(%r14), %ebp
addq $0x7, %r14
shrq $0x3, %r14
movl %ebp, %eax
xorl %edx, %edx
divl %r14d
movl %eax, %r12d
movl %edx, %r13d
movl (%rsp), %ecx
movl %ecx, %r15d
negl %r15d
movq 0x60(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negl %esi
cmpl %r15d, %eax
cmovgl %ecx, %esi
movl %esi, 0x4(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x70(%rsp)
movl $0x10, %edx
movl $0x10, %ecx
movl %r14d, %edi
movl %r9d, %esi
movq %r9, 0x30(%rsp)
callq 0x20adf4
testq %rax, %rax
je 0x3bc30b
movq %rax, %rbx
movl %r13d, 0x54(%rsp)
movl %r12d, 0x24(%rsp)
movl %ebp, 0x50(%rsp)
orl $0x8280801, 0xc(%rax)   # imm = 0x8280801
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, 0x8(%rsp)
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, %r13
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, %r12
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, 0xa0(%rsp)
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, %rbp
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %r14, 0x10(%rsp)
movq %rax, %r14
movq 0x30(%rsp), %rax
leal 0x1(%rax), %esi
movl $0x10, %edi
callq 0x20a625
movq 0xa0(%rsp), %r11
movq 0x8(%rsp), %xmm0
movq %r13, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %r12, 0x40(%rsp)
movq %r12, %xmm1
movq %r11, %xmm2
punpcklqdq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0]
pxor %xmm2, %xmm2
movq %rbp, 0x18(%rsp)
testq %rbp, %rbp
movq %rax, %rdi
sete %al
testq %r14, %r14
sete %cl
testq %rdi, %rdi
sete %dl
pcmpeqd %xmm2, %xmm0
pcmpeqd %xmm2, %xmm1
movdqa %xmm0, %xmm2
shufps $0xdd, %xmm1, %xmm2     # xmm2 = xmm2[1,3],xmm1[1,3]
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
andps %xmm2, %xmm0
movmskps %xmm0, %esi
testl %esi, %esi
setne %sil
orb %al, %cl
orb %dl, %cl
orb %sil, %cl
jne 0x3bc30b
movq %rdi, 0x58(%rsp)
movq 0x30(%rsp), %rax
decl %eax
movl %eax, 0x20(%rsp)
movl $0x7, %eax
subl 0x24(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl (%rsp), %eax
movd %eax, %xmm0
movdqa %xmm0, 0x90(%rsp)
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm2      # xmm2 = xmm0[0,0,0,0]
movq 0x28(%rsp), %rdx
movd %edx, %xmm0
pshuflw $0x0, %xmm0, %xmm1      # xmm1 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm3      # xmm3 = xmm1[0,0,0,0]
movl 0x4(%rsp), %ecx
addl $0xffff8001, %ecx       # imm = 0xFFFF8001
movl %ecx, 0x4(%rsp)
movd %ecx, %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]
movdqa %xmm1, 0x80(%rsp)
movd 0x70(%rsp), %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]
movdqa %xmm1, 0x70(%rsp)
movl %eax, %eax
movl %edx, %edi
movslq %r15d, %rdx
negq %rax
movq 0x10(%rsp), %rsi
imulq %rdi, %rsi
xorl %ebp, %ebp
movq $-0x7fff, %r8           # imm = 0x8001
movq $-0x8000, %r9           # imm = 0x8000
movq %r11, %rcx
movq %rdx, %r10
xorl %r11d, %r11d
cmpq %r8, %r10
movq $-0x8000, %r12          # imm = 0x8000
cmovgeq %r10, %r12
movw %r12w, 0xc0(%rsp,%r11,2)
leaq (%rax,%r10), %r12
cmpq %r8, %r12
cmovlq %r9, %r12
movw %r12w, 0xb0(%rsp,%r11,2)
incq %r11
subq %rsi, %r10
cmpq $0x8, %r11
jne 0x3bb9c2
movq %rbp, %r10
shlq $0x4, %r10
movaps 0xc0(%rsp), %xmm1
movq 0x8(%rsp), %r11
movaps %xmm1, (%r11,%r10)
movdqa 0xb0(%rsp), %xmm1
movq 0x40(%rsp), %r11
movdqa %xmm1, (%r11,%r10)
movq %rcx, %r11
movdqa %xmm1, (%rcx,%r10)
incq %rbp
subq %rdi, %rdx
cmpq 0x10(%rsp), %rbp
jne 0x3bb9b9
movq 0x58(%rsp), %rbp
movw $0x0, (%rbp)
movq 0x30(%rsp), %r10
movl %r10d, %eax
addl $0x7, %r10d
andl $-0x8, %r10d
movq %rax, %rdi
decq %rax
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm5     # xmm5 = xmm1[0,1,0,1]
movd %r15d, %xmm6
pshufd $0x0, %xmm6, %xmm1      # xmm1 = xmm6[0,0,0,0]
movdqa %xmm1, 0x30(%rsp)
pshufd $0x0, %xmm0, %xmm8      # xmm8 = xmm0[0,0,0,0]
movq 0x28(%rsp), %r9
movl %r9d, %ecx
negl %ecx
leal (,%r9,8), %edx
leal (%r9,%r9,2), %esi
negl %esi
addl %r9d, %r9d
xorl %r8d, %r8d
movdqa 0x26d3f8(%rip), %xmm13  # 0x628ea0
pxor %xmm13, %xmm5
pcmpeqd %xmm14, %xmm14
movdqa 0x26e056(%rip), %xmm1   # 0x629b10
movq %r8, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, %xmm9
por 0x26d3be(%rip), %xmm9   # 0x628e90
pxor %xmm13, %xmm9
movdqa %xmm9, %xmm12
pcmpgtd %xmm5, %xmm12
pshufd $0xa0, %xmm12, %xmm11   # xmm11 = xmm12[0,0,2,2]
pshuflw $0xe8, %xmm11, %xmm15   # xmm15 = xmm11[0,2,2,3,4,5,6,7]
pcmpeqd %xmm5, %xmm9
pshufd $0xf5, %xmm9, %xmm10    # xmm10 = xmm9[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm9    # xmm9 = xmm10[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm9
pshufd $0xf5, %xmm12, %xmm12   # xmm12 = xmm12[1,1,3,3]
pshuflw $0xe8, %xmm12, %xmm15   # xmm15 = xmm12[0,2,2,3,4,5,6,7]
por %xmm9, %xmm15
pxor %xmm14, %xmm15
packssdw %xmm15, %xmm15
movd %ecx, %xmm9
punpckldq %xmm6, %xmm9    # xmm9 = xmm9[0],xmm6[0],xmm9[1],xmm6[1]
movd %r9d, %xmm4
movdqa 0x90(%rsp), %xmm7
punpckldq %xmm4, %xmm7    # xmm7 = xmm7[0],xmm4[0],xmm7[1],xmm4[1]
psubd %xmm7, %xmm9
leal (%rsi,%r15), %eax
movd %r15d, %xmm4
movd %eax, %xmm7
shufps $0xd4, %xmm9, %xmm7     # xmm7 = xmm7[0,1],xmm9[1,3]
punpckldq %xmm4, %xmm9    # xmm9 = xmm9[0],xmm4[0],xmm9[1],xmm4[1]
shufps $0x21, %xmm7, %xmm9     # xmm9 = xmm9[1,0],xmm7[2,0]
movaps %xmm9, %xmm4
pcmpgtd %xmm1, %xmm4
andps %xmm4, %xmm9
pandn %xmm1, %xmm4
por %xmm9, %xmm4
movd %xmm15, %eax
testb $0x1, %al
je 0x3bbb83
movd %xmm4, %eax
movw %ax, 0x2(%rbp,%r8,2)
pand %xmm11, %xmm10
por %xmm12, %xmm10
packssdw %xmm10, %xmm10
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
movd %xmm10, %eax
shrl $0x10, %eax
testb $0x1, %al
je 0x3bbbb3
pextrw $0x2, %xmm4, %eax
movw %ax, 0x4(%rbp,%r8,2)
movdqa %xmm0, %xmm7
por 0x26d2c1(%rip), %xmm7   # 0x628e80
pxor %xmm13, %xmm7
movdqa %xmm7, %xmm9
pcmpgtd %xmm5, %xmm9
pshufd $0xa0, %xmm9, %xmm10    # xmm10 = xmm9[0,0,2,2]
pcmpeqd %xmm5, %xmm7
pshufd $0xf5, %xmm7, %xmm11    # xmm11 = xmm7[1,1,3,3]
movdqa %xmm11, %xmm7
pand %xmm10, %xmm7
pshufd $0xf5, %xmm9, %xmm12    # xmm12 = xmm9[1,1,3,3]
por %xmm12, %xmm7
packssdw %xmm7, %xmm7
pxor %xmm14, %xmm7
packssdw %xmm7, %xmm7
pextrw $0x2, %xmm7, %eax
testb $0x1, %al
je 0x3bbc14
pextrw $0x4, %xmm4, %eax
movw %ax, 0x6(%rbp,%r8,2)
pshufhw $0x84, %xmm10, %xmm7    # xmm7 = xmm10[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm11, %xmm9    # xmm9 = xmm11[0,1,2,3,4,5,4,6]
pand %xmm7, %xmm9
pshufhw $0x84, %xmm12, %xmm7    # xmm7 = xmm12[0,1,2,3,4,5,4,6]
por %xmm9, %xmm7
pxor %xmm14, %xmm7
packssdw %xmm7, %xmm7
pextrw $0x3, %xmm7, %eax
testb $0x1, %al
je 0x3bbc4d
pextrw $0x6, %xmm4, %eax
movw %ax, 0x8(%rbp,%r8,2)
movdqa %xmm0, %xmm10
por 0x26d275(%rip), %xmm10  # 0x628ed0
movd %r8d, %xmm4
pshufd $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
por 0x26de93(%rip), %xmm4   # 0x629b00
pshufd $0xf5, %xmm4, %xmm7     # xmm7 = xmm4[1,1,3,3]
pmuludq %xmm8, %xmm4
pshufd $0xe8, %xmm4, %xmm4     # xmm4 = xmm4[0,2,2,3]
pshufd $0xf5, %xmm8, %xmm9     # xmm9 = xmm8[1,1,3,3]
pmuludq %xmm7, %xmm9
pshufd $0xe8, %xmm9, %xmm7     # xmm7 = xmm9[0,2,2,3]
punpckldq %xmm7, %xmm4    # xmm4 = xmm4[0],xmm7[0],xmm4[1],xmm7[1]
movdqa 0x30(%rsp), %xmm7
psubd %xmm4, %xmm7
movdqa %xmm7, %xmm9
pcmpgtd %xmm1, %xmm9
pand %xmm9, %xmm7
pandn %xmm1, %xmm9
por %xmm7, %xmm9
pxor %xmm13, %xmm10
movdqa %xmm10, %xmm4
pcmpgtd %xmm5, %xmm4
pshufd $0xa0, %xmm4, %xmm11    # xmm11 = xmm4[0,0,2,2]
pshuflw $0xe8, %xmm11, %xmm7    # xmm7 = xmm11[0,2,2,3,4,5,6,7]
pcmpeqd %xmm5, %xmm10
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm15   # xmm15 = xmm10[0,2,2,3,4,5,6,7]
pand %xmm7, %xmm15
pshufd $0xf5, %xmm4, %xmm12    # xmm12 = xmm4[1,1,3,3]
pshuflw $0xe8, %xmm12, %xmm4    # xmm4 = xmm12[0,2,2,3,4,5,6,7]
por %xmm15, %xmm4
pxor %xmm14, %xmm4
packssdw %xmm4, %xmm4
pextrw $0x4, %xmm4, %eax
testb $0x1, %al
je 0x3bbd12
movd %xmm9, %eax
movw %ax, 0xa(%rbp,%r8,2)
pand %xmm11, %xmm10
por %xmm12, %xmm10
packssdw %xmm10, %xmm10
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm4
pextrw $0x5, %xmm4, %eax
testb $0x1, %al
je 0x3bbd40
pextrw $0x2, %xmm9, %eax
movw %ax, 0xc(%rbp,%r8,2)
por 0x26d178(%rip), %xmm0   # 0x628ec0
pxor %xmm13, %xmm0
movdqa %xmm0, %xmm4
pcmpgtd %xmm5, %xmm4
pshufd $0xa0, %xmm4, %xmm10    # xmm10 = xmm4[0,0,2,2]
pcmpeqd %xmm5, %xmm0
pshufd $0xf5, %xmm0, %xmm0     # xmm0 = xmm0[1,1,3,3]
movdqa %xmm0, %xmm7
pand %xmm10, %xmm7
pshufd $0xf5, %xmm4, %xmm11    # xmm11 = xmm4[1,1,3,3]
por %xmm11, %xmm7
packssdw %xmm7, %xmm4
pxor %xmm14, %xmm4
packssdw %xmm4, %xmm4
pextrw $0x6, %xmm4, %eax
testb $0x1, %al
je 0x3bbd9a
pextrw $0x4, %xmm9, %eax
movw %ax, 0xe(%rbp,%r8,2)
pshufhw $0x84, %xmm10, %xmm4    # xmm4 = xmm10[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pand %xmm4, %xmm0
pshufhw $0x84, %xmm11, %xmm4    # xmm4 = xmm11[0,1,2,3,4,5,4,6]
por %xmm0, %xmm4
pxor %xmm14, %xmm4
packssdw %xmm4, %xmm0
pextrw $0x7, %xmm0, %eax
testb $0x1, %al
je 0x3bbdd1
pextrw $0x6, %xmm9, %eax
movw %ax, 0x10(%rbp,%r8,2)
addq $0x8, %r8
subl %edx, %ecx
subl %edx, %r15d
addl %edx, %r9d
cmpq %r8, %r10
jne 0x3bbaba
movq 0x10(%rsp), %rsi
shlq $0x4, %rsi
xorl %eax, %eax
movdqa 0x26df97(%rip), %xmm0   # 0x629d90
movq 0x10(%rbx), %rcx
movq (%rcx), %rcx
movdqa %xmm0, (%rcx,%rax)
addq $0x10, %rax
cmpq %rax, %rsi
jne 0x3bbdf9
movq 0x10(%rsp), %rax
leal -0x1(%rax), %ecx
xorl %r9d, %r9d
shlq $0x4, %rcx
movq %rcx, 0x30(%rsp)
movl %eax, %eax
movq %rax, 0x28(%rsp)
movdqa 0x26f9ff(%rip), %xmm6   # 0x62b830
movdqa 0x26fa07(%rip), %xmm7   # 0x62b840
movdqa 0x26f9ce(%rip), %xmm10  # 0x62b810
movdqa 0x26f9d5(%rip), %xmm11  # 0x62b820
movdqa 0x26fd4c(%rip), %xmm13  # 0x62bba0
movq %rsi, %rcx
xorl %edx, %edx
movdqa 0x70(%rsp), %xmm5
movdqa 0x80(%rsp), %xmm4
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %r15
movq %r11, 0x18(%rsp)
movq %r13, %r12
movq %rax, %r13
movq %rdx, %r10
movq 0x30(%rsp), %rax
leaq (%r13,%rax), %rdx
movq %rdx, 0x90(%rsp)
movdqa (%r13,%rax), %xmm12
pslldq $0x2, %xmm12            # xmm12 = zero,zero,xmm12[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, (%rbp,%r10,2), %xmm12
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x68(%rsp), %rax
movzbl (%rax,%r10), %r8d
movslq (%rdx,%r8,4), %r8
imulq 0x28(%rsp), %r8
shlq $0x4, %r8
addq 0xa8(%rsp), %r8
movq %r10, 0x8(%rsp)
leaq 0x1(%r10), %rdx
movl $0x1, %r10d
xorl %r11d, %r11d
movdqa 0x80(%rsp), %xmm14
movq %r13, %rbp
movq 0x40(%rsp), %r13
movdqa (%r13,%r11), %xmm0
paddsw (%r8,%r11), %xmm12
movdqa %xmm12, %xmm8
pmaxsw %xmm0, %xmm8
movdqa %xmm8, %xmm1
pmaxsw %xmm14, %xmm1
movdqa %xmm1, (%r12,%r11)
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
pcmpeqw %xmm1, %xmm12
pcmpgtw %xmm14, %xmm8
paddw %xmm6, %xmm8
movdqa %xmm12, %xmm9
pandn %xmm8, %xmm9
pand %xmm7, %xmm12
por %xmm9, %xmm12
movdqa (%r11,%rax), %xmm8
por %xmm12, %xmm8
movdqa %xmm12, (%r14,%r11)
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
movdqa %xmm8, (%r11,%rax)
movdqa %xmm1, %xmm9
psubsw %xmm2, %xmm9
movdqa %xmm0, %xmm8
psubsw %xmm3, %xmm8
pmaxsw %xmm9, %xmm8
movdqa %xmm8, (%r13,%r11)
movq 0x18(%rsp), %rax
movdqa (%rax,%r11), %xmm8
psubsw %xmm3, %xmm8
movdqa %xmm9, %xmm12
pmaxsw %xmm8, %xmm12
movdqa %xmm12, (%r15,%r11)
cmpq %rdi, %rdx
jae 0x3bbfda
movdqa %xmm9, %xmm12
pcmpgtw %xmm8, %xmm12
pand 0x26f83f(%rip), %xmm12  # 0x62b800
pxor 0x26df76(%rip), %xmm12  # 0x629f40
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %rcx, %rax
movdqa %xmm12, (%r11,%rax)
movdqa %xmm14, %xmm15
psubsw %xmm3, %xmm15
cmpq 0x10(%rsp), %r10
movq %rbp, %r13
jae 0x3bc01a
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
movdqa %xmm9, %xmm8
pcmpgtw %xmm15, %xmm8
pand %xmm10, %xmm8
pxor %xmm11, %xmm8
por 0x10(%r11,%rax), %xmm8
movdqa %xmm8, 0x10(%r11,%rax)
pmaxsw %xmm1, %xmm4
pminsw %xmm0, %xmm5
pminsw %xmm14, %xmm5
pminsw %xmm1, %xmm5
movdqa %xmm9, %xmm14
pmaxsw %xmm15, %xmm14
movdqa (%r13,%r11), %xmm12
addq $0x10, %r11
incq %r10
cmpq %r11, %rsi
jne 0x3bbeec
xorl %r10d, %r10d
movdqa %xmm14, %xmm0
movq 0x58(%rsp), %rbp
movswl (%rbp,%rdx,2), %eax
subl (%rsp), %eax
cmpl $0xffff8001, %eax       # imm = 0xFFFF8001
movl $0xffff8000, %r11d      # imm = 0xFFFF8000
cmovll %r11d, %eax
movq 0x90(%rsp), %r11
movdqa (%r11), %xmm12
pslldq $0x2, %xmm12            # xmm12 = zero,zero,xmm12[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x8(%rsp), %r11
pinsrw $0x0, (%rbp,%r11,2), %xmm12
pslldq $0x2, %xmm9             # xmm9 = zero,zero,xmm9[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm9
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm0
pslldq $0x2, %xmm15            # xmm15 = zero,zero,xmm15[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, 0x4(%rsp), %xmm15
pslldq $0x2, %xmm14            # xmm14 = zero,zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm14
xorl %r11d, %r11d
movdqa (%r12,%r11), %xmm1
movdqa %xmm1, %xmm8
pmaxsw %xmm0, %xmm8
movdqa %xmm8, (%r12,%r11)
paddsw (%r8,%r11), %xmm12
pcmpgtw %xmm15, %xmm9
pcmpeqw %xmm8, %xmm12
pcmpgtw %xmm0, %xmm1
por %xmm12, %xmm1
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
movdqa (%r11,%rax), %xmm12
pand 0x26fa85(%rip), %xmm12  # 0x62bb90
movdqa (%r14,%r11), %xmm15
pand %xmm1, %xmm15
pandn %xmm6, %xmm1
por %xmm15, %xmm1
movdqa %xmm1, (%r14,%r11)
por %xmm12, %xmm1
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
movdqa %xmm1, (%r11,%rax)
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %r9, %rax
pand %xmm10, %xmm9
movdqa (%r11,%rax), %xmm1
pand %xmm13, %xmm1
por %xmm9, %xmm1
pxor %xmm11, %xmm1
movdqa %xmm1, (%r11,%rax)
movdqa %xmm8, %xmm9
psubsw %xmm2, %xmm9
movq 0x18(%rsp), %rax
movdqa (%rax,%r11), %xmm1
psubsw %xmm3, %xmm1
movdqa %xmm9, %xmm12
pmaxsw %xmm1, %xmm12
movdqa %xmm12, (%r15,%r11)
cmpq %rdi, %rdx
jae 0x3bc1be
movdqa %xmm9, %xmm12
pcmpgtw %xmm1, %xmm12
pand 0x26f65b(%rip), %xmm12  # 0x62b800
pxor 0x26dd92(%rip), %xmm12  # 0x629f40
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %rcx, %rax
movdqa %xmm12, (%r11,%rax)
pminsw %xmm8, %xmm5
pmaxsw %xmm8, %xmm4
psubsw %xmm3, %xmm0
movdqa %xmm9, %xmm1
pcmpgtw %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x3bc215
movdqa %xmm14, %xmm15
psubsw %xmm3, %xmm15
movdqa %xmm9, %xmm14
pmaxsw %xmm15, %xmm14
movdqa (%r13,%r11), %xmm12
addq $0x10, %r11
cmpq %r11, %rsi
jne 0x3bc0c3
incl %r10d
cmpl $0x8, %r10d
jne 0x3bc059
addq %rsi, %rcx
addq %rsi, %r9
movq %r12, %rax
movq %r15, %r11
cmpq %rdi, %rdx
jne 0x3bbe6d
movl 0x54(%rsp), %eax
shlq $0x4, %rax
movdqa (%r12,%rax), %xmm0
cmpl $0x6, 0x24(%rsp)
jg 0x3bc256
xorl %eax, %eax
movl 0x20(%rsp), %edx
movl 0x4c(%rsp), %ecx
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
incl %eax
cmpl %ecx, %eax
jl 0x3bc249
jmp 0x3bc25a
movl 0x20(%rsp), %edx
movdqa 0x80(%rsp), %xmm1
pcmpgtw %xmm5, %xmm1
pcmpgtw 0x70(%rsp), %xmm4
por %xmm1, %xmm4
pmovmskb %xmm4, %eax
testl %eax, %eax
je 0x3bc285
orb $0x40, 0xc(%rbx)
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x3bc28e
pextrw $0x7, %xmm0, %eax
movl 0x50(%rsp), %ecx
cwtl
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
movl %edx, 0x8(%rbx)
movq %rbp, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq 0x18(%rsp), %rdi
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
movq 0x40(%rsp), %rdi
callq 0x20a60d
movq %r13, %rdi
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
jmp 0x3bc30d
callq 0x1bf5ed
jmp 0x3bc30b
callq 0x1bf5c7
jmp 0x3bc30b
callq 0x1bf5a1
jmp 0x3bc30b
callq 0x1bf57b
jmp 0x3bc30b
callq 0x1bf555
jmp 0x3bc30b
callq 0x1bf52f
jmp 0x3bc30b
callq 0x1bf509
jmp 0x3bc30b
callq 0x1bf4e3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop