// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sw_striped_sse2_128_16.c
// Function: parasail_sw_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)
{
    /* declare local variables */
    int32_t i = 0;
    int32_t j = 0;
    int32_t k = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    int32_t s1Len = 0;
    const parasail_matrix_t *matrix = NULL;
    int32_t segWidth = 0;
    int32_t segLen = 0;
#ifdef PARASAIL_ROWCOL
    int32_t offset = 0;
    int32_t position = 0;
#endif
    __m128i* restrict vProfile = NULL;
    __m128i* restrict pvHStore = NULL;
    __m128i* restrict pvHLoad = NULL;
    __m128i* restrict pvHMax = NULL;
    __m128i* restrict pvE = NULL;
    __m128i vGapO;
    __m128i vGapE;
    __m128i vZero;
    int16_t bias = 0;
    int16_t score = 0;
    __m128i vBias;
    __m128i vMaxH;
    __m128i vMaxHUnit;
    int16_t maxp = 0;
    __m128i insert_mask;
    /*int16_t stop = 0;*/
    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;
    end_query = 0;
    end_ref = 0;
    s1Len = profile->s1Len;
    matrix = profile->matrix;
    segWidth = 8; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
#ifdef PARASAIL_ROWCOL
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
#endif
    vProfile = (__m128i*)profile->profile16.score;
    vGapO = _mm_set1_epi16(open);
    vGapE = _mm_set1_epi16(gap);
    vZero = _mm_set1_epi16(0);
    bias = INT16_MIN;
    score = bias;
    vBias = _mm_set1_epi16(bias);
    vMaxH = vBias;
    vMaxHUnit = vBias;
    maxp = INT16_MAX - (int16_t)(matrix->max+1);
    insert_mask = _mm_cmpgt_epi16(
            _mm_set_epi16(0,0,0,0,0,0,0,1),
            vZero);
    /*stop = profile->stop == INT32_MAX ?  INT16_MAX : (int16_t)profile->stop-bias;*/

    /* 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_SW | PARASAIL_FLAG_STRIPED
        | 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 */
    pvHStore = parasail_memalign___m128i(16, segLen);
    pvHLoad = parasail_memalign___m128i(16, segLen);
    pvHMax = parasail_memalign___m128i(16, segLen);
    pvE = parasail_memalign___m128i(16, segLen);

    /* validate heap variables */
    if (!pvHStore) return NULL;
    if (!pvHLoad) return NULL;
    if (!pvHMax) return NULL;
    if (!pvE) return NULL;

    /* initialize H and E */
    parasail_memset___m128i(pvHStore, vBias, segLen);
    parasail_memset___m128i(pvE, vBias, segLen);

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        __m128i vF;
        __m128i vH;
        const __m128i* vP = NULL;
        __m128i* pv = NULL;

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

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

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

        if (end_ref == j-2) {
            /* Swap in the max buffer. */
            pv = pvHMax;
            pvHMax = pvHLoad;
            pvHLoad = pvHStore;
            pvHStore = pv;
        }
        else {
            /* Swap the 2 H buffers. */
            pv = pvHLoad;
            pvHLoad = pvHStore;
            pvHStore = pv;
        }

        /* 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);
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len, bias);
#endif
            vMaxH = _mm_max_epi16(vH, vMaxH);

            /* 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) {
            vF = _mm_slli_si128(vF, 2);
            vF = _mm_blendv_epi8_rpl(vF, vBias, insert_mask);
            for (i=0; i<segLen; ++i) {
                vH = _mm_load_si128(pvHStore + i);
                vH = _mm_max_epi16(vH,vF);
                _mm_store_si128(pvHStore + i, vH);
#ifdef PARASAIL_TABLE
                arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len, bias);
#endif
                vMaxH = _mm_max_epi16(vH, vMaxH);
                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:
        {
        }

#ifdef PARASAIL_ROWCOL
        /* extract last value from the column */
        {
            vH = _mm_load_si128(pvHStore + offset);
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 2);
            }
            result->rowcols->score_row[j] = (int16_t) _mm_extract_epi16 (vH, 7) - bias;
        }
