// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sw_trace_striped_sse2_128_16.c
// Function: parasail_sw_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 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;
    __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;
    __m128i* restrict pvHMax = NULL;
    __m128i vGapO;
    __m128i vGapE;
    __m128i vZero;
    int16_t score = 0;
    __m128i vMaxH;
    __m128i vMaxHUnit;
    int16_t maxp = 0;
    parasail_result_t *result = NULL;
    __m128i vTZero;
    __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;
    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;
    vProfile = (__m128i*)profile->profile16.score;
    vGapO = _mm_set1_epi16(open);
    vGapE = _mm_set1_epi16(gap);
    vZero = _mm_setzero_si128();
    score = NEG_INF;
    vMaxH = vZero;
    vMaxHUnit = vZero;
    maxp = INT16_MAX - (int16_t)(matrix->max+1);
    vTZero = _mm_set1_epi16(PARASAIL_ZERO);
    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_SW | 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);
    pvHMax = parasail_memalign___m128i(16, segLen);

    /* 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 (!pvHMax) return NULL;

    /* initialize H and E */
    parasail_memset___m128i(pvHStore, vZero, segLen);
    parasail_memset___m128i(pvE, _mm_set1_epi16(-open), segLen);
    parasail_memset___m128i(pvEaStore, _mm_set1_epi16(-open), segLen);

    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 0.  Any errors to vH values will be
         * corrected in the Lazy_F loop. */
        vF = _mm_subs_epi16(vZero,vGapO);

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

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

        if (end_ref == j-2) {
            /* Swap in the max buffer. */
            SWAP3(pvHMax,  pvHLoad,  pvHStore)
            SWAP(pvEaLoad,  pvEaStore)
        }
        else {
            /* 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_dag = _mm_max_epi16(vH_dag, vZero);
            vH = _mm_max_epi16(vH_dag, vE);
            vH = _mm_max_epi16(vH, vF);
            /* Save vH values. */
            _mm_store_si128(pvHStore + i, vH);

            {
                __m128i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                __m128i cond_zero = _mm_cmpeq_epi16(vH, vZero);
                __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),
                        _mm_blendv_epi8_rpl(vTDiag, vTZero, cond_zero),
                        case1);
                _mm_store_si128(pvHT + i, vT);
                vT = _mm_or_si128(vT, vTAll);
                arr_store(result->trace->trace_table, vT, i, segLen, j);
            }
            vMaxH = _mm_max_epi16(vH, vMaxH);
            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) {
            __m128i vHp = _mm_load_si128(&pvHLoad[segLen - 1]);
            vHp = _mm_slli_si128(vHp, 2);
            vEF_opn = _mm_slli_si128(vEF_opn, 2);
            vEF_opn = _mm_insert_epi16(vEF_opn, -open, 0);
            vF_ext = _mm_slli_si128(vF_ext, 2);
            vF_ext = _mm_insert_epi16(vF_ext, NEG_INF, 0);
            vF = _mm_slli_si128(vF, 2);
            vF = _mm_insert_epi16(vF, -open, 0);
            vFa_ext = _mm_slli_si128(vFa_ext, 2);
            vFa_ext = _mm_insert_epi16(vFa_ext, NEG_INF, 0);
            vFa = _mm_slli_si128(vFa, 2);
            vFa = _mm_insert_epi16(vFa, -open, 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);
                {
                    __m128i vTAll;
                    __m128i vT;
                    __m128i case1;
                    __m128i case2;
                    __m128i cond;
                    vHp = _mm_adds_epi16(vHp, _mm_load_si128(vP + i));
                    vHp = _mm_max_epi16(vHp, vZero);
                    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);
                }
                vMaxH = _mm_max_epi16(vH, vMaxH);
                /* 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:
        {
        }

        {
            __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;*/
    }

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

    if (parasail_result_is_saturated(result)) {
        score = 0;
        end_query = 0;
        end_ref = 0;
    }
    else {
        if (end_ref == j-1) {
            /* end_ref was the last store column */
            SWAP(pvHMax,  pvHStore)
        }
        else if (end_ref == j-2) {
            /* end_ref was the last load column */
            SWAP(pvHMax,  pvHLoad)
        }
        /* 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;
    result->end_query = end_query;
    result->end_ref = end_ref;

    parasail_free(pvHMax);
    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, 0x4(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x80(%rsp)
testq %rdi, %rdi
je 0x35e23a
movq 0x30(%rdi), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x35e25e
movq 0x10(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x35e282
movl 0x8(%rdi), %r14d
testl %r14d, %r14d
jle 0x35e2a6
cmpq $0x0, 0x80(%rsp)
je 0x35e2ca
cmpl $0x0, 0x20(%rsp)
jle 0x35e2eb
cmpl $0x0, 0x4(%rsp)
js 0x35e30c
movl %r8d, %r15d
testl %r8d, %r8d
js 0x35e32d
leaq 0x7(%r14), %r12
shrq $0x3, %r12
movq 0x78(%rsp), %rax
movl 0x1c(%rax), %ebp
pushq $0x10
popq %rcx
movl %r12d, %edi
movq 0x20(%rsp), %rsi
movq %rcx, %rdx
callq 0x1abb59
testq %rax, %rax
je 0x35e353
movq %rax, %rbx
movl %r15d, 0x60(%rsp)
movl %ebp, 0x28(%rsp)
movq %r14, 0x88(%rsp)
orl $0x8280804, 0xc(%rax)   # imm = 0x8280804
pushq $0x10
popq %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x297cd8
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x297cd8
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x297cd8
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x297cd8
movq %rax, %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x297cd8
movq %r12, %rsi
movq %r12, 0x8(%rsp)
movq %rax, %r12
movq %r15, %rdi
callq 0x297cd8
movq %rax, %r15
pushq $0x10
popq %rdi
movq 0x8(%rsp), %rsi
callq 0x297cd8
movq %rax, 0x18(%rsp)
movq %r13, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq 0x40(%rsp), %xmm1
movq %rbp, %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
xorl %eax, %eax
testl %ecx, %ecx
jne 0x35e355
testq %r12, %r12
je 0x35e355
testq %r15, %r15
je 0x35e355
cmpq $0x0, 0x18(%rsp)
je 0x35e355
movd 0x4(%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, 0x50(%rsp)
movd 0x60(%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, 0x60(%rsp)
pxor %xmm0, %xmm0
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x297ce1
movl 0x4(%rsp), %eax
negl %eax
movl %eax, 0x4(%rsp)
movd %eax, %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, 0x30(%rsp)
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x297ce1
movq %rbp, %rdi
movaps 0x30(%rsp), %xmm0
movq 0x8(%rsp), %rsi
callq 0x297ce1
movq 0x8(%rsp), %rdx
movq %rdx, %rdi
shlq $0x4, %rdi
xorl %eax, %eax
movdqa 0x26a040(%rip), %xmm0   # 0x5c7c30
cmpq %rax, %rdi
je 0x35dc07
movq 0x10(%rbx), %rcx
movq (%rcx), %rcx
movdqa %xmm0, (%rcx,%rax)
addq $0x10, %rax
jmp 0x35dbf0
pxor %xmm0, %xmm0
pxor %xmm1, %xmm1
psubsw 0x50(%rsp), %xmm1
movdqa %xmm1, 0xc0(%rsp)
leal -0x1(%rdx), %ecx
movl $0x7ffe, %eax           # imm = 0x7FFE
subl 0x28(%rsp), %eax
cwtl
movl %eax, 0x4c(%rsp)
movl 0x20(%rsp), %eax
movq %rax, 0x98(%rsp)
xorl %r9d, %r9d
movw $0x8000, %ax            # imm = 0x8000
movl %eax, 0x14(%rsp)
shlq $0x4, %rcx
movq %rcx, 0x90(%rsp)
movdqa 0x26bab6(%rip), %xmm2   # 0x5c9710
movdqa 0x26ba8e(%rip), %xmm4   # 0x5c96f0
movdqa 0x26ba96(%rip), %xmm6   # 0x5c9700
movdqa 0x26ba6e(%rip), %xmm7   # 0x5c96e0
movdqa 0x26a155(%rip), %xmm8   # 0x5c7dd0
movdqa 0x26ba9c(%rip), %xmm9   # 0x5c9720
pxor %xmm5, %xmm5
movdqa %xmm5, 0xb0(%rsp)
pxor %xmm10, %xmm10
movl $0x0, (%rsp)
leaq 0x1(%r9), %rax
imulq %rdi, %rax
movq %rax, 0x28(%rsp)
movq %rdi, %rdx
imulq %r9, %rdx
movq %r12, %rax
movq %r14, 0x30(%rsp)
movq %r13, %r14
movq %rbp, %r12
movq %rax, %rbp
cmpq 0x98(%rsp), %r9
je 0x35e127
movq 0x90(%rsp), %rax
leaq (%r14,%rax), %rcx
movq %rcx, 0xa8(%rsp)
movdqa (%r14,%rax), %xmm14
pslldq $0x2, %xmm14            # xmm14 = zero,zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x80(%rsp), %rcx
movzbl (%rcx,%r9), %ecx
movl (%rax,%rcx,4), %eax
imull 0x8(%rsp), %eax
movslq %eax, %rsi
shlq $0x4, %rsi
addq 0xa0(%rsp), %rsi
leal -0x2(%r9), %r8d
cmpl %r8d, (%rsp)
movq 0x30(%rsp), %r13
cmoveq 0x18(%rsp), %r13
movq %r9, 0x70(%rsp)
incq %r9
pushq $0x1
popq %rax
xorl %ecx, %ecx
movdqa 0xc0(%rsp), %xmm13
movdqa 0x60(%rsp), %xmm5
cmpq %rcx, %rdi
je 0x35dea5
movq 0x40(%rsp), %r10
movdqa (%r10,%rcx), %xmm11
paddsw (%rsi,%rcx), %xmm14
pmaxsw %xmm0, %xmm14
movdqa %xmm14, %xmm12
pmaxsw %xmm11, %xmm12
movdqa %xmm12, %xmm1
pmaxsw %xmm13, %xmm1
movdqa %xmm1, (%r13,%rcx)
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rdx, %r11
pcmpeqw %xmm1, %xmm14
movdqa %xmm1, %xmm15
pcmpgtw %xmm0, %xmm15
pand %xmm14, %xmm15
pand %xmm9, %xmm15
pcmpgtw %xmm13, %xmm12
paddw %xmm2, %xmm12
pandn %xmm12, %xmm14
por %xmm15, %xmm14
movdqa (%rcx,%r11), %xmm12
por %xmm14, %xmm12
movdqa %xmm14, (%r15,%rcx)
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rdx, %r11
movdqa %xmm12, (%rcx,%r11)
movdqa %xmm1, %xmm3
psubsw 0x50(%rsp), %xmm3
psubsw %xmm5, %xmm11
pmaxsw %xmm3, %xmm11
movdqa %xmm11, (%r10,%rcx)
movdqa (%r12,%rcx), %xmm11
psubsw %xmm5, %xmm11
movdqa %xmm3, %xmm14
pmaxsw %xmm11, %xmm14
movdqa %xmm14, (%rbp,%rcx)
cmpl 0x20(%rsp), %r9d
jge 0x35de42
movdqa %xmm3, %xmm14
pcmpgtw %xmm11, %xmm14
pand %xmm7, %xmm14
pxor %xmm8, %xmm14
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq 0x28(%rsp), %r11
movdqa %xmm14, (%rcx,%r11)
psubsw %xmm5, %xmm13
cmpq 0x8(%rsp), %rax
jae 0x35de7a
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rdx, %r11
movdqa %xmm3, %xmm11
pcmpgtw %xmm13, %xmm11
pand %xmm4, %xmm11
pxor %xmm6, %xmm11
por 0x10(%rcx,%r11), %xmm11
movdqa %xmm11, 0x10(%rcx,%r11)
pmaxsw %xmm1, %xmm10
movdqa %xmm3, %xmm11
pmaxsw %xmm13, %xmm11
movdqa (%r14,%rcx), %xmm14
addq $0x10, %rcx
incq %rax
movdqa %xmm13, %xmm1
movdqa %xmm11, %xmm13
jmp 0x35dd4d
cmpl %r8d, (%rsp)
movq 0x18(%rsp), %rax
cmoveq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
xorl %eax, %eax
movdqa %xmm1, %xmm14
movdqa %xmm13, %xmm15
cmpl $0x8, %eax
je 0x35e094
movl %eax, 0x30(%rsp)
pslldq $0x2, %xmm3             # xmm3 = zero,zero,xmm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl 0x4(%rsp), %eax
pinsrw $0x0, %eax, %xmm3
pslldq $0x2, %xmm14            # xmm14 = zero,zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl $0x8000, %ecx           # imm = 0x8000
pinsrw $0x0, %ecx, %xmm14
pslldq $0x2, %xmm15            # xmm15 = zero,zero,xmm15[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm15
movq 0xa8(%rsp), %r8
movdqa (%r8), %xmm11
pslldq $0x2, %xmm1             # xmm1 = zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %ecx, %xmm1
pslldq $0x2, %xmm11            # xmm11 = zero,zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pslldq $0x2, %xmm13            # xmm13 = zero,zero,xmm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %eax, %xmm13
xorl %ecx, %ecx
movq %rdx, %rax
movq 0x28(%rsp), %r11
movq 0x8(%rsp), %r8
subq $0x1, %r8
jb 0x35e089
movdqa (%r13,%rcx), %xmm14
movdqa %xmm14, %xmm12
pmaxsw %xmm15, %xmm12
movdqa %xmm12, (%r13,%rcx)
paddsw (%rsi,%rcx), %xmm11
pmaxsw %xmm0, %xmm11
pcmpeqw %xmm12, %xmm11
pcmpgtw %xmm15, %xmm14
por %xmm11, %xmm14
movq 0x10(%rbx), %r10
movq (%r10), %r10
movdqa (%r10,%rax), %xmm11
pand 0x26bac9(%rip), %xmm11  # 0x5c9a50
movdqa (%r15,%rcx), %xmm5
pand %xmm14, %xmm5
pandn %xmm2, %xmm14
por %xmm5, %xmm14
movdqa %xmm14, (%r15,%rcx)
por %xmm11, %xmm14
movq 0x10(%rbx), %r10
movq (%r10), %r10
movdqa %xmm14, (%r10,%rax)
movq 0x10(%rbx), %r10
movq (%r10), %r10
pcmpgtw %xmm1, %xmm3
pand %xmm4, %xmm3
movdqa (%r10,%rax), %xmm1
pand 0x26ba8f(%rip), %xmm1   # 0x5c9a60
por %xmm3, %xmm1
pxor %xmm6, %xmm1
movdqa %xmm1, (%r10,%rax)
movdqa %xmm12, %xmm3
psubsw 0x50(%rsp), %xmm3
movdqa (%r12,%rcx), %xmm1
psubsw 0x60(%rsp), %xmm1
movdqa %xmm3, %xmm5
pmaxsw %xmm1, %xmm5
movdqa %xmm5, (%rbp,%rcx)
cmpl 0x20(%rsp), %r9d
jge 0x35e029
movdqa %xmm3, %xmm5
pcmpgtw %xmm1, %xmm5
pand %xmm7, %xmm5
pxor %xmm8, %xmm5
movq 0x10(%rbx), %r10
movq (%r10), %r10
movdqa %xmm5, (%r10,%r11)
pmaxsw %xmm12, %xmm10
movdqa 0x60(%rsp), %xmm5
psubsw %xmm5, %xmm15
movdqa %xmm15, %xmm14
movdqa %xmm3, %xmm1
pcmpgtw %xmm15, %xmm1
pmovmskb %xmm1, %r10d
cmpl $0xffff, %r10d          # imm = 0xFFFF
je 0x35e094
psubsw %xmm5, %xmm13
movdqa %xmm3, %xmm5
pmaxsw %xmm13, %xmm5
movdqa (%r14,%rcx), %xmm11
addq $0x10, %r11
addq $0x10, %rax
addq $0x10, %rcx
movdqa %xmm13, %xmm1
movdqa %xmm5, %xmm13
movdqa %xmm14, %xmm15
jmp 0x35df35
movl 0x30(%rsp), %eax
incl %eax
jmp 0x35dec5
movdqa %xmm14, %xmm1
movdqa %xmm10, %xmm5
pcmpgtw 0xb0(%rsp), %xmm5
pmovmskb %xmm5, %ecx
addq %rdi, 0x28(%rsp)
addq %rdi, %rdx
movq %r12, %rax
movq %r14, 0x30(%rsp)
testl %ecx, %ecx
je 0x35dcb9
movdqa %xmm10, %xmm5
psrldq $0x8, %xmm5             # xmm5 = xmm5[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
pmaxsw %xmm10, %xmm5
movdqa %xmm5, %xmm12
psrldq $0x4, %xmm12            # xmm12 = xmm12[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
pmaxsw %xmm5, %xmm12
movdqa %xmm12, %xmm11
psrldq $0x2, %xmm11            # xmm11 = xmm11[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pmaxsw %xmm12, %xmm11
movd %xmm11, %eax
movl %eax, 0x14(%rsp)
cwtl
cmpl %eax, 0x4c(%rsp)
jl 0x35e367
pshuflw $0x0, %xmm11, %xmm5     # xmm5 = xmm11[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
movdqa %xmm5, 0xb0(%rsp)
movq 0x70(%rsp), %rax
movl %eax, (%rsp)
jmp 0x35dc9d
movq %rbp, 0x50(%rsp)
movq %r12, %rbp
movq %r14, %r13
cmpw $0x7fff, 0x14(%rsp)     # imm = 0x7FFF
movq 0x88(%rsp), %r12
jne 0x35e147
orb $0x40, 0xc(%rbx)
movq %rbx, %rdi
callq 0x1ace42
xorl %ecx, %ecx
testl %eax, %eax
je 0x35e169
movq 0x18(%rsp), %rdi
movq 0x30(%rsp), %r14
xorl %eax, %eax
xorl %r12d, %r12d
jmp 0x35e1f0
movq 0x20(%rsp), %rcx
leal -0x1(%rcx), %eax
addl $-0x2, %ecx
movl (%rsp), %edx
cmpl %ecx, %edx
movq 0x18(%rsp), %rcx
movq %rcx, %rdi
movq 0x30(%rsp), %rsi
cmoveq %rsi, %rdi
movq %rsi, %r14
cmoveq %rcx, %r14
cmpl %eax, %edx
cmoveq %r13, %rdi
cmoveq %rsi, %r14
decl %r12d
movq 0x8(%rsp), %r9
movl %r9d, %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
shll $0x3, %ecx
xorl %edx, %edx
cmpl %edx, %ecx
je 0x35e1de
movl 0x14(%rsp), %esi
cmpw %si, (%rdi,%rdx,2)
jne 0x35e1d9
movl %edx, %esi
shrl $0x3, %esi
movl %edx, %r8d
andl $0x7, %r8d
imull %r9d, %r8d
addl %esi, %r8d
cmpl %r12d, %r8d
cmovll %r8d, %r12d
incq %rdx
jmp 0x35e1b1
movl (%rsp), %ecx
cmpl %eax, %ecx
movl %ecx, %eax
cmoveq 0x18(%rsp), %r13
movswl 0x14(%rsp), %ecx
movl %ecx, (%rbx)
movl %r12d, 0x4(%rbx)
movl %eax, 0x8(%rbx)
callq 0x1ab763
movq %r15, %rdi
callq 0x1ab763
movq 0x50(%rsp), %rdi
callq 0x1ab763
movq %rbp, %rdi
callq 0x1ab763
movq 0x40(%rsp), %rdi
callq 0x1ab763
movq %r14, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq %rbx, %rax
jmp 0x35e355
movq 0x3dcd97(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x268da0(%rip), %rsi    # 0x5c6feb
leaq 0x263dc5(%rip), %rdx    # 0x5c2017
leaq 0x23f284(%rip), %rcx    # 0x59d4dd
jmp 0x35e34c
movq 0x3dcd73(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x268d7c(%rip), %rsi    # 0x5c6feb
leaq 0x263da1(%rip), %rdx    # 0x5c2017
leaq 0x2697a1(%rip), %rcx    # 0x5c7a1e
jmp 0x35e34c
movq 0x3dcd4f(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x268d58(%rip), %rsi    # 0x5c6feb
leaq 0x263d7d(%rip), %rdx    # 0x5c2017
leaq 0x269698(%rip), %rcx    # 0x5c7939
jmp 0x35e34c
movq 0x3dcd2b(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26944a(%rip), %rsi    # 0x5c7701
leaq 0x263d59(%rip), %rdx    # 0x5c2017
leaq 0x269684(%rip), %rcx    # 0x5c7949
jmp 0x35e34c
movq 0x3dcd07(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x268d10(%rip), %rsi    # 0x5c6feb
leaq 0x263d35(%rip), %rdx    # 0x5c2017
leaq 0x269415(%rip), %rcx    # 0x5c76fe
jmp 0x35e34c
movq 0x3dcce6(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x269405(%rip), %rsi    # 0x5c7701
leaq 0x263d14(%rip), %rdx    # 0x5c2017
leaq 0x26940b(%rip), %rcx    # 0x5c7715
jmp 0x35e34c
movq 0x3dccc5(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2693fe(%rip), %rsi    # 0x5c771b
leaq 0x263cf3(%rip), %rdx    # 0x5c2017
leaq 0x269405(%rip), %rcx    # 0x5c7730
jmp 0x35e34c
movq 0x3dcca4(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2693dd(%rip), %rsi    # 0x5c771b
leaq 0x263cd2(%rip), %rdx    # 0x5c2017
leaq 0x2693e9(%rip), %rcx    # 0x5c7735
xorl %eax, %eax
callq 0x19e180
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x40, 0xc(%rbx)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, 0x50(%rsp)
movq %r14, 0x30(%rsp)
jmp 0x35e132