// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_trace_scan_sse41_128_8.c
// Function: parasail_sg_flags_trace_scan_profile_sse41_128_8
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;
    int8_t* restrict boundary = NULL;
    __m128i* restrict pvHt = NULL;
    __m128i* restrict pvH = NULL;
    __m128i* restrict pvGapper = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int8_t NEG_LIMIT = 0;
    int8_t POS_LIMIT = 0;
    __m128i vZero;
    int8_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->profile8.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 = 16; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m128i*)profile->profile8.score;
    vGapO = _mm_set1_epi8(open);
    vGapE = _mm_set1_epi8(gap);
    NEG_LIMIT = (-open < matrix->min ? INT8_MIN + open : INT8_MIN - matrix->min) + 1;
    POS_LIMIT = INT8_MAX - matrix->max - 1;
    vZero = _mm_setzero_si128();
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi8(NEG_LIMIT);
    vPosLimit = _mm_set1_epi8(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi8(_mm_set1_epi8(position),
            _mm_set_epi8(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15));
    vNegInfFront = vZero;
    vNegInfFront = _mm_insert_epi8(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_adds_epi8(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi8(-segLen*gap), 1));
    vTIns  = _mm_set1_epi8(PARASAIL_INS);
    vTDel  = _mm_set1_epi8(PARASAIL_DEL);
    vTDiag = _mm_set1_epi8(PARASAIL_DIAG);
    vTDiagE= _mm_set1_epi8(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi8(PARASAIL_INS_E);
    vTDiagF= _mm_set1_epi8(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi8(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_8 | PARASAIL_FLAG_LANES_16;
    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_int8_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_8_t h;
            __m128i_8_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT8_MIN ? INT8_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT8_MIN ? INT8_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 < INT8_MIN ? INT8_MIN : tmp;
        }
    }

    {
        __m128i vGapper = _mm_subs_epi8(vZero,vGapO);
        for (i=segLen-1; i>=0; --i) {
            _mm_store_si128(pvGapper+i, vGapper);
            vGapper = _mm_subs_epi8(vGapper, vGapE);
            /* long queries and/or large penalties will break the pseudo prefix scan */
            vSaturationCheckMin = _mm_min_epi8(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, 1);
        vHp = _mm_insert_epi8(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm_subs_epi8(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_subs_epi8(vH, vGapO);
            vE_ext = _mm_subs_epi8(vE, vGapE);
            case1 = _mm_cmpgt_epi8(vE_opn, vE_ext);
            vET = _mm_blendv_epi8(vTInsE, vTDiagE, case1);
            arr_store(result->trace->trace_table, vET, i, segLen, j);
            vE = _mm_max_epi8(vE_opn, vE_ext);
            vSaturationCheckMin = _mm_min_epi8(vSaturationCheckMin, vE);
            vGapper = _mm_adds_epi8(vHt, vGapper);
            vF = _mm_max_epi8(vF, vGapper);
            vHp = _mm_adds_epi8(vHp, vW);
            vHt = _mm_max_epi8(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, 1);
        vHt = _mm_insert_epi8(vHt, boundary[j+1], 0);
        vGapper = _mm_load_si128(pvGapper);
        vGapper = _mm_adds_epi8(vHt, vGapper);
        vF = _mm_max_epi8(vF, vGapper);
        for (i=0; i<segWidth-2; ++i) {
            __m128i vFt = _mm_slli_si128(vF, 1);
            vFt = _mm_adds_epi8(vFt, vSegLenXgap);
            vF = _mm_max_epi8(vF, vFt);
        }

        /* calculate final H */
        vF = _mm_slli_si128(vF, 1);
        vF = _mm_adds_epi8(vF, vNegInfFront);
        vH = _mm_max_epi8(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_subs_epi8(vH, vGapO);
            vF_ext = _mm_subs_epi8(vF, vGapE);
            vF = _mm_max_epi8(vF_opn, vF_ext);
            case1 = _mm_cmpgt_epi8(vF_opn, vF_ext);
            vFT = _mm_blendv_epi8(vTDelF, vTDiagF, case1);
            vH = _mm_max_epi8(vHt, vF);
            case1 = _mm_cmpeq_epi8(vH, vHp);
            case2 = _mm_cmpeq_epi8(vH, vF);
            vT = _mm_blendv_epi8(
                    _mm_blendv_epi8(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_epi8(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi8(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm_max_epi8(vSaturationCheckMax, vH);
        }

        /* extract vector containing last value from column */
        {
            __m128i vCompare;
            vH = _mm_load_si128(pvH + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi8(vH, vMaxH));
            vMaxH = _mm_max_epi8(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, 1);
        }
        score = (int8_t) _mm_extract_epi8(vMaxH, 15);
        end_query = s1Len-1;
    }

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

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi8(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi8(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 $0x108, %rsp            # imm = 0x108
movq %rsi, 0x78(%rsp)
testq %rdi, %rdi
je 0x498c6e
movq 0x18(%rdi), %rax
movq %rax, 0xa8(%rsp)
testq %rax, %rax
je 0x498c75
movq 0x10(%rdi), %rax
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x498c7c
movl %r8d, %r12d
movl %edx, %r8d
movl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x498c83
cmpq $0x0, 0x78(%rsp)
je 0x498c8a
testl %r8d, %r8d
jle 0x498c91
testl %ecx, %ecx
js 0x498c98
testl %r12d, %r12d
js 0x498c9f
movl %r9d, %r13d
leal -0x1(%rdx), %eax
movq %rdx, 0xa0(%rsp)
leaq 0xf(%rdx), %r14
movq %r14, %rdi
shrq $0x4, %rdi
movl %eax, 0x4c(%rsp)
xorl %edx, %edx
divl %edi
movl %eax, 0x8(%rsp)
movl %edx, %ebp
movl %ecx, %r15d
negl %r15d
movq 0x70(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negb %sil
cmpl %r15d, %eax
movzbl %sil, %eax
movl %ecx, 0x30(%rsp)
cmovgl %ecx, %eax
movl %eax, 0xc(%rsp)
movb $0x7e, %al
subb 0x1c(%rdx), %al
movb %al, 0x60(%rsp)
movl $0x10, %edx
movl $0x10, %ecx
movq %rdi, 0x18(%rsp)
movl %r8d, %esi
movq %r8, 0x10(%rsp)
callq 0x20adf4
testq %rax, %rax
je 0x498ca4
movq %rax, %rbx
movl %r12d, 0x50(%rsp)
movl %r15d, 0x2c(%rsp)
movl %ebp, 0x44(%rsp)
movq %r14, 0x98(%rsp)
movl 0x150(%rsp), %edi
xorl %eax, %eax
testl %r13d, %r13d
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x140(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x148(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x48(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%rbx), %eax
orl $0x10180402, %eax       # imm = 0x10180402
movl %eax, 0xc(%rbx)
movl $0x10, %edi
movq 0x18(%rsp), %r12
movq %r12, %rsi
callq 0x2f600c
movq %rax, %r15
movq 0x10(%rsp), %rax
leal 0x1(%rax), %esi
movl $0x10, %edi
callq 0x20a620
movq %rax, 0x20(%rsp)
movl $0x10, %edi
movq %r12, %rsi
callq 0x2f600c
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x2f600c
movq %rax, %rbp
movl $0x10, %edi
movq %r12, %rsi
callq 0x2f600c
testq %r15, %r15
sete %cl
cmpq $0x0, 0x20(%rsp)
sete %dl
orb %cl, %dl
testq %r14, %r14
sete %cl
testq %rbp, %rbp
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x498ca4
movq 0x10(%rsp), %rcx
decl %ecx
movl %ecx, 0x4(%rsp)
movl $0xf, %edx
subl 0x8(%rsp), %edx
movl 0x30(%rsp), %edi
movd %edi, %xmm4
pxor %xmm1, %xmm1
pshufb %xmm1, %xmm4
movl 0x50(%rsp), %esi
movd %esi, %xmm0
movdqa %xmm0, %xmm5
pshufb %xmm1, %xmm5
movl 0xc(%rsp), %ecx
addb $-0x7f, %cl
movl %ecx, 0xc(%rsp)
movzbl %cl, %ecx
movd %ecx, %xmm3
movdqa %xmm3, %xmm2
pshufb %xmm1, %xmm2
movdqa %xmm2, 0x80(%rsp)
movzbl 0x60(%rsp), %ecx
movd %ecx, %xmm2
pshufb %xmm1, %xmm2
movdqa %xmm2, 0xb0(%rsp)
movl %edx, 0x28(%rsp)
movd %edx, %xmm2
pshufb %xmm1, %xmm2
movdqa %xmm2, 0x60(%rsp)
movq 0x18(%rsp), %rdx
movl %edx, %ecx
imull %esi, %ecx
negb %cl
movzbl %cl, %ecx
movd %ecx, %xmm8
pshufb 0x191e38(%rip), %xmm8   # 0x62a100
movdqa %xmm3, 0xd0(%rsp)
paddsb %xmm3, %xmm8
movl %edi, %ecx
movl %esi, %esi
movslq 0x2c(%rsp), %r12
movq %rdx, %rdi
movq %rsi, 0x30(%rsp)
imulq %rsi, %rdi
xorl %r8d, %r8d
movq $-0x80, %r9
movq %r12, %rsi
xorl %r11d, %r11d
testl %r13d, %r13d
je 0x498305
xorl %r10d, %r10d
jmp 0x498308
movq %rsi, %r10
cmpq $-0x7f, %r10
movq $-0x80, %rdx
cmovgeq %r10, %rdx
movb %dl, 0xf0(%rsp,%r11)
subq %rcx, %r10
cmpq $-0x7f, %r10
cmovlq %r9, %r10
movb %r10b, 0xe0(%rsp,%r11)
incq %r11
subq %rdi, %rsi
cmpq $0x10, %r11
jne 0x4982fb
movq %r8, %rdx
shlq $0x4, %rdx
movaps 0xf0(%rsp), %xmm1
movaps %xmm1, (%rbp,%rdx)
movdqa 0xe0(%rsp), %xmm1
movdqa %xmm1, (%r15,%rdx)
incq %r8
subq 0x30(%rsp), %r12
cmpq 0x18(%rsp), %r8
jne 0x4982f5
movq 0x20(%rsp), %rdx
movb $0x0, (%rdx)
movq 0x10(%rsp), %r8
movl %r8d, %ecx
addl $0xf, %r8d
andl $-0x10, %r8d
movq %rcx, 0x10(%rsp)
decq %rcx
movq %rcx, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqa %xmm1, 0x30(%rsp)
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x50(%rsp)
movd 0x2c(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm2      # xmm2 = xmm0[0,0,0,0]
pmovsxbd 0x193a91(%rip), %xmm1   # 0x62be50
pmovsxbd 0x193a8b(%rip), %xmm11  # 0x62be54
pmovsxbd 0x193a85(%rip), %xmm12  # 0x62be58
pmovsxbd 0x193a7f(%rip), %xmm13  # 0x62be5c
xorl %edi, %edi
movdqa 0x1938a9(%rip), %xmm3   # 0x62bc90
pcmpeqd %xmm14, %xmm14
pmovsxbd 0x193a6b(%rip), %xmm7   # 0x62be60
movq 0x18(%rsp), %rsi
movl 0x148(%rsp), %r9d
testl %r9d, %r9d
je 0x498411
pxor %xmm9, %xmm9
jmp 0x4984ce
movdqa %xmm13, %xmm0
paddd %xmm14, %xmm0
movdqa %xmm12, %xmm6
paddd %xmm14, %xmm6
movdqa %xmm11, %xmm15
paddd %xmm14, %xmm15
movdqa %xmm1, %xmm10
paddd %xmm14, %xmm10
movdqa 0x50(%rsp), %xmm9
pmulld %xmm9, %xmm10
pmulld %xmm9, %xmm15
pmulld %xmm9, %xmm6
pmulld %xmm9, %xmm0
movdqa %xmm2, %xmm9
psubd %xmm0, %xmm9
movdqa %xmm2, %xmm0
psubd %xmm6, %xmm0
movdqa %xmm2, %xmm6
psubd %xmm15, %xmm6
movdqa %xmm2, %xmm15
psubd %xmm10, %xmm15
pmovsxbd 0x193985(%rip), %xmm10  # 0x62be0c
pmaxsd %xmm10, %xmm15
pmaxsd %xmm10, %xmm6
pmaxsd %xmm10, %xmm0
pmaxsd %xmm10, %xmm9
pmovzxbd 0x1939bb(%rip), %xmm10  # 0x62be64
pand %xmm10, %xmm9
pand %xmm10, %xmm0
packusdw %xmm0, %xmm9
pand %xmm10, %xmm6
pand %xmm10, %xmm15
packusdw %xmm15, %xmm6
packuswb %xmm6, %xmm9
movq %rdi, %xmm0
pshufd $0x44, %xmm0, %xmm6     # xmm6 = xmm0[0,1,0,1]
movdqa %xmm6, %xmm0
por 0x1909ac(%rip), %xmm0   # 0x628e90
movdqa 0x30(%rsp), %xmm15
pxor %xmm3, %xmm15
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
pshuflw $0xe8, %xmm0, %xmm10    # xmm10 = xmm0[0,2,2,3,4,5,6,7]
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
movd %xmm10, %ecx
testb $0x1, %cl
je 0x49851d
pextrb $0x0, %xmm9, 0x1(%rdx,%rdi)
packssdw %xmm0, %xmm0
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0x1, %xmm0, %ecx
testb $0x1, %cl
je 0x498542
pextrb $0x1, %xmm9, 0x2(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x190932(%rip), %xmm0   # 0x628e80
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
packssdw %xmm0, %xmm10
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0x2, %xmm10, %ecx
testb $0x1, %cl
je 0x498581
pextrb $0x2, %xmm9, 0x3(%rdx,%rdi)
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0x3, %xmm0, %ecx
testb $0x1, %cl
je 0x4985a7
pextrb $0x3, %xmm9, 0x4(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x19091d(%rip), %xmm0   # 0x628ed0
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
pshuflw $0xe8, %xmm0, %xmm10    # xmm10 = xmm0[0,2,2,3,4,5,6,7]
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0x4, %xmm10, %ecx
testb $0x1, %cl
je 0x4985e7
pextrb $0x4, %xmm9, 0x5(%rdx,%rdi)
packssdw %xmm0, %xmm0
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0x5, %xmm0, %ecx
testb $0x1, %cl
je 0x49860c
pextrb $0x5, %xmm9, 0x6(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x1908a8(%rip), %xmm0   # 0x628ec0
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
packssdw %xmm0, %xmm10
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0x6, %xmm10, %ecx
testb $0x1, %cl
je 0x49864b
pextrb $0x6, %xmm9, 0x7(%rdx,%rdi)
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0x7, %xmm0, %ecx
testb $0x1, %cl
je 0x498671
pextrb $0x7, %xmm9, 0x8(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x191563(%rip), %xmm0   # 0x629be0
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
pshuflw $0xe8, %xmm0, %xmm10    # xmm10 = xmm0[0,2,2,3,4,5,6,7]
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0x8, %xmm10, %ecx
testb $0x1, %cl
je 0x4986b1
pextrb $0x8, %xmm9, 0x9(%rdx,%rdi)
packssdw %xmm0, %xmm0
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0x9, %xmm0, %ecx
testb $0x1, %cl
je 0x4986d6
pextrb $0x9, %xmm9, 0xa(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x1914ee(%rip), %xmm0   # 0x629bd0
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
packssdw %xmm0, %xmm10
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0xa, %xmm10, %ecx
testb $0x1, %cl
je 0x498715
pextrb $0xa, %xmm9, 0xb(%rdx,%rdi)
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0xb, %xmm0, %ecx
testb $0x1, %cl
je 0x49873b
pextrb $0xb, %xmm9, 0xc(%rdx,%rdi)
movdqa %xmm6, %xmm0
por 0x191479(%rip), %xmm0   # 0x629bc0
pxor %xmm3, %xmm0
pcmpgtq %xmm15, %xmm0
pshuflw $0xe8, %xmm0, %xmm10    # xmm10 = xmm0[0,2,2,3,4,5,6,7]
pxor %xmm14, %xmm10
packssdw %xmm10, %xmm10
packsswb %xmm10, %xmm10
pextrb $0xc, %xmm10, %ecx
testb $0x1, %cl
je 0x49877b
pextrb $0xc, %xmm9, 0xd(%rdx,%rdi)
packssdw %xmm0, %xmm0
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0xd, %xmm0, %ecx
testb $0x1, %cl
je 0x4987a0
pextrb $0xd, %xmm9, 0xe(%rdx,%rdi)
por 0x191408(%rip), %xmm6   # 0x629bb0
pxor %xmm3, %xmm6
pcmpgtq %xmm15, %xmm6
packssdw %xmm6, %xmm0
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0xe, %xmm0, %ecx
testb $0x1, %cl
je 0x4987d7
pextrb $0xe, %xmm9, 0xf(%rdx,%rdi)
pshufhw $0x84, %xmm6, %xmm0     # xmm0 = xmm6[0,1,2,3,4,5,4,6]
pxor %xmm14, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrb $0xf, %xmm0, %ecx
testb $0x1, %cl
je 0x4987fd
pextrb $0xf, %xmm9, 0x10(%rdx,%rdi)
addq $0x10, %rdi
paddd %xmm7, %xmm13
paddd %xmm7, %xmm12
paddd %xmm7, %xmm11
paddd %xmm7, %xmm1
cmpq %rdi, %r8
jne 0x498402
pxor %xmm0, %xmm0
psubsb %xmm4, %xmm0
leal -0x1(%rsi), %edx
shlq $0x4, %rdx
movq %rax, %rcx
movq %rdx, %r12
addq %rdx, %rcx
movl %esi, %edx
movdqa 0xb0(%rsp), %xmm9
movdqa %xmm0, (%rcx)
psubsb %xmm5, %xmm0
pminsb %xmm0, %xmm9
addq $-0x10, %rcx
decl %edx
jg 0x498841
addq %rbp, %r12
movl 0x44(%rsp), %r10d
movq %r10, 0x50(%rsp)
shlq $0x4, %r10
addq %rbp, %r10
movq %rsi, %r11
shlq $0x4, %r11
xorl %r13d, %r13d
movl %esi, %edi
movdqa 0x131941(%rip), %xmm3   # 0x5ca1c0
movdqa 0x131929(%rip), %xmm6   # 0x5ca1b0
movdqa 0x131951(%rip), %xmm7   # 0x5ca1e0
movdqa 0x131908(%rip), %xmm13  # 0x5ca1a0
movdqa 0x60(%rsp), %xmm0
pcmpeqb 0x1913aa(%rip), %xmm0   # 0x629c50
movdqa %xmm0, 0x60(%rsp)
xorl %ecx, %ecx
movl 0x4(%rsp), %r8d
movdqa 0x80(%rsp), %xmm0
movdqa %xmm0, %xmm10
movdqa %xmm0, %xmm2
movdqa %xmm8, 0xc0(%rsp)
movdqa %xmm2, 0x30(%rsp)
movdqa (%r12), %xmm15
pslldq $0x1, %xmm15            # xmm15 = zero,xmm15[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
movq 0x20(%rsp), %rdx
pinsrb $0x0, (%rdx,%rcx), %xmm15
movq 0x70(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x78(%rsp), %rsi
movzbl (%rsi,%rcx), %esi
movslq (%rdx,%rsi,4), %rdx
imulq %rdi, %rdx
shlq $0x4, %rdx
addq 0xa8(%rsp), %rdx
movdqa 0x80(%rsp), %xmm14
movdqa %xmm14, %xmm1
psubsb (%rax), %xmm1
xorl %esi, %esi
movdqa %xmm6, %xmm12
movdqa (%rbp,%rsi), %xmm6
movdqa (%r15,%rsi), %xmm8
movdqa %xmm6, %xmm2
psubsb %xmm4, %xmm2
psubsb %xmm5, %xmm8
movdqa %xmm2, %xmm0
pcmpgtb %xmm8, %xmm0
movdqa %xmm3, %xmm11
pblendvb %xmm0, %xmm12, %xmm3
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r13, %r9
paddsb (%rax,%rsi), %xmm1
paddsb (%rdx,%rsi), %xmm15
pmaxsb %xmm1, %xmm14
movdqa %xmm3, (%rsi,%r9)
movdqa %xmm11, %xmm3
pmaxsb %xmm2, %xmm8
pminsb %xmm8, %xmm9
movdqa %xmm8, (%r15,%rsi)
movdqa %xmm8, %xmm1
pmaxsb %xmm15, %xmm1
movdqa %xmm1, (%r14,%rsi)
movdqa %xmm15, (%rbp,%rsi)
addq $0x10, %rsi
movdqa %xmm6, %xmm15
cmpq %rsi, %r11
jne 0x49892e
pslldq $0x1, %xmm1             # xmm1 = zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
leaq 0x1(%rcx), %rdx
movq 0x20(%rsp), %rsi
pinsrb $0x0, 0x1(%rsi,%rcx), %xmm1
movdqa (%rax), %xmm0
paddsb %xmm1, %xmm0
pmaxsb %xmm0, %xmm14
movl $0xe, %esi
movdqa 0xc0(%rsp), %xmm2
movdqa %xmm14, %xmm0
pslldq $0x1, %xmm14            # xmm14 = zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
paddsb %xmm2, %xmm14
pmaxsb %xmm0, %xmm14
decl %esi
jne 0x4989ef
pslldq $0x1, %xmm14            # xmm14 = zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
paddsb 0xd0(%rsp), %xmm14
pmaxsb %xmm14, %xmm1
xorl %esi, %esi
movdqa %xmm12, %xmm6
movdqa 0x1317a1(%rip), %xmm12  # 0x5ca1d0
movdqa 0x131748(%rip), %xmm8   # 0x5ca180
movq 0x10(%rbx), %r9
movq (%r9), %r9
movdqa (%r14,%rsi), %xmm2
psubsb %xmm4, %xmm1
psubsb %xmm5, %xmm14
movdqa %xmm1, %xmm15
pmaxsb %xmm14, %xmm15
pcmpgtb %xmm14, %xmm1
movdqa %xmm7, %xmm3
movdqa %xmm1, %xmm0
pblendvb %xmm0, %xmm12, %xmm3
movdqa %xmm2, %xmm1
pmaxsb %xmm15, %xmm1
movdqa (%rbp,%rsi), %xmm0
pcmpeqb %xmm1, %xmm0
pcmpgtb %xmm15, %xmm2
paddb %xmm8, %xmm2
pblendvb %xmm0, %xmm13, %xmm2
addq %r13, %r9
por (%rsi,%r9), %xmm3
por %xmm2, %xmm3
movdqa %xmm3, (%rsi,%r9)
movdqa %xmm1, (%rbp,%rsi)
pminsb %xmm15, %xmm9
pminsb %xmm1, %xmm9
pmaxsb %xmm1, %xmm10
addq $0x10, %rsi
movdqa %xmm15, %xmm14
cmpq %rsi, %r11
jne 0x498a38
movdqa (%r10), %xmm0
movdqa %xmm0, %xmm1
movdqa 0x30(%rsp), %xmm2
pcmpgtb %xmm2, %xmm1
pand 0x60(%rsp), %xmm1
pmovmskb %xmm1, %esi
testl %esi, %esi
cmovnel %ecx, %r8d
pmaxsb %xmm0, %xmm2
addq %r11, %r13
movq %rdx, %rcx
cmpq 0x10(%rsp), %rdx
movdqa %xmm11, %xmm3
jne 0x4988cf
cmpl $0x0, 0x150(%rsp)
movq 0xa0(%rsp), %r10
movl 0xc(%rsp), %r11d
movq 0x18(%rsp), %r13
movl 0x4c(%rsp), %r12d
je 0x498b4b
cmpl $0xe, 0x8(%rsp)
jg 0x498b44
xorl %ecx, %ecx
movl 0x28(%rsp), %edx
pslldq $0x1, %xmm2             # xmm2 = zero,xmm2[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
incl %ecx
cmpl %edx, %ecx
jl 0x498b39
pextrb $0xf, %xmm2, %r11d
cmpl $0x0, 0x140(%rsp)
je 0x498bbd
testl $0x7ffffff0, 0x98(%rsp) # imm = 0x7FFFFFF0
je 0x498bbd
movl %r13d, %edx
andl $0x7ffffff, %edx        # imm = 0x7FFFFFF
shll $0x4, %edx
xorl %esi, %esi
movl %r12d, %ecx
movl %esi, %r9d
shrl $0x4, %r9d
movl %esi, %edi
andl $0xf, %edi
imull %r13d, %edi
addl %r9d, %edi
cmpl %r10d, %edi
jge 0x498bb4
movb (%rbp,%rsi), %r9b
cmpb %r11b, %r9b
jle 0x498ba1
movl %r9d, %r11d
movl 0x4(%rsp), %r8d
movl %edi, %ecx
jmp 0x498bb4
cmpl %ecx, %edi
cmovgel %ecx, %edi
cmpl 0x4(%rsp), %r8d
cmovnel %ecx, %edi
cmpb %r11b, %r9b
cmovel %edi, %ecx
incq %rsi
cmpl %esi, %edx
jne 0x498b73
jmp 0x498bc0
movl %r12d, %ecx
movl 0x140(%rsp), %edx
orl %edx, 0x48(%rsp)
jne 0x498c03
movq 0x50(%rsp), %rcx
shlq $0x4, %rcx
movdqa (%rbp,%rcx), %xmm0
cmpl $0xe, 0x8(%rsp)
jg 0x498bf4
xorl %ecx, %ecx
movl 0x28(%rsp), %edx
pslldq $0x1, %xmm0             # xmm0 = zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
incl %ecx
cmpl %edx, %ecx
jl 0x498be9
pextrb $0xf, %xmm0, %r11d
movl 0x4(%rsp), %r8d
movl %r12d, %ecx
movdqa 0x80(%rsp), %xmm0
pcmpgtb %xmm9, %xmm0
pcmpgtb 0xb0(%rsp), %xmm10
por %xmm0, %xmm10
pmovmskb %xmm10, %edx
testl %edx, %edx
je 0x498c35
orb $0x40, 0xc(%rbx)
xorl %r11d, %r11d
xorl %r8d, %r8d
xorl %ecx, %ecx
movsbl %r11b, %edx
movl %edx, (%rbx)
movl %ecx, 0x4(%rbx)
movl %r8d, 0x8(%rbx)
movq %rax, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq 0x20(%rsp), %rdi
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
jmp 0x498ca6
callq 0x1db211
jmp 0x498ca4
callq 0x1db1eb
jmp 0x498ca4
callq 0x1db1c5
jmp 0x498ca4
callq 0x1db19f
jmp 0x498ca4
callq 0x1db179
jmp 0x498ca4
callq 0x1db153
jmp 0x498ca4
callq 0x1db12d
jmp 0x498ca4
callq 0x1db107
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq