// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_striped_sse2_128_32.c
// Function: parasail_sg_flags_table_striped_profile_sse2_128_32
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;
    int32_t* restrict boundary = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int32_t NEG_LIMIT = 0;
    int32_t POS_LIMIT = 0;
    int32_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->profile32.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 = 4; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    vProfile = (__m128i*)profile->profile32.score;
    vGapO = _mm_set1_epi32(open);
    vGapE = _mm_set1_epi32(gap);
    NEG_LIMIT = (-open < matrix->min ? INT32_MIN + open : INT32_MIN - matrix->min) + 1;
    POS_LIMIT = INT32_MAX - matrix->max - 1;
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi32(NEG_LIMIT);
    vPosLimit = _mm_set1_epi32(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi32(_mm_set1_epi32(position),
            _mm_set_epi32(0,1,2,3));

    /* 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_32 | PARASAIL_FLAG_LANES_4;
    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_int32_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_32_t h;
            __m128i_32_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT32_MIN ? INT32_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT32_MIN ? INT32_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 < INT32_MIN ? INT32_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], 4);

        /* 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_epi32_rpl(vH, boundary[j], 0);

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

            /* Get max from vH, vE and vF. */
            vH = _mm_max_epi32_rpl(vH, vE);
            vH = _mm_max_epi32_rpl(vH, vF);
            /* Save vH values. */
            _mm_store_si128(pvHStore + i, vH);
            vSaturationCheckMax = _mm_max_epi32_rpl(vSaturationCheckMax, vH);
            vSaturationCheckMin = _mm_min_epi32_rpl(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi32_rpl(vSaturationCheckMin, vE);
            vSaturationCheckMin = _mm_min_epi32_rpl(vSaturationCheckMin, vF);
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif

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

            /* Update vF value. */
            vF = _mm_sub_epi32(vF, vGapE);
            vF = _mm_max_epi32_rpl(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);
            int32_t tmp2 = tmp < INT32_MIN ? INT32_MIN : tmp;
            vF = _mm_slli_si128(vF, 4);
            vF = _mm_insert_epi32_rpl(vF, tmp2, 0);
            for (i=0; i<segLen; ++i) {
                vH = _mm_load_si128(pvHStore + i);
                vH = _mm_max_epi32_rpl(vH,vF);
                _mm_store_si128(pvHStore + i, vH);
                vSaturationCheckMin = _mm_min_epi32_rpl(vSaturationCheckMin, vH);
                vSaturationCheckMax = _mm_max_epi32_rpl(vSaturationCheckMax, vH);
#ifdef PARASAIL_TABLE
                arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif
                vH = _mm_sub_epi32(vH, vGapO);
                vF = _mm_sub_epi32(vF, vGapE);
                if (! _mm_movemask_epi8(_mm_cmpgt_epi32(vF, vH))) goto end;
                /*vF = _mm_max_epi32_rpl(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_epi32(vH, vMaxH));
            vMaxH = _mm_max_epi32_rpl(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
#ifdef PARASAIL_ROWCOL
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 4);
            }
            result->rowcols->score_row[j] = (int32_t) _mm_extract_epi32_rpl (vH, 3);
#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, 4);
        }
        score = (int32_t) _mm_extract_epi32_rpl(vMaxH, 3);
        end_query = s1Len-1;
    }

    /* max of last column */
    if (s1_end)
    {
        /* Trace the alignment ending position on read. */
        int32_t *t = (int32_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, 4);
            }
            score = (int32_t) _mm_extract_epi32_rpl (vH, 3);
            end_ref = s2Len - 1;
            end_query = s1Len - 1;
        }
    }

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi32(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi32(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 $0xc8, %rsp
movl %ecx, 0xc(%rsp)
movq %rsi, 0x68(%rsp)
testq %rdi, %rdi
je 0x30ecc7
movq 0x48(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x30ecd1
movq 0x10(%rdi), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x30ecdb
movl 0x8(%rdi), %r15d
testl %r15d, %r15d
jle 0x30ece5
cmpq $0x0, 0x68(%rsp)
je 0x30ecef
movl %edx, %r10d
testl %edx, %edx
jle 0x30ecf9
cmpl $0x0, 0xc(%rsp)
js 0x30ed03
testl %r8d, %r8d
js 0x30ed0d
movl %r9d, 0x18(%rsp)
movl %r8d, 0x50(%rsp)
leal -0x1(%r15), %r14d
leaq 0x3(%r15), %r13
movq %r13, %rbp
shrq $0x2, %rbp
movl %r14d, %eax
xorl %edx, %edx
divl %ebp
movl %eax, %r12d
movl %edx, 0x48(%rsp)
movl 0xc(%rsp), %ecx
movl %ecx, %edi
negl %edi
movq 0x60(%rsp), %rsi
movl 0x20(%rsi), %eax
movl $0x80000000, %edx       # imm = 0x80000000
orl %edx, %ecx
subl %eax, %edx
movl %edi, 0x14(%rsp)
cmpl %edi, %eax
cmovgl %ecx, %edx
movl %edx, 0x10(%rsp)
movl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
subl 0x1c(%rsi), %eax
movl %eax, 0x20(%rsp)
andl $0x7ffffffc, %r13d      # imm = 0x7FFFFFFC
movl %r13d, %edi
movl %r10d, %esi
movq %r10, 0x30(%rsp)
callq 0x20abc2
testq %rax, %rax
je 0x30e513
movq %rax, %rbx
movq %r13, 0x88(%rsp)
movl %r12d, 0x3c(%rsp)
movq %r15, 0x90(%rsp)
movl %r14d, 0x5c(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x18(%rsp)
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x100(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x108(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x110(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%rbx), %eax
orl $0x4420802, %eax        # imm = 0x4420802
movl %eax, 0xc(%rbx)
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %r12
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %r14
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2f600c
movq %rax, %r13
movq 0x30(%rsp), %rax
leal 0x1(%rax), %r15d
movl $0x10, %edi
movq %r15, %rsi
callq 0x20a62d
movq %r12, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %r13, %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 0x30e52a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %rcx
movq %rcx, %r9
decl %ecx
movl %ecx, 0x8(%rsp)
movl $0x3, %edx
subl 0x3c(%rsp), %edx
movd 0xc(%rsp), %xmm1
pshufd $0x0, %xmm1, %xmm2      # xmm2 = xmm1[0,0,0,0]
movl 0x50(%rsp), %r11d
movd %r11d, %xmm0
pshufd $0x0, %xmm0, %xmm3      # xmm3 = xmm0[0,0,0,0]
movl 0x10(%rsp), %ecx
incl %ecx
movl %ecx, 0x10(%rsp)
movd %ecx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0xb0(%rsp)
movd 0x20(%rsp), %xmm4
pshufd $0x0, %xmm4, %xmm0      # xmm0 = xmm4[0,0,0,0]
movdqa %xmm0, 0xa0(%rsp)
movl %edx, 0x38(%rsp)
movd %edx, %xmm4
pshufd $0x0, %xmm4, %xmm0      # xmm0 = xmm4[0,0,0,0]
movdqa %xmm0, 0x70(%rsp)
movd 0x14(%rsp), %xmm5
pshufd $0x0, %xmm5, %xmm0      # xmm0 = xmm5[0,0,0,0]
movdqa %xmm0, 0x20(%rsp)
pshufd $0x44, %xmm1, %xmm6     # xmm6 = xmm1[0,1,0,1]
movd %ebp, %xmm1
pshufd $0x44, %xmm1, %xmm7     # xmm7 = xmm1[0,1,0,1]
movdqa 0x31a8ba(%rip), %xmm8   # 0x628e80
pmuludq %xmm7, %xmm8
pmuludq 0x31a8bd(%rip), %xmm7   # 0x628e90
xorl %esi, %esi
pshufd $0xf5, %xmm3, %xmm9     # xmm9 = xmm3[1,1,3,3]
movdqa 0x31b3ac(%rip), %xmm10  # 0x629990
movdqa 0x31b443(%rip), %xmm11  # 0x629a30
pshufd $0xf5, %xmm11, %xmm12   # xmm12 = xmm11[1,1,3,3]
movdqa 0x31b444(%rip), %xmm13  # 0x629a40
movq %r12, %rcx
movq %r13, %rdx
movq %rbp, %r8
movl 0x108(%rsp), %r10d
movl 0x18(%rsp), %edi
pxor %xmm1, %xmm1
testl %edi, %edi
je 0x30e61f
pxor %xmm5, %xmm5
jmp 0x30e66b
movq %rsi, %xmm14
pshufd $0x44, %xmm14, %xmm14   # xmm14 = xmm14[0,1,0,1]
movdqa %xmm8, %xmm15
paddq %xmm14, %xmm15
paddq %xmm7, %xmm14
movdqa %xmm14, %xmm0
punpcklqdq %xmm15, %xmm0   # xmm0 = xmm0[0],xmm15[0]
punpckhqdq %xmm15, %xmm14  # xmm14 = xmm14[1],xmm15[1]
pmuludq %xmm9, %xmm14
pshufd $0xe8, %xmm14, %xmm14   # xmm14 = xmm14[0,2,2,3]
pmuludq %xmm3, %xmm0
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
punpckldq %xmm14, %xmm0   # xmm0 = xmm0[0],xmm14[0],xmm0[1],xmm14[1]
movdqa 0x20(%rsp), %xmm5
psubd %xmm0, %xmm5
pxor %xmm0, %xmm0
pcmpgtd %xmm5, %xmm0
movdqa %xmm5, %xmm14
punpckldq %xmm0, %xmm14   # xmm14 = xmm14[0],xmm0[0],xmm14[1],xmm0[1]
pshufd $0xee, %xmm5, %xmm15    # xmm15 = xmm5[2,3,2,3]
pcmpgtd %xmm15, %xmm1
punpckldq %xmm1, %xmm15   # xmm15 = xmm15[0],xmm1[0],xmm15[1],xmm1[1]
psubq %xmm6, %xmm15
psubq %xmm6, %xmm14
movdqa %xmm14, %xmm0
pxor %xmm10, %xmm0
pshufd $0xf5, %xmm0, %xmm1     # xmm1 = xmm0[1,1,3,3]
pcmpeqd %xmm12, %xmm1
pcmpgtd %xmm11, %xmm0
pshufd $0xa0, %xmm0, %xmm4     # xmm4 = xmm0[0,0,2,2]
pand %xmm1, %xmm4
pshufd $0xf5, %xmm0, %xmm0     # xmm0 = xmm0[1,1,3,3]
por %xmm4, %xmm0
pand %xmm0, %xmm14
pandn %xmm13, %xmm0
por %xmm14, %xmm0
movdqa %xmm15, %xmm1
pxor %xmm10, %xmm1
pshufd $0xf5, %xmm1, %xmm4     # xmm4 = xmm1[1,1,3,3]
pcmpeqd %xmm12, %xmm4
pcmpgtd %xmm11, %xmm1
pshufd $0xa0, %xmm1, %xmm14    # xmm14 = xmm1[0,0,2,2]
pand %xmm4, %xmm14
pshufd $0xf5, %xmm1, %xmm1     # xmm1 = xmm1[1,1,3,3]
por %xmm14, %xmm1
pand %xmm1, %xmm15
pandn %xmm13, %xmm1
por %xmm15, %xmm1
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
movdqa %xmm5, (%rcx)
movaps %xmm0, (%rdx)
incq %rsi
addq $0x10, %rdx
addq $0x10, %rcx
cmpq %rsi, %r8
jne 0x30e611
movl $0x0, (%rax)
movl %r9d, %ecx
andl $-0x2, %r15d
movq %rcx, 0x30(%rsp)
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm5     # xmm5 = xmm0[0,1,0,1]
movl %r11d, %r9d
negl %r9d
addl %r11d, %r11d
xorl %ecx, %ecx
movdqa 0x31a731(%rip), %xmm6   # 0x628e90
movdqa 0x31a739(%rip), %xmm7   # 0x628ea0
pcmpeqd %xmm8, %xmm8
movl 0x14(%rsp), %edx
xorl %esi, %esi
movdqa 0xb0(%rsp), %xmm11
movdqa 0xa0(%rsp), %xmm12
movdqa 0x70(%rsp), %xmm13
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
por %xmm6, %xmm0
movdqa %xmm5, %xmm1
pxor %xmm7, %xmm1
pxor %xmm7, %xmm0
movdqa %xmm0, %xmm4
pcmpgtd %xmm1, %xmm4
pcmpeqd %xmm1, %xmm0
pshufd $0xf5, %xmm0, %xmm0     # xmm0 = xmm0[1,1,3,3]
pand %xmm4, %xmm0
pshufd $0xf5, %xmm4, %xmm1     # xmm1 = xmm4[1,1,3,3]
por %xmm0, %xmm1
movd %xmm1, %edi
notl %edi
testb $0x1, %dil
je 0x30e7e0
testl %r10d, %r10d
movl $0x0, %edi
cmovel %edx, %edi
movl %edi, 0x4(%rax,%rsi,4)
pxor %xmm8, %xmm1
pextrw $0x4, %xmm1, %edi
testb $0x1, %dil
je 0x30e7fe
leal (%r9,%rdx), %edi
testl %r10d, %r10d
cmovnel %ecx, %edi
movl %edi, 0x8(%rax,%rsi,4)
addq $0x2, %rsi
subl %r11d, %edx
cmpq %rsi, %r15
jne 0x30e78d
movq %rax, 0x18(%rsp)
leal -0x1(%r8), %edx
movl 0x48(%rsp), %eax
movq %r8, %r10
movq 0x30(%rsp), %rcx
imulq %rcx, %r10
leaq (,%r10,4), %r11
leaq (,%rcx,4), %rbp
shlq $0x3, %r10
leaq (%r11,%r11,2), %rsi
movq %r8, %rcx
shlq $0x4, %rcx
xorl %r9d, %r9d
shlq $0x4, %rdx
movq %rdx, 0x50(%rsp)
pcmpeqd 0x31b219(%rip), %xmm13  # 0x629a70
movq %r8, 0x40(%rsp)
movl %r8d, %edx
movq %rdx, 0x48(%rsp)
movq %rax, 0x80(%rsp)
shlq $0x4, %rax
movq %rax, 0x70(%rsp)
xorl %r8d, %r8d
movl 0x8(%rsp), %eax
movl %eax, 0x20(%rsp)
movdqa %xmm11, %xmm7
movdqa %xmm11, %xmm5
movdqa %xmm12, %xmm6
movq %r14, %r15
movq %r12, %r14
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x68(%rsp), %rax
movzbl (%rax,%r8), %edi
movslq (%rdx,%rdi,4), %r12
imulq 0x48(%rsp), %r12
shlq $0x4, %r12
addq 0x98(%rsp), %r12
movq 0x50(%rsp), %rax
pshufd $0x90, (%r14,%rax), %xmm9 # xmm9 = mem[0,0,1,2]
movq 0x18(%rsp), %rax
movss (%rax,%r8,4), %xmm0
movss %xmm0, %xmm9            # xmm9 = xmm0[0],xmm9[1,2,3]
movq %r9, %rdx
xorl %edi, %edi
movdqa %xmm11, %xmm8
paddd (%r12,%rdi), %xmm9
movdqa (%r13,%rdi), %xmm10
movdqa %xmm9, %xmm0
pcmpgtd %xmm10, %xmm0
pand %xmm0, %xmm9
pandn %xmm10, %xmm0
por %xmm9, %xmm0
movdqa %xmm0, %xmm9
pcmpgtd %xmm8, %xmm9
pand %xmm9, %xmm0
pandn %xmm8, %xmm9
por %xmm0, %xmm9
movdqa %xmm9, (%r15,%rdi)
movdqa %xmm5, %xmm0
pcmpgtd %xmm9, %xmm5
pand %xmm5, %xmm0
pandn %xmm9, %xmm5
por %xmm0, %xmm5
movdqa %xmm6, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm9, %xmm1
pand %xmm0, %xmm1
pandn %xmm6, %xmm0
por %xmm1, %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm10, %xmm1
movdqa %xmm10, %xmm4
pand %xmm1, %xmm4
pandn %xmm0, %xmm1
por %xmm4, %xmm1
movdqa %xmm1, %xmm6
pcmpgtd %xmm8, %xmm6
movdqa %xmm8, %xmm0
pand %xmm6, %xmm0
pandn %xmm1, %xmm6
por %xmm0, %xmm6
movq 0x10(%rbx), %rax
movq (%rax), %rax
movd %xmm9, (%rax,%rdx)
addq %rdx, %rax
pshufd $0x55, %xmm9, %xmm0     # xmm0 = xmm9[1,1,1,1]
movd %xmm0, (%r11,%rax)
pshufd $0xee, %xmm9, %xmm0     # xmm0 = xmm9[2,3,2,3]
movd %xmm0, (%r10,%rax)
pshufd $0xff, %xmm9, %xmm0     # xmm0 = xmm9[3,3,3,3]
movd %xmm0, (%rsi,%rax)
psubd %xmm2, %xmm9
psubd %xmm3, %xmm10
movdqa %xmm10, %xmm0
pcmpgtd %xmm9, %xmm0
pand %xmm0, %xmm10
pandn %xmm9, %xmm0
por %xmm10, %xmm0
movdqa %xmm0, (%r13,%rdi)
psubd %xmm3, %xmm8
movdqa %xmm8, %xmm0
pcmpgtd %xmm9, %xmm8
pand %xmm8, %xmm0
pandn %xmm9, %xmm8
por %xmm0, %xmm8
movdqa (%r14,%rdi), %xmm9
addq $0x10, %rdi
addq %rbp, %rdx
cmpq %rdi, %rcx
jne 0x30e8e4
xorl %edx, %edx
movl 0x14(%rsp), %edi
cmpl $0x0, 0x108(%rsp)
jne 0x30ea3c
movq 0x18(%rsp), %rax
movl 0x4(%rax,%r8,4), %edi
subl 0xc(%rsp), %edi
pshufd $0x90, %xmm8, %xmm8     # xmm8 = xmm8[0,0,1,2]
movd %edi, %xmm0
movss %xmm0, %xmm8            # xmm8 = xmm0[0],xmm8[1,2,3]
movq %r9, %rdi
xorl %r12d, %r12d
movdqa (%r15,%r12), %xmm0
movdqa %xmm0, %xmm9
pcmpgtd %xmm8, %xmm9
pand %xmm9, %xmm0
pandn %xmm8, %xmm9
por %xmm0, %xmm9
movdqa %xmm9, (%r15,%r12)
movdqa %xmm6, %xmm0
pcmpgtd %xmm9, %xmm0
movdqa %xmm9, %xmm1
pand %xmm0, %xmm1
pandn %xmm6, %xmm0
movdqa %xmm0, %xmm6
por %xmm1, %xmm6
movdqa %xmm5, %xmm0
pcmpgtd %xmm9, %xmm5
pand %xmm5, %xmm0
pandn %xmm9, %xmm5
por %xmm0, %xmm5
movq 0x10(%rbx), %rax
movq (%rax), %rax
movd %xmm9, (%rax,%rdi)
addq %rdi, %rax
pshufd $0x55, %xmm9, %xmm0     # xmm0 = xmm9[1,1,1,1]
movd %xmm0, (%r11,%rax)
pshufd $0xee, %xmm9, %xmm0     # xmm0 = xmm9[2,3,2,3]
movd %xmm0, (%r10,%rax)
pshufd $0xff, %xmm9, %xmm0     # xmm0 = xmm9[3,3,3,3]
movd %xmm0, (%rsi,%rax)
psubd %xmm2, %xmm9
psubd %xmm3, %xmm8
movdqa %xmm8, %xmm0
pcmpgtd %xmm9, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
je 0x30eb13
addq $0x10, %r12
addq %rbp, %rdi
cmpq %r12, %rcx
jne 0x30ea51
incl %edx
cmpl $0x4, %edx
jne 0x30ea20
movq 0x70(%rsp), %rax
movdqa (%r15,%rax), %xmm0
movdqa %xmm0, %xmm1
pcmpgtd %xmm7, %xmm1
movdqa %xmm1, %xmm4
pand %xmm13, %xmm4
pand %xmm1, %xmm0
pandn %xmm7, %xmm1
movdqa %xmm1, %xmm7
por %xmm0, %xmm7
movmskps %xmm4, %eax
testl %eax, %eax
movl 0x20(%rsp), %eax
cmovnel %r8d, %eax
movl %eax, 0x20(%rsp)
incq %r8
addq $0x4, %r9
movq %r15, %r12
cmpq 0x30(%rsp), %r8
jne 0x30e88f
movl 0x110(%rsp), %r12d
testl %r12d, %r12d
movl 0x5c(%rsp), %r9d
movq 0x90(%rsp), %r10
movl 0x3c(%rsp), %r11d
movl 0x10(%rsp), %ebp
movq 0x40(%rsp), %r8
movl 0x100(%rsp), %eax
je 0x30ebb4
cmpl $0x2, %r11d
jg 0x30ebab
xorl %ecx, %ecx
movl 0x38(%rsp), %edx
pslldq $0x4, %xmm7             # xmm7 = zero,zero,zero,zero,xmm7[0,1,2,3,4,5,6,7,8,9,10,11]
incl %ecx
cmpl %edx, %ecx
jl 0x30eba0
pshufd $0xff, %xmm7, %xmm0     # xmm0 = xmm7[3,3,3,3]
movd %xmm0, %ebp
testl %eax, %eax
je 0x30ec24
cmpl $0x0, 0x88(%rsp)
je 0x30ec24
movl %r8d, %edx
andl $0x1fffffff, %edx       # imm = 0x1FFFFFFF
shll $0x2, %edx
xorl %esi, %esi
movl %r9d, %ecx
movl %esi, %eax
shrl $0x2, %eax
movl %esi, %edi
andl $0x3, %edi
imull %r8d, %edi
addl %eax, %edi
cmpl %r10d, %edi
jge 0x30ec1b
movl (%r15,%rsi,4), %r8d
cmpl %ebp, %r8d
jle 0x30ec00
movl %r8d, %ebp
movl 0x8(%rsp), %eax
movl %eax, 0x20(%rsp)
movl %edi, %ecx
jmp 0x30ec16
xorl %ebp, %r8d
movl 0x20(%rsp), %eax
xorl 0x8(%rsp), %eax
cmpl %ecx, %edi
cmovgel %ecx, %edi
orl %r8d, %eax
cmovel %edi, %ecx
movq 0x40(%rsp), %r8
incq %rsi
cmpl %esi, %edx
jne 0x30ebd3
jmp 0x30ec27
movl %r9d, %ecx
orl 0x100(%rsp), %r12d
jne 0x30ec6e
movq 0x80(%rsp), %rax
shlq $0x4, %rax
movdqa (%r15,%rax), %xmm1
cmpl $0x2, %r11d
jg 0x30ec5a
xorl %eax, %eax
movl 0x38(%rsp), %ecx
pslldq $0x4, %xmm1             # xmm1 = zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
incl %eax
cmpl %ecx, %eax
jl 0x30ec4f
pshufd $0xff, %xmm1, %xmm0     # xmm0 = xmm1[3,3,3,3]
movd %xmm0, %ebp
movl 0x8(%rsp), %eax
movl %eax, 0x20(%rsp)
movl %r9d, %ecx
pcmpgtd %xmm6, %xmm11
pcmpgtd %xmm12, %xmm5
por %xmm11, %xmm5
movmskps %xmm5, %eax
testl %eax, %eax
je 0x30ec94
orb $0x40, 0xc(%rbx)
xorl %ebp, %ebp
movl $0x0, 0x20(%rsp)
xorl %ecx, %ecx
movl %ebp, (%rbx)
movl %ecx, 0x4(%rbx)
movl 0x20(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0x18(%rsp), %rdi
callq 0x20a60d
movq %r13, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
jmp 0x30e515
callq 0x1ae121
jmp 0x30e513
callq 0x1ae0fb
jmp 0x30e513
callq 0x1ae0d5
jmp 0x30e513
callq 0x1ae0af
jmp 0x30e513
callq 0x1ae089
jmp 0x30e513
callq 0x1ae063
jmp 0x30e513
callq 0x1ae03d
jmp 0x30e513
callq 0x1ae017
jmp 0x30e513