// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_striped_sse2_128_16.c
// Function: parasail_sg_flags_table_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,
        int s1_beg, int s1_end, int s2_beg, int s2_end)
{
    /* 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;
    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;
    __m128i vMaxH;
    __m128i vPosMask;
    parasail_result_t *result = NULL;

    /* 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;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi16(_mm_set1_epi16(position),
            _mm_set_epi16(0,1,2,3,4,5,6,7));

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

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_STRIPED
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_8;
    result->flag |= s1_beg ? PARASAIL_FLAG_SG_S1_BEG : 0;
    result->flag |= s1_end ? PARASAIL_FLAG_SG_S1_END : 0;
    result->flag |= s2_beg ? PARASAIL_FLAG_SG_S2_BEG : 0;
    result->flag |= s2_end ? PARASAIL_FLAG_SG_S2_END : 0;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* initialize heap variables */
    pvHStore = parasail_memalign___m128i(16, segLen);
    pvHLoad =  parasail_memalign___m128i(16, segLen);
    pvE      = 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 (!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 = s1_beg ? 0 : (-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);
            ++index;
        }
    }

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

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        /* Initialize F value to -inf.  Any errors to vH values will be
         * corrected in the Lazy_F loop.  */
        __m128i vF = vNegLimit;

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

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

        /* Swap the 2 H buffers. */
        __m128i* pv = pvHLoad;
        pvHLoad = pvHStore;
        pvHStore = pv;

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

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

            /* Get max from vH, vE and vF. */
            vH = _mm_max_epi16(vH, 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);
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif

            /* Update vE value. */
            vH = _mm_subs_epi16(vH, vGapO);
            vE = _mm_subs_epi16(vE, vGapE);
            vE = _mm_max_epi16(vE, vH);
            _mm_store_si128(pvE + i, vE);

            /* Update vF value. */
            vF = _mm_subs_epi16(vF, vGapE);
            vF = _mm_max_epi16(vF, vH);

            /* 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 */
        for (k=0; k<segWidth; ++k) {
            int64_t tmp = s2_beg ? -open : (boundary[j+1]-open);
            int16_t tmp2 = tmp < INT16_MIN ? INT16_MIN : tmp;
            vF = _mm_slli_si128(vF, 2);
            vF = _mm_insert_epi16(vF, 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);
#ifdef PARASAIL_TABLE
                arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif
                vH = _mm_subs_epi16(vH, vGapO);
                vF = _mm_subs_epi16(vF, vGapE);
                if (! _mm_movemask_epi8(_mm_cmpgt_epi16(vF, vH))) goto end;
                /*vF = _mm_max_epi16(vF, vH);*/
            }
        }
end:
        {
            /* extract vector containing last value from the column */
            __m128i vCompare;
            vH = _mm_load_si128(pvHStore + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi16(vH, vMaxH));
            vMaxH = _mm_max_epi16(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
#ifdef PARASAIL_ROWCOL
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 2);
            }
            result->rowcols->score_row[j] = (int16_t) _mm_extract_epi16 (vH, 7);
#endif
        }
    }

#ifdef PARASAIL_ROWCOL
    for (i=0; i<segLen; ++i) {
        __m128i vH = _mm_load_si128(pvHStore + i);
        arr_store_col(result->rowcols->score_col, vH, i, segLen);
    }
#endif

    /* max last value from all columns */
    if (s2_end)
    {
        for (k=0; k<position; ++k) {
            vMaxH = _mm_slli_si128(vMaxH, 2);
        }
        score = (int16_t) _mm_extract_epi16(vMaxH, 7);
        end_query = s1Len-1;
    }

    /* max of last column */
    if (s1_end)
    {
        /* Trace the alignment ending position on read. */
        int16_t *t = (int16_t*)pvHStore;
        int32_t column_len = segLen * segWidth;
        for (i = 0; i<column_len; ++i, ++t) {
            int32_t temp = i / segWidth + i % segWidth * segLen;
            if (temp >= s1Len) continue;
            if (*t > score) {
                score = *t;
                end_query = temp;
                end_ref = s2Len-1;
            }
            else if (*t == score && end_ref == s2Len-1 && temp < end_query) {
                end_query = temp;
            }
        }
    }

    if (!s1_end && !s2_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);
            end_ref = s2Len - 1;
            end_query = s1Len - 1;
        }
    }

    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(pvE);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %ecx, 0x10(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, 0x88(%rsp)
testq %rdi, %rdi
je 0x31101c
movq 0x30(%rdi), %rax
movq %rax, 0x100(%rsp)
testq %rax, %rax
je 0x311026
movq 0x10(%rdi), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x311030
movl 0x8(%rdi), %ebx
testl %ebx, %ebx
jle 0x31103a
cmpq $0x0, 0x88(%rsp)
je 0x311044
movq 0x30(%rsp), %rcx
testl %ecx, %ecx
jle 0x31104e
cmpl $0x0, 0x10(%rsp)
js 0x311058
movl %r8d, %ebp
testl %r8d, %r8d
js 0x311062
movl %r9d, %r13d
leal -0x1(%rbx), %eax
leaq 0x7(%rbx), %r15
movq %r15, %r14
shrq $0x3, %r14
movl %eax, 0x70(%rsp)
xorl %edx, %edx
divl %r14d
movl %eax, 0x14(%rsp)
movl %edx, 0x60(%rsp)
movl 0x10(%rsp), %edx
movl %edx, %edi
negl %edi
movq %rcx, %rsi
movq 0x80(%rsp), %r8
movl 0x20(%r8), %eax
movl %eax, %ecx
negl %ecx
movl %edi, 0x1c(%rsp)
cmpl %edi, %eax
cmovgl %edx, %ecx
movl %ecx, 0x18(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%r8), %ax
movl %eax, 0x58(%rsp)
andl $0x7ffffff8, %r15d      # imm = 0x7FFFFFF8
movl %r15d, %edi
callq 0x20abc2
testq %rax, %rax
je 0x310567
movq %rax, %r12
movq %rbx, 0xd8(%rsp)
movq %r15, 0xd0(%rsp)
xorl %eax, %eax
testl %r13d, %r13d
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x190(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x198(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x1a0(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%r12), %eax
orl $0x8220802, %eax        # imm = 0x8220802
movl %eax, 0xc(%r12)
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %rax, %r15
movl $0x10, %edi
movq %r14, %rsi
callq 0x2f600c
movq %r14, %rsi
movq %rax, %r14
movl $0x10, %edi
movq %rsi, 0x50(%rsp)
callq 0x2f600c
movq %rax, %rbx
movq 0x30(%rsp), %rax
leal 0x1(%rax), %esi
movl $0x10, %edi
callq 0x20a625
movq %r15, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %rbx, %xmm1
movq %rax, %xmm2
punpcklqdq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0]
pxor %xmm2, %xmm2
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, %ecx
testl %ecx, %ecx
je 0x31057f
xorl %r12d, %r12d
movq %r12, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x20(%rsp)
movq %rax, 0x48(%rsp)
movq %rbx, 0x68(%rsp)
movq %r14, %r15
movq 0x30(%rsp), %rax
decl %eax
movl %eax, 0xc(%rsp)
movl $0x7, %edx
subl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movd %ecx, %xmm0
movdqa %xmm0, 0xb0(%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]
movd %ebp, %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 0x18(%rsp), %eax
addl $0xffff8001, %eax       # imm = 0xFFFF8001
movl %eax, 0x18(%rsp)
movd %eax, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm4      # xmm4 = xmm1[0,0,0,0]
movd 0x58(%rsp), %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm5      # xmm5 = xmm1[0,0,0,0]
movl %edx, 0x2c(%rsp)
movd %edx, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm6      # xmm6 = xmm1[0,0,0,0]
movl %ecx, %eax
movl %ebp, %ecx
movslq 0x1c(%rsp), %rdx
movq 0x50(%rsp), %rsi
imulq %rcx, %rsi
xorl %edi, %edi
movq $-0x7fff, %r8           # imm = 0x8001
movq $-0x8000, %r9           # imm = 0x8000
movq %rdx, %r10
xorl %r11d, %r11d
testl %r13d, %r13d
je 0x31063c
xorl %ebx, %ebx
jmp 0x31063f
movq %r10, %rbx
cmpq %r8, %rbx
movq $-0x8000, %r14          # imm = 0x8000
cmovgeq %rbx, %r14
movw %r14w, 0x140(%rsp,%r11,2)
subq %rax, %rbx
cmpq %r8, %rbx
cmovlq %r9, %rbx
movw %bx, 0x130(%rsp,%r11,2)
incq %r11
subq %rsi, %r10
cmpq $0x8, %r11
jne 0x310633
movq %rdi, %r10
shlq $0x4, %r10
movaps 0x140(%rsp), %xmm1
movq 0x20(%rsp), %r11
movaps %xmm1, (%r11,%r10)
movdqa 0x130(%rsp), %xmm1
movq 0x68(%rsp), %r11
movdqa %xmm1, (%r11,%r10)
incq %rdi
subq %rcx, %rdx
cmpq 0x50(%rsp), %rdi
jne 0x31062d
movdqa %xmm6, 0xa0(%rsp)
movdqa %xmm5, 0x110(%rsp)
movdqa %xmm4, 0x120(%rsp)
movq 0x48(%rsp), %rcx
movw $0x0, (%rcx)
movq 0x30(%rsp), %rsi
movl %esi, %eax
addl $0x7, %esi
andl $-0x8, %esi
movq %rax, 0x78(%rsp)
decq %rax
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm6     # xmm6 = xmm1[0,1,0,1]
movl 0x1c(%rsp), %eax
movd %eax, %xmm7
pshufd $0x0, %xmm7, %xmm1      # xmm1 = xmm7[0,0,0,0]
movdqa %xmm1, 0x30(%rsp)
pshufd $0x0, %xmm0, %xmm9      # xmm9 = xmm0[0,0,0,0]
movl %ebp, %edi
negl %edi
leal (,%rbp,8), %r8d
leal (%rbp,%rbp,2), %r9d
negl %r9d
addl %ebp, %ebp
xorl %r10d, %r10d
movdqa 0x31876e(%rip), %xmm14  # 0x628ea0
pxor %xmm14, %xmm6
pcmpeqd %xmm15, %xmm15
movdqa 0x3193cc(%rip), %xmm0   # 0x629b10
movl %eax, %r11d
xorl %r13d, %r13d
movq %r15, %rbx
movq 0x50(%rsp), %r15
movl 0x198(%rsp), %edx
movq %r13, %xmm1
pshufd $0x44, %xmm1, %xmm4     # xmm4 = xmm1[0,1,0,1]
movdqa %xmm4, %xmm1
por 0x318721(%rip), %xmm1   # 0x628e90
pxor %xmm14, %xmm1
movdqa %xmm1, %xmm10
pcmpgtd %xmm6, %xmm10
pshufd $0xa0, %xmm10, %xmm12   # xmm12 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm12, %xmm13   # xmm13 = xmm12[0,2,2,3,4,5,6,7]
pcmpeqd %xmm6, %xmm1
pshufd $0xf5, %xmm1, %xmm11    # xmm11 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm11, %xmm5    # xmm5 = xmm11[0,2,2,3,4,5,6,7]
pand %xmm13, %xmm5
pshufd $0xf5, %xmm10, %xmm13   # xmm13 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
por %xmm5, %xmm1
pxor %xmm15, %xmm1
packssdw %xmm1, %xmm1
movd %edi, %xmm5
punpckldq %xmm7, %xmm5    # xmm5 = xmm5[0],xmm7[0],xmm5[1],xmm7[1]
movd %ebp, %xmm10
movdqa 0xb0(%rsp), %xmm8
punpckldq %xmm10, %xmm8   # xmm8 = xmm8[0],xmm10[0],xmm8[1],xmm10[1]
psubd %xmm8, %xmm5
leal (%r9,%r11), %eax
movd %r11d, %xmm8
movd %eax, %xmm10
shufps $0xd4, %xmm5, %xmm10    # xmm10 = xmm10[0,1],xmm5[1,3]
punpckldq %xmm8, %xmm5    # xmm5 = xmm5[0],xmm8[0],xmm5[1],xmm8[1]
shufps $0x21, %xmm10, %xmm5    # xmm5 = xmm5[1,0],xmm10[2,0]
movaps %xmm5, %xmm10
pcmpgtd %xmm0, %xmm10
andps %xmm10, %xmm5
pandn %xmm0, %xmm10
por %xmm5, %xmm10
movd %xmm1, %eax
testb $0x1, %al
je 0x310826
testl %edx, %edx
movd %xmm10, %eax
cmovnel %r10d, %eax
movw %ax, 0x2(%rcx,%r13,2)
pand %xmm12, %xmm11
por %xmm13, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm15, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %eax
shrl $0x10, %eax
testb $0x1, %al
je 0x31085d
pextrw $0x2, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0x4(%rcx,%r13,2)
movdqa %xmm4, %xmm5
por 0x318617(%rip), %xmm5   # 0x628e80
pxor %xmm14, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm6, %xmm8
pshufd $0xa0, %xmm8, %xmm1     # xmm1 = xmm8[0,0,2,2]
pcmpeqd %xmm6, %xmm5
pshufd $0xf5, %xmm5, %xmm11    # xmm11 = xmm5[1,1,3,3]
movdqa %xmm11, %xmm5
pand %xmm1, %xmm5
pshufd $0xf5, %xmm8, %xmm12    # xmm12 = xmm8[1,1,3,3]
por %xmm12, %xmm5
packssdw %xmm5, %xmm5
pxor %xmm15, %xmm5
packssdw %xmm5, %xmm5
pextrw $0x2, %xmm5, %eax
testb $0x1, %al
je 0x3108c4
pextrw $0x4, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0x6(%rcx,%r13,2)
pshufhw $0x84, %xmm1, %xmm1     # xmm1 = xmm1[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm11, %xmm5    # xmm5 = xmm11[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm5
pshufhw $0x84, %xmm12, %xmm1    # xmm1 = xmm12[0,1,2,3,4,5,4,6]
por %xmm5, %xmm1
pxor %xmm15, %xmm1
packssdw %xmm1, %xmm1
pextrw $0x3, %xmm1, %eax
testb $0x1, %al
je 0x310901
pextrw $0x6, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0x8(%rcx,%r13,2)
movdqa %xmm4, %xmm11
por 0x3185c1(%rip), %xmm11  # 0x628ed0
movd %r13d, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
por 0x3191df(%rip), %xmm1   # 0x629b00
pshufd $0xf5, %xmm1, %xmm5     # xmm5 = xmm1[1,1,3,3]
pmuludq %xmm9, %xmm1
pshufd $0xe8, %xmm1, %xmm1     # xmm1 = xmm1[0,2,2,3]
pshufd $0xf5, %xmm9, %xmm8     # xmm8 = xmm9[1,1,3,3]
pmuludq %xmm5, %xmm8
pshufd $0xe8, %xmm8, %xmm5     # xmm5 = xmm8[0,2,2,3]
punpckldq %xmm5, %xmm1    # xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1]
movdqa 0x30(%rsp), %xmm5
psubd %xmm1, %xmm5
movdqa %xmm5, %xmm10
pcmpgtd %xmm0, %xmm10
pand %xmm10, %xmm5
pandn %xmm0, %xmm10
por %xmm5, %xmm10
pxor %xmm14, %xmm11
movdqa %xmm11, %xmm5
pcmpgtd %xmm6, %xmm5
pshufd $0xa0, %xmm5, %xmm12    # xmm12 = xmm5[0,0,2,2]
pshuflw $0xe8, %xmm12, %xmm8    # xmm8 = xmm12[0,2,2,3,4,5,6,7]
pcmpeqd %xmm6, %xmm11
pshufd $0xf5, %xmm11, %xmm1    # xmm1 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm1, %xmm13    # xmm13 = xmm1[0,2,2,3,4,5,6,7]
pand %xmm8, %xmm13
pshufd $0xf5, %xmm5, %xmm11    # xmm11 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm11, %xmm5    # xmm5 = xmm11[0,2,2,3,4,5,6,7]
por %xmm13, %xmm5
pxor %xmm15, %xmm5
packssdw %xmm5, %xmm5
pextrw $0x4, %xmm5, %eax
testb $0x1, %al
je 0x3109cc
testl %edx, %edx
movd %xmm10, %eax
cmovnel %r10d, %eax
movw %ax, 0xa(%rcx,%r13,2)
pand %xmm12, %xmm1
por %xmm11, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm15, %xmm1
packssdw %xmm1, %xmm1
pextrw $0x5, %xmm1, %eax
testb $0x1, %al
je 0x3109fe
pextrw $0x2, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0xc(%rcx,%r13,2)
por 0x3184ba(%rip), %xmm4   # 0x628ec0
pxor %xmm14, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm6, %xmm5
pshufd $0xa0, %xmm5, %xmm1     # xmm1 = xmm5[0,0,2,2]
pcmpeqd %xmm6, %xmm4
pshufd $0xf5, %xmm4, %xmm4     # xmm4 = xmm4[1,1,3,3]
movdqa %xmm4, %xmm8
pand %xmm1, %xmm8
pshufd $0xf5, %xmm5, %xmm11    # xmm11 = xmm5[1,1,3,3]
por %xmm11, %xmm8
packssdw %xmm8, %xmm5
pxor %xmm15, %xmm5
packssdw %xmm5, %xmm5
pextrw $0x6, %xmm5, %eax
testb $0x1, %al
je 0x310a5f
pextrw $0x4, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0xe(%rcx,%r13,2)
pshufhw $0x84, %xmm1, %xmm1     # xmm1 = xmm1[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm4, %xmm4     # xmm4 = xmm4[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm4
pshufhw $0x84, %xmm11, %xmm1    # xmm1 = xmm11[0,1,2,3,4,5,4,6]
por %xmm4, %xmm1
pxor %xmm15, %xmm1
packssdw %xmm1, %xmm1
pextrw $0x7, %xmm1, %eax
testb $0x1, %al
je 0x310a9b
pextrw $0x6, %xmm10, %eax
testl %edx, %edx
cmovnel %r10d, %eax
movw %ax, 0x10(%rcx,%r13,2)
addq $0x8, %r13
subl %r8d, %edi
subl %r8d, %r11d
addl %r8d, %ebp
cmpq %r13, %rsi
jne 0x310759
leal -0x1(%r15), %r10d
movl 0x60(%rsp), %r8d
movq %r15, %rdx
movq 0x78(%rsp), %rax
imulq %rax, %rdx
leaq (,%rdx,4), %rsi
leaq (,%rax,4), %rdi
leaq (,%rdx,8), %rcx
leaq (%rsi,%rsi,2), %rax
movq %rax, 0xe8(%rsp)
leaq (%rdx,%rdx,8), %rax
leaq (%rax,%rax,2), %r14
addq %rdx, %r14
shlq $0x4, %rdx
movq %rsi, 0xf0(%rsp)
leaq (%rsi,%rsi,4), %r9
leaq (%rcx,%rcx,2), %rax
movq %rax, 0x58(%rsp)
movq %r15, %rax
shlq $0x4, %rax
movq %rax, 0x98(%rsp)
xorl %esi, %esi
shlq $0x4, %r10
movq %r10, 0xf8(%rsp)
movdqa 0xa0(%rsp), %xmm11
pcmpeqw 0x319002(%rip), %xmm11  # 0x629b40
movq %r8, 0xc8(%rsp)
shlq $0x4, %r8
movq %r8, 0xe0(%rsp)
xorl %r11d, %r11d
movdqa 0x120(%rsp), %xmm9
movdqa %xmm9, %xmm1
movdqa %xmm9, %xmm5
movdqa 0x110(%rsp), %xmm10
movdqa %xmm10, %xmm6
movl 0xc(%rsp), %r13d
movq 0x20(%rsp), %r10
movq %rcx, 0xb0(%rsp)
movq %r9, 0x30(%rsp)
movq %rdi, 0x60(%rsp)
movl %r13d, 0x74(%rsp)
movq %rbx, 0x20(%rsp)
movq %r10, %r9
movdqa %xmm1, %xmm0
movq 0xf8(%rsp), %rax
movdqa (%r10,%rax), %xmm8
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %r8
movzbl (%r8,%r11), %r8d
movslq (%rax,%r8,4), %rax
movl %r15d, %r8d
imulq %rax, %r8
shlq $0x4, %r8
pslldq $0x2, %xmm8             # xmm8 = zero,zero,xmm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x48(%rsp), %rax
movq %r11, 0x90(%rsp)
pinsrw $0x0, (%rax,%r11,2), %xmm8
addq 0x100(%rsp), %r8
movq %rsi, 0xa0(%rsp)
movq %rsi, %r15
xorl %eax, %eax
movdqa %xmm9, %xmm1
movq 0x68(%rsp), %r13
movq 0xf0(%rsp), %r10
movq 0xe8(%rsp), %rsi
movq 0x58(%rsp), %rbp
movq 0x98(%rsp), %rcx
paddsw (%r8,%rax), %xmm8
movdqa (%r13,%rax), %xmm7
movdqa %xmm7, %xmm4
pmaxsw %xmm1, %xmm4
pmaxsw %xmm8, %xmm4
movq 0x20(%rsp), %rdi
movdqa %xmm4, (%rdi,%rax)
movq 0x10(%r12), %rbx
movq (%rbx), %rbx
movq %r12, %r11
movd %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rbx,%r15)
addq %r15, %rbx
pextrw $0x1, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%r10,%rbx)
pextrw $0x2, %xmm4, %r12d
movswl %r12w, %r12d
movq 0xb0(%rsp), %rdi
movl %r12d, (%rdi,%rbx)
pextrw $0x3, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rsi,%rbx)
pextrw $0x4, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rdx,%rbx)
pextrw $0x5, %xmm4, %r12d
movswl %r12w, %r12d
movq 0x30(%rsp), %rdi
movl %r12d, (%rdi,%rbx)
pextrw $0x6, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rbp,%rbx)
pextrw $0x7, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%r14,%rbx)
movq %r11, %r12
pmaxsw %xmm4, %xmm5
pminsw %xmm7, %xmm6
pminsw %xmm1, %xmm6
pminsw %xmm4, %xmm6
psubsw %xmm2, %xmm4
psubsw %xmm3, %xmm7
pmaxsw %xmm4, %xmm7
movdqa %xmm7, (%r13,%rax)
psubsw %xmm3, %xmm1
pmaxsw %xmm4, %xmm1
movdqa (%r9,%rax), %xmm8
addq $0x10, %rax
addq 0x60(%rsp), %r15
cmpq %rax, %rcx
jne 0x310c31
movq %r9, 0x108(%rsp)
xorl %r8d, %r8d
movq 0x60(%rsp), %rdi
movq 0x20(%rsp), %rbp
movq 0xb0(%rsp), %rcx
movq 0x30(%rsp), %r9
movl 0x1c(%rsp), %eax
cmpl $0x0, 0x198(%rsp)
jne 0x310d6c
movq 0x48(%rsp), %rax
movq 0x90(%rsp), %rbx
movswl 0x2(%rax,%rbx,2), %eax
subl 0x10(%rsp), %eax
cmpl $0xffff8001, %eax       # imm = 0xFFFF8001
movl $0xffff8000, %ebx       # imm = 0xFFFF8000
cmovll %ebx, %eax
pslldq $0x2, %xmm1             # xmm1 = zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm1
movq 0xa0(%rsp), %rax
xorl %r15d, %r15d
movdqa (%rbp,%r15), %xmm4
pmaxsw %xmm1, %xmm4
movdqa %xmm4, (%rbp,%r15)
pminsw %xmm4, %xmm6
pmaxsw %xmm4, %xmm5
movq 0x10(%r12), %rbx
movq (%rbx), %rbx
movd %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rbx,%rax)
addq %rax, %rbx
pextrw $0x1, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%r10,%rbx)
pextrw $0x2, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rcx,%rbx)
pextrw $0x3, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rsi,%rbx)
pextrw $0x4, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%rdx,%rbx)
pextrw $0x5, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%r9,%rbx)
pextrw $0x6, %xmm4, %r12d
movswl %r12w, %r12d
movq 0x58(%rsp), %r13
movl %r12d, (%r13,%rbx)
pextrw $0x7, %xmm4, %r12d
movswl %r12w, %r12d
movl %r12d, (%r14,%rbx)
movq %r11, %r12
psubsw %xmm2, %xmm4
psubsw %xmm3, %xmm1
movdqa %xmm1, %xmm7
pcmpgtw %xmm4, %xmm7
pmovmskb %xmm7, %ebx
testl %ebx, %ebx
movq 0x98(%rsp), %rbx
je 0x310e68
addq $0x10, %r15
addq %rdi, %rax
cmpq %r15, %rbx
jne 0x310d8e
incl %r8d
cmpl $0x8, %r8d
jne 0x310d48
movq 0xe0(%rsp), %rax
movdqa (%rbp,%rax), %xmm1
movdqa %xmm1, %xmm4
pcmpgtw %xmm0, %xmm4
pand %xmm11, %xmm4
pmaxsw %xmm0, %xmm1
pmovmskb %xmm4, %eax
testl %eax, %eax
movl 0x74(%rsp), %r13d
movq 0x90(%rsp), %r11
cmovnel %r11d, %r13d
incq %r11
movq 0xa0(%rsp), %rsi
addq $0x4, %rsi
movq %rbp, %r10
cmpq 0x78(%rsp), %r11
movq 0x108(%rsp), %rbx
movq 0x50(%rsp), %r15
jne 0x310b94
movl 0x1a0(%rsp), %r11d
testl %r11d, %r11d
movl 0x70(%rsp), %r8d
movq 0xd8(%rsp), %r9
movl 0x18(%rsp), %r10d
movq 0x68(%rsp), %r14
movl 0x190(%rsp), %ecx
je 0x310f11
cmpl $0x6, 0x14(%rsp)
jg 0x310f0b
xorl %eax, %eax
movl 0x2c(%rsp), %edx
pslldq $0x2, %xmm1             # xmm1 = zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
incl %eax
cmpl %edx, %eax
jl 0x310f00
pextrw $0x7, %xmm1, %r10d
testl %ecx, %ecx
je 0x310f79
cmpl $0x0, 0xd0(%rsp)
je 0x310f79
movl %r15d, %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
shll $0x3, %ecx
xorl %edx, %edx
movl %r8d, %eax
movl %edx, %edi
shrl $0x3, %edi
movl %edx, %esi
andl $0x7, %esi
imull %r15d, %esi
addl %edi, %esi
cmpl %r9d, %esi
jge 0x310f70
movzwl (%rbp,%rdx,2), %edi
cmpw %r10w, %di
jle 0x310f5c
movl %edi, %r10d
movl 0xc(%rsp), %r13d
movl %esi, %eax
jmp 0x310f70
cmpl %eax, %esi
cmovgel %eax, %esi
cmpl 0xc(%rsp), %r13d
cmovnel %eax, %esi
cmpw %r10w, %di
cmovel %esi, %eax
incq %rdx
cmpl %edx, %ecx
jne 0x310f30
jmp 0x310f7c
movl %r8d, %eax
orl 0x190(%rsp), %r11d
jne 0x310fbe
movq 0xc8(%rsp), %rax
shlq $0x4, %rax
movdqa (%rbp,%rax), %xmm0
cmpl $0x6, 0x14(%rsp)
jg 0x310fb0
xorl %eax, %eax
movl 0x2c(%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 0x310fa5
pextrw $0x7, %xmm0, %r10d
movl 0xc(%rsp), %r13d
movl %r8d, %eax
pcmpgtw %xmm6, %xmm9
pcmpgtw %xmm10, %xmm5
por %xmm9, %xmm5
pmovmskb %xmm5, %ecx
testl %ecx, %ecx
je 0x310fe3
orb $0x40, 0xc(%r12)
xorl %r10d, %r10d
xorl %r13d, %r13d
xorl %eax, %eax
movswl %r10w, %ecx
movl %ecx, (%r12)
movl %eax, 0x4(%r12)
movl %r13d, 0x8(%r12)
movq 0x48(%rsp), %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %rbx, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
jmp 0x31056a
callq 0x1ae7cf
jmp 0x310567
callq 0x1ae7a9
jmp 0x310567
callq 0x1ae783
jmp 0x310567
callq 0x1ae75d
jmp 0x310567
callq 0x1ae737
jmp 0x310567
callq 0x1ae711
jmp 0x310567
callq 0x1ae6eb
jmp 0x310567
callq 0x1ae6c5
jmp 0x310567