// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x58(%rsp)
testq %rdi, %rdi
je 0x550a98
movq 0x48(%rdi), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x550a9f
movq 0x10(%rdi), %rax
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x550aa6
movl 0x8(%rdi), %eax
movq %rax, 0x48(%rsp)
testl %eax, %eax
jle 0x550aad
cmpq $0x0, 0x58(%rsp)
je 0x550ab4
movl %edx, %ebx
testl %edx, %edx
jle 0x550abb
movl %ecx, %r12d
testl %ecx, %ecx
js 0x550ac2
testl %r8d, %r8d
js 0x550ac9
movl %r9d, %r15d
movl %r8d, 0x8(%rsp)
movq 0x48(%rsp), %rcx
leal -0x1(%rcx), %eax
leaq 0x7(%rcx), %r14
movq %r14, %rcx
shrq $0x3, %rcx
movl %eax, 0x44(%rsp)
xorl %edx, %edx
movq %rcx, 0x20(%rsp)
divl %ecx
movl %eax, 0xc(%rsp)
movl %edx, %ebp
movl %r12d, %edi
negl %edi
movq 0x50(%rsp), %rsi
movl 0x20(%rsi), %eax
movl $0x80000000, %edx       # imm = 0x80000000
movl %r12d, %ecx
orl %edx, %ecx
subl %eax, %edx
movl %edi, 0x28(%rsp)
cmpl %edi, %eax
cmovgl %ecx, %edx
movl %edx, 0x14(%rsp)
movl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
subl 0x1c(%rsi), %eax
movl %eax, 0x70(%rsp)
andl $0x7ffffff8, %r14d      # imm = 0x7FFFFFF8
movl %r14d, %edi
movl %ebx, %esi
callq 0x20ac53
testq %rax, %rax
je 0x550ace
movq %rax, %r13
movl %r12d, 0x34(%rsp)
movl %ebp, 0x3c(%rsp)
movq %r14, 0x60(%rsp)
movl 0x100(%rsp), %edi
xorl %eax, %eax
movl %r15d, 0x38(%rsp)
testl %r15d, %r15d
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0xf0(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0xf8(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x40(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%r13), %eax
orl $0x8440402, %eax        # imm = 0x8440402
movl %eax, 0xc(%r13)
movl $0x20, %edi
movq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0x4f1904
movq %rax, %r15
leal 0x1(%rbx), %esi
movl $0x20, %edi
callq 0x20a62d
movq %rax, 0x18(%rsp)
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
movq %rax, %rbp
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
movq %rax, %r14
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
testq %r15, %r15
sete %cl
cmpq $0x0, 0x18(%rsp)
sete %dl
orb %cl, %dl
testq %rbp, %rbp
sete %cl
testq %r14, %r14
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x550ace
leal -0x1(%rbx), %ecx
movl %ecx, 0x10(%rsp)
movl $0x7, %edx
subl 0xc(%rsp), %edx
movl 0x34(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastd %xmm0, %ymm4
movl 0x8(%rsp), %edi
vmovd %edi, %xmm0
vpbroadcastd %xmm0, %ymm5
movl 0x14(%rsp), %ecx
incl %ecx
movl %ecx, 0x14(%rsp)
vmovd %ecx, %xmm0
vpbroadcastd %xmm0, %ymm0
vmovss 0x70(%rsp), %xmm1
vbroadcastss %xmm1, %ymm1
vmovups %ymm1, 0x70(%rsp)
vmovd %edx, %xmm2
vpbroadcastd %xmm2, %ymm1
vmovdqu %ymm1, 0x90(%rsp)
vpxor %xmm2, %xmm2, %xmm2
vmovss %xmm0, %xmm2, %xmm6     # xmm6 = xmm0[0],xmm2[1,2,3]
movq 0x20(%rsp), %r11
imull %r11d, %edi
negl %edi
vmovd %edi, %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 %esi, %ecx
vmovd 0x28(%rsp), %xmm2
vpbroadcastd %xmm2, %ymm2
vmovq %rcx, %xmm10
vmovq %r11, %xmm8
vpbroadcastq %xmm8, %ymm9
vpmuldq 0xdd745(%rip), %ymm9, %ymm8 # 0x62dc40
vpmuldq 0xdd63c(%rip), %ymm9, %ymm9 # 0x62db40
vpbroadcastq %xmm10, %ymm10
xorl %esi, %esi
vpmovsxbd 0xdd7b4(%rip), %ymm11 # 0x62dcc8
vpbroadcastq 0xdd7a3(%rip), %ymm12 # 0x62dcc0
movq %r14, %rdi
movq %r15, %r8
movl 0x38(%rsp), %ecx
testl %ecx, %ecx
je 0x550532
vpxor %xmm13, %xmm13, %xmm13
jmp 0x550560
vmovq %rsi, %xmm13
vpbroadcastq %xmm13, %ymm13
vpaddq %ymm13, %ymm8, %ymm14
vpaddq %ymm13, %ymm9, %ymm13
vpermd %ymm13, %ymm11, %ymm13
vpermd %ymm14, %ymm11, %ymm14
vinserti128 $0x1, %xmm14, %ymm13, %ymm13
vpmulld %ymm13, %ymm5, %ymm13
vpsubd %ymm13, %ymm2, %ymm13
vextracti128 $0x1, %ymm13, %xmm14
vpmovsxdq %xmm14, %ymm14
vpmovsxdq %xmm13, %ymm15
vpsubq %ymm10, %ymm14, %ymm14
vpcmpgtq %ymm12, %ymm14, %ymm1
vblendvpd %ymm1, %ymm14, %ymm12, %ymm1
vpsubq %ymm10, %ymm15, %ymm14
vpcmpgtq %ymm12, %ymm14, %ymm15
vblendvpd %ymm15, %ymm14, %ymm12, %ymm14
vpermd %ymm14, %ymm11, %ymm14
vpermd %ymm1, %ymm11, %ymm1
vmovdqa %ymm13, (%rdi)
vmovdqa %xmm1, 0x10(%r8)
vmovdqa %xmm14, (%r8)
incq %rsi
addq $0x20, %r8
addq $0x20, %rdi
cmpq %rsi, %r11
jne 0x550527
movq 0x18(%rsp), %rcx
movl $0x0, (%rcx)
movl %ebx, %r8d
addl $0x7, %ebx
andl $-0x8, %ebx
leaq -0x1(%r8), %rcx
vmovq %rcx, %xmm1
vpbroadcastq %xmm1, %ymm1
vpmovsxbd 0xdd6e8(%rip), %ymm8 # 0x62dcd0
xorl %esi, %esi
vpmovsxbq 0xdd5d5(%rip), %ymm9 # 0x62dbc8
vpmovsxbq 0xdd6e8(%rip), %ymm10 # 0x62dce4
vpbroadcastq 0xdd57b(%rip), %ymm11 # 0x62db80
vpxor %ymm1, %ymm11, %ymm12
vpcmpeqd %ymm13, %ymm13, %ymm13
vpbroadcastd 0xdd6c9(%rip), %ymm14 # 0x62dce0
movl 0xf8(%rsp), %edi
movq 0x18(%rsp), %rcx
testl %edi, %edi
je 0x55062e
vpxor %xmm15, %xmm15, %xmm15
jmp 0x55063c
vpaddd %ymm13, %ymm8, %ymm1
vpmulld %ymm5, %ymm1, %ymm1
vpsubd %ymm1, %ymm2, %ymm15
vmovq %rsi, %xmm1
vpbroadcastq %xmm1, %ymm1
vpor %ymm1, %ymm9, %ymm3
vpor %ymm1, %ymm10, %ymm1
vpxor %ymm1, %ymm11, %ymm1
vpcmpgtq %ymm12, %ymm1, %ymm1
vpxor %ymm3, %ymm11, %ymm3
vpcmpgtq %ymm12, %ymm3, %ymm3
vpackssdw %ymm1, %ymm3, %ymm1
vpxor %ymm1, %ymm13, %ymm1
vextracti128 $0x1, %ymm1, %xmm3
vpackssdw %xmm3, %xmm1, %xmm1
vpshufd $0xd8, %xmm1, %xmm1     # xmm1 = xmm1[0,2,1,3]
vpmovzxwd %xmm1, %ymm1    # ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
vpslld $0x1f, %ymm1, %ymm1
vpmaskmovd %ymm15, %ymm1, 0x4(%rcx,%rsi,4)
addq $0x8, %rsi
vpaddd %ymm14, %ymm8, %ymm8
cmpq %rsi, %rbx
jne 0x550623
vpxor %xmm1, %xmm1, %xmm1
vpsubd %ymm4, %ymm1, %ymm8
leal -0x1(%r11), %r9d
shlq $0x5, %r9
movq %rax, %rcx
addq %r9, %rcx
movl %r11d, %esi
vmovdqu 0x70(%rsp), %ymm2
vmovdqa %ymm8, (%rcx)
vpsubd %ymm5, %ymm8, %ymm8
vpminsd %ymm8, %ymm2, %ymm2
addq $-0x20, %rcx
decl %esi
jg 0x5506b5
addq %r14, %r9
movl 0x3c(%rsp), %r10d
movq %r10, 0x28(%rsp)
shlq $0x5, %r10
addq %r14, %r10
movq %r11, %rcx
shlq $0x5, %r11
xorl %edi, %edi
vpmovsxbd 0xdd5e8(%rip), %ymm9 # 0x62dcd8
movl %ecx, %ebx
vmovdqu 0x90(%rsp), %ymm1
vpcmpeqd 0xdd5fd(%rip), %ymm1, %ymm10 # 0x62dd00
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rsp)
vmovdqa %ymm0, %ymm8
vmovdqa %ymm0, %ymm3
movl 0xc(%rsp), %esi
vpermd (%r9), %ymm9, %ymm1
movq %rdi, %r12
movq 0x18(%rsp), %rcx
vmovd (%rcx,%rdi,4), %xmm11
vpblendd $0x1, %ymm11, %ymm1, %ymm13 # ymm13 = ymm11[0],ymm1[1,2,3,4,5,6,7]
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x58(%rsp), %rdi
movzbl (%rdi,%r12), %edi
movslq (%rcx,%rdi,4), %rdi
imulq %rbx, %rdi
shlq $0x5, %rdi
addq 0x68(%rsp), %rdi
vpsubd (%rax), %ymm0, %ymm12
xorl %ecx, %ecx
vmovdqa %ymm0, %ymm11
vpaddd (%rdi,%rcx), %ymm13, %ymm1
vmovdqa (%r14,%rcx), %ymm13
vmovdqa (%r15,%rcx), %ymm14
vpsubd %ymm5, %ymm14, %ymm14
vpsubd %ymm4, %ymm13, %ymm15
vpmaxsd %ymm15, %ymm14, %ymm14
vpaddd (%rax,%rcx), %ymm12, %ymm12
vpmaxsd %ymm12, %ymm11, %ymm11
vpmaxsd %ymm1, %ymm14, %ymm12
vmovdqa %ymm14, (%r15,%rcx)
vmovdqa %ymm12, (%rbp,%rcx)
addq $0x20, %rcx
cmpq %rcx, %r11
jne 0x55075d
vpermd %ymm12, %ymm9, %ymm1
leaq 0x1(%r12), %rdi
movq 0x18(%rsp), %rcx
vmovd 0x4(%rcx,%r12,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 0x5507c9
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 (%rbp,%rcx), %ymm11, %ymm12
vmovdqa %ymm12, (%r14,%rcx)
vpminsd %ymm11, %ymm2, %ymm1
vpminsd %ymm12, %ymm1, %ymm2
vpmaxsd %ymm12, %ymm3, %ymm3
addq $0x20, %rcx
cmpq %rcx, %r11
jne 0x5507f9
vmovdqa (%r10), %ymm11
vpcmpgtd %ymm8, %ymm11, %ymm1
vtestps %ymm10, %ymm1
movl 0x8(%rsp), %ecx
cmovnel %r12d, %ecx
movl %ecx, 0x8(%rsp)
vmovdqa %ymm11, %ymm12
cmpl $0x6, %esi
jg 0x550869
xorl %ecx, %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]
incl %ecx
cmpl %edx, %ecx
jl 0x550857
vpmaxsd %ymm8, %ymm11, %ymm8
vextracti128 $0x1, %ymm12, %xmm1
movq 0x10(%r13), %rcx
movq (%rcx), %rcx
vpextrd $0x3, %xmm1, (%rcx,%r12,4)
cmpq %r8, %rdi
jne 0x550717
movq 0x20(%rsp), %r11
leal (,%r11,4), %edi
leaq (%r11,%r11,8), %rcx
leaq (%rcx,%rcx,2), %r8
addq %r11, %r8
leaq (,%r11,8), %r9
leaq (%r9,%r9,2), %r10
leal (,%r11,4), %ebx
leaq (%rbx,%rbx,4), %rcx
shlq $0x4, %r11
leaq (%rbx,%rbx,2), %rbx
xorl %r12d, %r12d
movq %r13, %rsi
movq 0x10(%r13), %r13
movq 0x8(%r13), %r13
vmovdqa (%r14,%r12,8), %xmm1
vmovdqa 0x10(%r14,%r12,8), %xmm4
vmovd %xmm1, (%r13,%r12)
addq %r12, %r13
vpextrd $0x1, %xmm1, (%rdi,%r13)
vpextrd $0x2, %xmm1, (%r9,%r13)
vpextrd $0x3, %xmm1, (%rbx,%r13)
vmovd %xmm4, (%r11,%r13)
vpextrd $0x1, %xmm4, (%rcx,%r13)
vpextrd $0x2, %xmm4, (%r10,%r13)
vpextrd $0x3, %xmm4, (%r8,%r13)
movq %rsi, %r13
addq $0x4, %r12
cmpq %r12, %rdi
jne 0x5508c6
cmpl $0x0, 0x100(%rsp)
movl 0x44(%rsp), %esi
movq 0x48(%rsp), %rbx
movl 0x14(%rsp), %r12d
movq 0x20(%rsp), %r11
je 0x550968
cmpl $0x6, 0xc(%rsp)
jg 0x55095c
xorl %ecx, %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]
incl %ecx
cmpl %edx, %ecx
jl 0x55094a
vextracti128 $0x1, %ymm8, %xmm1
vpextrd $0x3, %xmm1, %r12d
cmpl $0x0, 0xf0(%rsp)
je 0x5509e3
cmpl $0x0, 0x60(%rsp)
je 0x5509e3
movl %r11d, %r8d
andl $0xfffffff, %r8d        # imm = 0xFFFFFFF
shll $0x3, %r8d
xorl %r9d, %r9d
movl %esi, %edi
movl %r9d, %r10d
shrl $0x3, %r10d
movl %r9d, %ecx
andl $0x7, %ecx
imull %r11d, %ecx
addl %r10d, %ecx
cmpl %ebx, %ecx
jge 0x5509d9
movl (%r14,%r9,4), %r10d
cmpl %r12d, %r10d
jle 0x5509bc
movl %r10d, %r12d
movl 0x10(%rsp), %edi
movl %edi, 0x8(%rsp)
movl %ecx, %edi
jmp 0x5509d9
xorl %r12d, %r10d
movl 0x8(%rsp), %r11d
xorl 0x10(%rsp), %r11d
cmpl %edi, %ecx
cmovgel %edi, %ecx
orl %r10d, %r11d
movq 0x20(%rsp), %r11
cmovel %ecx, %edi
incq %r9
cmpl %r9d, %r8d
jne 0x55098c
jmp 0x5509e5
movl %esi, %edi
movl 0xf0(%rsp), %ecx
orl %ecx, 0x40(%rsp)
jne 0x550a32
movq 0x28(%rsp), %rcx
shlq $0x5, %rcx
vmovdqa (%r14,%rcx), %ymm4
cmpl $0x6, 0xc(%rsp)
jg 0x550a1c
xorl %ecx, %ecx
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]
incl %ecx
cmpl %edx, %ecx
jl 0x550a0a
vextracti128 $0x1, %ymm4, %xmm1
vpextrd $0x3, %xmm1, %r12d
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rsp)
movl %esi, %edi
vpcmpgtd %ymm2, %ymm0, %ymm0
vpcmpgtd 0x70(%rsp), %ymm3, %ymm1
vpor %ymm0, %ymm1, %ymm0
vtestps %ymm0, %ymm0
je 0x550a59
orb $0x40, 0xc(%r13)
xorl %r12d, %r12d
movl $0x0, 0x8(%rsp)
xorl %edi, %edi
movl %r12d, (%r13)
movl %edi, 0x4(%r13)
movl 0x8(%rsp), %ecx
movl %ecx, 0x8(%r13)
movq %rax, %rdi
vzeroupper
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq 0x18(%rsp), %rdi
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
jmp 0x550ad1
callq 0x1ef955
jmp 0x550ace
callq 0x1ef92f
jmp 0x550ace
callq 0x1ef909
jmp 0x550ace
callq 0x1ef8e3
jmp 0x550ace
callq 0x1ef8bd
jmp 0x550ace
callq 0x1ef897
jmp 0x550ace
callq 0x1ef871
jmp 0x550ace
callq 0x1ef84b
xorl %r13d, %r13d
movq %r13, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq