// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_32.c
// Function: parasail_sg_flags_rowcol_scan_profile_avx2_256_32
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;
    int32_t* restrict boundary = NULL;
    __m256i* restrict pvHt = NULL;
    __m256i* restrict pvH = NULL;
    __m256i* restrict pvGapper = NULL;
    __m256i vGapO;
    __m256i vGapE;
    int32_t NEG_LIMIT = 0;
    int32_t POS_LIMIT = 0;
    __m256i vZero;
    int32_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->profile32.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 = 8; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m256i*)profile->profile32.score;
    vGapO = _mm256_set1_epi32(open);
    vGapE = _mm256_set1_epi32(gap);
    NEG_LIMIT = (-open < matrix->min ? INT32_MIN + open : INT32_MIN - matrix->min) + 1;
    POS_LIMIT = INT32_MAX - matrix->max - 1;
    vZero = _mm256_setzero_si256();
    score = NEG_LIMIT;
    vNegLimit = _mm256_set1_epi32(NEG_LIMIT);
    vPosLimit = _mm256_set1_epi32(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm256_cmpeq_epi32(_mm256_set1_epi32(position),
            _mm256_set_epi32(0,1,2,3,4,5,6,7));
    vNegInfFront = vZero;
    vNegInfFront = _mm256_insert_epi32_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm256_add_epi32(vNegInfFront,
            _mm256_slli_si256_rpl(_mm256_set1_epi32(-segLen*gap), 4));

    /* 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_32 | PARASAIL_FLAG_LANES_8;
    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_int32_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_32_t h;
            __m256i_32_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT32_MIN ? INT32_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT32_MIN ? INT32_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 < INT32_MIN ? INT32_MIN : tmp;
        }
    }

    {
        __m256i vGapper = _mm256_sub_epi32(vZero,vGapO);
        for (i=segLen-1; i>=0; --i) {
            _mm256_store_si256(pvGapper+i, vGapper);
            vGapper = _mm256_sub_epi32(vGapper, vGapE);
            /* long queries and/or large penalties will break the pseudo prefix scan */
            vSaturationCheckMin = _mm256_min_epi32(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, 4);
        vHp = _mm256_insert_epi32_rpl(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm256_sub_epi32(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_epi32(
                    _mm256_sub_epi32(vE, vGapE),
                    _mm256_sub_epi32(vH, vGapO));
            vHp = _mm256_add_epi32(vHp, vW);
            vF = _mm256_max_epi32(vF, _mm256_add_epi32(vHt, pvGapper[i]));
            vHt = _mm256_max_epi32(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, 4);
        vHt = _mm256_insert_epi32_rpl(vHt, boundary[j+1], 0);
        vF = _mm256_max_epi32(vF, _mm256_add_epi32(vHt, pvGapper[0]));
        for (i=0; i<segWidth-2; ++i) {
            __m256i vFt = _mm256_slli_si256_rpl(vF, 4);
            vFt = _mm256_add_epi32(vFt, vSegLenXgap);
            vF = _mm256_max_epi32(vF, vFt);
        }

        /* calculate final H */
        vF = _mm256_slli_si256_rpl(vF, 4);
        vF = _mm256_add_epi32(vF, vNegInfFront);
        vH = _mm256_max_epi32(vHt, vF);
        for (i=0; i<segLen; ++i) {
            vHt = _mm256_load_si256(pvHt+i);
            vF = _mm256_max_epi32(
                    _mm256_sub_epi32(vF, vGapE),
                    _mm256_sub_epi32(vH, vGapO));
            vH = _mm256_max_epi32(vHt, vF);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi32(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi32(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi32(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_epi32(vH, vMaxH));
            vMaxH = _mm256_max_epi32(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, 4);
            }
            result->rowcols->score_row[j] = (int32_t) _mm256_extract_epi32_rpl (vH, 7);
#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, 4);
        }
        score = (int32_t) _mm256_extract_epi32_rpl(vMaxH, 7);
        end_query = s1Len-1;
    }

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

    if (_mm256_movemask_epi8(_mm256_or_si256(
            _mm256_cmplt_epi32_rpl(vSaturationCheckMin, vNegLimit),
            _mm256_cmpgt_epi32(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 $0x100, %rsp            # imm = 0x100
movq %rsi, 0x40(%rsp)
testq %rdi, %rdi
je 0x5222b5
movq 0x48(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x5222bc
movq 0x10(%rdi), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x5222c3
movl %edx, %r15d
movl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x5222ca
cmpq $0x0, 0x40(%rsp)
je 0x5222d1
testl %r15d, %r15d
jle 0x5222d8
testl %ecx, %ecx
js 0x5222df
testl %r8d, %r8d
js 0x5222e6
movl %r9d, %r13d
movl %r8d, 0x8(%rsp)
leal -0x1(%rdx), %eax
movq %rdx, 0x70(%rsp)
leaq 0x7(%rdx), %r14
movq %r14, %rsi
shrq $0x3, %rsi
movl %eax, 0x18(%rsp)
cltd
movq %rsi, 0x20(%rsp)
idivl %esi
movl %eax, 0x10(%rsp)
movl %edx, %r12d
movl %ecx, %ebx
negl %ebx
movq 0x38(%rsp), %rsi
movl 0x20(%rsi), %eax
movl $0x80000000, %edx       # imm = 0x80000000
movl %ecx, 0x28(%rsp)
orl %edx, %ecx
subl %eax, %edx
cmpl %ebx, %eax
cmovgl %ecx, %edx
movl %edx, 0x1c(%rsp)
movl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
subl 0x1c(%rsi), %eax
movl %eax, 0xc(%rsp)
andl $0x7ffffff8, %r14d      # imm = 0x7FFFFFF8
movl %r14d, %edi
movl %r15d, %esi
callq 0x209630
testq %rax, %rax
je 0x5222eb
movl %r12d, 0x48(%rsp)
movq %r14, 0x68(%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, 0x5c(%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 $0x8440402, %ecx        # imm = 0x8440402
movq %rax, 0x50(%rsp)
movl %ecx, 0xc(%rax)
movl $0x20, %edi
movq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, %r12
leal 0x1(%r15), %esi
movl $0x20, %edi
movq %rsi, 0x80(%rsp)
callq 0x2094d5
movq %rax, 0x30(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r15, 0x60(%rsp)
movq %rax, %r15
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, %r14
movl $0x20, %edi
movq 0x20(%rsp), %rsi
callq 0x4c5e3c
testq %r12, %r12
sete %cl
cmpq $0x0, 0x30(%rsp)
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
xorl %edx, %edx
orb %sil, %cl
jne 0x5222eb
movq 0x60(%rsp), %rcx
decl %ecx
movl %ecx, 0x14(%rsp)
movl $0x7, %esi
subl 0x10(%rsp), %esi
movl 0x28(%rsp), %r8d
vmovd %r8d, %xmm0
vpbroadcastd %xmm0, %ymm4
movl 0x8(%rsp), %edi
vmovd %edi, %xmm0
vpbroadcastd %xmm0, %ymm5
movl 0x1c(%rsp), %ecx
incl %ecx
movl %ecx, 0x1c(%rsp)
vmovd %ecx, %xmm0
vpbroadcastd %xmm0, %ymm0
vmovd 0xc(%rsp), %xmm1
vpbroadcastd %xmm1, %ymm1
movl %esi, 0xc(%rsp)
vmovd %esi, %xmm2
vpbroadcastd %xmm2, %ymm3
vpxor %xmm2, %xmm2, %xmm2
vmovss %xmm0, %xmm2, %xmm6     # xmm6 = xmm0[0],xmm2[1,2,3]
movq 0x20(%rsp), %r9
movl %r9d, %esi
imull %edi, %esi
movl %esi, %ecx
negl %ecx
vmovd %ecx, %xmm2
vpbroadcastd %xmm2, %ymm2
vpxor %xmm7, %xmm7, %xmm7
vpblendd $0x1, %ymm7, %ymm2, %ymm2 # ymm2 = ymm7[0],ymm2[1,2,3,4,5,6,7]
vpaddd %ymm2, %ymm6, %ymm7
movl %r8d, %edi
movl %r9d, %ecx
movq $-0x80000000, %r9       # imm = 0x80000000
movl %ebx, %r10d
movq %rcx, 0x28(%rsp)
movl %r10d, %ecx
xorl %r11d, %r11d
testl %r13d, %r13d
movl $0x0, %r8d
cmovel %ecx, %r8d
movslq %r8d, %r8
movl %r8d, 0xc0(%rsp,%r11,4)
subq %rdi, %r8
cmpq $-0x7fffffff, %r8       # imm = 0x80000001
cmovlq %r9, %r8
movl %r8d, 0xa0(%rsp,%r11,4)
incq %r11
subl %esi, %ecx
cmpq $0x8, %r11
jne 0x521e18
movq %rdx, %rcx
shlq $0x5, %rcx
vmovaps 0xc0(%rsp), %ymm2
vmovaps %ymm2, (%r14,%rcx)
vmovdqa 0xa0(%rsp), %ymm2
vmovdqa %ymm2, (%r12,%rcx)
incq %rdx
movl 0x8(%rsp), %r8d
subl %r8d, %r10d
movq 0x28(%rsp), %rcx
cmpq %rcx, %rdx
jne 0x521e12
movq 0x30(%rsp), %rsi
movl $0x0, (%rsi)
movl $0x1, %ecx
movl 0x18(%rbp), %edi
movq 0x80(%rsp), %r9
testl %edi, %edi
movl $0x0, %edx
cmovel %ebx, %edx
movl %edx, (%rsi,%rcx,4)
incq %rcx
subl %r8d, %ebx
cmpq %rcx, %r9
jne 0x521ea6
vpxor %xmm2, %xmm2, %xmm2
vpsubd %ymm4, %ymm2, %ymm8
movq 0x20(%rsp), %rbx
leal -0x1(%rbx), %ecx
movq %rcx, %rsi
shlq $0x5, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movl %ebx, %esi
vmovdqa %ymm1, 0x80(%rsp)
vmovdqa %ymm1, %ymm2
movq 0x50(%rsp), %r8
movl 0x10(%rsp), %edi
vmovdqa %ymm8, (%rdx)
vpsubd %ymm5, %ymm8, %ymm8
vpminsd %ymm8, %ymm2, %ymm2
addq $-0x20, %rdx
decl %esi
jg 0x521ef3
movl %ecx, %r9d
shlq $0x5, %r9
addq %r14, %r9
movl 0x48(%rsp), %r10d
movq %r10, 0x48(%rsp)
shlq $0x5, %r10
addq %r14, %r10
movl $0x1, %r11d
cmpl %r11d, %ebx
adcl $0x0, %ebx
movl 0xc(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %r13d
cmovgel %ecx, %r13d
movq 0x60(%rsp), %rcx
cmpl $0x2, %ecx
cmovgel %ecx, %r11d
shlq $0x5, %rbx
xorl %edx, %edx
vpmovsxbd 0xd7825(%rip), %ymm9 # 0x5f9780
vpcmpeqd 0xd783d(%rip), %ymm3, %ymm10 # 0x5f97a0
movl 0x14(%rsp), %ecx
movl %ecx, 0x8(%rsp)
vmovdqa %ymm0, %ymm8
vmovdqa %ymm0, %ymm3
vpermd (%r9), %ymm9, %ymm11
movq %rdx, %rsi
movq 0x30(%rsp), %rcx
vmovd (%rcx,%rdx,4), %xmm12
vpblendd $0x1, %ymm12, %ymm11, %ymm13 # ymm13 = ymm12[0],ymm11[1,2,3,4,5,6,7]
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x40(%rsp), %rdx
movzbl (%rdx,%rsi), %edx
movslq (%rcx,%rdx,4), %rdx
imulq 0x28(%rsp), %rdx
shlq $0x5, %rdx
addq 0x78(%rsp), %rdx
vpsubd (%rax), %ymm0, %ymm12
xorl %ecx, %ecx
vmovdqa %ymm0, %ymm11
vpaddd (%rdx,%rcx), %ymm13, %ymm13
vmovdqa (%r14,%rcx), %ymm14
vmovdqa (%r12,%rcx), %ymm15
vpsubd %ymm5, %ymm15, %ymm15
vpsubd %ymm4, %ymm14, %ymm1
vpmaxsd %ymm1, %ymm15, %ymm1
vpaddd (%rax,%rcx), %ymm12, %ymm12
vpmaxsd %ymm12, %ymm11, %ymm11
vpmaxsd %ymm13, %ymm1, %ymm12
vmovdqa %ymm1, (%r12,%rcx)
vmovdqa %ymm12, (%r15,%rcx)
addq $0x20, %rcx
vmovdqa %ymm14, %ymm13
cmpq %rcx, %rbx
jne 0x521fba
vpermd %ymm12, %ymm9, %ymm1
leaq 0x1(%rsi), %rdx
movq 0x30(%rsp), %rcx
vmovd 0x4(%rcx,%rsi,4), %xmm12
vpblendd $0x1, %ymm12, %ymm1, %ymm12 # ymm12 = ymm12[0],ymm1[1,2,3,4,5,6,7]
vpaddd (%rax), %ymm12, %ymm1
vpmaxsd %ymm1, %ymm11, %ymm11
movl $0x6, %ecx
vperm2i128 $0x28, %ymm11, %ymm11, %ymm1 # ymm1 = zero,zero,ymm11[0,1]
vpalignr $0xc, %ymm1, %ymm11, %ymm1 # ymm1 = ymm1[12,13,14,15],ymm11[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm11[16,17,18,19,20,21,22,23,24,25,26,27]
vpaddd %ymm1, %ymm7, %ymm1
vpmaxsd %ymm1, %ymm11, %ymm11
decl %ecx
jne 0x522029
vperm2i128 $0x28, %ymm11, %ymm11, %ymm1 # ymm1 = zero,zero,ymm11[0,1]
vpalignr $0xc, %ymm1, %ymm11, %ymm1 # ymm1 = ymm1[12,13,14,15],ymm11[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm11[16,17,18,19,20,21,22,23,24,25,26,27]
vpaddd %ymm1, %ymm6, %ymm11
vpmaxsd %ymm11, %ymm12, %ymm12
xorl %ecx, %ecx
vpsubd %ymm5, %ymm11, %ymm1
vpsubd %ymm4, %ymm12, %ymm11
vpmaxsd %ymm11, %ymm1, %ymm11
vpmaxsd (%r15,%rcx), %ymm11, %ymm12
vmovdqa %ymm12, (%r14,%rcx)
vpminsd %ymm11, %ymm2, %ymm1
vpminsd %ymm12, %ymm1, %ymm2
vpmaxsd %ymm12, %ymm3, %ymm3
addq $0x20, %rcx
cmpq %rcx, %rbx
jne 0x522059
vmovdqa (%r10), %ymm11
vpcmpgtd %ymm8, %ymm11, %ymm1
vtestps %ymm10, %ymm1
movl 0x8(%rsp), %ecx
cmovnel %esi, %ecx
movl %ecx, 0x8(%rsp)
vmovdqa %ymm11, %ymm12
cmpl $0x6, %edi
jg 0x5220c6
movl %r13d, %ecx
vmovdqa %ymm11, %ymm12
vperm2i128 $0x28, %ymm12, %ymm12, %ymm1 # ymm1 = zero,zero,ymm12[0,1]
vpalignr $0xc, %ymm1, %ymm12, %ymm12 # ymm12 = ymm1[12,13,14,15],ymm12[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm12[16,17,18,19,20,21,22,23,24,25,26,27]
decl %ecx
jne 0x5220b6
vpmaxsd %ymm8, %ymm11, %ymm8
vextracti128 $0x1, %ymm12, %xmm1
movq 0x10(%r8), %rcx
movq (%rcx), %rcx
vpextrd $0x3, %xmm1, (%rcx,%rsi,4)
cmpq %r11, %rdx
jne 0x521f73
movq 0x20(%rsp), %rcx
cmpl $0x1, %ecx
movl %ecx, %edx
adcl $0x0, %edx
leal (,%rcx,4), %ecx
movq %rcx, 0x40(%rsp)
movq 0x28(%rsp), %rsi
leaq (%rsi,%rsi,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rsi, %rcx
movq %rcx, 0x38(%rsp)
leaq (,%rsi,8), %r10
leaq (%r10,%r10,2), %r11
movq %r8, %rdi
leal (,%rsi,4), %r8d
leaq (%r8,%r8,4), %rcx
shlq $0x4, %rsi
leaq (%r8,%r8,2), %rbx
shll $0x2, %edx
xorl %r13d, %r13d
movq 0x10(%rdi), %r8
movq 0x8(%r8), %r8
vmovdqa (%r14,%r13,8), %xmm1
vmovdqa 0x10(%r14,%r13,8), %xmm4
vmovd %xmm1, (%r8,%r13)
addq %r13, %r8
movq 0x40(%rsp), %r9
vpextrd $0x1, %xmm1, (%r9,%r8)
vpextrd $0x2, %xmm1, (%r10,%r8)
vpextrd $0x3, %xmm1, (%rbx,%r8)
vmovd %xmm4, (%rsi,%r8)
vpextrd $0x1, %xmm4, (%rcx,%r8)
vpextrd $0x2, %xmm4, (%r11,%r8)
movq 0x38(%rsp), %r9
vpextrd $0x3, %xmm4, (%r9,%r8)
addq $0x4, %r13
cmpq %r13, %rdx
jne 0x52213f
cmpl $0x0, 0x20(%rbp)
movl 0x18(%rsp), %edi
movq 0x70(%rsp), %r11
movq 0x20(%rsp), %rbx
movl 0x1c(%rsp), %r13d
vmovdqa 0x80(%rsp), %ymm5
movl 0x8(%rsp), %r10d
je 0x5221f9
cmpl $0x6, 0x10(%rsp)
jg 0x5221ed
movl 0xc(%rsp), %edx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
vperm2i128 $0x28, %ymm8, %ymm8, %ymm1 # ymm1 = zero,zero,ymm8[0,1]
vpalignr $0xc, %ymm1, %ymm8, %ymm8 # ymm8 = ymm1[12,13,14,15],ymm8[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm8[16,17,18,19,20,21,22,23,24,25,26,27]
decl %ecx
jne 0x5221dd
vextracti128 $0x1, %ymm8, %xmm1
vpextrd $0x3, %xmm1, %r13d
cmpl $0x0, 0x10(%rbp)
je 0x522266
cmpl $0x0, 0x68(%rsp)
je 0x522266
movl %ebx, %esi
andl $0xfffffff, %esi        # imm = 0xFFFFFFF
shll $0x3, %esi
xorl %r8d, %r8d
movl %edi, %edx
movl %r8d, %r9d
shrl $0x3, %r9d
movl %r8d, %ecx
andl $0x7, %ecx
imull %ebx, %ecx
addl %r9d, %ecx
cmpl %r11d, %ecx
jge 0x52225c
movl (%r14,%r8,4), %r9d
cmpl %r13d, %r9d
jle 0x522243
movl %r9d, %r13d
movl 0x14(%rsp), %r10d
movl %ecx, %edx
jmp 0x52225c
xorl %r13d, %r9d
movl %r10d, %edi
xorl 0x14(%rsp), %r10d
cmpl %edx, %ecx
cmovgel %edx, %ecx
orl %r9d, %r10d
movl %edi, %r10d
cmovel %ecx, %edx
incq %r8
cmpl %r8d, %esi
jne 0x522216
jmp 0x522268
movl %edi, %edx
movl 0x10(%rbp), %ecx
orl %ecx, 0x5c(%rsp)
movq 0x50(%rsp), %rsi
jne 0x522311
movq 0x48(%rsp), %rcx
shlq $0x5, %rcx
vmovdqa (%r14,%rcx), %ymm4
cmpl $0x6, 0x10(%rsp)
jg 0x5222fc
movl 0xc(%rsp), %edx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
movl 0x18(%rsp), %edx
vperm2i128 $0x28, %ymm4, %ymm4, %ymm1 # ymm1 = zero,zero,ymm4[0,1]
vpalignr $0xc, %ymm1, %ymm4, %ymm4 # ymm4 = ymm1[12,13,14,15],ymm4[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm4[16,17,18,19,20,21,22,23,24,25,26,27]
decl %ecx
jne 0x5222a3
jmp 0x522300
callq 0x1ef961
jmp 0x5222eb
callq 0x1ef93b
jmp 0x5222eb
callq 0x1ef915
jmp 0x5222eb
callq 0x1ef8ef
jmp 0x5222eb
callq 0x1ef8c9
jmp 0x5222eb
callq 0x1ef8a3
jmp 0x5222eb
callq 0x1ef87d
jmp 0x5222eb
callq 0x1ef857
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x18(%rsp), %edx
vextracti128 $0x1, %ymm4, %xmm1
vpextrd $0x3, %xmm1, %r13d
movl 0x14(%rsp), %r10d
vpcmpgtd %ymm2, %ymm0, %ymm0
vpcmpgtd %ymm5, %ymm3, %ymm1
vpor %ymm0, %ymm1, %ymm0
vtestps %ymm0, %ymm0
je 0x522330
orb $0x40, 0xc(%rsi)
xorl %r13d, %r13d
xorl %r10d, %r10d
xorl %edx, %edx
movl %r13d, (%rsi)
movl %edx, 0x4(%rsi)
movl %r10d, 0x8(%rsi)
movq %rax, %rdi
vzeroupper
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq 0x30(%rsp), %rdi
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
movq 0x50(%rsp), %rax
jmp 0x5222ed