// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sw_trace_striped_sse2_128_32.c
// Function: parasail_sw_trace_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)
{
    /* 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;
    int32_t score = 0;
    __m128i vMaxH;
    __m128i vMaxHUnit;
    int32_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->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;
    end_query = 0;
    end_ref = 0;
    s1Len = profile->s1Len;
    matrix = profile->matrix;
    segWidth = 4; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    vProfile = (__m128i*)profile->profile32.score;
    vGapO = _mm_set1_epi32(open);
    vGapE = _mm_set1_epi32(gap);
    vZero = _mm_setzero_si128();
    score = NEG_INF;
    vMaxH = vZero;
    vMaxHUnit = vZero;
    maxp = INT32_MAX - (int32_t)(matrix->max+1);
    vTZero = _mm_set1_epi32(PARASAIL_ZERO);
    vTIns  = _mm_set1_epi32(PARASAIL_INS);
    vTDel  = _mm_set1_epi32(PARASAIL_DEL);
    vTDiag = _mm_set1_epi32(PARASAIL_DIAG);
    vTDiagE= _mm_set1_epi32(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi32(PARASAIL_INS_E);
    vTDiagF= _mm_set1_epi32(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi32(PARASAIL_DEL_F);
    vTMask = _mm_set1_epi32(PARASAIL_ZERO_MASK);
    vFTMask= _mm_set1_epi32(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_32 | PARASAIL_FLAG_LANES_4;

    /* 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_epi32(-open), segLen);
    parasail_memset___m128i(pvEaStore, _mm_set1_epi32(-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_sub_epi32(vZero,vGapO);

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

        /* 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_add_epi32(vH, _mm_load_si128(vP + i));
            vH_dag = _mm_max_epi32_rpl(vH_dag, vZero);
            vH = _mm_max_epi32_rpl(vH_dag, vE);
            vH = _mm_max_epi32_rpl(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_epi32(vH, vZero);
                __m128i case1 = _mm_cmpeq_epi32(vH, vH_dag);
                __m128i case2 = _mm_cmpeq_epi32(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_epi32_rpl(vH, vMaxH);
            vEF_opn = _mm_sub_epi32(vH, vGapO);

            /* Update vE value. */
            vE_ext = _mm_sub_epi32(vE, vGapE);
            vE = _mm_max_epi32_rpl(vEF_opn, vE_ext);
            _mm_store_si128(pvE + i, vE);
            {
                __m128i vEa = _mm_load_si128(pvEaLoad + i);
                __m128i vEa_ext = _mm_sub_epi32(vEa, vGapE);
                vEa = _mm_max_epi32_rpl(vEF_opn, vEa_ext);
                _mm_store_si128(pvEaStore + i, vEa);
                if (j+1<s2Len) {
                    __m128i cond = _mm_cmpgt_epi32(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_sub_epi32(vF, vGapE);
            vF = _mm_max_epi32_rpl(vEF_opn, vF_ext);
            if (i+1<segLen) {
                __m128i vTAll = arr_load(result->trace->trace_table, i+1, segLen, j);
                __m128i cond = _mm_cmpgt_epi32(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, 4);
            vEF_opn = _mm_slli_si128(vEF_opn, 4);
            vEF_opn = _mm_insert_epi32_rpl(vEF_opn, -open, 0);
            vF_ext = _mm_slli_si128(vF_ext, 4);
            vF_ext = _mm_insert_epi32_rpl(vF_ext, NEG_INF, 0);
            vF = _mm_slli_si128(vF, 4);
            vF = _mm_insert_epi32_rpl(vF, -open, 0);
            vFa_ext = _mm_slli_si128(vFa_ext, 4);
            vFa_ext = _mm_insert_epi32_rpl(vFa_ext, NEG_INF, 0);
            vFa = _mm_slli_si128(vFa, 4);
            vFa = _mm_insert_epi32_rpl(vFa, -open, 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);
                {
                    __m128i vTAll;
                    __m128i vT;
                    __m128i case1;
                    __m128i case2;
                    __m128i cond;
                    vHp = _mm_add_epi32(vHp, _mm_load_si128(vP + i));
                    vHp = _mm_max_epi32_rpl(vHp, vZero);
                    case1 = _mm_cmpeq_epi32(vH, vHp);
                    case2 = _mm_cmpeq_epi32(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_epi32_rpl(vH, vMaxH);
                /* Update vF value. */
                {
                    __m128i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                    __m128i cond = _mm_cmpgt_epi32(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_sub_epi32(vH, vGapO);
                vF_ext = _mm_sub_epi32(vF, vGapE);
                {
                    __m128i vEa = _mm_load_si128(pvEaLoad + i);
                    __m128i vEa_ext = _mm_sub_epi32(vEa, vGapE);
                    vEa = _mm_max_epi32_rpl(vEF_opn, vEa_ext);
                    _mm_store_si128(pvEaStore + i, vEa);
                    if (j+1<s2Len) {
                        __m128i cond = _mm_cmpgt_epi32(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_epi32(vF_ext, vEF_opn),
                                _mm_cmpeq_epi32(vF_ext, vEF_opn))))
                    goto end;
                /*vF = _mm_max_epi32_rpl(vEF_opn, vF_ext);*/
                vF = vF_ext;
                vFa_ext = _mm_sub_epi32(vFa, vGapE);
                vFa = _mm_max_epi32_rpl(vEF_opn, vFa_ext);
                vHp = _mm_load_si128(pvHLoad + i);
            }
        }
end:
        {
        }

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

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

    if (score == INT32_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. */
        {
            int32_t *t = (int32_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 $0xf8, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, 0x88(%rsp)
testq %rdi, %rdi
je 0x35bc10
movq 0x48(%rdi), %rax
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x35bc34
movq 0x10(%rdi), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x35bc58
movl 0x8(%rdi), %r14d
testl %r14d, %r14d
jle 0x35bc7c
cmpq $0x0, 0x88(%rsp)
je 0x35bca0
cmpl $0x0, 0x28(%rsp)
jle 0x35bcc1
cmpl $0x0, 0xc(%rsp)
js 0x35bce2
movl %r8d, %r12d
testl %r8d, %r8d
js 0x35bd03
leaq 0x3(%r14), %r15
shrq $0x2, %r15
movl $0x7ffffffe, %ebp       # imm = 0x7FFFFFFE
movq 0x80(%rsp), %rax
subl 0x1c(%rax), %ebp
pushq $0x10
popq %rcx
movl %r15d, %edi
movq 0x28(%rsp), %rsi
movq %rcx, %rdx
callq 0x1abb59
testq %rax, %rax
je 0x35bd29
movq %rax, %rbx
movl %r12d, 0x30(%rsp)
movl %ebp, 0x5c(%rsp)
movq %r14, 0xa8(%rsp)
orl $0x4480804, 0xc(%rax)   # imm = 0x4480804
pushq $0x10
popq %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, 0x48(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %rbp
movq %r12, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %r15, 0x10(%rsp)
movq %rax, %r12
pushq $0x10
popq %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r15
pushq $0x10
popq %rdi
movq 0x10(%rsp), %rsi
callq 0x297cd8
movq %rax, 0x20(%rsp)
movq %r13, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq 0x48(%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 0x35bd2b
testq %r12, %r12
je 0x35bd2b
testq %r15, %r15
je 0x35bd2b
cmpq $0x0, 0x20(%rsp)
je 0x35bd2b
movd 0xc(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x90(%rsp)
movd 0x30(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x30(%rsp)
pxor %xmm0, %xmm0
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x297ce1
movl 0xc(%rsp), %eax
negl %eax
movl %eax, 0xc(%rsp)
movd %eax, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x60(%rsp)
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x297ce1
movq %rbp, %rdi
movaps 0x60(%rsp), %xmm0
movq 0x10(%rsp), %rsi
callq 0x297ce1
movq 0x10(%rsp), %rax
shlq $0x4, %rax
xorl %ecx, %ecx
movdqa 0x26e4bc(%rip), %xmm0   # 0x5c99b0
cmpq %rcx, %rax
je 0x35b50b
movq 0x10(%rbx), %rdx
movq (%rdx), %rdx
movdqa %xmm0, (%rdx,%rcx)
addq $0x10, %rcx
jmp 0x35b4f4
pxor %xmm0, %xmm0
pxor %xmm1, %xmm1
psubd 0x90(%rsp), %xmm1
movdqa %xmm1, 0xe0(%rsp)
movq 0x10(%rsp), %rcx
decl %ecx
movl 0x28(%rsp), %edx
movq %rdx, 0xb8(%rsp)
xorl %edi, %edi
movl $0xc0000000, 0x1c(%rsp) # imm = 0xC0000000
shlq $0x4, %rcx
movq %rcx, 0xb0(%rsp)
movdqa 0x26e11a(%rip), %xmm3   # 0x5c9670
movdqa 0x26e0f2(%rip), %xmm5   # 0x5c9650
movdqa 0x26e0fa(%rip), %xmm7   # 0x5c9660
movdqa 0x26e0c1(%rip), %xmm8   # 0x5c9630
movdqa 0x26e0c8(%rip), %xmm9   # 0x5c9640
movdqa 0x26c63f(%rip), %xmm10  # 0x5c7bc0
pxor %xmm1, %xmm1
movdqa %xmm1, 0xd0(%rsp)
pxor %xmm11, %xmm11
movl $0x0, 0x8(%rsp)
leaq 0x1(%rdi), %rcx
imulq %rax, %rcx
movq %rcx, 0x60(%rsp)
movq %rax, %r10
imulq %rdi, %r10
movq %r12, %rcx
movq %r14, %r8
movdqa 0x30(%rsp), %xmm4
movq %r13, %r14
movq %rbp, %r12
movq %rcx, %rbp
cmpq 0xb8(%rsp), %rdi
je 0x35bafe
movq 0xb0(%rsp), %rcx
leaq (%r14,%rcx), %rdx
movq %rdx, 0xc8(%rsp)
movdqa (%r14,%rcx), %xmm1
pslldq $0x4, %xmm1             # xmm1 = zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
movq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x88(%rsp), %rdx
movzbl (%rdx,%rdi), %edx
movl (%rcx,%rdx,4), %ecx
imull 0x10(%rsp), %ecx
movslq %ecx, %rsi
shlq $0x4, %rsi
addq 0xc0(%rsp), %rsi
leal -0x2(%rdi), %edx
cmpl %edx, 0x8(%rsp)
movq %r8, 0x50(%rsp)
movq %r8, %r13
cmoveq 0x20(%rsp), %r13
movq %rdi, 0x78(%rsp)
incq %rdi
pushq $0x1
popq %rcx
xorl %r11d, %r11d
movdqa 0xe0(%rsp), %xmm14
cmpq %r11, %rax
je 0x35b81f
paddd (%rsi,%r11), %xmm1
movq 0x48(%rsp), %r8
movdqa (%r8,%r11), %xmm2
movdqa %xmm1, %xmm12
pcmpgtd %xmm0, %xmm12
pand %xmm1, %xmm12
movdqa %xmm12, %xmm13
pcmpgtd %xmm2, %xmm13
movdqa %xmm12, %xmm1
pand %xmm13, %xmm1
pandn %xmm2, %xmm13
por %xmm1, %xmm13
movdqa %xmm13, %xmm15
pcmpgtd %xmm14, %xmm15
pand %xmm15, %xmm13
movdqa %xmm15, %xmm1
pandn %xmm14, %xmm1
por %xmm13, %xmm1
movdqa %xmm1, (%r13,%r11)
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r10, %r9
pcmpeqd %xmm1, %xmm12
movdqa %xmm1, %xmm13
pcmpeqd %xmm0, %xmm13
pandn %xmm12, %xmm13
pand %xmm10, %xmm13
paddd %xmm3, %xmm15
pandn %xmm15, %xmm12
por %xmm13, %xmm12
movdqa (%r11,%r9), %xmm13
por %xmm12, %xmm13
movdqa %xmm12, (%r15,%r11)
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r10, %r9
movdqa %xmm13, (%r11,%r9)
movdqa %xmm1, %xmm6
psubd 0x90(%rsp), %xmm6
psubd %xmm4, %xmm2
movdqa %xmm6, %xmm12
pcmpgtd %xmm2, %xmm12
movdqa %xmm6, %xmm15
pand %xmm12, %xmm15
pandn %xmm2, %xmm12
por %xmm15, %xmm12
movdqa %xmm12, (%r8,%r11)
movdqa (%r12,%r11), %xmm12
psubd %xmm4, %xmm12
movdqa %xmm6, %xmm13
pcmpgtd %xmm12, %xmm13
movdqa %xmm6, %xmm15
pand %xmm13, %xmm15
movdqa %xmm13, %xmm2
pandn %xmm12, %xmm2
por %xmm15, %xmm2
movdqa %xmm2, (%rbp,%r11)
cmpl 0x28(%rsp), %edi
jge 0x35b798
pand %xmm8, %xmm13
pxor %xmm9, %xmm13
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq 0x60(%rsp), %r9
movdqa %xmm13, (%r11,%r9)
psubd %xmm4, %xmm14
movdqa %xmm6, %xmm2
pcmpgtd %xmm14, %xmm2
cmpq 0x10(%rsp), %rcx
jae 0x35b7d4
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r10, %r9
movdqa %xmm2, %xmm12
pand %xmm5, %xmm12
pxor %xmm7, %xmm12
por 0x10(%r11,%r9), %xmm12
movdqa %xmm12, 0x10(%r11,%r9)
movdqa %xmm1, %xmm13
pcmpgtd %xmm11, %xmm13
pand %xmm13, %xmm1
pandn %xmm11, %xmm13
por %xmm1, %xmm13
movdqa %xmm6, %xmm1
pand %xmm2, %xmm1
pandn %xmm14, %xmm2
por %xmm1, %xmm2
movdqa (%r14,%r11), %xmm1
addq $0x10, %r11
incq %rcx
movdqa %xmm14, %xmm12
movdqa %xmm2, %xmm14
movdqa %xmm13, %xmm11
jmp 0x35b64d
cmpl %edx, 0x8(%rsp)
movq 0x20(%rsp), %rcx
cmoveq 0x50(%rsp), %rcx
movq %rcx, 0x20(%rsp)
xorl %ecx, %ecx
movdqa %xmm12, %xmm15
movdqa %xmm14, %xmm1
cmpl $0x4, %ecx
je 0x35ba63
movl %ecx, 0x50(%rsp)
movq 0xc8(%rsp), %rcx
movdqa (%rcx), %xmm2
pslldq $0x4, %xmm2             # xmm2 = zero,zero,zero,zero,xmm2[0,1,2,3,4,5,6,7,8,9,10,11]
pshufd $0x90, %xmm6, %xmm6     # xmm6 = xmm6[0,0,1,2]
movss 0xc(%rsp), %xmm13
movss %xmm13, %xmm6           # xmm6 = xmm13[0],xmm6[1,2,3]
pshufd $0x90, %xmm15, %xmm15   # xmm15 = xmm15[0,0,1,2]
movss 0x26e1c4(%rip), %xmm4   # 0x5c9a40
movss %xmm4, %xmm15           # xmm15 = xmm4[0],xmm15[1,2,3]
pshufd $0x90, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,2]
movss %xmm13, %xmm1           # xmm1 = xmm13[0],xmm1[1,2,3]
pshufd $0x90, %xmm12, %xmm12   # xmm12 = xmm12[0,0,1,2]
movss %xmm4, %xmm12           # xmm12 = xmm4[0],xmm12[1,2,3]
pshufd $0x90, %xmm14, %xmm14   # xmm14 = xmm14[0,0,1,2]
movss %xmm13, %xmm14          # xmm14 = xmm13[0],xmm14[1,2,3]
xorl %ecx, %ecx
movq %r10, %r11
movq 0x60(%rsp), %r9
movq 0x10(%rsp), %rdx
subq $0x1, %rdx
jb 0x35ba52
movdqa (%r13,%rcx), %xmm13
movdqa %xmm13, %xmm15
pcmpgtd %xmm1, %xmm15
pand %xmm15, %xmm13
movdqa %xmm15, %xmm4
pandn %xmm1, %xmm4
por %xmm13, %xmm4
movdqa %xmm4, (%r13,%rcx)
paddd (%rsi,%rcx), %xmm2
movdqa %xmm2, %xmm13
pcmpgtd %xmm0, %xmm13
pand %xmm2, %xmm13
pcmpeqd %xmm4, %xmm13
por %xmm15, %xmm13
movq 0x10(%rbx), %r8
movq (%r8), %r8
movdqa (%r8,%r11), %xmm2
pand 0x26e0a8(%rip), %xmm2   # 0x5c99c0
movdqa (%r15,%rcx), %xmm15
pand %xmm13, %xmm15
pandn %xmm3, %xmm13
por %xmm15, %xmm13
movdqa %xmm13, (%r15,%rcx)
por %xmm2, %xmm13
movq 0x10(%rbx), %r8
movq (%r8), %r8
movdqa %xmm13, (%r8,%r11)
movq 0x10(%rbx), %r8
movq (%r8), %r8
pcmpgtd %xmm12, %xmm6
pand %xmm5, %xmm6
movdqa (%r8,%r11), %xmm2
pand 0x26e06d(%rip), %xmm2   # 0x5c99d0
por %xmm6, %xmm2
pxor %xmm7, %xmm2
movdqa %xmm2, (%r8,%r11)
movdqa %xmm4, %xmm6
psubd 0x90(%rsp), %xmm6
movdqa (%r12,%rcx), %xmm12
psubd 0x30(%rsp), %xmm12
movdqa %xmm6, %xmm2
pcmpgtd %xmm12, %xmm2
movdqa %xmm6, %xmm13
pand %xmm2, %xmm13
movdqa %xmm2, %xmm15
pandn %xmm12, %xmm15
por %xmm13, %xmm15
movdqa %xmm15, (%rbp,%rcx)
cmpl 0x28(%rsp), %edi
jge 0x35b9d1
pand %xmm8, %xmm2
pxor %xmm9, %xmm2
movq 0x10(%rbx), %r8
movq (%r8), %r8
movdqa %xmm2, (%r8,%r9)
movdqa %xmm4, %xmm2
pcmpgtd %xmm11, %xmm2
pand %xmm2, %xmm4
pandn %xmm11, %xmm2
movdqa %xmm2, %xmm11
por %xmm4, %xmm11
movdqa 0x30(%rsp), %xmm4
psubd %xmm4, %xmm1
movdqa %xmm1, %xmm15
movdqa %xmm6, %xmm2
pcmpgtd %xmm1, %xmm2
movmskps %xmm2, %r8d
cmpl $0xf, %r8d
je 0x35ba63
psubd %xmm4, %xmm14
movdqa %xmm6, %xmm1
pcmpgtd %xmm14, %xmm1
movdqa %xmm6, %xmm2
pand %xmm1, %xmm2
pandn %xmm14, %xmm1
por %xmm2, %xmm1
movaps (%r14,%rcx), %xmm2
addq $0x10, %r9
addq $0x10, %r11
addq $0x10, %rcx
movdqa %xmm14, %xmm12
movdqa %xmm1, %xmm14
movdqa %xmm15, %xmm1
jmp 0x35b8b0
movl 0x50(%rsp), %ecx
incl %ecx
movdqa 0x30(%rsp), %xmm4
jmp 0x35b83f
movdqa %xmm15, %xmm12
movdqa %xmm11, %xmm1
pcmpgtd 0xd0(%rsp), %xmm1
movmskps %xmm1, %edx
addq %rax, 0x60(%rsp)
addq %rax, %r10
movq %r12, %rcx
movq %r14, %r8
testl %edx, %edx
je 0x35b5bb
movdqa %xmm11, %xmm1
psrldq $0x8, %xmm1             # xmm1 = xmm1[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
movdqa %xmm11, %xmm2
pcmpgtd %xmm1, %xmm2
movdqa %xmm11, %xmm4
pand %xmm2, %xmm4
pandn %xmm1, %xmm2
por %xmm4, %xmm2
movdqa %xmm2, %xmm4
psrldq $0x4, %xmm4             # xmm4 = xmm4[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm2, %xmm1
pcmpgtd %xmm4, %xmm1
pand %xmm1, %xmm2
pandn %xmm4, %xmm1
por %xmm2, %xmm1
movd %xmm1, %ecx
cmpl 0x5c(%rsp), %ecx
jg 0x35bd3d
movl %ecx, 0x1c(%rsp)
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movdqa %xmm1, 0xd0(%rsp)
movq 0x78(%rsp), %rcx
movl %ecx, 0x8(%rsp)
jmp 0x35b59b
movq %rbp, 0x30(%rsp)
movq %r12, %rbp
movq %r14, %r13
movl 0x1c(%rsp), %ecx
movq %r8, %r14
movl %ecx, 0x1c(%rsp)
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %r12
jne 0x35bb25
orb $0x40, 0xc(%rbx)
movq %rbx, %rdi
callq 0x1ace42
xorl %ecx, %ecx
testl %eax, %eax
je 0x35bb42
xorl %r10d, %r10d
movq 0x20(%rsp), %rdi
xorl %eax, %eax
jmp 0x35bbc6
movq 0x28(%rsp), %rcx
leal -0x1(%rcx), %eax
addl $-0x2, %ecx
movl 0x8(%rsp), %edx
cmpl %ecx, %edx
movq 0x20(%rsp), %rcx
movq %rcx, %rdi
movq %r14, %rsi
cmoveq %r14, %rdi
cmoveq %rcx, %r14
cmpl %eax, %edx
cmoveq %r13, %rdi
cmoveq %rsi, %r14
movq 0xa8(%rsp), %rcx
decl %ecx
movl %r12d, %edx
andl $0x1fffffff, %edx       # imm = 0x1FFFFFFF
shll $0x2, %edx
xorl %esi, %esi
movl 0x1c(%rsp), %r10d
cmpl %esi, %edx
je 0x35bbb8
cmpl %r10d, (%rdi,%rsi,4)
jne 0x35bbb3
movl %esi, %r8d
shrl $0x2, %r8d
movl %esi, %r9d
andl $0x3, %r9d
imull %r12d, %r9d
addl %r8d, %r9d
cmpl %ecx, %r9d
cmovll %r9d, %ecx
incq %rsi
jmp 0x35bb8d
movl 0x8(%rsp), %edx
cmpl %eax, %edx
movl %edx, %eax
cmoveq 0x20(%rsp), %r13
movl %r10d, (%rbx)
movl %ecx, 0x4(%rbx)
movl %eax, 0x8(%rbx)
callq 0x1ab763
movq %r15, %rdi
callq 0x1ab763
movq 0x30(%rsp), %rdi
callq 0x1ab763
movq %rbp, %rdi
callq 0x1ab763
movq 0x48(%rsp), %rdi
callq 0x1ab763
movq %r14, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq %rbx, %rax
jmp 0x35bd2b
movq 0x3df3c1(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26b3ca(%rip), %rsi    # 0x5c6feb
leaq 0x2663c1(%rip), %rdx    # 0x5c1fe9
leaq 0x2418ae(%rip), %rcx    # 0x59d4dd
jmp 0x35bd22
movq 0x3df39d(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26b3a6(%rip), %rsi    # 0x5c6feb
leaq 0x26639d(%rip), %rdx    # 0x5c1fe9
leaq 0x26bd53(%rip), %rcx    # 0x5c79a6
jmp 0x35bd22
movq 0x3df379(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26b382(%rip), %rsi    # 0x5c6feb
leaq 0x266379(%rip), %rdx    # 0x5c1fe9
leaq 0x26bcc2(%rip), %rcx    # 0x5c7939
jmp 0x35bd22
movq 0x3df355(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26ba74(%rip), %rsi    # 0x5c7701
leaq 0x266355(%rip), %rdx    # 0x5c1fe9
leaq 0x26bcae(%rip), %rcx    # 0x5c7949
jmp 0x35bd22
movq 0x3df331(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26b33a(%rip), %rsi    # 0x5c6feb
leaq 0x266331(%rip), %rdx    # 0x5c1fe9
leaq 0x26ba3f(%rip), %rcx    # 0x5c76fe
jmp 0x35bd22
movq 0x3df310(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26ba2f(%rip), %rsi    # 0x5c7701
leaq 0x266310(%rip), %rdx    # 0x5c1fe9
leaq 0x26ba35(%rip), %rcx    # 0x5c7715
jmp 0x35bd22
movq 0x3df2ef(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26ba28(%rip), %rsi    # 0x5c771b
leaq 0x2662ef(%rip), %rdx    # 0x5c1fe9
leaq 0x26ba2f(%rip), %rcx    # 0x5c7730
jmp 0x35bd22
movq 0x3df2ce(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x26ba07(%rip), %rsi    # 0x5c771b
leaq 0x2662ce(%rip), %rdx    # 0x5c1fe9
leaq 0x26ba13(%rip), %rcx    # 0x5c7735
xorl %eax, %eax
callq 0x19e180
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x40, 0xc(%rbx)
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq %r14, %r8
jmp 0x35bb0d