#endif

        {
            __m128i vCompare = _mm_cmpgt_epi16(vMaxH, vMaxHUnit);
            if (_mm_movemask_epi8(vCompare)) {
                score = _mm_hmax_epi16_rpl(vMaxH);
                /* if score has potential to overflow, abort early */
                if (score > maxp) {
                    result->flag |= PARASAIL_FLAG_SATURATED;
                    break;
                }
                vMaxHUnit = _mm_set1_epi16(score);
                end_ref = j;
            }
        }

        /*if (score == stop) break;*/
    }

#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, bias);
    }
#endif

    if (score == INT16_MAX) {
        result->flag |= PARASAIL_FLAG_SATURATED;
    }

    if (parasail_result_is_saturated(result)) {
        score = INT16_MAX;
        end_query = 0;
        end_ref = 0;
    }
    else {
        if (end_ref == j-1) {
            /* end_ref was the last store column */
            __m128i *pv = pvHMax;
            pvHMax = pvHStore;
            pvHStore = pv;
        }
        else if (end_ref == j-2) {
            /* end_ref was the last load column */
            __m128i *pv = pvHMax;
            pvHMax = pvHLoad;
            pvHLoad = pv;
        }
        /* Trace the alignment ending position on read. */
        {
            int16_t *t = (int16_t*)pvHMax;
            int32_t column_len = segLen * segWidth;
            end_query = s1Len - 1;
            for (i = 0; i<column_len; ++i, ++t) {
                if (*t == score) {
                    int32_t temp = i / segWidth + i % segWidth * segLen;
                    if (temp < end_query) {
                        end_query = temp;
                    }
                }
            }
        }
    }

    result->score = score - bias;
    result->end_query = end_query;
    result->end_ref = end_ref;

    parasail_free(pvE);
    parasail_free(pvHMax);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, 0x68(%rsp)
testq %rdi, %rdi
je 0x3119b8
movq 0x30(%rdi), %rax
movq %rax, 0xc8(%rsp)
testq %rax, %rax
je 0x311a11
movq 0x10(%rdi), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x311b6e
movl 0x8(%rdi), %r12d
testl %r12d, %r12d
jle 0x311b78
cmpq $0x0, 0x68(%rsp)
je 0x311b82
testl %edx, %edx
jle 0x311b8c
movl %ecx, %r13d
testl %ecx, %ecx
js 0x311b96
movl %r8d, %ebx
testl %r8d, %r8d
js 0x311ba0
leaq 0x7(%r12), %rbp
movq 0x60(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0x10(%rsp)
movl %ebp, %r15d
andl $0x7ffffff8, %r15d      # imm = 0x7FFFFFF8
movl %r15d, %edi
movq %rdx, 0x38(%rsp)
movl %edx, %esi
callq 0x20abc2
testq %rax, %rax
je 0x3114e8
movq %rax, %r14
movl %ebx, 0x30(%rsp)
movq %r12, 0x98(%rsp)
movq %r15, 0xa0(%rsp)
shrq $0x3, %rbp
orl $0x8220804, 0xc(%rax)   # imm = 0x8220804
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %r12
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %rbx
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %r15
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %r12, %xmm0
movq %rbx, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %r15, %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 0x311500
xorl %r12d, %r12d
movq %r12, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movd %r13d, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0xe0(%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, 0xd0(%rsp)
movaps 0x318b2e(%rip), %xmm0   # 0x62a070
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %r14
movq %r12, %r15
movq %rbx, %r12
callq 0x2f6015
movq %r14, 0x50(%rsp)
movq %r14, %rdi
movaps 0x318b0b(%rip), %xmm0   # 0x62a070
movq %rbp, %rsi
callq 0x2f6015
movdqa 0x318afa(%rip), %xmm9   # 0x62a070
movdqa 0xd0(%rsp), %xmm8
movdqa 0xe0(%rsp), %xmm7
xorl %esi, %esi
leal -0x1(%rbp), %r8d
movl 0x38(%rsp), %ecx
movl $0x7ffe, %eax           # imm = 0x7FFE
subl 0x10(%rsp), %eax
cwtl
movl %eax, 0x44(%rsp)
movq %rbp, %r11
imulq %rcx, %r11
leaq (,%r11,4), %rdi
movq %rcx, 0xa8(%rsp)
leaq (,%rcx,4), %rax
movq %rax, 0x80(%rsp)
leaq (,%r11,8), %r9
leaq (%rdi,%rdi,2), %rdx
leaq (%r11,%r11,8), %rax
leaq (%rax,%rax,2), %rax
addq %r11, %rax
shlq $0x4, %r11
movq %rdi, 0xb0(%rsp)
leaq (%rdi,%rdi,4), %rcx
movq %rcx, 0xb8(%rsp)
leaq (%r9,%r9,2), %rcx
movq %rbp, %r10
shlq $0x4, %r10
movw $0x8000, %di            # imm = 0x8000
movl %edi, 0xc(%rsp)
shlq $0x4, %r8
movq %r8, 0xc0(%rsp)
movq %r15, %r8
movd 0x318a6f(%rip), %xmm0   # 0x62a090
movl $0x8000, %r14d          # imm = 0x8000
xorl %r13d, %r13d
movdqa %xmm9, %xmm2
movdqa %xmm9, %xmm1
xorl %edi, %edi
movq %rbp, 0x48(%rsp)
movq %rdx, 0x90(%rsp)
movq %r9, 0x88(%rsp)
movq %r12, %r9
movq %r8, %r12
movq %rdi, %r8
movq 0x60(%rsp), %rdi
movq 0x10(%rdi), %rbx
movq 0x68(%rsp), %rdi
movzbl (%rdi,%r8), %r15d
movslq (%rbx,%r15,4), %rbx
movl %ebp, %edi
imulq %rbx, %rdi
shlq $0x4, %rdi
addq 0xc8(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq %r8, 0x70(%rsp)
leal -0x2(%r8), %ebx
movq %rsi, 0x58(%rsp)
cmpl %ebx, %esi
movq %r9, %rdx
movq 0x18(%rsp), %rsi
cmoveq %rsi, %rdx
movq %rdx, 0x30(%rsp)
cmoveq %r9, %rsi
movq %rsi, 0x18(%rsp)
movq 0xc0(%rsp), %rsi
movq %r12, 0x10(%rsp)
movdqa (%r12,%rsi), %xmm6
pslldq $0x2, %xmm6             # xmm6 = zero,zero,xmm6[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
por %xmm0, %xmm6
movq %r13, 0x78(%rsp)
movq %r13, %rbx
xorl %r13d, %r13d
movdqa %xmm9, %xmm3
movq 0x20(%rsp), %r8
movq %r10, %rbp
movq %rcx, %r10
movq %r11, %rcx
movq %rax, %r11
movq 0x80(%rsp), %rax
movq 0xb0(%rsp), %rdx
movq 0x50(%rsp), %r9
movq 0xb8(%rsp), %r12
movq 0x28(%rsp), %rsi
paddsw (%rsi,%r13), %xmm6
movdqa (%r9,%r13), %xmm5
movdqa %xmm5, %xmm4
pmaxsw %xmm3, %xmm4
pmaxsw %xmm6, %xmm4
movq 0x30(%rsp), %rsi
movdqa %xmm4, (%rsi,%r13)
movq 0x10(%r8), %r15
movq (%r15), %r15
movd %xmm4, %edi
movswl %di, %edi
addl %r14d, %edi
movl %edi, (%r15,%rbx)
addq %rbx, %r15
pextrw $0x1, %xmm4, %edi
movswl %di, %edi
addl %r14d, %edi
pextrw $0x2, %xmm4, %esi
movl %edi, (%rdx,%r15)
movswl %si, %esi
addl %r14d, %esi
movq 0x88(%rsp), %rdi
movl %esi, (%rdi,%r15)
pextrw $0x3, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movq 0x90(%rsp), %rdi
movl %esi, (%rdi,%r15)
pextrw $0x4, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%rcx,%r15)
pextrw $0x5, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
pextrw $0x6, %xmm4, %edi
movl %esi, (%r12,%r15)
movswl %di, %esi
addl %r14d, %esi
movl %esi, (%r10,%r15)
pextrw $0x7, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%r11,%r15)
pmaxsw %xmm4, %xmm1
psubsw %xmm7, %xmm4
psubsw %xmm8, %xmm5
pmaxsw %xmm4, %xmm5
movdqa %xmm5, (%r9,%r13)
psubsw %xmm8, %xmm3
pmaxsw %xmm4, %xmm3
movq 0x10(%rsp), %rsi
movdqa (%rsi,%r13), %xmm6
addq $0x10, %r13
addq %rax, %rbx
cmpq %r13, %rbp
jne 0x311706
movl $0x0, 0x28(%rsp)
movq 0x30(%rsp), %r8
movq %rdx, %rsi
movq 0x88(%rsp), %r9
movq 0x90(%rsp), %rdx
movq %r11, %rax
movq %rcx, %r11
movq %r10, %rcx
movq %rbp, %r10
movq %rsi, %rbp
pslldq $0x2, %xmm3             # xmm3 = zero,zero,xmm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
por %xmm0, %xmm3
movq 0x78(%rsp), %rbx
xorl %r13d, %r13d
movdqa (%r8,%r13), %xmm4
pmaxsw %xmm3, %xmm4
movdqa %xmm4, (%r8,%r13)
movq 0x20(%rsp), %rsi
movq 0x10(%rsi), %rsi
movq (%rsi), %r15
movd %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%r15,%rbx)
addq %rbx, %r15
pextrw $0x1, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
pextrw $0x2, %xmm4, %edi
movl %esi, (%rbp,%r15)
movswl %di, %esi
addl %r14d, %esi
movl %esi, (%r9,%r15)
pextrw $0x3, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%rdx,%r15)
pextrw $0x4, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%r11,%r15)
pextrw $0x5, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
pextrw $0x6, %xmm4, %edi
movl %esi, (%r12,%r15)
movswl %di, %esi
addl %r14d, %esi
movl %esi, (%rcx,%r15)
pextrw $0x7, %xmm4, %esi
movswl %si, %esi
addl %r14d, %esi
movl %esi, (%rax,%r15)
pmaxsw %xmm4, %xmm1
psubsw %xmm7, %xmm4
psubsw %xmm8, %xmm3
movdqa %xmm3, %xmm5
pcmpgtw %xmm4, %xmm5
pmovmskb %xmm5, %esi
testl %esi, %esi
je 0x311916
addq $0x10, %r13
addq 0x80(%rsp), %rbx
cmpq %r13, %r10
jne 0x31183a
movl 0x28(%rsp), %esi
incl %esi
movl %esi, 0x28(%rsp)
cmpl $0x8, %esi
jne 0x311829
movdqa %xmm1, %xmm3
pcmpgtw %xmm2, %xmm3
pmovmskb %xmm3, %esi
testl %esi, %esi
je 0x31197b
movdqa %xmm1, %xmm2
psrldq $0x8, %xmm2             # xmm2 = xmm2[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
pmaxsw %xmm1, %xmm2
movdqa %xmm2, %xmm3
psrldq $0x4, %xmm3             # xmm3 = xmm3[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
pmaxsw %xmm2, %xmm3
movdqa %xmm3, %xmm2
psrldq $0x2, %xmm2             # xmm2 = xmm2[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pmaxsw %xmm3, %xmm2
movd %xmm2, %esi
movl %esi, 0xc(%rsp)
movswl %si, %esi
cmpl %esi, 0x44(%rsp)
movq 0x48(%rsp), %rbp
movq 0x10(%rsp), %rbx
movq 0x70(%rsp), %rdi
jl 0x3119c2
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movl %edi, %esi
jmp 0x31198f
movq 0x58(%rsp), %rsi
movq 0x48(%rsp), %rbp
movq 0x10(%rsp), %rbx
movq 0x70(%rsp), %rdi
incq %rdi
movq 0x78(%rsp), %r13
addq $0x4, %r13
movq %rbx, %r12
cmpq 0xa8(%rsp), %rdi
jne 0x31164b
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r14
jmp 0x3119de
callq 0x1aea09
jmp 0x3114e8
movq 0x20(%rsp), %r12
orb $0x40, 0xc(%r12)
movl %edi, %eax
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %r14
movq 0x58(%rsp), %rsi
movq %r8, %r13
movq %rsi, %r15
movzwl 0xc(%rsp), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x3119f6
orb $0x40, 0xc(%r12)
movq %r12, %rdi
callq 0x20be2e
testl %eax, %eax
je 0x311a1b
xorl %r15d, %r15d
movl $0xffff, %eax           # imm = 0xFFFF
xorl %esi, %esi
jmp 0x311bd6
callq 0x1ae9e3
jmp 0x3114e8
movq 0x38(%rsp), %rcx
leal -0x1(%rcx), %eax
addl $-0x2, %ecx
movq %r15, %rdx
cmpl %ecx, %edx
movq %rbx, %rsi
cmoveq %r14, %rsi
movq %r14, %rcx
cmoveq %rbx, %rcx
cmpl %eax, %edx
cmovneq %r13, %r14
movq %r14, %rax
cmoveq %rbx, %rsi
movq %rsi, %rbx
movq %rcx, %r14
cmoveq %r13, %r14
movq 0x98(%rsp), %rsi
decl %esi
movq 0xa0(%rsp), %rdx
testl %edx, %edx
je 0x311baa
movl 0xc(%rsp), %edi
movq %rax, %r13
je 0x311bb3
movd %esi, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movd %edi, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
movd %ebp, %xmm2
pshufd $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movdqa 0x318036(%rip), %xmm3   # 0x629ad0
xorl %eax, %eax
movdqa 0x3180fc(%rip), %xmm4   # 0x629ba0
pshufd $0xf5, %xmm2, %xmm5     # xmm5 = xmm2[1,1,3,3]
movdqa 0x31803f(%rip), %xmm6   # 0x629af0
movq (%r14,%rax,2), %xmm7
pcmpeqw %xmm1, %xmm7
punpcklwd %xmm7, %xmm7    # xmm7 = xmm7[0,0,1,1,2,2,3,3]
movdqa %xmm3, %xmm8
psrld $0x3, %xmm8
movdqa %xmm3, %xmm9
pand %xmm4, %xmm9
pshufd $0xf5, %xmm9, %xmm10    # xmm10 = xmm9[1,1,3,3]
pmuludq %xmm2, %xmm9
pshufd $0xe8, %xmm9, %xmm9     # xmm9 = xmm9[0,2,2,3]
pmuludq %xmm5, %xmm10
pshufd $0xe8, %xmm10, %xmm10   # xmm10 = xmm10[0,2,2,3]
punpckldq %xmm10, %xmm9   # xmm9 = xmm9[0],xmm10[0],xmm9[1],xmm10[1]
paddd %xmm8, %xmm9
movdqa %xmm0, %xmm8
pcmpgtd %xmm9, %xmm8
pand %xmm8, %xmm9
pandn %xmm0, %xmm8
por %xmm9, %xmm8
pand %xmm7, %xmm8
pandn %xmm0, %xmm7
movdqa %xmm7, %xmm0
por %xmm8, %xmm0
addq $0x4, %rax
paddd %xmm6, %xmm3
cmpq %rax, %rdx
jne 0x311ab1
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
pshufd $0x55, %xmm2, %xmm0     # xmm0 = xmm2[1,1,1,1]
movdqa %xmm0, %xmm1
pcmpgtd %xmm2, %xmm1
pand %xmm1, %xmm2
pandn %xmm0, %xmm1
por %xmm2, %xmm1
movd %xmm1, %esi
jmp 0x311bce
callq 0x1ae9bd
jmp 0x3114e8
callq 0x1ae997
jmp 0x3114e8
callq 0x1ae971
jmp 0x3114e8
callq 0x1ae94b
jmp 0x3114e8
callq 0x1ae925
jmp 0x3114e8
callq 0x1ae8ff
jmp 0x3114e8
movl 0xc(%rsp), %edi
movq %rax, %r13
jmp 0x311bce
xorl %eax, %eax
movl %eax, %ecx
shrl $0x3, %ecx
cmpl %esi, %ecx
cmovgel %esi, %ecx
cmpw %di, (%r14,%rax,2)
cmovel %ecx, %esi
incq %rax
cmpl %eax, %edx
jne 0x311bb5
movswl %di, %eax
addl $0x8000, %eax           # imm = 0x8000
movl %eax, (%r12)
movl %esi, 0x4(%r12)
movl %r15d, 0x8(%r12)
movq 0x50(%rsp), %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %rbx, %rdi
callq 0x20a60d
movq %r13, %rdi
callq 0x20a60d
jmp 0x3114eb
nop