// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sg_scan_sse2_128_8.c
// Function: parasail_sg_flags_rowcol_scan_profile_sse2_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 end_query = 0;
    int32_t end_ref = 0;
    int32_t s1Len = 0;
    const parasail_matrix_t *matrix = NULL;
    int32_t segWidth = 0;
    int32_t segLen = 0;
    int32_t offset = 0;
    int32_t position = 0;
    __m128i* restrict pvP = NULL;
    __m128i* restrict pvE = NULL;
    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;

    /* 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_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_adds_epi8(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi8(-segLen*gap), 1));

    /* initialize result */
#ifdef PARASAIL_TABLE
    result = parasail_result_new_table1(segLen*segWidth, s2Len);
#else
#ifdef PARASAIL_ROWCOL
    result = parasail_result_new_rowcol1(segLen*segWidth, s2Len);
#else
    result = parasail_result_new();
#endif
#endif
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_SCAN
        | PARASAIL_FLAG_BITS_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;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* initialize heap variables */
    pvE = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_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_rpl(vSaturationCheckMin, vGapper);
        }
    }

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

        /* calculate E */
        /* calculate Ht */
        /* calculate F and H first pass */
        vHp = _mm_load_si128(pvH+(segLen-1));
        vHp = _mm_slli_si128(vHp, 1);
        vHp = _mm_insert_epi8_rpl(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);
            vE = _mm_max_epi8_rpl(
                    _mm_subs_epi8(vE, vGapE),
                    _mm_subs_epi8(vH, vGapO));
            vHp = _mm_adds_epi8(vHp, vW);
            vF = _mm_max_epi8_rpl(vF, _mm_adds_epi8(vHt, pvGapper[i]));
            vHt = _mm_max_epi8_rpl(vE, vHp);
            _mm_store_si128(pvE+i, vE);
            _mm_store_si128(pvHt+i, vHt);
            vHp = vH;
        }

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

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

        /* extract vector containing last value from column */
        {
            __m128i vCompare;
            vH = _mm_load_si128(pvH + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi8(vH, vMaxH));
            vMaxH = _mm_max_epi8_rpl(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
#ifdef PARASAIL_ROWCOL
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 1);
            }
            result->rowcols->score_row[j] = (int8_t) _mm_extract_epi8_rpl (vH, 15);
#endif
        }
    }

#ifdef PARASAIL_ROWCOL
    for (i=0; i<segLen; ++i) {
        __m128i vH = _mm_load_si128(pvH + i);
        arr_store_col(result->rowcols->score_col, vH, i, segLen);
    }
#endif

    /* max last value from all columns */
    if (s2_end)
    {
        for (k=0; k<position; ++k) {
            vMaxH = _mm_slli_si128(vMaxH, 1);
        }
        score = (int8_t) _mm_extract_epi8_rpl(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_rpl (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 $0xf8, %rsp
movq %rsi, 0x60(%rsp)
testq %rdi, %rdi
je 0x2f5487
movq 0x18(%rdi), %rax
movq %rax, 0x88(%rsp)
testq %rax, %rax
je 0x2f54ab
movq 0x10(%rdi), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x2f54cf
movl 0x8(%rdi), %eax
testl %eax, %eax
jle 0x2f54f3
cmpq $0x0, 0x60(%rsp)
je 0x2f5517
movl %edx, %r12d
testl %edx, %edx
jle 0x2f5538
movl %ecx, %r14d
testl %ecx, %ecx
js 0x2f5559
testl %r8d, %r8d
js 0x2f557a
movl %r9d, %ebx
movl %r8d, 0x30(%rsp)
leal -0x1(%rax), %r13d
movq %rax, 0xb8(%rsp)
leaq 0xf(%rax), %rdi
movq %rdi, %r15
shrq $0x4, %r15
movl %r13d, %eax
xorl %edx, %edx
divl %r15d
movl %eax, 0xa0(%rsp)
movl %edx, %ebp
movl %r14d, %esi
negl %esi
movq 0x58(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negb %cl
movl %esi, 0x50(%rsp)
cmpl %esi, %eax
movzbl %cl, %eax
cmovgl %r14d, %eax
movl %eax, 0x2c(%rsp)
movb $0x7e, %al
subb 0x1c(%rdx), %al
movb %al, (%rsp)
andl $0x7ffffff0, %edi       # imm = 0x7FFFFFF0
movl %r12d, %esi
callq 0x1ab93b
testq %rax, %rax
je 0x2f4de4
movl %r13d, 0x44(%rsp)
movl %r14d, 0x78(%rsp)
movl %ebp, 0x80(%rsp)
movl 0x140(%rsp), %r8d
xorl %edi, %edi
testl %ebx, %ebx
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0x130(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x138(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %r8d, 0x9c(%rsp)
testl %r8d, %r8d
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x10140402, %ecx       # imm = 0x10140402
movq %rax, 0x90(%rsp)
movl %ecx, 0xc(%rax)
pushq $0x10
popq %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r14
movq %r12, 0x48(%rsp)
leal 0x1(%r12), %esi
movq %rbp, %rdi
movq %rsi, 0x70(%rsp)
callq 0x1ab776
movq %rax, %r12
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r13
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %rbp
pushq $0x10
popq %rdi
movq %r15, 0x68(%rsp)
movq %r15, %rsi
callq 0x297cd8
movq %r14, %xmm0
movq %r12, 0x38(%rsp)
movq %r12, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %r13, %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 %r15d, %r15d
testl %ecx, %ecx
jne 0x2f55a3
testq %rax, %rax
je 0x2f55a3
movq 0x48(%rsp), %rcx
decl %ecx
movl %ecx, 0xc(%rsp)
pushq $0xf
popq %rdx
subl 0xa0(%rsp), %edx
movl 0x78(%rsp), %esi
movd %esi, %xmm0
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm4      # xmm4 = xmm0[0,0,0,0]
movl 0x30(%rsp), %edi
movd %edi, %xmm0
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm5      # xmm5 = xmm0[0,0,0,0]
movl 0x2c(%rsp), %r12d
addb $-0x7f, %r12b
movl %r12d, 0x2c(%rsp)
movzbl %r12b, %ecx
movd %ecx, %xmm3
movdqa %xmm3, %xmm0
punpcklbw %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7]
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movzbl (%rsp), %ecx
movd %ecx, %xmm1
punpcklbw %xmm1, %xmm1    # xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movd %edx, %xmm2
punpcklbw %xmm2, %xmm2    # xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm7      # xmm7 = xmm2[0,0,0,0]
movq 0x68(%rsp), %r12
movl %r12d, %ecx
imull %edi, %ecx
negb %cl
movzbl %cl, %ecx
movd %ecx, %xmm2
punpcklbw %xmm2, %xmm2    # xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm8      # xmm8 = xmm2[0,0,0,0]
pslldq $0x1, %xmm8             # xmm8 = zero,xmm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
movdqa %xmm3, 0xa0(%rsp)
paddsb %xmm3, %xmm8
movl %esi, %esi
movl %edi, %ecx
movslq 0x50(%rsp), %rdi
movq %r12, %r9
movq %rcx, (%rsp)
imulq %rcx, %r9
xorl %r10d, %r10d
pushq $-0x80
popq %r15
cmpq %r12, %r10
je 0x2f4dec
movq %rdi, %r8
xorl %r12d, %r12d
cmpq $0x10, %r12
je 0x2f4db3
testl %ebx, %ebx
je 0x2f4d82
xorl %ecx, %ecx
jmp 0x2f4d85
movq %r8, %rcx
cmpq $-0x7f, %rcx
movq %r15, %r11
cmovgeq %rcx, %r11
subq %rsi, %rcx
cmpq $-0x7f, %rcx
cmovlq %r15, %rcx
movb %r11b, 0xe0(%rsp,%r12)
movb %cl, 0xd0(%rsp,%r12)
incq %r12
subq %r9, %r8
jmp 0x2f4d74
movq %r10, %rcx
shlq $0x4, %rcx
movaps 0xe0(%rsp), %xmm2
movaps %xmm2, (%rbp,%rcx)
movdqa 0xd0(%rsp), %xmm2
movdqa %xmm2, (%r14,%rcx)
incq %r10
subq (%rsp), %rdi
movq 0x68(%rsp), %r12
jmp 0x2f4d69
xorl %r15d, %r15d
jmp 0x2f55a3
movq 0x38(%rsp), %rcx
movb $0x0, (%rcx)
pushq $0x1
popq %rcx
pushq $-0x80
popq %rsi
xorl %edi, %edi
movl 0x30(%rsp), %r10d
movl 0x50(%rsp), %r11d
movl 0x138(%rsp), %ebx
movq 0x70(%rsp), %r15
movq 0x38(%rsp), %r9
cmpq %rcx, %r15
je 0x2f4e39
cmpl $-0x7f, %r11d
movl %esi, %r8d
cmovgel %r11d, %r8d
testl %ebx, %ebx
cmovnel %edi, %r8d
movb %r8b, (%r9,%rcx)
incq %rcx
subl %r10d, %r11d
jmp 0x2f4e17
pxor %xmm3, %xmm3
psubsb %xmm4, %xmm3
leal -0x1(%r12), %ecx
movdqa %xmm1, 0xc0(%rsp)
movdqa %xmm1, %xmm2
movl %ecx, %esi
testl %esi, %esi
js 0x2f4e8f
movl %esi, %edi
shlq $0x4, %rdi
movdqa %xmm3, (%rax,%rdi)
psubsb %xmm5, %xmm3
movdqa %xmm2, %xmm9
pcmpgtb %xmm3, %xmm9
movdqa %xmm3, %xmm10
pand %xmm9, %xmm10
pandn %xmm2, %xmm9
por %xmm10, %xmm9
decl %esi
movdqa %xmm9, %xmm2
jmp 0x2f4e55
movl %ecx, %r9d
shlq $0x4, %r9
addq %rbp, %r9
movl 0x80(%rsp), %ecx
shlq $0x4, %rcx
addq %rbp, %rcx
movq %rcx, 0x30(%rsp)
movl 0x48(%rsp), %r10d
movq %r12, %r8
shlq $0x4, %r8
xorl %r11d, %r11d
movdqa 0x2d2bdc(%rip), %xmm10  # 0x5c7aa0
pcmpeqb 0x2d2c04(%rip), %xmm7   # 0x5c7ad0
pushq $0xe
popq %rbx
movdqa %xmm0, %xmm3
movdqa %xmm0, %xmm9
movl 0xc(%rsp), %ecx
movl %ecx, (%rsp)
movq 0x90(%rsp), %rdi
cmpq %r10, %r11
je 0x2f51ab
movdqa (%r9), %xmm11
pslldq $0x1, %xmm11            # xmm11 = zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
movq 0x38(%rsp), %rcx
movzbl (%rcx,%r11), %ecx
movd %ecx, %xmm13
movdqa %xmm10, %xmm12
pandn %xmm13, %xmm12
por %xmm11, %xmm12
movq 0x58(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x60(%rsp), %rsi
movzbl (%rsi,%r11), %esi
movl (%rcx,%rsi,4), %ecx
imull %r12d, %ecx
movslq %ecx, %r15
shlq $0x4, %r15
addq 0x88(%rsp), %r15
movdqa %xmm0, %xmm13
psubsb (%rax), %xmm13
xorl %ecx, %ecx
movdqa %xmm0, %xmm11
cmpq %rcx, %r8
je 0x2f4fe8
movdqa (%rbp,%rcx), %xmm1
movdqa (%r14,%rcx), %xmm6
psubsb %xmm5, %xmm6
movdqa %xmm1, %xmm14
psubsb %xmm4, %xmm14
movdqa %xmm6, %xmm15
pcmpgtb %xmm14, %xmm15
pand %xmm15, %xmm6
pandn %xmm14, %xmm15
paddsb (%r15,%rcx), %xmm12
paddsb (%rax,%rcx), %xmm13
por %xmm6, %xmm15
movdqa %xmm11, %xmm6
pcmpgtb %xmm13, %xmm6
pand %xmm6, %xmm11
pandn %xmm13, %xmm6
por %xmm6, %xmm11
movdqa %xmm15, %xmm13
pcmpgtb %xmm12, %xmm13
movdqa %xmm15, (%r14,%rcx)
pand %xmm13, %xmm15
pandn %xmm12, %xmm13
por %xmm15, %xmm13
movdqa %xmm13, (%r13,%rcx)
addq $0x10, %rcx
movdqa %xmm1, %xmm12
jmp 0x2f4f53
pslldq $0x1, %xmm13            # xmm13 = zero,xmm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
leaq 0x1(%r11), %r15
movq 0x38(%rsp), %rcx
movzbl 0x1(%rcx,%r11), %ecx
movd %ecx, %xmm1
movdqa %xmm10, %xmm14
pandn %xmm1, %xmm14
por %xmm13, %xmm14
movdqa (%rax), %xmm1
paddsb %xmm14, %xmm1
movdqa %xmm11, %xmm12
pcmpgtb %xmm1, %xmm12
pand %xmm12, %xmm11
pandn %xmm1, %xmm12
por %xmm11, %xmm12
movl %ebx, %ecx
movdqa %xmm12, %xmm11
pslldq $0x1, %xmm11            # xmm11 = zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
subl $0x1, %ecx
jb 0x2f5064
paddsb %xmm8, %xmm11
movdqa %xmm12, %xmm1
pcmpgtb %xmm11, %xmm1
pand %xmm1, %xmm12
pandn %xmm11, %xmm1
por %xmm1, %xmm12
jmp 0x2f5034
paddsb 0xa0(%rsp), %xmm11
movdqa %xmm14, %xmm12
pcmpgtb %xmm11, %xmm12
pand %xmm12, %xmm14
pandn %xmm11, %xmm12
por %xmm14, %xmm12
xorl %r12d, %r12d
cmpq %r12, %r8
je 0x2f5130
movdqa (%r13,%r12), %xmm1
psubsb %xmm5, %xmm11
psubsb %xmm4, %xmm12
movdqa %xmm11, %xmm6
pcmpgtb %xmm12, %xmm6
pand %xmm6, %xmm11
pandn %xmm12, %xmm6
por %xmm6, %xmm11
movdqa %xmm1, %xmm12
pcmpgtb %xmm11, %xmm12
pand %xmm12, %xmm1
pandn %xmm11, %xmm12
por %xmm1, %xmm12
movdqa %xmm12, (%rbp,%r12)
movdqa %xmm2, %xmm1
pcmpgtb %xmm12, %xmm1
movdqa %xmm12, %xmm6
pand %xmm1, %xmm6
pandn %xmm2, %xmm1
por %xmm6, %xmm1
movdqa %xmm1, %xmm2
pcmpgtb %xmm11, %xmm2
movdqa %xmm11, %xmm6
pand %xmm2, %xmm6
pandn %xmm1, %xmm2
por %xmm6, %xmm2
movdqa %xmm3, %xmm1
pcmpgtb %xmm12, %xmm1
pand %xmm1, %xmm3
pandn %xmm12, %xmm1
por %xmm1, %xmm3
addq $0x10, %r12
jmp 0x2f508a
movq 0x30(%rsp), %rcx
movdqa (%rcx), %xmm12
movdqa %xmm12, %xmm11
pcmpgtb %xmm9, %xmm11
movdqa %xmm11, %xmm1
pand %xmm7, %xmm1
pmovmskb %xmm1, %ecx
xorl %esi, %esi
movdqa %xmm12, %xmm13
movq 0x68(%rsp), %r12
cmpl %edx, %esi
jge 0x2f516b
pslldq $0x1, %xmm13            # xmm13 = zero,xmm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
incl %esi
jmp 0x2f515d
testw %cx, %cx
pand %xmm11, %xmm12
pandn %xmm9, %xmm11
movl (%rsp), %ecx
cmovnel %r11d, %ecx
movl %ecx, (%rsp)
pextrw $0x7, %xmm13, %ecx
por %xmm12, %xmm11
shrl $0x8, %ecx
movsbl %cl, %ecx
movq 0x10(%rdi), %rsi
movq (%rsi), %rsi
movl %ecx, (%rsi,%r11,4)
movq %r15, %r11
movdqa %xmm11, %xmm9
jmp 0x2f4ee7
leal (,%r12,4), %r9d
leal (,%r12,8), %ecx
movq %rcx, 0x60(%rsp)
movl %r12d, %ecx
imulq $0xc, %rcx, %rcx
movq %rcx, 0x58(%rsp)
imulq $0x3c, %r12, %rcx
movq %rcx, 0x88(%rsp)
imulq $0x38, %r12, %rcx
movq %rcx, 0xa0(%rsp)
imulq $0x34, %r12, %rcx
movq %rcx, 0x50(%rsp)
imulq $0x30, %r12, %rcx
movq %rcx, 0x48(%rsp)
imulq $0x2c, %r12, %rcx
movq %rcx, 0x80(%rsp)
imulq $0x28, %r12, %rcx
movq %rcx, 0x78(%rsp)
imulq $0x24, %r12, %rcx
movq %rcx, 0x70(%rsp)
movq %r12, %r11
shlq $0x5, %r11
imulq $0x1c, %r12, %rbx
imulq $0x18, %r12, %r15
imulq $0x14, %r12, %r12
xorl %ecx, %ecx
cmpq %rcx, %r9
je 0x2f5326
movdqa (%rbp,%rcx,4), %xmm1
movq 0x90(%rsp), %rsi
movq 0x10(%rsi), %rdi
movq 0x8(%rdi), %rdi
movdqa %xmm1, 0x10(%rsp)
movsbl 0x10(%rsp), %esi
movl %esi, (%rdi,%rcx)
addq %rcx, %rdi
movsbl 0x11(%rsp), %esi
movl %esi, (%r9,%rdi)
movsbl 0x12(%rsp), %esi
movq 0x60(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x13(%rsp), %esi
movq 0x58(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x14(%rsp), %esi
movl %esi, (%r8,%rdi)
movsbl 0x15(%rsp), %esi
movl %esi, (%r12,%rdi)
movsbl 0x16(%rsp), %esi
movl %esi, (%r15,%rdi)
movsbl 0x17(%rsp), %esi
movl %esi, (%rbx,%rdi)
movsbl 0x18(%rsp), %esi
movl %esi, (%r11,%rdi)
movsbl 0x19(%rsp), %esi
movq 0x70(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1a(%rsp), %esi
movq 0x78(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1b(%rsp), %esi
movq 0x80(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1c(%rsp), %esi
movq 0x48(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1d(%rsp), %esi
movq 0x50(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1e(%rsp), %esi
movq 0xa0(%rsp), %r10
movl %esi, (%r10,%rdi)
movsbl 0x1f(%rsp), %esi
movq 0x88(%rsp), %r10
movl %esi, (%r10,%rdi)
movq 0x90(%rsp), %rdi
addq $0x4, %rcx
jmp 0x2f5229
cmpl $0x0, 0x140(%rsp)
movl 0x44(%rsp), %r8d
movq 0xb8(%rsp), %rbx
movl 0x2c(%rsp), %r15d
movq 0x68(%rsp), %r12
je 0x2f5361
xorl %ecx, %ecx
cmpl %edx, %ecx
jge 0x2f5357
pslldq $0x1, %xmm9             # xmm9 = zero,xmm9[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
incl %ecx
jmp 0x2f5349
pextrw $0x7, %xmm9, %r15d
shrl $0x8, %r15d
cmpl $0x0, 0x130(%rsp)
je 0x2f53d9
movl %r12d, %r9d
andl $0x7ffffff, %r9d        # imm = 0x7FFFFFF
shll $0x4, %r9d
xorl %r10d, %r10d
movdqa 0xc0(%rsp), %xmm1
cmpl %r10d, %r9d
je 0x2f53e2
movl %r10d, %esi
shrl $0x4, %esi
movl %r10d, %ecx
andl $0xf, %ecx
imull %r12d, %ecx
addl %esi, %ecx
cmpl %ebx, %ecx
jge 0x2f53d4
movb (%rbp,%r10), %sil
cmpb %r15b, %sil
jle 0x2f53b9
movl %esi, %r15d
movl 0xc(%rsp), %esi
movl %esi, (%rsp)
movl %ecx, %r8d
jmp 0x2f53d4
cmpl %r8d, %ecx
cmovgel %r8d, %ecx
movl (%rsp), %r11d
cmpl 0xc(%rsp), %r11d
cmovnel %r8d, %ecx
cmpb %r15b, %sil
cmovel %ecx, %r8d
incq %r10
jmp 0x2f5385
movdqa 0xc0(%rsp), %xmm1
movl 0x130(%rsp), %ecx
orl %ecx, 0x9c(%rsp)
jne 0x2f5420
movq 0x30(%rsp), %rcx
movdqa (%rcx), %xmm4
xorl %ecx, %ecx
movl 0x44(%rsp), %r8d
cmpl %edx, %ecx
jge 0x2f540f
pslldq $0x1, %xmm4             # xmm4 = zero,xmm4[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
incl %ecx
jmp 0x2f5402
pextrw $0x7, %xmm4, %r15d
shrl $0x8, %r15d
movl 0xc(%rsp), %ecx
movl %ecx, (%rsp)
pcmpgtb %xmm2, %xmm0
pcmpgtb %xmm1, %xmm3
por %xmm0, %xmm3
pmovmskb %xmm3, %ecx
testl %ecx, %ecx
je 0x2f5445
orb $0x40, 0xc(%rdi)
xorl %r15d, %r15d
movl $0x0, (%rsp)
xorl %r8d, %r8d
movsbl %r15b, %ecx
movl %ecx, (%rdi)
movl %r8d, 0x4(%rdi)
movl (%rsp), %ecx
movl %ecx, 0x8(%rdi)
movq %rdi, %r15
movq %rax, %rdi
callq 0x1ab763
movq %rbp, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq 0x38(%rsp), %rdi
callq 0x1ab763
movq %r14, %rdi
callq 0x1ab763
jmp 0x2f55a3
movq 0x445b4a(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d1b53(%rip), %rsi    # 0x5c6feb
leaq 0x2d3a58(%rip), %rdx    # 0x5c8ef7
leaq 0x2a8037(%rip), %rcx    # 0x59d4dd
jmp 0x2f5599
movq 0x445b26(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d1b2f(%rip), %rsi    # 0x5c6feb
leaq 0x2d3a34(%rip), %rdx    # 0x5c8ef7
leaq 0x2d25e6(%rip), %rcx    # 0x5c7ab0
jmp 0x2f5599
movq 0x445b02(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d1b0b(%rip), %rsi    # 0x5c6feb
leaq 0x2d3a10(%rip), %rdx    # 0x5c8ef7
leaq 0x2d244b(%rip), %rcx    # 0x5c7939
jmp 0x2f5599
movq 0x445ade(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d21fd(%rip), %rsi    # 0x5c7701
leaq 0x2d39ec(%rip), %rdx    # 0x5c8ef7
leaq 0x2d2437(%rip), %rcx    # 0x5c7949
jmp 0x2f5599
movq 0x445aba(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d1ac3(%rip), %rsi    # 0x5c6feb
leaq 0x2d39c8(%rip), %rdx    # 0x5c8ef7
leaq 0x2d21c8(%rip), %rcx    # 0x5c76fe
jmp 0x2f5599
movq 0x445a99(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d21b8(%rip), %rsi    # 0x5c7701
leaq 0x2d39a7(%rip), %rdx    # 0x5c8ef7
leaq 0x2d21be(%rip), %rcx    # 0x5c7715
jmp 0x2f5599
movq 0x445a78(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d21b1(%rip), %rsi    # 0x5c771b
leaq 0x2d3986(%rip), %rdx    # 0x5c8ef7
leaq 0x2d21b8(%rip), %rcx    # 0x5c7730
jmp 0x2f5599
movq 0x445a57(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2d2190(%rip), %rsi    # 0x5c771b
leaq 0x2d3965(%rip), %rdx    # 0x5c8ef7
leaq 0x2d219c(%rip), %rcx    # 0x5c7735
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x19e180
movq %r15, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq