// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_8.c
// Function: parasail_sg_flags_table_scan_profile_avx2_256_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;
    __m256i* restrict pvP = NULL;
    __m256i* restrict pvE = NULL;
    int8_t* restrict boundary = NULL;
    __m256i* restrict pvHt = NULL;
    __m256i* restrict pvH = NULL;
    __m256i* restrict pvGapper = NULL;
    __m256i vGapO;
    __m256i vGapE;
    int8_t NEG_LIMIT = 0;
    int8_t POS_LIMIT = 0;
    __m256i vZero;
    int8_t score = 0;
    __m256i vNegLimit;
    __m256i vPosLimit;
    __m256i vSaturationCheckMin;
    __m256i vSaturationCheckMax;
    __m256i vMaxH;
    __m256i vPosMask;
    __m256i vNegInfFront;
    __m256i 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 = 32; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m256i*)profile->profile8.score;
    vGapO = _mm256_set1_epi8(open);
    vGapE = _mm256_set1_epi8(gap);
    NEG_LIMIT = (-open < matrix->min ? INT8_MIN + open : INT8_MIN - matrix->min) + 1;
    POS_LIMIT = INT8_MAX - matrix->max - 1;
    vZero = _mm256_setzero_si256();
    score = NEG_LIMIT;
    vNegLimit = _mm256_set1_epi8(NEG_LIMIT);
    vPosLimit = _mm256_set1_epi8(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm256_cmpeq_epi8(_mm256_set1_epi8(position),
            _mm256_set_epi8(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31));
    vNegInfFront = vZero;
    vNegInfFront = _mm256_insert_epi8_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm256_adds_epi8(vNegInfFront,
            _mm256_slli_si256_rpl(_mm256_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_32;
    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___m256i(32, segLen);
    boundary = parasail_memalign_int8_t(32, s2Len+1);
    pvHt= parasail_memalign___m256i(32, segLen);
    pvH = parasail_memalign___m256i(32, segLen);
    pvGapper = parasail_memalign___m256i(32, 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;
            __m256i_8_t h;
            __m256i_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;
            }
            _mm256_store_si256(&pvH[index], h.m);
            _mm256_store_si256(&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;
        }
    }

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

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

        /* calculate E */
        /* calculate Ht */
        /* calculate F and H first pass */
        vHp = _mm256_load_si256(pvH+(segLen-1));
        vHp = _mm256_slli_si256_rpl(vHp, 1);
        vHp = _mm256_insert_epi8_rpl(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm256_subs_epi8(vNegLimit, pvGapper[0]);
        vF = vNegLimit;
        for (i=0; i<segLen; ++i) {
            vH = _mm256_load_si256(pvH+i);
            vE = _mm256_load_si256(pvE+i);
            vW = _mm256_load_si256(pvW+i);
            vE = _mm256_max_epi8(
                    _mm256_subs_epi8(vE, vGapE),
                    _mm256_subs_epi8(vH, vGapO));
            vHp = _mm256_adds_epi8(vHp, vW);
            vF = _mm256_max_epi8(vF, _mm256_adds_epi8(vHt, pvGapper[i]));
            vHt = _mm256_max_epi8(vE, vHp);
            _mm256_store_si256(pvE+i, vE);
            _mm256_store_si256(pvHt+i, vHt);
            vHp = vH;
        }

        /* pseudo prefix scan on F and H */
        vHt = _mm256_slli_si256_rpl(vHt, 1);
        vHt = _mm256_insert_epi8_rpl(vHt, boundary[j+1], 0);
        vF = _mm256_max_epi8(vF, _mm256_adds_epi8(vHt, pvGapper[0]));
        for (i=0; i<segWidth-2; ++i) {
            __m256i vFt = _mm256_slli_si256_rpl(vF, 1);
            vFt = _mm256_adds_epi8(vFt, vSegLenXgap);
            vF = _mm256_max_epi8(vF, vFt);
        }

        /* calculate final H */
        vF = _mm256_slli_si256_rpl(vF, 1);
        vF = _mm256_adds_epi8(vF, vNegInfFront);
        vH = _mm256_max_epi8(vHt, vF);
        for (i=0; i<segLen; ++i) {
            vHt = _mm256_load_si256(pvHt+i);
            vF = _mm256_max_epi8(
                    _mm256_subs_epi8(vF, vGapE),
                    _mm256_subs_epi8(vH, vGapO));
            vH = _mm256_max_epi8(vHt, vF);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi8(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi8(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi8(vSaturationCheckMax, vH);
#ifdef PARASAIL_TABLE
            arr_store_si256(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif
        } 

        /* extract vector containing last value from column */
        {
            __m256i vCompare;
            vH = _mm256_load_si256(pvH + offset);
            vCompare = _mm256_and_si256(vPosMask, _mm256_cmpgt_epi8(vH, vMaxH));
            vMaxH = _mm256_max_epi8(vH, vMaxH);
            if (_mm256_movemask_epi8(vCompare)) {
                end_ref = j;
            }
#ifdef PARASAIL_ROWCOL
            for (k=0; k<position; ++k) {
                vH = _mm256_slli_si256_rpl(vH, 1);
            }
            result->rowcols->score_row[j] = (int8_t) _mm256_extract_epi8_rpl (vH, 31);
#endif
        }
    }

#ifdef PARASAIL_ROWCOL
    for (i=0; i<segLen; ++i) {
        __m256i vH = _mm256_load_si256(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 = _mm256_slli_si256_rpl(vMaxH, 1);
        }
        score = (int8_t) _mm256_extract_epi8_rpl(vMaxH, 31);
        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 */
        {
            __m256i vH = _mm256_load_si256(pvH + offset);
            for (k=0; k<position; ++k) {
                vH = _mm256_slli_si256_rpl(vH, 1);
            }
            score = (int8_t) _mm256_extract_epi8_rpl (vH, 31);
            end_ref = s2Len - 1;
            end_query = s1Len - 1;
        }
    }

    if (_mm256_movemask_epi8(_mm256_or_si256(
            _mm256_cmplt_epi8_rpl(vSaturationCheckMin, vNegLimit),
            _mm256_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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
andq $-0x20, %rsp
subq $0x1e0, %rsp            # imm = 0x1E0
movl %r8d, 0x30(%rsp)
movq %rsi, 0xa8(%rsp)
testq %rdi, %rdi
je 0x49fe08
movq 0x18(%rdi), %rax
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x49fe2c
movq 0x10(%rdi), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x49fe50
movl 0x8(%rdi), %eax
testl %eax, %eax
jle 0x49fe74
cmpq $0x0, 0xa8(%rsp)
je 0x49fe98
movl %edx, %r8d
testl %edx, %edx
jle 0x49feb9
movl %ecx, %r15d
testl %ecx, %ecx
js 0x49feda
cmpl $0x0, 0x30(%rsp)
js 0x49fefb
movl %r9d, %r12d
leal -0x1(%rax), %r14d
movq %rax, 0xc8(%rsp)
leaq 0x1f(%rax), %rdi
movq %rdi, %r13
shrq $0x5, %r13
movl %r14d, %eax
xorl %edx, %edx
divl %r13d
movl %eax, 0x78(%rsp)
movl %edx, 0x80(%rsp)
movq 0xa0(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negb %cl
movzbl %cl, %ecx
movl %r15d, %ebx
negl %ebx
cmpl %ebx, %eax
cmovgl %r15d, %ecx
movl %ecx, 0x1c(%rsp)
movb $0x7e, %al
subb 0x1c(%rdx), %al
movl %eax, 0x70(%rsp)
andl $0x7fffffe0, %edi       # imm = 0x7FFFFFE0
movl %r8d, %esi
movq %r8, 0x50(%rsp)
callq 0x1ab876
testq %rax, %rax
je 0x49f4cf
movl %r15d, 0x68(%rsp)
movl %r14d, 0x94(%rsp)
xorl %edi, %edi
testl %r12d, %r12d
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0x10(%rbp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x18(%rbp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x20(%rbp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x20120402, %ecx       # imm = 0x20120402
movq %rax, 0xc0(%rsp)
movl %ecx, 0xc(%rax)
pushq $0x20
popq %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x496aa4
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
leal 0x1(%rax), %esi
movq %r15, %rdi
movq %rsi, 0x60(%rsp)
callq 0x1ab776
movq %rax, 0x20(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x496aa4
movq %rax, %r14
movq %r15, %rdi
movq %r13, %rsi
callq 0x496aa4
movq %rax, %r15
pushq $0x20
popq %rdi
movq %r13, 0x58(%rsp)
movq %r13, %rsi
callq 0x496aa4
cmpq $0x0, 0x48(%rsp)
sete %dl
cmpq $0x0, 0x20(%rsp)
sete %cl
orb %dl, %cl
movq %r14, 0x88(%rsp)
testq %r14, %r14
sete %sil
movq %r15, 0x28(%rsp)
testq %r15, %r15
sete %dl
orb %sil, %dl
orb %cl, %dl
movq %rax, 0x38(%rsp)
testq %rax, %rax
sete %al
orb %dl, %al
je 0x49f4d6
xorl %ebx, %ebx
jmp 0x49ff23
movq 0x50(%rsp), %rax
movq %rax, %r14
decl %eax
movl %eax, 0x44(%rsp)
pushq $0x1f
popq %rcx
subl 0x78(%rsp), %ecx
movl 0x68(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastb %xmm0, %ymm3
movl 0x30(%rsp), %edx
vmovd %edx, %xmm0
vpbroadcastb %xmm0, %ymm4
movl 0x1c(%rsp), %eax
addb $-0x7f, %al
vmovd %eax, %xmm0
vpbroadcastb %xmm0, %ymm0
vmovd 0x70(%rsp), %xmm1
vpbroadcastb %xmm1, %ymm1
movl %ecx, 0x90(%rsp)
vmovd %ecx, %xmm2
vpbroadcastb %xmm2, %ymm7
movl %eax, 0x1c(%rsp)
movzbl %al, %eax
movq 0x58(%rsp), %r13
movl %r13d, %ecx
imull %edx, %ecx
negb %cl
vmovd %ecx, %xmm2
vpbroadcastb %xmm2, %ymm2
vpand 0x12c46c(%rip), %ymm2, %ymm2 # 0x5cb9c0
vmovd %eax, %xmm5
vpaddsb %ymm2, %ymm5, %ymm6
movl %esi, %eax
movl %edx, %ecx
movslq %ebx, %rdx
movq %r13, %rsi
imulq %rcx, %rsi
xorl %edi, %edi
pushq $-0x80
popq %r8
cmpq %r13, %rdi
je 0x49f5fa
movq %rdx, %r9
xorl %r10d, %r10d
cmpq $0x20, %r10
je 0x49f5c0
testl %r12d, %r12d
je 0x49f58f
xorl %r11d, %r11d
jmp 0x49f592
movq %r9, %r11
cmpq $-0x7f, %r11
movq %r8, %r15
cmovgeq %r11, %r15
subq %rax, %r11
cmpq $-0x7f, %r11
cmovlq %r8, %r11
movb %r15b, 0x1a0(%rsp,%r10)
movb %r11b, 0x180(%rsp,%r10)
incq %r10
subq %rsi, %r9
jmp 0x49f57f
movq %rdi, %r9
shlq $0x5, %r9
vmovaps 0x1a0(%rsp), %ymm2
movq 0x28(%rsp), %r10
vmovaps %ymm2, (%r10,%r9)
vmovdqa 0x180(%rsp), %ymm2
movq 0x48(%rsp), %r10
vmovdqa %ymm2, (%r10,%r9)
incq %rdi
subq %rcx, %rdx
jmp 0x49f570
movq 0x20(%rsp), %rax
movb $0x0, (%rax)
pushq $0x1
popq %rax
pushq $-0x80
popq %rcx
xorl %edx, %edx
movl 0x30(%rsp), %r8d
movl 0x18(%rbp), %r9d
movq 0x60(%rsp), %r10
movq 0x20(%rsp), %rdi
cmpq %rax, %r10
je 0x49f63c
cmpl $-0x7f, %ebx
movl %ecx, %esi
cmovgel %ebx, %esi
testl %r9d, %r9d
cmovnel %edx, %esi
movb %sil, (%rdi,%rax)
incq %rax
subl %r8d, %ebx
jmp 0x49f61d
vpxor %xmm2, %xmm2, %xmm2
vpsubsb %ymm3, %ymm2, %ymm8
leal -0x1(%r13), %eax
vmovdqa %ymm1, %ymm2
movl %eax, %ecx
movq 0x38(%rsp), %rsi
testl %ecx, %ecx
js 0x49f66f
movl %ecx, %edx
shlq $0x5, %rdx
vmovdqa %ymm8, (%rsi,%rdx)
vpsubsb %ymm4, %ymm8, %ymm8
vpminsb %ymm8, %ymm2, %ymm2
decl %ecx
jmp 0x49f653
movl %eax, %ecx
shlq $0x5, %rcx
movq 0x28(%rsp), %rax
addq %rax, %rcx
movq %rcx, 0xd0(%rsp)
movl %r14d, %r8d
movl 0x80(%rsp), %ecx
shlq $0x5, %rcx
addq %rax, %rcx
movq %rcx, 0x98(%rsp)
movq %r13, %r10
shlq $0x5, %r10
movq %r13, %rdi
imulq %r8, %rdi
imulq $0x7c, %rdi, %rax
movq %rax, 0x30(%rsp)
imulq $0x78, %rdi, %rax
movq %rax, 0x50(%rsp)
imulq $0x74, %rdi, %rax
movq %rax, 0x80(%rsp)
imulq $0x70, %rdi, %rax
movq %rax, 0x78(%rsp)
imulq $0x6c, %rdi, %rax
movq %rax, 0x70(%rsp)
movq %rdi, %rax
shlq $0x6, %rax
movq %rax, 0x68(%rsp)
movq %rdi, %rax
shlq $0x5, %rax
movq %rax, 0x60(%rsp)
movq %rdi, %rax
shlq $0x4, %rax
movq %rax, 0x178(%rsp)
imulq $0x68, %rdi, %rax
movq %rax, 0x170(%rsp)
imulq $0x64, %rdi, %rax
movq %rax, 0x168(%rsp)
imulq $0x60, %rdi, %rax
movq %rax, 0x160(%rsp)
imulq $0x5c, %rdi, %rax
movq %rax, 0x158(%rsp)
imulq $0x58, %rdi, %rax
movq %rax, 0x150(%rsp)
imulq $0x54, %rdi, %rax
movq %rax, 0x148(%rsp)
imulq $0x50, %rdi, %rax
movq %rax, 0x140(%rsp)
imulq $0x4c, %rdi, %rax
movq %rax, 0x138(%rsp)
imulq $0x48, %rdi, %rax
movq %rax, 0x130(%rsp)
imulq $0x44, %rdi, %rax
movq %rax, 0x128(%rsp)
imulq $0x3c, %rdi, %rax
movq %rax, 0x120(%rsp)
imulq $0x38, %rdi, %rax
movq %rax, 0x118(%rsp)
imulq $0x34, %rdi, %rax
movq %rax, 0x110(%rsp)
imulq $0x30, %rdi, %rax
movq %rax, 0x108(%rsp)
imulq $0x2c, %rdi, %rax
movq %rax, 0x100(%rsp)
imulq $0x28, %rdi, %rax
movq %rax, 0xf8(%rsp)
imulq $0x24, %rdi, %rax
movq %rax, 0xf0(%rsp)
imulq $0x1c, %rdi, %rdx
imulq $0x18, %rdi, %rsi
imulq $0x14, %rdi, %r9
imulq $0xc, %rdi, %r14
leaq (,%rdi,8), %rbx
shlq $0x2, %rdi
vpcmpeqb 0x12c1ed(%rip), %ymm7, %ymm9 # 0x5cb9e0
vmovdqa %ymm0, %ymm7
vmovdqa %ymm0, %ymm8
movq %r8, 0xd8(%rsp)
leaq (,%r8,4), %r13
movq $0x0, 0xb0(%rsp)
xorl %ecx, %ecx
movl 0x44(%rsp), %eax
movl %eax, 0x18(%rsp)
cmpq 0xd8(%rsp), %rcx
movq 0x48(%rsp), %rax
je 0x49fc97
movq 0xd0(%rsp), %r8
vmovdqa (%r8), %ymm10
vinserti128 $0x1, %xmm10, %ymm0, %ymm11
vpalignr $0xf, %ymm11, %ymm10, %ymm10 # ymm10 = ymm11[15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm11[31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
movq 0x20(%rsp), %r8
vpinsrb $0x0, (%r8,%rcx), %xmm10, %xmm11
vpblendd $0xf, %ymm11, %ymm10, %ymm12 # ymm12 = ymm11[0,1,2,3],ymm10[4,5,6,7]
movq 0xa0(%rsp), %r8
movq 0x10(%r8), %r8
movq 0xa8(%rsp), %r11
movq %rcx, 0xb8(%rsp)
movzbl (%r11,%rcx), %r11d
movl (%r8,%r11,4), %r8d
imull 0x58(%rsp), %r8d
movslq %r8d, %r8
shlq $0x5, %r8
addq 0xe0(%rsp), %r8
movq 0x38(%rsp), %r11
vpsubsb (%r11), %ymm0, %ymm11
xorl %r11d, %r11d
vmovdqa %ymm0, %ymm10
cmpq %r11, %r10
je 0x49f907
vpaddsb (%r8,%r11), %ymm12, %ymm12
movq 0x28(%rsp), %r15
vmovdqa (%r15,%r11), %ymm13
vmovdqa (%rax,%r11), %ymm14
vpsubsb %ymm4, %ymm14, %ymm14
vpsubsb %ymm3, %ymm13, %ymm15
movq 0x38(%rsp), %r15
vpaddsb (%r15,%r11), %ymm11, %ymm11
vpmaxsb %ymm15, %ymm14, %ymm14
vpmaxsb %ymm11, %ymm10, %ymm10
vmovdqa %ymm14, (%rax,%r11)
vpmaxsb %ymm12, %ymm14, %ymm11
movq 0x88(%rsp), %r15
vmovdqa %ymm11, (%r15,%r11)
addq $0x20, %r11
vmovdqa %ymm13, %ymm12
jmp 0x49f8aa
vinserti128 $0x1, %xmm11, %ymm0, %ymm12
vpalignr $0xf, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[15],ymm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm12[31],ymm11[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
movq 0xb8(%rsp), %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0xe8(%rsp)
movq 0x20(%rsp), %rax
vpinsrb $0x0, 0x1(%rax,%rcx), %xmm11, %xmm12
vpblendd $0xf, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[0,1,2,3],ymm11[4,5,6,7]
movq 0x38(%rsp), %rax
vpaddsb (%rax), %ymm11, %ymm12
vpmaxsb %ymm12, %ymm10, %ymm10
pushq $0x1e
popq %r8
vperm2i128 $0x8, %ymm10, %ymm10, %ymm12 # ymm12 = zero,zero,ymm10[0,1]
vpalignr $0xf, %ymm12, %ymm10, %ymm12 # ymm12 = ymm12[15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm12[31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
subl $0x1, %r8d
jb 0x49f969
vpaddsb %ymm6, %ymm12, %ymm12
vpmaxsb %ymm12, %ymm10, %ymm10
jmp 0x49f94c
vpaddsb %ymm5, %ymm12, %ymm10
vpmaxsb %ymm10, %ymm11, %ymm11
movq 0xb0(%rsp), %r11
xorl %r8d, %r8d
cmpq %r8, %r10
je 0x49fc4f
vpsubsb %ymm4, %ymm10, %ymm10
vpsubsb %ymm3, %ymm11, %ymm11
vpmaxsb %ymm11, %ymm10, %ymm10
movq 0x88(%rsp), %rax
vpmaxsb (%rax,%r8), %ymm10, %ymm11
movq 0x28(%rsp), %rax
vmovdqa %ymm11, (%rax,%r8)
movq 0xc0(%rsp), %rax
movq 0x10(%rax), %r12
movq (%r12), %r12
vmovd %xmm11, %eax
movsbl %al, %eax
movl %eax, (%r12,%r11)
vpextrb $0x1, %xmm11, %eax
addq %r11, %r12
movsbl %al, %eax
vpextrb $0x2, %xmm11, %r15d
movl %eax, (%rdi,%r12)
movsbl %r15b, %eax
vpextrb $0x3, %xmm11, %r15d
movl %eax, (%rbx,%r12)
movsbl %r15b, %eax
vpextrb $0x4, %xmm11, %r15d
movl %eax, (%r14,%r12)
movsbl %r15b, %eax
vpextrb $0x5, %xmm11, %r15d
movq 0x178(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x6, %xmm11, %r15d
movl %eax, (%r9,%r12)
movsbl %r15b, %eax
vpextrb $0x7, %xmm11, %r15d
movl %eax, (%rsi,%r12)
movsbl %r15b, %eax
vpextrb $0x8, %xmm11, %r15d
movl %eax, (%rdx,%r12)
movsbl %r15b, %eax
vpextrb $0x9, %xmm11, %r15d
movq 0x60(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xa, %xmm11, %r15d
movq 0xf0(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xb, %xmm11, %r15d
movq 0xf8(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xc, %xmm11, %r15d
movq 0x100(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xd, %xmm11, %r15d
movq 0x108(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xe, %xmm11, %r15d
movq 0x110(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xf, %xmm11, %r15d
movq 0x118(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
movq 0x120(%rsp), %rcx
movl %eax, (%rcx,%r12)
vextracti128 $0x1, %ymm11, %xmm12
vmovd %xmm12, %eax
movsbl %al, %eax
vpextrb $0x1, %xmm12, %r15d
movq 0x68(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x2, %xmm12, %r15d
movq 0x128(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x3, %xmm12, %r15d
movq 0x130(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x4, %xmm12, %r15d
movq 0x138(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x5, %xmm12, %r15d
movq 0x140(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x6, %xmm12, %r15d
movq 0x148(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x7, %xmm12, %r15d
movq 0x150(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x8, %xmm12, %r15d
movq 0x158(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0x9, %xmm12, %r15d
movq 0x160(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xa, %xmm12, %r15d
movq 0x168(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xb, %xmm12, %r15d
movq 0x170(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xc, %xmm12, %r15d
movq 0x70(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xd, %xmm12, %r15d
movq 0x78(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xe, %xmm12, %r15d
movq 0x80(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
vpextrb $0xf, %xmm12, %r15d
movq 0x50(%rsp), %rcx
movl %eax, (%rcx,%r12)
movsbl %r15b, %eax
movq 0x30(%rsp), %r15
movl %eax, (%r15,%r12)
vpminsb %ymm10, %ymm2, %ymm2
vpminsb %ymm11, %ymm2, %ymm2
vpmaxsb %ymm11, %ymm7, %ymm7
addq $0x20, %r8
addq %r13, %r11
jmp 0x49f97d
movq 0x98(%rsp), %rax
vmovdqa (%rax), %ymm10
vpcmpgtb %ymm8, %ymm10, %ymm11
vpand %ymm9, %ymm11, %ymm11
vpmaxsb %ymm8, %ymm10, %ymm8
vpmovmskb %ymm11, %eax
testl %eax, %eax
movl 0x18(%rsp), %eax
cmovnel 0xb8(%rsp), %eax
movl %eax, 0x18(%rsp)
addq $0x4, 0xb0(%rsp)
movq 0xe8(%rsp), %rcx
jmp 0x49f821
movl 0x20(%rbp), %r14d
testl %r14d, %r14d
movq 0xc0(%rsp), %rbx
movl 0x94(%rsp), %r8d
movq 0xc8(%rsp), %r9
movl 0x1c(%rsp), %r10d
movq 0x58(%rsp), %r11
movl 0x10(%rbp), %r15d
movl 0x44(%rsp), %r12d
movl 0x90(%rsp), %r13d
je 0x49fcf6
xorl %eax, %eax
cmpl %r13d, %eax
jge 0x49fcea
vperm2i128 $0x8, %ymm8, %ymm8, %ymm3 # ymm3 = zero,zero,ymm8[0,1]
vpalignr $0xf, %ymm3, %ymm8, %ymm8 # ymm8 = ymm3[15],ymm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm3[31],ymm8[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
incl %eax
jmp 0x49fcd5
vextracti128 $0x1, %ymm8, %xmm3
vpextrb $0xf, %xmm3, %r10d
testl %r15d, %r15d
je 0x49fd57
movl %r11d, %ecx
andl $0x3ffffff, %ecx        # imm = 0x3FFFFFF
shll $0x5, %ecx
xorl %edx, %edx
movl %r8d, %eax
cmpl %edx, %ecx
je 0x49fd5a
movl %edx, %edi
shrl $0x5, %edi
movl %edx, %esi
andl $0x1f, %esi
imull %r11d, %esi
addl %edi, %esi
cmpl %r9d, %esi
jge 0x49fd52
movq 0x28(%rsp), %rdi
movb (%rdi,%rdx), %dil
cmpb %r10b, %dil
jle 0x49fd3f
movl %edi, %r10d
movl %r12d, 0x18(%rsp)
movl %esi, %eax
jmp 0x49fd52
cmpl %eax, %esi
cmovgel %eax, %esi
cmpl %r12d, 0x18(%rsp)
cmovnel %eax, %esi
cmpb %r10b, %dil
cmovel %esi, %eax
incq %rdx
jmp 0x49fd0c
movl %r8d, %eax
orl %r15d, %r14d
jne 0x49fd96
movq 0x98(%rsp), %rax
vmovdqa (%rax), %ymm3
xorl %eax, %eax
cmpl %r13d, %eax
jge 0x49fd82
vperm2i128 $0x28, %ymm3, %ymm3, %ymm4 # ymm4 = zero,zero,ymm3[0,1]
vpalignr $0xf, %ymm4, %ymm3, %ymm3 # ymm3 = ymm4[15],ymm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm4[31],ymm3[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
incl %eax
jmp 0x49fd6d
vextracti128 $0x1, %ymm3, %xmm3
vpextrb $0xf, %xmm3, %r10d
movl %r12d, 0x18(%rsp)
movl %r8d, %eax
vpcmpgtb %ymm2, %ymm0, %ymm0
vpcmpgtb %ymm1, %ymm7, %ymm1
vpor %ymm0, %ymm1, %ymm0
vpmovmskb %ymm0, %ecx
testl %ecx, %ecx
je 0x49fdbb
orb $0x40, 0xc(%rbx)
xorl %r10d, %r10d
movl $0x0, 0x18(%rsp)
xorl %eax, %eax
movsbl %r10b, %ecx
movl %ecx, (%rbx)
movl %eax, 0x4(%rbx)
movl 0x18(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0x38(%rsp), %rdi
vzeroupper
callq 0x1ab763
movq 0x28(%rsp), %rdi
callq 0x1ab763
movq 0x88(%rsp), %rdi
callq 0x1ab763
movq 0x20(%rsp), %rdi
callq 0x1ab763
movq 0x48(%rsp), %rdi
callq 0x1ab763
jmp 0x49ff23
movq 0x29b1c9(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1271d2(%rip), %rsi    # 0x5c6feb
leaq 0x12ca06(%rip), %rdx    # 0x5cc826
leaq 0xfd6b6(%rip), %rcx     # 0x59d4dd
jmp 0x49ff1a
movq 0x29b1a5(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1271ae(%rip), %rsi    # 0x5c6feb
leaq 0x12c9e2(%rip), %rdx    # 0x5cc826
leaq 0x127c65(%rip), %rcx    # 0x5c7ab0
jmp 0x49ff1a
movq 0x29b181(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12718a(%rip), %rsi    # 0x5c6feb
leaq 0x12c9be(%rip), %rdx    # 0x5cc826
leaq 0x127aca(%rip), %rcx    # 0x5c7939
jmp 0x49ff1a
movq 0x29b15d(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12787c(%rip), %rsi    # 0x5c7701
leaq 0x12c99a(%rip), %rdx    # 0x5cc826
leaq 0x127ab6(%rip), %rcx    # 0x5c7949
jmp 0x49ff1a
movq 0x29b139(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x127142(%rip), %rsi    # 0x5c6feb
leaq 0x12c976(%rip), %rdx    # 0x5cc826
leaq 0x127847(%rip), %rcx    # 0x5c76fe
jmp 0x49ff1a
movq 0x29b118(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x127837(%rip), %rsi    # 0x5c7701
leaq 0x12c955(%rip), %rdx    # 0x5cc826
leaq 0x12783d(%rip), %rcx    # 0x5c7715
jmp 0x49ff1a
movq 0x29b0f7(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x127830(%rip), %rsi    # 0x5c771b
leaq 0x12c934(%rip), %rdx    # 0x5cc826
leaq 0x127837(%rip), %rcx    # 0x5c7730
jmp 0x49ff1a
movq 0x29b0d6(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12780f(%rip), %rsi    # 0x5c771b
leaq 0x12c913(%rip), %rdx    # 0x5cc826
leaq 0x12781b(%rip), %rcx    # 0x5c7735
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq