// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_8.c
// Function: parasail_sg_flags_rowcol_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 $0x1a0, %rsp            # imm = 0x1A0
movq %rsi, 0x60(%rsp)
testq %rdi, %rdi
je 0x5262bd
movq 0x18(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x5262c4
movq 0x10(%rdi), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x5262cb
movl %edx, %r15d
movl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x5262d2
cmpq $0x0, 0x60(%rsp)
je 0x5262d9
testl %r15d, %r15d
jle 0x5262e0
testl %ecx, %ecx
js 0x5262e7
testl %r8d, %r8d
js 0x5262ee
movl %r9d, %r13d
movl %r8d, 0x50(%rsp)
leal -0x1(%rdx), %eax
movq %rdx, 0xa0(%rsp)
leaq 0x1f(%rdx), %rbx
movq %rbx, %r14
shrq $0x5, %r14
movl %eax, 0x8c(%rsp)
cltd
idivl %r14d
movl %eax, 0x24(%rsp)
movl %edx, %r12d
movq 0x58(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negb %sil
movzbl %sil, %edi
movl %ecx, %esi
negl %esi
movl %esi, 0x48(%rsp)
cmpl %esi, %eax
movl %ecx, 0x18(%rsp)
cmovgl %ecx, %edi
movl %edi, 0x34(%rsp)
movb $0x7e, %al
subb 0x1c(%rdx), %al
movl %eax, 0x28(%rsp)
andl $0x7fffffe0, %ebx       # imm = 0x7FFFFFE0
movl %ebx, %edi
movl %r15d, %esi
callq 0x209630
testq %rax, %rax
je 0x5262f3
movl %r12d, 0x70(%rsp)
movq %rbx, 0x98(%rsp)
movl 0x20(%rbp), %r8d
xorl %edi, %edi
testl %r13d, %r13d
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
movl %r8d, 0x88(%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 $0x20140402, %ecx       # imm = 0x20140402
movq %rax, 0x80(%rsp)
movl %ecx, 0xc(%rax)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, %r12
leal 0x1(%r15), %esi
movl $0x20, %edi
callq 0x2094c8
movq %rax, %rbx
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r15, 0x40(%rsp)
movq %rax, %r15
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r14, %rsi
movq %rax, %r14
movl $0x20, %edi
movq %rsi, 0x38(%rsp)
callq 0x4c5e3c
testq %r12, %r12
sete %cl
movq %rbx, 0x68(%rsp)
testq %rbx, %rbx
sete %dl
orb %cl, %dl
testq %r15, %r15
sete %cl
testq %r14, %r14
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x5262f3
movq 0x40(%rsp), %rcx
decl %ecx
movl %ecx, 0x20(%rsp)
movl $0x1f, %edx
subl 0x24(%rsp), %edx
movl 0x18(%rsp), %edi
vmovd %edi, %xmm0
vpbroadcastb %xmm0, %ymm5
movl 0x50(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastb %xmm0, %ymm6
movl 0x34(%rsp), %ecx
addb $-0x7f, %cl
vmovd %ecx, %xmm0
vpbroadcastb %xmm0, %ymm0
vmovd 0x28(%rsp), %xmm1
vpbroadcastb %xmm1, %ymm1
movl %edx, 0x30(%rsp)
vmovd %edx, %xmm2
vpbroadcastb %xmm2, %ymm3
movl %ecx, 0x34(%rsp)
movzbl %cl, %ecx
vmovd %ecx, %xmm7
movq 0x38(%rsp), %r8
movl %r8d, %ecx
imull %esi, %ecx
negb %cl
vmovd %ecx, %xmm2
vpbroadcastb %xmm2, %ymm2
vpand 0xd3eff(%rip), %ymm2, %ymm2 # 0x5f98c0
vpaddsb %ymm2, %ymm7, %ymm8
movl %edi, %ecx
movl %esi, %esi
movslq 0x48(%rsp), %rdx
movl %r8d, %edi
movq %rdi, 0x28(%rsp)
movq %rsi, 0x18(%rsp)
imulq %rsi, %rdi
xorl %r9d, %r9d
movq $-0x80, %r10
movq %rdx, %rsi
xorl %r8d, %r8d
testl %r13d, %r13d
je 0x5259f9
xorl %r11d, %r11d
jmp 0x5259fc
movq %rsi, %r11
cmpq $-0x7f, %r11
movq $-0x80, %rbx
cmovgeq %r11, %rbx
movb %bl, 0x160(%rsp,%r8)
subq %rcx, %r11
cmpq $-0x7f, %r11
cmovlq %r10, %r11
movb %r11b, 0x140(%rsp,%r8)
incq %r8
subq %rdi, %rsi
cmpq $0x20, %r8
jne 0x5259ef
movq %r9, %rsi
shlq $0x5, %rsi
vmovaps 0x160(%rsp), %ymm2
vmovaps %ymm2, (%r14,%rsi)
vmovdqa 0x140(%rsp), %ymm2
vmovdqa %ymm2, (%r12,%rsi)
incq %r9
subq 0x18(%rsp), %rdx
cmpq 0x28(%rsp), %r9
jne 0x5259e9
movq 0x68(%rsp), %r8
movb $0x0, (%r8)
movq 0x40(%rsp), %rdx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl 0x50(%rsp), %r9d
movl 0x48(%rsp), %r10d
movl 0x18(%rbp), %r11d
cmpl $-0x7f, %r10d
movl $0xffffff80, %edi       # imm = 0xFFFFFF80
cmovgel %r10d, %edi
testl %r11d, %r11d
cmovnel %edx, %edi
movb %dil, 0x1(%r8,%rsi)
subl %r9d, %r10d
incq %rsi
cmpq %rsi, %rcx
jne 0x525a91
movq 0x38(%rsp), %rdi
leal -0x1(%rdi), %ecx
vpxor %xmm2, %xmm2, %xmm2
vpsubsb %ymm5, %ymm2, %ymm4
movq %rcx, %rsi
shlq $0x5, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movl %edi, %esi
vmovdqa %ymm1, %ymm2
movq 0x80(%rsp), %r13
vmovdqa %ymm4, (%rdx)
vpsubsb %ymm6, %ymm4, %ymm4
vpminsb %ymm4, %ymm2, %ymm2
addq $-0x20, %rdx
decl %esi
jg 0x525adf
movl %ecx, %ecx
shlq $0x5, %rcx
addq %r14, %rcx
movl 0x70(%rsp), %edx
movq %rdx, 0x90(%rsp)
shlq $0x5, %rdx
addq %r14, %rdx
movl $0x1, %esi
movq 0x38(%rsp), %rdi
cmpl %esi, %edi
adcl $0x0, %edi
movl 0x30(%rsp), %r8d
cmpl $0x2, %r8d
movl $0x1, %r9d
cmovgel %r8d, %r9d
movq 0x40(%rsp), %r8
cmpl $0x2, %r8d
cmovgel %r8d, %esi
shlq $0x5, %rdi
xorl %r11d, %r11d
vpcmpeqb 0xd3d92(%rip), %ymm3, %ymm9 # 0x5f98e0
movl 0x20(%rsp), %r8d
movl %r8d, 0x18(%rsp)
vmovdqa %ymm0, %ymm4
vmovdqa %ymm0, %ymm3
movq %r11, %r10
movq 0x58(%rsp), %r8
movq 0x10(%r8), %r8
movq 0x60(%rsp), %r11
movzbl (%r11,%r10), %r11d
movslq (%r8,%r11,4), %r11
imulq 0x28(%rsp), %r11
shlq $0x5, %r11
vpsubsb (%rax), %ymm0, %ymm10
addq 0x78(%rsp), %r11
vmovdqa (%rcx), %ymm11
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 0x68(%rsp), %r8
vpinsrb $0x0, (%r8,%r10), %xmm11, %xmm12
vpblendd $0xf, %ymm12, %ymm11, %ymm12 # ymm12 = ymm12[0,1,2,3],ymm11[4,5,6,7]
xorl %r8d, %r8d
vmovdqa %ymm0, %ymm11
vpaddsb (%r11,%r8), %ymm12, %ymm12
vmovdqa (%r14,%r8), %ymm13
vmovdqa (%r12,%r8), %ymm14
vpsubsb %ymm6, %ymm14, %ymm14
vpsubsb %ymm5, %ymm13, %ymm15
vpmaxsb %ymm15, %ymm14, %ymm14
vpaddsb (%rax,%r8), %ymm10, %ymm10
vpmaxsb %ymm10, %ymm11, %ymm11
vpmaxsb %ymm12, %ymm14, %ymm10
vmovdqa %ymm14, (%r12,%r8)
vmovdqa %ymm10, (%r15,%r8)
addq $0x20, %r8
vmovdqa %ymm13, %ymm12
cmpq %r8, %rdi
jne 0x525bb6
vinserti128 $0x1, %xmm10, %ymm0, %ymm12
vpalignr $0xf, %ymm12, %ymm10, %ymm10 # ymm10 = 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]
leaq 0x1(%r10), %r11
movq 0x68(%rsp), %r8
vpinsrb $0x0, 0x1(%r8,%r10), %xmm10, %xmm12
vpblendd $0xf, %ymm12, %ymm10, %ymm12 # ymm12 = ymm12[0,1,2,3],ymm10[4,5,6,7]
vpaddsb (%rax), %ymm12, %ymm10
vpmaxsb %ymm10, %ymm11, %ymm10
movl $0x1e, %r8d
vperm2i128 $0x28, %ymm10, %ymm10, %ymm11 # ymm11 = zero,zero,ymm10[0,1]
vpalignr $0xf, %ymm11, %ymm10, %ymm11 # ymm11 = 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]
vpaddsb %ymm8, %ymm11, %ymm11
vpmaxsb %ymm11, %ymm10, %ymm10
decl %r8d
jne 0x525c31
vperm2i128 $0x28, %ymm10, %ymm10, %ymm11 # ymm11 = zero,zero,ymm10[0,1]
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]
vpaddsb %ymm7, %ymm10, %ymm10
vpmaxsb %ymm10, %ymm12, %ymm11
xorl %r8d, %r8d
vpsubsb %ymm6, %ymm10, %ymm10
vpsubsb %ymm5, %ymm11, %ymm11
vpmaxsb %ymm11, %ymm10, %ymm10
vpmaxsb (%r15,%r8), %ymm10, %ymm11
vmovdqa %ymm11, (%r14,%r8)
vpminsb %ymm10, %ymm2, %ymm2
vpminsb %ymm11, %ymm2, %ymm2
vpmaxsb %ymm11, %ymm3, %ymm3
addq $0x20, %r8
cmpq %r8, %rdi
jne 0x525c64
vmovdqa (%rdx), %ymm10
vpcmpgtb %ymm4, %ymm10, %ymm11
vpand %ymm9, %ymm11, %ymm11
vpmovmskb %ymm11, %r8d
testl %r8d, %r8d
movl 0x18(%rsp), %r8d
cmovnel %r10d, %r8d
movl %r8d, 0x18(%rsp)
vmovdqa %ymm10, %ymm11
cmpl $0x1e, 0x24(%rsp)
jg 0x525cdd
movl %r9d, %r8d
vmovdqa %ymm10, %ymm11
vperm2i128 $0x28, %ymm11, %ymm11, %ymm12 # ymm12 = zero,zero,ymm11[0,1]
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]
decl %r8d
jne 0x525ccc
vpmaxsb %ymm4, %ymm10, %ymm4
vextracti128 $0x1, %ymm11, %xmm10
vpextrb $0xf, %xmm10, %r8d
movsbl %r8b, %r8d
movq 0x10(%r13), %rbx
movq (%rbx), %rbx
movl %r8d, (%rbx,%r10,4)
cmpq %rsi, %r11
jne 0x525b60
movq 0x38(%rsp), %rsi
movl %esi, %ecx
shll $0x4, %ecx
movq %rcx, 0x60(%rsp)
movq 0x28(%rsp), %rdi
leaq (%rdi,%rdi,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdi, %rcx
movq %rcx, 0x58(%rsp)
cmpl $0x1, %esi
movl %esi, %r8d
adcl $0x0, %r8d
imulq $0x7c, %rdi, %rcx
movq %rcx, 0x78(%rsp)
imulq $0x78, %rdi, %rcx
movq %rcx, 0x50(%rsp)
imulq $0x74, %rdi, %rcx
movq %rcx, 0x48(%rsp)
imulq $0x70, %rdi, %rcx
movq %rcx, 0x40(%rsp)
imulq $0x6c, %rdi, %rcx
movq %rcx, 0x70(%rsp)
movq %rdi, %r9
shlq $0x5, %r9
movl %edi, %ecx
shll $0x4, %ecx
leaq (%rcx,%rcx,4), %rdx
movq %rdx, 0x138(%rsp)
movq %rdi, %r10
shlq $0x6, %r10
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x128(%rsp)
imulq $0x68, %rdi, %rcx
movq %rcx, 0x120(%rsp)
imulq $0x64, %rdi, %rcx
movq %rcx, 0x118(%rsp)
imulq $0x5c, %rdi, %rcx
movq %rcx, 0x110(%rsp)
imulq $0x58, %rdi, %rcx
movq %rcx, 0x108(%rsp)
imulq $0x54, %rdi, %rcx
movq %rcx, 0x100(%rsp)
imulq $0x4c, %rdi, %rcx
movq %rcx, 0xf8(%rsp)
leal (,%rdi,8), %ecx
leal (,%rdi,4), %edx
imulq $0x3c, %rdi, %r11
movq %r11, 0xf0(%rsp)
imulq $0x38, %rdi, %r11
movq %r11, 0xe8(%rsp)
imulq $0x34, %rdi, %r11
movq %r11, 0xe0(%rsp)
imulq $0x2c, %rdi, %rdi
movq %rdi, 0xd8(%rsp)
leaq (%rcx,%rcx,8), %rdi
movq %rdi, 0xd0(%rsp)
leaq (%rcx,%rcx,4), %rcx
movq %rcx, 0xc8(%rsp)
movq %r10, 0x130(%rsp)
leaq (%r10,%rdx), %rcx
movq %rcx, 0xc0(%rsp)
leaq (%rdx,%rdx,8), %rcx
movq %rcx, 0xb8(%rsp)
shll $0x2, %r8d
movq %r8, 0x28(%rsp)
leal (,%rsi,4), %r11d
leal (,%rsi,8), %edi
leaq (%r11,%r11,2), %rcx
movq %rcx, 0xb0(%rsp)
leaq (%r11,%r11,4), %rcx
movq %rcx, 0xa8(%rsp)
leaq (%rdi,%rdi,2), %r8
movq %r9, %rdx
leaq (%r9,%r9,2), %rcx
xorl %r9d, %r9d
movq 0x80(%rsp), %r10
movq 0x10(%r10), %r13
movq 0x8(%r13), %r13
vmovdqa (%r14,%r9,8), %xmm6
vmovdqa 0x10(%r14,%r9,8), %xmm5
vmovd %xmm6, %r10d
movsbl %r10b, %r10d
movl %r10d, (%r13,%r9)
vpextrb $0x1, %xmm6, %r10d
addq %r9, %r13
movsbl %r10b, %r10d
vpextrb $0x2, %xmm6, %ebx
movl %r10d, (%r11,%r13)
movsbl %bl, %r10d
vpextrb $0x3, %xmm6, %ebx
movl %r10d, (%rdi,%r13)
movsbl %bl, %r10d
vpextrb $0x4, %xmm6, %ebx
movq 0xb0(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0x5, %xmm6, %ebx
movq 0x60(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0x6, %xmm6, %ebx
movq 0xa8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0x7, %xmm6, %ebx
movl %r10d, (%r8,%r13)
movsbl %bl, %r10d
vpextrb $0x8, %xmm6, %ebx
movq 0x58(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0x9, %xmm6, %ebx
movl %r10d, (%rdx,%r13)
movsbl %bl, %r10d
vpextrb $0xa, %xmm6, %ebx
movq 0xb8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0xb, %xmm6, %ebx
movq 0xc8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0xc, %xmm6, %ebx
movq 0xd8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0xd, %xmm6, %ebx
movq 0x128(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0xe, %xmm6, %ebx
movq 0xe0(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
vpextrb $0xf, %xmm6, %ebx
movq 0xe8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movsbl %bl, %r10d
movq 0xf0(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vmovd %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x130(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x1, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0xc0(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x2, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0xd0(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x3, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0xf8(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x4, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x138(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x5, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x100(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x6, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x108(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x7, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x110(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0x8, %xmm5, %r10d
movsbl %r10b, %r10d
movl %r10d, (%rcx,%r13)
vpextrb $0x9, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x118(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xa, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x120(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xb, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x70(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xc, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x40(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xd, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x48(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xe, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x50(%rsp), %rsi
movl %r10d, (%rsi,%r13)
vpextrb $0xf, %xmm5, %r10d
movsbl %r10b, %r10d
movq 0x78(%rsp), %rsi
movl %r10d, (%rsi,%r13)
movq 0x80(%rsp), %rbx
addq $0x4, %r9
cmpq %r9, 0x28(%rsp)
jne 0x525e88
cmpl $0x0, 0x20(%rbp)
movl 0x8c(%rsp), %r9d
movq 0xa0(%rsp), %r10
movl 0x34(%rsp), %r11d
je 0x526186
cmpl $0x1e, 0x24(%rsp)
jg 0x52617a
movl 0x30(%rsp), %edx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
vperm2i128 $0x8, %ymm4, %ymm4, %ymm5 # ymm5 = zero,zero,ymm4[0,1]
vpalignr $0xf, %ymm5, %ymm4, %ymm4 # ymm4 = ymm5[15],ymm4[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm5[31],ymm4[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
decl %ecx
jne 0x52616a
vextracti128 $0x1, %ymm4, %xmm4
vpextrb $0xf, %xmm4, %r11d
cmpl $0x0, 0x10(%rbp)
je 0x5261fb
cmpl $0x0, 0x98(%rsp)
je 0x5261fb
movq 0x38(%rsp), %rdx
andl $0x3ffffff, %edx        # imm = 0x3FFFFFF
shll $0x5, %edx
xorl %esi, %esi
movl %r9d, %ecx
movl %esi, %r8d
shrl $0x5, %r8d
movl %esi, %edi
andl $0x1f, %edi
imull 0x38(%rsp), %edi
addl %r8d, %edi
cmpl %r10d, %edi
jge 0x5261f2
movb (%r14,%rsi), %r8b
cmpb %r11b, %r8b
jle 0x5261da
movl %r8d, %r11d
movl 0x20(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %edi, %ecx
jmp 0x5261f2
cmpl %ecx, %edi
cmovgel %ecx, %edi
movl 0x18(%rsp), %r13d
cmpl 0x20(%rsp), %r13d
cmovnel %ecx, %edi
cmpb %r11b, %r8b
cmovel %edi, %ecx
incq %rsi
cmpl %esi, %edx
jne 0x5261a9
jmp 0x5261fe
movl %r9d, %ecx
movl 0x10(%rbp), %edx
orl %edx, 0x88(%rsp)
jne 0x526259
movq 0x90(%rsp), %rcx
shlq $0x5, %rcx
vmovdqa (%r14,%rcx), %ymm4
cmpl $0x1e, 0x24(%rsp)
jg 0x526242
movl 0x30(%rsp), %edx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
vperm2i128 $0x28, %ymm4, %ymm4, %ymm5 # ymm5 = zero,zero,ymm4[0,1]
vpalignr $0xf, %ymm5, %ymm4, %ymm4 # ymm4 = ymm5[15],ymm4[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],ymm5[31],ymm4[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
decl %ecx
jne 0x526232
vextracti128 $0x1, %ymm4, %xmm4
vpextrb $0xf, %xmm4, %r11d
movl 0x20(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %r9d, %ecx
vpcmpgtb %ymm2, %ymm0, %ymm0
vpcmpgtb %ymm1, %ymm3, %ymm1
vpor %ymm0, %ymm1, %ymm0
vpmovmskb %ymm0, %edx
testl %edx, %edx
je 0x52627e
orb $0x40, 0xc(%rbx)
xorl %r11d, %r11d
movl $0x0, 0x18(%rsp)
xorl %ecx, %ecx
movsbl %r11b, %edx
movl %edx, (%rbx)
movl %ecx, 0x4(%rbx)
movl 0x18(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movq %rax, %rdi
vzeroupper
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq 0x68(%rsp), %rdi
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
jmp 0x5262f5
callq 0x1f06bd
jmp 0x5262f3
callq 0x1f0697
jmp 0x5262f3
callq 0x1f0671
jmp 0x5262f3
callq 0x1f064b
jmp 0x5262f3
callq 0x1f0625
jmp 0x5262f3
callq 0x1f05ff
jmp 0x5262f3
callq 0x1f05d9
jmp 0x5262f3
callq 0x1f05b3
xorl %ebx, %ebx
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq