// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_scan_sse2_128_16.c
// Function: parasail_sg_flags_rowcol_scan_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 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;
    int32_t offset = 0;
    int32_t position = 0;
    __m128i* restrict pvP = NULL;
    __m128i* restrict pvE = NULL;
    int16_t* restrict boundary = NULL;
    __m128i* restrict pvHt = NULL;
    __m128i* restrict pvH = NULL;
    __m128i* restrict pvGapper = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    __m128i vZero;
    int16_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vMaxH;
    __m128i vPosMask;
    __m128i vNegInfFront;
    __m128i vSegLenXgap;
    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;
    pvP = (__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;
    vZero = _mm_setzero_si128();
    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));
    vNegInfFront = vZero;
    vNegInfFront = _mm_insert_epi16(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_adds_epi16(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi16(-segLen*gap), 2));

    /* 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_SCAN
        | 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 */
    pvE = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_int16_t(16, s2Len+1);
    pvHt= parasail_memalign___m128i(16, segLen);
    pvH = parasail_memalign___m128i(16, segLen);
    pvGapper = parasail_memalign___m128i(16, segLen);

    /* validate heap variables */
    if (!pvE) return NULL;
    if (!boundary) return NULL;
    if (!pvHt) return NULL;
    if (!pvH) return NULL;
    if (!pvGapper) 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(&pvH[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;
        }
    }

    {
        __m128i vGapper = _mm_subs_epi16(vZero,vGapO);
        for (i=segLen-1; i>=0; --i) {
            _mm_store_si128(pvGapper+i, vGapper);
            vGapper = _mm_subs_epi16(vGapper, vGapE);
            /* long queries and/or large penalties will break the pseudo prefix scan */
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vGapper);
        }
    }

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        __m128i vHt;
        __m128i vF;
        __m128i vH;
        __m128i vHp;
        __m128i *pvW;
        __m128i vW;

        /* calculate E */
        /* calculate Ht */
        /* calculate F and H first pass */
        vHp = _mm_load_si128(pvH+(segLen-1));
        vHp = _mm_slli_si128(vHp, 2);
        vHp = _mm_insert_epi16(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm_subs_epi16(vNegLimit, pvGapper[0]);
        vF = vNegLimit;
        for (i=0; i<segLen; ++i) {
            vH = _mm_load_si128(pvH+i);
            vE = _mm_load_si128(pvE+i);
            vW = _mm_load_si128(pvW+i);
            vE = _mm_max_epi16(
                    _mm_subs_epi16(vE, vGapE),
                    _mm_subs_epi16(vH, vGapO));
            vHp = _mm_adds_epi16(vHp, vW);
            vF = _mm_max_epi16(vF, _mm_adds_epi16(vHt, pvGapper[i]));
            vHt = _mm_max_epi16(vE, vHp);
            _mm_store_si128(pvE+i, vE);
            _mm_store_si128(pvHt+i, vHt);
            vHp = vH;
        }

        /* pseudo prefix scan on F and H */
        vHt = _mm_slli_si128(vHt, 2);
        vHt = _mm_insert_epi16(vHt, boundary[j+1], 0);
        vF = _mm_max_epi16(vF, _mm_adds_epi16(vHt, pvGapper[0]));
        for (i=0; i<segWidth-2; ++i) {
            __m128i vFt = _mm_slli_si128(vF, 2);
            vFt = _mm_adds_epi16(vFt, vSegLenXgap);
            vF = _mm_max_epi16(vF, vFt);
        }

        /* calculate final H */
        vF = _mm_slli_si128(vF, 2);
        vF = _mm_adds_epi16(vF, vNegInfFront);
        vH = _mm_max_epi16(vHt, vF);
        for (i=0; i<segLen; ++i) {
            vHt = _mm_load_si128(pvHt+i);
            vF = _mm_max_epi16(
                    _mm_subs_epi16(vF, vGapE),
                    _mm_subs_epi16(vH, vGapO));
            vH = _mm_max_epi16(vHt, vF);
            _mm_store_si128(pvH+i, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vH);
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif
        } 

        /* extract vector containing last value from column */
        {
            __m128i vCompare;
            vH = _mm_load_si128(pvH + 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(pvH + 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*)pvH;
        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(pvH + 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(pvGapper);
    parasail_free(pvH);
    parasail_free(pvHt);
    parasail_free(boundary);
    parasail_free(pvE);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, 0x38(%rsp)
testq %rdi, %rdi
je 0x33d93d
movq 0x30(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x33d944
movq 0x10(%rdi), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x33d94b
movl %ecx, %r13d
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x33d952
cmpq $0x0, 0x38(%rsp)
je 0x33d959
movl %edx, %r15d
testl %edx, %edx
jle 0x33d960
testl %r13d, %r13d
js 0x33d967
testl %r8d, %r8d
js 0x33d96e
movl %r9d, %ebx
movl %r8d, 0x2c(%rsp)
leal -0x1(%rcx), %eax
movq %rcx, 0x70(%rsp)
leaq 0x7(%rcx), %r14
movq %r14, %rbp
shrq $0x3, %rbp
movl %eax, 0x4c(%rsp)
cltd
idivl %ebp
movl %eax, 0x4(%rsp)
movl %edx, %r12d
movl %r13d, %esi
negl %esi
movq 0x58(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negl %ecx
movl %esi, 0x28(%rsp)
cmpl %esi, %eax
cmovgl %r13d, %ecx
movl %ecx, 0xc(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x20(%rsp)
andl $0x7ffffff8, %r14d      # imm = 0x7FFFFFF8
movl %r14d, %edi
movl %r15d, %esi
callq 0x209630
testq %rax, %rax
je 0x33d973
movl %r13d, 0x18(%rsp)
movl %r12d, 0x48(%rsp)
movq %r14, 0x60(%rsp)
xorl %edi, %edi
testl %ebx, %ebx
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0xe0(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0xe8(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0xf0(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x8240402, %ecx        # imm = 0x8240402
movq %rax, 0x30(%rsp)
movl %ecx, 0xc(%rax)
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2ea474
movq %rax, %r14
leal 0x1(%r15), %esi
movl $0x10, %edi
movq %rsi, 0x68(%rsp)
callq 0x2094cd
movq %rax, %r12
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2ea474
movq %rax, %r13
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2ea474
movq %r15, 0x50(%rsp)
movq %rax, %r15
movl $0x10, %edi
movq %rbp, %rsi
callq 0x2ea474
testq %r14, %r14
sete %cl
movq %r12, 0x40(%rsp)
testq %r12, %r12
sete %dl
orb %cl, %dl
testq %r13, %r13
sete %cl
testq %r15, %r15
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x33d973
movq 0x50(%rsp), %rcx
decl %ecx
movl %ecx, (%rsp)
movl $0x7, %edx
subl 0x4(%rsp), %edx
movl 0x18(%rsp), %esi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm4      # xmm4 = xmm0[0,0,0,0]
movl 0x2c(%rsp), %edi
movd %edi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm5      # xmm5 = xmm0[0,0,0,0]
movl 0xc(%rsp), %ecx
addl $0xffff8001, %ecx       # imm = 0xFFFF8001
movd %ecx, %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]
movd 0x20(%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]
movl %edx, 0x8(%rsp)
movd %edx, %xmm2
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm6      # xmm6 = xmm2[0,0,0,0]
movl %ecx, 0xc(%rsp)
movzwl %cx, %ecx
movd %ecx, %xmm7
movl %ebp, %ecx
imull %edi, %ecx
negl %ecx
movd %ecx, %xmm2
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm8      # xmm8 = xmm2[0,0,0,0]
pslldq $0x2, %xmm8             # xmm8 = zero,zero,xmm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
paddsw %xmm7, %xmm8
movl %esi, %esi
movl %edi, %ecx
movslq 0x28(%rsp), %rdi
movq %rbp, 0x10(%rsp)
movl %ebp, %r8d
movq %r8, %r10
movq %rcx, 0x18(%rsp)
imulq %rcx, %r10
xorl %r11d, %r11d
movq $-0x7fff, %rdx          # imm = 0x8001
movq $-0x8000, %rcx          # imm = 0x8000
movq %r8, 0x20(%rsp)
movq %rdi, %rbp
xorl %r8d, %r8d
testl %ebx, %ebx
je 0x33d42b
xorl %r9d, %r9d
jmp 0x33d42e
movq %rbp, %r9
cmpq %rdx, %r9
movq $-0x8000, %r12          # imm = 0x8000
cmovgeq %r9, %r12
movw %r12w, 0x90(%rsp,%r8,2)
subq %rsi, %r9
cmpq %rdx, %r9
cmovlq %rcx, %r9
movw %r9w, 0x80(%rsp,%r8,2)
incq %r8
subq %r10, %rbp
cmpq $0x8, %r8
jne 0x33d422
movq %r11, %r8
shlq $0x4, %r8
movaps 0x90(%rsp), %xmm2
movaps %xmm2, (%r15,%r8)
movdqa 0x80(%rsp), %xmm2
movdqa %xmm2, (%r14,%r8)
incq %r11
subq 0x18(%rsp), %rdi
movq 0x20(%rsp), %r8
cmpq %r8, %r11
jne 0x33d41c
movq 0x40(%rsp), %rdi
movw $0x0, (%rdi)
movl $0x1, %ecx
xorl %edx, %edx
movl 0x2c(%rsp), %r8d
movl 0x28(%rsp), %r9d
movl 0xe8(%rsp), %r10d
movq 0x68(%rsp), %r11
cmpl $0xffff8001, %r9d       # imm = 0xFFFF8001
movl $0xffff8000, %esi       # imm = 0xFFFF8000
cmovgel %r9d, %esi
testl %r10d, %r10d
cmovnel %edx, %esi
movw %si, (%rdi,%rcx,2)
incq %rcx
subl %r8d, %r9d
cmpq %rcx, %r11
jne 0x33d4c1
pxor %xmm3, %xmm3
psubsw %xmm4, %xmm3
movq 0x10(%rsp), %rdi
leal -0x1(%rdi), %ecx
movq %rcx, %rsi
shlq $0x4, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movl %edi, %esi
movdqa %xmm1, %xmm2
movq 0x30(%rsp), %r8
movdqa %xmm3, (%rdx)
psubsw %xmm5, %xmm3
pminsw %xmm3, %xmm2
addq $-0x10, %rdx
decl %esi
jg 0x33d50e
movl %ecx, %r9d
shlq $0x4, %r9
addq %r15, %r9
movl 0x48(%rsp), %r10d
movq %r10, 0x18(%rsp)
shlq $0x4, %r10
addq %r15, %r10
movl $0x1, %r11d
movq 0x10(%rsp), %rbx
cmpl %r11d, %ebx
adcl $0x0, %ebx
movl 0x8(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %ebp
cmovgel %ecx, %ebp
movq 0x50(%rsp), %rcx
cmpl $0x2, %ecx
cmovgel %ecx, %r11d
shlq $0x4, %rbx
pcmpeqw 0x2b84ab(%rip), %xmm6   # 0x5f5a20
xorl %esi, %esi
movl (%rsp), %edi
movdqa %xmm0, %xmm9
movdqa %xmm0, %xmm3
movq %rsi, %r12
movdqa (%r9), %xmm12
pslldq $0x2, %xmm12            # xmm12 = zero,zero,xmm12[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x40(%rsp), %rcx
pinsrw $0x0, (%rcx,%rsi,2), %xmm12
movdqa %xmm9, %xmm10
movq 0x58(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x38(%rsp), %rdx
movzbl (%rdx,%rsi), %edx
movslq (%rcx,%rdx,4), %rcx
imulq 0x20(%rsp), %rcx
shlq $0x4, %rcx
addq 0x78(%rsp), %rcx
movdqa %xmm0, %xmm9
psubsw (%rax), %xmm9
xorl %edx, %edx
movdqa %xmm0, %xmm11
movdqa (%r15,%rdx), %xmm13
movdqa (%r14,%rdx), %xmm14
paddsw (%rcx,%rdx), %xmm12
paddsw (%rax,%rdx), %xmm9
psubsw %xmm5, %xmm14
pmaxsw %xmm9, %xmm11
movdqa %xmm12, %xmm9
movdqa %xmm13, %xmm12
psubsw %xmm4, %xmm13
pmaxsw %xmm14, %xmm13
pmaxsw %xmm13, %xmm9
movdqa %xmm13, (%r14,%rdx)
movdqa %xmm9, (%r13,%rdx)
addq $0x10, %rdx
cmpq %rdx, %rbx
jne 0x33d5d8
pslldq $0x2, %xmm9             # xmm9 = zero,zero,xmm9[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
leaq 0x1(%r12), %rsi
movq 0x40(%rsp), %rcx
pinsrw $0x0, 0x2(%rcx,%r12,2), %xmm9
movdqa (%rax), %xmm12
paddsw %xmm9, %xmm12
pmaxsw %xmm12, %xmm11
movl $0x6, %ecx
movdqa %xmm11, %xmm12
pslldq $0x2, %xmm11            # xmm11 = zero,zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
paddsw %xmm8, %xmm11
pmaxsw %xmm12, %xmm11
decl %ecx
jne 0x33d655
pslldq $0x2, %xmm11            # xmm11 = zero,zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
paddsw %xmm7, %xmm11
pmaxsw %xmm11, %xmm9
xorl %ecx, %ecx
psubsw %xmm5, %xmm11
psubsw %xmm4, %xmm9
pmaxsw %xmm9, %xmm11
movdqa (%r13,%rcx), %xmm9
pmaxsw %xmm11, %xmm9
movdqa %xmm9, (%r15,%rcx)
pminsw %xmm11, %xmm2
pminsw %xmm9, %xmm2
pmaxsw %xmm9, %xmm3
addq $0x10, %rcx
cmpq %rcx, %rbx
jne 0x33d680
movdqa (%r10), %xmm9
movdqa %xmm9, %xmm11
pcmpgtw %xmm10, %xmm11
pand %xmm6, %xmm11
pmovmskb %xmm11, %ecx
testl %ecx, %ecx
cmovnel %r12d, %edi
movdqa %xmm9, %xmm11
cmpl $0x6, 0x4(%rsp)
jg 0x33d6f5
movl %ebp, %ecx
movdqa %xmm9, %xmm11
pslldq $0x2, %xmm11            # xmm11 = zero,zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
decl %ecx
jne 0x33d6eb
pmaxsw %xmm10, %xmm9
pextrw $0x7, %xmm11, %ecx
movswl %cx, %ecx
movq 0x10(%r8), %rdx
movq (%rdx), %rdx
movl %ecx, (%rdx,%r12,4)
cmpq %r11, %rsi
jne 0x33d583
movl %edi, 0x38(%rsp)
movq 0x10(%rsp), %rcx
cmpl $0x1, %ecx
movl %ecx, %esi
adcl $0x0, %esi
leal (,%rcx,4), %r9d
movq 0x20(%rsp), %rdi
leaq (%rdi,%rdi,8), %rcx
leaq (%rcx,%rcx,2), %r10
addq %rdi, %r10
leaq (,%rdi,8), %r11
leaq (%r11,%r11,2), %rbx
leal (,%rdi,4), %edx
leaq (%rdx,%rdx,4), %rcx
shlq $0x4, %rdi
leaq (%rdx,%rdx,2), %rdx
shll $0x2, %esi
xorl %r12d, %r12d
movdqa (%r15,%r12,4), %xmm4
movq 0x30(%rsp), %r8
movq 0x10(%r8), %r8
movq 0x8(%r8), %r8
movd %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%r8,%r12)
addq %r12, %r8
pextrw $0x1, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%r9,%r8)
pextrw $0x2, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%r11,%r8)
pextrw $0x3, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%rdx,%r8)
pextrw $0x4, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%rdi,%r8)
pextrw $0x5, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%rcx,%r8)
pextrw $0x6, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%rbx,%r8)
pextrw $0x7, %xmm4, %ebp
movswl %bp, %ebp
movl %ebp, (%r10,%r8)
addq $0x4, %r12
cmpq %r12, %rsi
jne 0x33d765
movl 0xf0(%rsp), %r12d
testl %r12d, %r12d
movl 0x4c(%rsp), %r10d
movq 0x70(%rsp), %r11
movq 0x40(%rsp), %rbx
movl 0xc(%rsp), %ebp
movl 0x38(%rsp), %edi
je 0x33d82d
cmpl $0x6, 0x4(%rsp)
jg 0x33d827
movl 0x8(%rsp), %edx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
pslldq $0x2, %xmm9             # xmm9 = zero,zero,xmm9[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
decl %ecx
jne 0x33d81d
pextrw $0x7, %xmm9, %ebp
cmpl $0x0, 0xe0(%rsp)
je 0x33d89a
cmpl $0x0, 0x60(%rsp)
je 0x33d89a
movq 0x10(%rsp), %r8
andl $0xfffffff, %r8d        # imm = 0xFFFFFFF
shll $0x3, %r8d
xorl %r9d, %r9d
movl %r10d, %esi
movl %r9d, %edx
shrl $0x3, %edx
movl %r9d, %ecx
andl $0x7, %ecx
imull 0x10(%rsp), %ecx
addl %edx, %ecx
cmpl %r11d, %ecx
jge 0x33d890
movzwl (%r15,%r9,2), %edx
cmpw %bp, %dx
jle 0x33d87f
movl %edx, %ebp
movl (%rsp), %edi
movl %ecx, %esi
jmp 0x33d890
cmpl %esi, %ecx
cmovgel %esi, %ecx
cmpl (%rsp), %edi
cmovnel %esi, %ecx
cmpw %bp, %dx
cmovel %ecx, %esi
incq %r9
cmpl %r9d, %r8d
jne 0x33d854
jmp 0x33d89d
movl %r10d, %esi
orl 0xe0(%rsp), %r12d
movq 0x30(%rsp), %rdx
jne 0x33d8e5
movq 0x18(%rsp), %rcx
shlq $0x4, %rcx
movdqa (%r15,%rcx), %xmm4
cmpl $0x6, 0x4(%rsp)
jg 0x33d8da
movl 0x8(%rsp), %esi
cmpl $0x2, %esi
movl $0x1, %ecx
cmovgel %esi, %ecx
pslldq $0x2, %xmm4             # xmm4 = zero,zero,xmm4[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
decl %ecx
jne 0x33d8d1
pextrw $0x7, %xmm4, %ebp
movl (%rsp), %edi
movl %r10d, %esi
pcmpgtw %xmm2, %xmm0
pcmpgtw %xmm1, %xmm3
por %xmm0, %xmm3
pmovmskb %xmm3, %ecx
testl %ecx, %ecx
je 0x33d903
orb $0x40, 0xc(%rdx)
xorl %ebp, %ebp
xorl %edi, %edi
xorl %esi, %esi
movswl %bp, %ecx
movl %ecx, (%rdx)
movl %esi, 0x4(%rdx)
movl %edi, 0x8(%rdx)
movq %rax, %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq %r13, %rdi
callq 0x2094b5
movq %rbx, %rdi
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq 0x30(%rsp), %rax
jmp 0x33d975
callq 0x1b48d7
jmp 0x33d973
callq 0x1b48b1
jmp 0x33d973
callq 0x1b488b
jmp 0x33d973
callq 0x1b4865
jmp 0x33d973
callq 0x1b483f
jmp 0x33d973
callq 0x1b4819
jmp 0x33d973
callq 0x1b47f3
jmp 0x33d973
callq 0x1b47cd
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq