// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_trace_scan_sse2_128_64.c
// Function: parasail_sg_flags_trace_scan_profile_sse2_128_64
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 pvP = NULL;
    __m128i* restrict pvE = NULL;
    int64_t* restrict boundary = NULL;
    __m128i* restrict pvHt = NULL;
    __m128i* restrict pvH = NULL;
    __m128i* restrict pvGapper = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int64_t NEG_LIMIT = 0;
    int64_t POS_LIMIT = 0;
    __m128i vZero;
    int64_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vMaxH;
    __m128i vPosMask;
    __m128i vNegInfFront;
    __m128i vSegLenXgap;
    parasail_result_t *result = NULL;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTDiag;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i vTDelF;

    /* validate inputs */
    PARASAIL_CHECK_NULL(profile);
    PARASAIL_CHECK_NULL(profile->profile64.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 = 2; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m128i*)profile->profile64.score;
    vGapO = _mm_set1_epi64x_rpl(open);
    vGapE = _mm_set1_epi64x_rpl(gap);
    NEG_LIMIT = (-open < matrix->min ? INT64_MIN + open : INT64_MIN - matrix->min) + 1;
    POS_LIMIT = INT64_MAX - matrix->max - 1;
    vZero = _mm_setzero_si128();
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi64x_rpl(NEG_LIMIT);
    vPosLimit = _mm_set1_epi64x_rpl(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi64_rpl(_mm_set1_epi64x_rpl(position),
            _mm_set_epi64x_rpl(0,1));
    vNegInfFront = vZero;
    vNegInfFront = _mm_insert_epi64_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_add_epi64(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi64x_rpl(-segLen*gap), 8));
    vTIns  = _mm_set1_epi64x_rpl(PARASAIL_INS);
    vTDel  = _mm_set1_epi64x_rpl(PARASAIL_DEL);
    vTDiag = _mm_set1_epi64x_rpl(PARASAIL_DIAG);
    vTDiagE= _mm_set1_epi64x_rpl(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi64x_rpl(PARASAIL_INS_E);
    vTDiagF= _mm_set1_epi64x_rpl(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi64x_rpl(PARASAIL_DEL_F);

    /* initialize result */
    result = parasail_result_new_trace(segLen, s2Len, 16, sizeof(__m128i));
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_SCAN
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_64 | PARASAIL_FLAG_LANES_2;
    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;

    /* initialize heap variables */
    pvE = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_int64_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_64_t h;
            __m128i_64_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT64_MIN ? INT64_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT64_MIN ? INT64_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 < INT64_MIN ? INT64_MIN : tmp;
        }
    }

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

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        __m128i vE_ext;
        __m128i vE_opn;
        __m128i vHt;
        __m128i vF;
        __m128i vF_ext;
        __m128i vF_opn;
        __m128i vH;
        __m128i vHp;
        __m128i *pvW;
        __m128i vW;
        __m128i case1;
        __m128i case2;
        __m128i vGapper;
        __m128i vT;
        __m128i vET;
        __m128i vFT;

        /* calculate E */
        /* calculate Ht */
        /* calculate F and H first pass */
        vHp = _mm_load_si128(pvH+(segLen-1));
        vHp = _mm_slli_si128(vHp, 8);
        vHp = _mm_insert_epi64_rpl(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm_sub_epi64(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);
            vGapper = _mm_load_si128(pvGapper+i);
            vE_opn = _mm_sub_epi64(vH, vGapO);
            vE_ext = _mm_sub_epi64(vE, vGapE);
            case1 = _mm_cmpgt_epi64_rpl(vE_opn, vE_ext);
            vET = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, case1);
            arr_store(result->trace->trace_table, vET, i, segLen, j);
            vE = _mm_max_epi64_rpl(vE_opn, vE_ext);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vE);
            vGapper = _mm_add_epi64(vHt, vGapper);
            vF = _mm_max_epi64_rpl(vF, vGapper);
            vHp = _mm_add_epi64(vHp, vW);
            vHt = _mm_max_epi64_rpl(vE, vHp);
            _mm_store_si128(pvE+i, vE);
            _mm_store_si128(pvHt+i, vHt);
            _mm_store_si128(pvH+i, vHp);
            vHp = vH;
        }

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

        /* calculate final H */
        vF = _mm_slli_si128(vF, 8);
        vF = _mm_add_epi64(vF, vNegInfFront);
        vH = _mm_max_epi64_rpl(vF, vHt);
        for (i=0; i<segLen; ++i) {
            vET = arr_load(result->trace->trace_table, i, segLen, j);
            vHp = _mm_load_si128(pvH+i);
            vHt = _mm_load_si128(pvHt+i);
            vF_opn = _mm_sub_epi64(vH, vGapO);
            vF_ext = _mm_sub_epi64(vF, vGapE);
            vF = _mm_max_epi64_rpl(vF_opn, vF_ext);
            case1 = _mm_cmpgt_epi64_rpl(vF_opn, vF_ext);
            vFT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, case1);
            vH = _mm_max_epi64_rpl(vHt, vF);
            case1 = _mm_cmpeq_epi64_rpl(vH, vHp);
            case2 = _mm_cmpeq_epi64_rpl(vH, vF);
            vT = _mm_blendv_epi8_rpl(
                    _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                    vTDiag, case1);
            vT = _mm_or_si128(vT, vET);
            vT = _mm_or_si128(vT, vFT);
            arr_store(result->trace->trace_table, vT, i, segLen, j);
            _mm_store_si128(pvH+i, vH);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm_max_epi64_rpl(vSaturationCheckMax, vH);
        }

        /* extract vector containing last value from column */
        {
            __m128i vCompare;
            vH = _mm_load_si128(pvH + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi64_rpl(vH, vMaxH));
            vMaxH = _mm_max_epi64_rpl(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
        }
    } 

    /* max last value from all columns */
    if (s2_end)
    {
        for (k=0; k<position; ++k) {
            vMaxH = _mm_slli_si128(vMaxH, 8);
        }
        score = (int64_t) _mm_extract_epi64_rpl(vMaxH, 1);
        end_query = s1Len-1;
    }

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

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi64_rpl(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi64_rpl(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 $0x138, %rsp            # imm = 0x138
movq %rsi, 0x88(%rsp)
testq %rdi, %rdi
je 0x3a2eb9
movq 0x60(%rdi), %rax
movq %rax, 0xf8(%rsp)
testq %rax, %rax
je 0x3a2ec0
movq 0x10(%rdi), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x3a2ec7
movl 0x8(%rdi), %eax
movq %rax, 0x78(%rsp)
testl %eax, %eax
jle 0x3a2ece
cmpq $0x0, 0x88(%rsp)
je 0x3a2ed5
movl %edx, %r13d
testl %edx, %edx
jle 0x3a2edc
movl %ecx, %r14d
testl %ecx, %ecx
js 0x3a2ee3
movl %r8d, %ebp
testl %r8d, %r8d
js 0x3a2eea
movl %r9d, %r15d
movq 0x78(%rsp), %rax
leal -0x1(%rax), %r8d
leaq 0x1(%rax), %rbx
movq %rbx, 0xe0(%rsp)
shrq %rbx
movl %r8d, %eax
xorl %edx, %edx
divl %ebx
movl %edx, 0x58(%rsp)
movl %r14d, %r12d
negl %r14d
movq 0x80(%rsp), %rdi
movslq 0x20(%rdi), %rsi
movq %r12, %rcx
btsq $0x3f, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
subq %rsi, %rdx
cmpl %r14d, %esi
cmovgq %rcx, %rdx
movq %rdx, 0x70(%rsp)
movslq 0x1c(%rdi), %rcx
movq %rcx, 0x90(%rsp)
movl %r8d, 0x10(%rsp)
cmpl %ebx, %r8d
movl $0x0, %ecx
sbbq %rcx, %rcx
movq %rcx, 0x30(%rsp)
movl %eax, 0x24(%rsp)
cmpl $0x1, %eax
sete 0xb0(%rsp)
movl $0x10, %edx
movl $0x10, %ecx
movl %ebx, %edi
movl %r13d, %esi
callq 0x20adf4
xorl %esi, %esi
testq %rax, %rax
je 0x3a2ef1
movq %r14, 0xa0(%rsp)
movl %ebp, 0xc(%rsp)
movl 0x180(%rsp), %edi
xorl %r8d, %r8d
testl %r15d, %r15d
setne %r8b
xorl %ecx, %ecx
cmpl $0x0, 0x170(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x178(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x6c(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%r8,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x2880402, %ecx        # imm = 0x2880402
movq %rax, 0xd8(%rsp)
movl %ecx, 0xc(%rax)
movl $0x10, %edi
movq %rbx, %rsi
callq 0x2f600c
movq %r13, %rcx
movq %rax, %r13
movq %rcx, 0x38(%rsp)
leal 0x1(%rcx), %esi
movl $0x10, %edi
movq %rsi, 0x48(%rsp)
callq 0x20a636
movq %rax, %r14
movl $0x10, %edi
movq %rbx, %rsi
callq 0x2f600c
movq %rax, 0x40(%rsp)
movl $0x10, %edi
movq %rbx, %rsi
callq 0x2f600c
movq %rax, %rbp
movl $0x10, %edi
movq %rbx, 0x18(%rsp)
movq %rbx, %rsi
callq 0x2f600c
movq %r13, 0x60(%rsp)
movq %r13, %xmm0
movq %r14, 0x50(%rsp)
movq %r14, %xmm1
movq 0x40(%rsp), %rcx
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %rcx, %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 %esi, %esi
testl %ecx, %ecx
jne 0x3a2ef1
testq %rax, %rax
movq 0x18(%rsp), %rdx
movl 0xc(%rsp), %edi
movq 0xa0(%rsp), %r8
movq 0x38(%rsp), %rcx
je 0x3a2ef1
leaq 0x108(%rsp), %r11
leaq 0x118(%rsp), %rbx
decl %ecx
movl %ecx, 0x14(%rsp)
movq %r12, %xmm0
pshufd $0x44, %xmm0, %xmm10    # xmm10 = xmm0[0,1,0,1]
movd %edi, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movq 0x70(%rsp), %rcx
incq %rcx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
subq 0x90(%rsp), %rsi
addq $-0x2, %rsi
movq %rcx, 0x28(%rsp)
movq %rcx, %xmm2
movdqa %xmm2, 0x120(%rsp)
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
movdqa %xmm2, 0x90(%rsp)
movq %rsi, 0xd0(%rsp)
movq %rsi, %xmm2
pshufd $0x44, %xmm2, %xmm5     # xmm5 = xmm2[0,1,0,1]
xorl %ecx, %ecx
movb 0xb0(%rsp), %sil
movb %sil, %cl
negq %rcx
movq %rcx, %xmm2
movq 0x30(%rsp), %xmm3
punpcklqdq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0]
movdqa %xmm3, 0xb0(%rsp)
movl %edx, %esi
movl %edi, %edi
movslq %r8d, %r13
xorl %r9d, %r9d
movb $0x1, %r10b
leaq 0x100(%rsp), %rcx
leaq 0x110(%rsp), %rdx
xorl %r14d, %r14d
testl %r15d, %r15d
je 0x3a25b3
xorl %r8d, %r8d
jmp 0x3a25c4
imulq %rsi, %r14
addq %r9, %r14
imulq %rdi, %r14
movq %r13, %r8
subq %r14, %r8
movq %r8, (%rdx)
subq %r12, %r8
movq %r8, (%rcx)
movl $0x1, %r14d
movq %r11, %rcx
movq %rbx, %rdx
testb $0x1, %r10b
movl $0x0, %r10d
jne 0x3a25a9
movq %r9, %rcx
shlq $0x4, %rcx
movaps 0x110(%rsp), %xmm2
movaps %xmm2, (%rbp,%rcx)
movdqa 0x100(%rsp), %xmm2
movq 0x60(%rsp), %rdx
movdqa %xmm2, (%rdx,%rcx)
incq %r9
movq 0x18(%rsp), %r10
cmpq %r10, %r9
jne 0x3a2593
movq 0x50(%rsp), %r8
movq $0x0, (%r8)
movl 0x38(%rsp), %ecx
movq 0x48(%rsp), %r14
andl $-0x2, %r14d
movq %rcx, 0x48(%rsp)
decq %rcx
movq %rcx, %xmm2
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
movl 0xc(%rsp), %r9d
movl %r9d, %ecx
negl %ecx
addl %r9d, %r9d
xorl %edx, %edx
movdqa 0x286831(%rip), %xmm3   # 0x628e90
movdqa 0x286839(%rip), %xmm4   # 0x628ea0
pxor %xmm4, %xmm2
pcmpeqd %xmm6, %xmm6
xorl %esi, %esi
movq 0xd8(%rsp), %r13
movq 0xa0(%rsp), %r11
movl 0x178(%rsp), %ebx
movq %rsi, %xmm7
pshufd $0x44, %xmm7, %xmm7     # xmm7 = xmm7[0,1,0,1]
por %xmm3, %xmm7
pxor %xmm4, %xmm7
movdqa %xmm7, %xmm8
pcmpgtd %xmm2, %xmm8
pcmpeqd %xmm2, %xmm7
pshufd $0xf5, %xmm7, %xmm9     # xmm9 = xmm7[1,1,3,3]
pand %xmm8, %xmm9
pshufd $0xf5, %xmm8, %xmm7     # xmm7 = xmm8[1,1,3,3]
por %xmm9, %xmm7
movd %xmm7, %edi
notl %edi
testb $0x1, %dil
je 0x3a26dd
testl %ebx, %ebx
movl $0x0, %edi
cmovel %r11d, %edi
movslq %edi, %rdi
movq %rdi, 0x8(%r8,%rsi,8)
pxor %xmm6, %xmm7
pextrw $0x4, %xmm7, %edi
testb $0x1, %dil
je 0x3a26fd
leal (%rcx,%r11), %edi
testl %ebx, %ebx
cmovnel %edx, %edi
movslq %edi, %rdi
movq %rdi, 0x10(%r8,%rsi,8)
addq $0x2, %rsi
subl %r9d, %r11d
cmpq %rsi, %r14
jne 0x3a2688
pxor %xmm2, %xmm2
psubq %xmm10, %xmm2
leal -0x1(%r10), %edx
shlq $0x4, %rdx
movq %rax, %rcx
movq %rdx, 0x30(%rsp)
addq %rdx, %rcx
movdqa 0x28725f(%rip), %xmm6   # 0x629990
movl %r10d, %edx
movq 0x40(%rsp), %r14
movdqa %xmm2, (%rcx)
psubq %xmm1, %xmm2
movdqa %xmm5, %xmm3
pxor %xmm6, %xmm5
movdqa %xmm2, %xmm4
pxor %xmm6, %xmm4
movdqa %xmm4, %xmm7
pcmpgtd %xmm5, %xmm7
pshufd $0xa0, %xmm7, %xmm8     # xmm8 = xmm7[0,0,2,2]
pcmpeqd %xmm5, %xmm4
pshufd $0xf5, %xmm4, %xmm4     # xmm4 = xmm4[1,1,3,3]
pand %xmm8, %xmm4
pshufd $0xf5, %xmm7, %xmm5     # xmm5 = xmm7[1,1,3,3]
por %xmm4, %xmm5
pand %xmm5, %xmm3
pandn %xmm2, %xmm5
por %xmm3, %xmm5
addq $-0x10, %rcx
decl %edx
jg 0x3a2739
addq %rbp, 0x30(%rsp)
movl 0x58(%rsp), %ecx
movq %rcx, 0xc8(%rsp)
shlq $0x4, %rcx
addq %rbp, %rcx
movq %rcx, 0xf0(%rsp)
movq 0x18(%rsp), %rcx
movq %rcx, %r11
shlq $0x4, %r11
xorl %r15d, %r15d
movslq %ecx, %rcx
movq %rcx, 0xe8(%rsp)
xorl %r10d, %r10d
movl 0x14(%rsp), %ecx
movl %ecx, 0xc(%rsp)
movdqa 0x90(%rsp), %xmm2
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm0
movdqa %xmm0, 0xa0(%rsp)
movq 0x50(%rsp), %r8
movq (%r8,%r10,8), %xmm2
movq 0x30(%rsp), %rcx
punpcklqdq (%rcx), %xmm2   # xmm2 = xmm2[0],mem[0]
movq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x88(%rsp), %rdx
movzbl (%rdx,%r10), %edx
movslq (%rcx,%rdx,4), %rcx
imulq 0xe8(%rsp), %rcx
shlq $0x4, %rcx
addq 0xf8(%rsp), %rcx
movdqa 0x90(%rsp), %xmm15
movdqa %xmm15, %xmm3
psubq (%rax), %xmm3
xorl %edx, %edx
movq 0x60(%rsp), %rdi
movdqa 0x28668e(%rip), %xmm0   # 0x628ee0
movdqa (%rbp,%rdx), %xmm9
movdqa (%rdi,%rdx), %xmm8
movdqa %xmm9, %xmm7
psubq %xmm10, %xmm7
psubq %xmm1, %xmm8
movdqa %xmm8, %xmm13
pxor %xmm6, %xmm13
movdqa %xmm7, %xmm4
pxor %xmm6, %xmm4
movdqa %xmm1, %xmm12
movdqa %xmm10, %xmm1
movdqa %xmm4, %xmm10
pcmpgtd %xmm13, %xmm10
pshufd $0xa0, %xmm10, %xmm11   # xmm11 = xmm10[0,0,2,2]
pcmpeqd %xmm13, %xmm4
pshufd $0xf5, %xmm4, %xmm4     # xmm4 = xmm4[1,1,3,3]
pand %xmm11, %xmm4
pshufd $0xf5, %xmm10, %xmm13   # xmm13 = xmm10[1,1,3,3]
por %xmm4, %xmm13
movdqa %xmm13, %xmm4
pandn 0x288dff(%rip), %xmm4   # 0x62b6c0
movdqa %xmm13, %xmm10
pand %xmm0, %xmm10
por %xmm4, %xmm10
movq 0x10(%r13), %rsi
movq (%rsi), %rsi
addq %r15, %rsi
paddq (%rax,%rdx), %xmm3
paddq (%rcx,%rdx), %xmm2
movdqa %xmm10, (%rdx,%rsi)
movdqa %xmm3, %xmm4
pxor %xmm6, %xmm4
movdqa %xmm15, %xmm10
pxor %xmm6, %xmm10
movdqa %xmm10, %xmm11
pcmpgtd %xmm4, %xmm11
pcmpeqd %xmm4, %xmm10
pshufd $0xa0, %xmm11, %xmm4    # xmm4 = xmm11[0,0,2,2]
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pand %xmm4, %xmm10
pshufd $0xf5, %xmm11, %xmm4    # xmm4 = xmm11[1,1,3,3]
por %xmm10, %xmm4
movdqa %xmm15, %xmm10
pand %xmm4, %xmm10
pandn %xmm3, %xmm4
movdqa %xmm4, %xmm15
por %xmm10, %xmm15
movdqa %xmm1, %xmm10
movdqa %xmm12, %xmm1
pand %xmm13, %xmm7
pandn %xmm8, %xmm13
por %xmm7, %xmm13
movdqa %xmm5, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm13, %xmm4
pxor %xmm6, %xmm4
movdqa %xmm4, %xmm7
pcmpgtd %xmm3, %xmm7
pshufd $0xa0, %xmm7, %xmm8     # xmm8 = xmm7[0,0,2,2]
pcmpeqd %xmm4, %xmm3
pshufd $0xf5, %xmm3, %xmm3     # xmm3 = xmm3[1,1,3,3]
pand %xmm8, %xmm3
movdqa %xmm5, %xmm8
pshufd $0xf5, %xmm7, %xmm5     # xmm5 = xmm7[1,1,3,3]
por %xmm3, %xmm5
pand %xmm5, %xmm8
pandn %xmm13, %xmm5
por %xmm8, %xmm5
movdqa %xmm2, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm4, %xmm7
pcmpgtd %xmm3, %xmm7
pcmpeqd %xmm4, %xmm3
pshufd $0xa0, %xmm7, %xmm4     # xmm4 = xmm7[0,0,2,2]
pshufd $0xf5, %xmm3, %xmm8     # xmm8 = xmm3[1,1,3,3]
pand %xmm4, %xmm8
pshufd $0xf5, %xmm7, %xmm3     # xmm3 = xmm7[1,1,3,3]
por %xmm8, %xmm3
movdqa %xmm13, (%rdi,%rdx)
pand %xmm3, %xmm13
pandn %xmm2, %xmm3
por %xmm13, %xmm3
movdqa %xmm3, (%r14,%rdx)
movdqa %xmm2, (%rbp,%rdx)
addq $0x10, %rdx
movdqa %xmm9, %xmm2
cmpq %rdx, %r11
jne 0x3a2852
leaq 0x1(%r10), %rcx
movq %rcx, 0x58(%rsp)
movq %r10, 0x38(%rsp)
movq 0x8(%r8,%r10,8), %rcx
movq %rcx, %xmm4
addq (%rax), %rcx
movq %xmm15, %rdx
cmpq %rcx, %rdx
cmovgq %rdx, %rcx
movq %rcx, %xmm2
pslldq $0x8, %xmm2             # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm2[0,1,2,3,4,5,6,7]
paddq 0x120(%rsp), %xmm2
punpcklqdq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0]
movdqa %xmm2, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm4, %xmm7
pxor %xmm6, %xmm7
movdqa %xmm3, %xmm8
pcmpgtd %xmm7, %xmm8
pshufd $0xa0, %xmm8, %xmm9     # xmm9 = xmm8[0,0,2,2]
pcmpeqd %xmm3, %xmm7
pshufd $0xf5, %xmm7, %xmm3     # xmm3 = xmm7[1,1,3,3]
pand %xmm9, %xmm3
pshufd $0xf5, %xmm8, %xmm15    # xmm15 = xmm8[1,1,3,3]
por %xmm3, %xmm15
movdqa %xmm2, %xmm3
pand %xmm15, %xmm3
pandn %xmm4, %xmm15
por %xmm3, %xmm15
xorl %r10d, %r10d
movdqa 0x288c39(%rip), %xmm0   # 0x62b6d0
movdqa 0x288c40(%rip), %xmm9   # 0x62b6e0
movdqa 0x287677(%rip), %xmm11  # 0x62a120
movdqa 0x2863fe(%rip), %xmm12  # 0x628eb0
movq 0x10(%r13), %rcx
movq (%rcx), %rdi
addq %r15, %rdi
psubq %xmm10, %xmm15
psubq %xmm1, %xmm2
movdqa %xmm2, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm15, %xmm4
pxor %xmm6, %xmm4
movdqa %xmm4, %xmm7
pcmpgtd %xmm3, %xmm7
pshufd $0xa0, %xmm7, %xmm8     # xmm8 = xmm7[0,0,2,2]
pcmpeqd %xmm3, %xmm4
pshufd $0xf5, %xmm4, %xmm4     # xmm4 = xmm4[1,1,3,3]
pand %xmm8, %xmm4
pshufd $0xf5, %xmm7, %xmm3     # xmm3 = xmm7[1,1,3,3]
por %xmm4, %xmm3
movdqa %xmm3, %xmm4
pandn %xmm2, %xmm4
pand %xmm3, %xmm15
movdqa %xmm15, %xmm2
por %xmm4, %xmm2
movdqa %xmm3, %xmm4
pandn %xmm0, %xmm4
pand %xmm9, %xmm3
por %xmm4, %xmm3
movq %xmm2, %rsi
movq (%r14,%r10), %r8
movq 0x8(%r14,%r10), %r9
cmpq %rsi, %r8
movq %rsi, %rcx
cmovgq %r8, %rcx
pshufd $0xee, %xmm2, %xmm4     # xmm4 = xmm2[2,3,2,3]
movq %xmm4, %rdx
cmpq %rdx, %r9
movq %rdx, %r12
cmovgq %r9, %r12
movq %rcx, %xmm15
movq %r12, %xmm4
xorl %ebx, %ebx
cmpq (%rbp,%r10), %rcx
sete %bl
negq %rbx
xorl %r14d, %r14d
cmpq 0x8(%rbp,%r10), %r12
punpcklqdq %xmm4, %xmm15   # xmm15 = xmm15[0],xmm4[0]
sete %r14b
negq %r14
movq %rbx, %xmm4
movq %r14, %xmm7
movq 0x40(%rsp), %r14
punpcklqdq %xmm7, %xmm4    # xmm4 = xmm4[0],xmm7[0]
xorl %ebx, %ebx
cmpq %r8, %rsi
setge %bl
negq %rbx
xorl %r8d, %r8d
cmpq %r9, %rdx
setge %r8b
negq %r8
movq %rbx, %xmm7
movq %r8, %xmm8
punpcklqdq %xmm8, %xmm7    # xmm7 = xmm7[0],xmm8[0]
psrlq $0x3e, %xmm7
pxor %xmm11, %xmm7
movdqa %xmm4, %xmm8
pandn %xmm7, %xmm8
pand %xmm12, %xmm4
por (%r10,%rdi), %xmm3
por %xmm8, %xmm3
por %xmm4, %xmm3
movdqa %xmm3, (%r10,%rdi)
movq %xmm5, %r9
cmpq %rcx, %r9
cmovgeq %rcx, %r9
pshufd $0xee, %xmm5, %xmm3     # xmm3 = xmm5[2,3,2,3]
movq %xmm3, %rdi
cmpq %r12, %rdi
cmovgeq %r12, %rdi
movdqa %xmm15, (%rbp,%r10)
cmpq %rsi, %r9
cmovgeq %rsi, %r9
cmpq %rdx, %rdi
cmovgeq %rdx, %rdi
movq %r9, %xmm5
movq %rdi, %xmm3
punpcklqdq %xmm3, %xmm5    # xmm5 = xmm5[0],xmm3[0]
movq %xmm14, %rdx
cmpq %rcx, %rdx
cmovgq %rdx, %rcx
pshufd $0xee, %xmm14, %xmm3    # xmm3 = xmm14[2,3,2,3]
movq %xmm3, %rdx
cmpq %r12, %rdx
cmovgq %rdx, %r12
movq %rcx, %xmm14
movq %r12, %xmm3
punpcklqdq %xmm3, %xmm14   # xmm14 = xmm14[0],xmm3[0]
addq $0x10, %r10
cmpq %r10, %r11
jne 0x3a2ab2
movdqa 0xa0(%rsp), %xmm0
movq %xmm0, %rdx
movq 0xf0(%rsp), %r8
movq (%r8), %rsi
movq 0x8(%r8), %r8
pshufd $0xee, %xmm0, %xmm2     # xmm2 = xmm0[2,3,2,3]
movq %xmm2, %r10
xorl %ebx, %ebx
cmpq %r10, %r8
setg %bl
cmovgq %r8, %r10
xorl %r8d, %r8d
cmpq %rdx, %rsi
setg %r8b
cmovgq %rsi, %rdx
negq %r8
negq %rbx
movq %r8, %xmm2
movq %rbx, %xmm3
punpcklqdq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0]
pand 0xb0(%rsp), %xmm2
movq %rdx, %xmm0
movq %r10, %xmm3
pmovmskb %xmm2, %edx
testl %edx, %edx
movl 0xc(%rsp), %edx
cmovnel 0x38(%rsp), %edx
movl %edx, 0xc(%rsp)
punpcklqdq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0]
addq %r11, %r15
movq 0x58(%rsp), %rdx
movq %rdx, %r10
cmpq 0x48(%rsp), %rdx
jne 0x3a27e1
cmpl $0x0, 0x180(%rsp)
movl 0x24(%rsp), %edx
movq 0x78(%rsp), %r15
je 0x3a2d1b
testl %edx, %edx
jg 0x3a2d10
pslldq $0x8, %xmm0             # xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
testl %edx, %edx
js 0x3a2d07
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, 0x28(%rsp)
cmpl $0x0, 0x170(%rsp)
je 0x3a2db0
testl $0x7ffffffe, 0xe0(%rsp) # imm = 0x7FFFFFFE
je 0x3a2db0
movq 0x18(%rsp), %rdx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
addl %edx, %edx
xorl %esi, %esi
movl 0x10(%rsp), %r8d
movl %esi, %r11d
shrl %r11d
testb $0x1, %sil
movl $0x0, %r10d
cmovnel 0x18(%rsp), %r10d
addl %r11d, %r10d
cmpl %r15d, %r10d
jge 0x3a2da7
movq (%rbp,%rsi,8), %r11
movq 0x28(%rsp), %rbx
cmpq %rbx, %r11
jle 0x3a2d8b
movq %r11, 0x28(%rsp)
movl 0x14(%rsp), %r8d
movl %r8d, 0xc(%rsp)
movl %r10d, %r8d
jmp 0x3a2da7
cmpl %r8d, %r10d
cmovgel %r8d, %r10d
movl 0xc(%rsp), %r14d
cmpl 0x14(%rsp), %r14d
cmovnel %r8d, %r10d
cmpq %rbx, %r11
cmovel %r10d, %r8d
incq %rsi
cmpl %esi, %edx
jne 0x3a2d4a
jmp 0x3a2db5
movl 0x10(%rsp), %r8d
movl 0x170(%rsp), %edx
orl %edx, 0x6c(%rsp)
movq 0x28(%rsp), %r11
jne 0x3a2e01
movq 0xc8(%rsp), %rdx
shlq $0x4, %rdx
movdqa (%rbp,%rdx), %xmm0
movl 0x24(%rsp), %edx
testl %edx, %edx
jg 0x3a2dea
pslldq $0x8, %xmm0             # xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
testl %edx, %edx
js 0x3a2de1
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %r11
movl 0x14(%rsp), %edx
movl %edx, 0xc(%rsp)
movl 0x10(%rsp), %r8d
xorl %edx, %edx
movq 0x70(%rsp), %r10
cmpq %r10, %r9
setle %dl
negq %rdx
xorl %esi, %esi
cmpq %r10, %rdi
setle %sil
negq %rsi
movq %rsi, %xmm0
movq %rdx, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
xorl %edx, %edx
movq 0xd0(%rsp), %rsi
cmpq %rsi, %rcx
setg %dl
negq %rdx
xorl %ecx, %ecx
cmpq %rsi, %r12
setg %cl
negq %rcx
movq %rcx, %xmm0
movq %rdx, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
por %xmm1, %xmm2
pmovmskb %xmm2, %ecx
testl %ecx, %ecx
je 0x3a2e76
orb $0x40, 0xc(%r13)
xorl %r11d, %r11d
movl $0x0, 0xc(%rsp)
xorl %r8d, %r8d
movl %r11d, (%r13)
movl %r8d, 0x4(%r13)
movl 0xc(%rsp), %ecx
movl %ecx, 0x8(%r13)
movq %rax, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq 0x40(%rsp), %rdi
callq 0x20a60d
movq 0x50(%rsp), %rdi
callq 0x20a60d
movq 0x60(%rsp), %rdi
callq 0x20a60d
movq %r13, %rsi
jmp 0x3a2ef1
callq 0x1bc39b
jmp 0x3a2eef
callq 0x1bc375
jmp 0x3a2eef
callq 0x1bc34f
jmp 0x3a2eef
callq 0x1bc329
jmp 0x3a2eef
callq 0x1bc303
jmp 0x3a2eef
callq 0x1bc2dd
jmp 0x3a2eef
callq 0x1bc2b7
jmp 0x3a2eef
callq 0x1bc291
xorl %esi, %esi
movq %rsi, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq