// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_trace_scan_avx2_256_32.c
// Function: parasail_sg_flags_trace_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 s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 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;
    __m256i vTIns;
    __m256i vTDel;
    __m256i vTDiag;
    __m256i vTDiagE;
    __m256i vTInsE;
    __m256i vTDiagF;
    __m256i vTDelF;

    /* 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));
    vTIns  = _mm256_set1_epi32(PARASAIL_INS);
    vTDel  = _mm256_set1_epi32(PARASAIL_DEL);
    vTDiag = _mm256_set1_epi32(PARASAIL_DIAG);
    vTDiagE= _mm256_set1_epi32(PARASAIL_DIAG_E);
    vTInsE = _mm256_set1_epi32(PARASAIL_INS_E);
    vTDiagF= _mm256_set1_epi32(PARASAIL_DIAG_F);
    vTDelF = _mm256_set1_epi32(PARASAIL_DEL_F);

    /* initialize result */
    result = parasail_result_new_trace(segLen, s2Len, 32, sizeof(__m256i));
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_SCAN
        | PARASAIL_FLAG_TRACE
        | 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;

    /* 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 vE_ext;
        __m256i vE_opn;
        __m256i vHt;
        __m256i vF;
        __m256i vF_ext;
        __m256i vF_opn;
        __m256i vH;
        __m256i vHp;
        __m256i *pvW;
        __m256i vW;
        __m256i case1;
        __m256i case2;
        __m256i vGapper;
        __m256i vT;
        __m256i vET;
        __m256i vFT;

        /* 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);
            vGapper = _mm256_load_si256(pvGapper+i);
            vE_opn = _mm256_sub_epi32(vH, vGapO);
            vE_ext = _mm256_sub_epi32(vE, vGapE);
            case1 = _mm256_cmpgt_epi32(vE_opn, vE_ext);
            vET = _mm256_blendv_epi8(vTInsE, vTDiagE, case1);
            arr_store(result->trace->trace_table, vET, i, segLen, j);
            vE = _mm256_max_epi32(vE_opn, vE_ext);
            vSaturationCheckMin = _mm256_min_epi32(vSaturationCheckMin, vE);
            vGapper = _mm256_add_epi32(vHt, vGapper);
            vF = _mm256_max_epi32(vF, vGapper);
            vHp = _mm256_add_epi32(vHp, vW);
            vHt = _mm256_max_epi32(vE, vHp);
            _mm256_store_si256(pvE+i, vE);
            _mm256_store_si256(pvHt+i, vHt);
            _mm256_store_si256(pvH+i, vHp);
            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);
        vGapper = _mm256_load_si256(pvGapper);
        vGapper = _mm256_add_epi32(vHt, vGapper);
        vF = _mm256_max_epi32(vF, vGapper);
        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(vF, vHt);
        for (i=0; i<segLen; ++i) {
            vET = arr_load(result->trace->trace_table, i, segLen, j);
            vHp = _mm256_load_si256(pvH+i);
            vHt = _mm256_load_si256(pvHt+i);
            vF_opn = _mm256_sub_epi32(vH, vGapO);
            vF_ext = _mm256_sub_epi32(vF, vGapE);
            vF = _mm256_max_epi32(vF_opn, vF_ext);
            case1 = _mm256_cmpgt_epi32(vF_opn, vF_ext);
            vFT = _mm256_blendv_epi8(vTDelF, vTDiagF, case1);
            vH = _mm256_max_epi32(vHt, vF);
            case1 = _mm256_cmpeq_epi32(vH, vHp);
            case2 = _mm256_cmpeq_epi32(vH, vF);
            vT = _mm256_blendv_epi8(
                    _mm256_blendv_epi8(vTIns, vTDel, case2),
                    vTDiag, case1);
            vT = _mm256_or_si256(vT, vET);
            vT = _mm256_or_si256(vT, vFT);
            arr_store(result->trace->trace_table, vT, i, segLen, j);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi32(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi32(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi32(vSaturationCheckMax, vH);
        }

        /* 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;
            }
        }
    } 

    /* 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 $0x188, %rsp            # imm = 0x188
movq %rsi, 0x40(%rsp)
testq %rdi, %rdi
je 0x5a9e13
movq 0x48(%rdi), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x5a9e1a
movq 0x10(%rdi), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x5a9e21
movl %ecx, %r15d
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x5a9e28
cmpq $0x0, 0x40(%rsp)
je 0x5a9e2f
movl %edx, %r12d
testl %edx, %edx
jle 0x5a9e36
testl %r15d, %r15d
js 0x5a9e3d
movl %r8d, %r13d
testl %r8d, %r8d
js 0x5a9e44
movl %r9d, 0xa0(%rsp)
leal -0x1(%rcx), %eax
movq %rcx, 0x30(%rsp)
leaq 0x7(%rcx), %r14
movq %r14, %rdi
shrq $0x3, %rdi
movl %eax, 0x2c(%rsp)
xorl %edx, %edx
divl %edi
movl %eax, 0x4(%rsp)
movl %edx, %ebp
movl %r15d, %r8d
negl %r8d
movq 0x38(%rsp), %rsi
movl 0x20(%rsi), %eax
movl $0x80000000, %edx       # imm = 0x80000000
movl %r15d, %ecx
orl %edx, %ecx
subl %eax, %edx
movl %r8d, 0x80(%rsp)
cmpl %r8d, %eax
cmovgl %ecx, %edx
movl %edx, 0x8(%rsp)
movl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
subl 0x1c(%rsi), %eax
movl %eax, 0x60(%rsp)
movl $0x20, %edx
movl $0x20, %ecx
movq %rdi, 0x10(%rsp)
movl %r12d, %esi
callq 0x20adf4
testq %rax, %rax
je 0x5a9e49
movq %rax, %rbx
movl %r13d, 0xe0(%rsp)
movl %r15d, 0x18(%rsp)
movl %ebp, 0xc0(%rsp)
movq %r14, 0x50(%rsp)
movl 0x1d0(%rsp), %edi
xorl %eax, %eax
cmpl $0x0, 0xa0(%rsp)
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x1c0(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x1c8(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x28(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%rbx), %eax
orl $0x8480402, %eax        # imm = 0x8480402
movl %eax, 0xc(%rbx)
movl $0x20, %edi
movq %r12, %r14
movq 0x10(%rsp), %r12
movq %r12, %rsi
callq 0x4f1904
movq %rax, %r15
movq %r14, 0x20(%rsp)
leal 0x1(%r14), %esi
movl $0x20, %edi
callq 0x20a62d
movq %rax, %r13
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
movq %rax, %r14
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
movq %rax, %rbp
movl $0x20, %edi
movq %r12, %rsi
callq 0x4f1904
testq %r15, %r15
sete %cl
testq %r13, %r13
sete %dl
orb %cl, %dl
testq %r14, %r14
sete %cl
testq %rbp, %rbp
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x5a9e49
movq 0x20(%rsp), %r9
leal -0x1(%r9), %ecx
movl %ecx, (%rsp)
movl $0x7, %edx
subl 0x4(%rsp), %edx
movl 0x18(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastd %xmm0, %ymm3
movl 0xe0(%rsp), %edi
vmovd %edi, %xmm0
vpbroadcastd %xmm0, %ymm4
movl 0x8(%rsp), %ecx
incl %ecx
movl %ecx, 0x8(%rsp)
vmovd %ecx, %xmm0
vpbroadcastd %xmm0, %ymm1
vmovd 0x60(%rsp), %xmm0
vpbroadcastd %xmm0, %ymm6
movl %edx, 0xc(%rsp)
vmovd %edx, %xmm0
vpbroadcastd %xmm0, %ymm7
vpxor %xmm0, %xmm0, %xmm0
vmovdqu %ymm1, 0x60(%rsp)
vmovss %xmm1, %xmm0, %xmm2     # xmm2 = xmm1[0],xmm0[1,2,3]
movq 0x10(%rsp), %r8
imull %r8d, %edi
negl %edi
vmovd %edi, %xmm0
vpbroadcastd %xmm0, %ymm0
vpxor %xmm1, %xmm1, %xmm1
vpblendd $0x1, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]
vmovups %ymm2, 0xe0(%rsp)
vpaddd %ymm0, %ymm2, %ymm0
vmovdqu %ymm0, 0x160(%rsp)
movl %esi, %ecx
vmovd 0x80(%rsp), %xmm0
vpbroadcastd %xmm0, %ymm1
vmovq %rcx, %xmm0
vmovq %r8, %xmm2
vpbroadcastq %xmm2, %ymm5
vpmuldq 0x84415(%rip), %ymm5, %ymm2 # 0x62dc40
vpmuldq 0x8430c(%rip), %ymm5, %ymm8 # 0x62db40
vpbroadcastq %xmm0, %ymm9
xorl %ecx, %ecx
vpmovsxbd 0x84484(%rip), %ymm10 # 0x62dcc8
vpbroadcastq 0x84473(%rip), %ymm0 # 0x62dcc0
movq %rbp, %rdx
movq %r15, %rsi
movq %r8, %rdi
movl 0xa0(%rsp), %r8d
testl %r8d, %r8d
je 0x5a9869
vpxor %xmm5, %xmm5, %xmm5
jmp 0x5a9894
vmovq %rcx, %xmm5
vpbroadcastq %xmm5, %ymm5
vpaddq %ymm5, %ymm2, %ymm11
vpaddq %ymm5, %ymm8, %ymm5
vpermd %ymm5, %ymm10, %ymm5
vpermd %ymm11, %ymm10, %ymm11
vinserti128 $0x1, %xmm11, %ymm5, %ymm5
vpmulld %ymm5, %ymm4, %ymm5
vpsubd %ymm5, %ymm1, %ymm5
vextracti128 $0x1, %ymm5, %xmm11
vpmovsxdq %xmm11, %ymm11
vpmovsxdq %xmm5, %ymm12
vpsubq %ymm9, %ymm11, %ymm11
vpcmpgtq %ymm0, %ymm11, %ymm13
vblendvpd %ymm13, %ymm11, %ymm0, %ymm11
vpsubq %ymm9, %ymm12, %ymm12
vpcmpgtq %ymm0, %ymm12, %ymm13
vblendvpd %ymm13, %ymm12, %ymm0, %ymm12
vpermd %ymm12, %ymm10, %ymm12
vpermd %ymm11, %ymm10, %ymm11
vmovdqa %ymm5, (%rdx)
vmovdqa %xmm11, 0x10(%rsi)
vmovdqa %xmm12, (%rsi)
incq %rcx
addq $0x20, %rsi
addq $0x20, %rdx
cmpq %rcx, %rdi
jne 0x5a985e
vmovdqu %ymm3, 0x80(%rsp)
movl $0x0, (%r13)
movl %r9d, %ecx
addl $0x7, %r9d
andl $-0x8, %r9d
movq %rcx, 0x20(%rsp)
decq %rcx
vmovq %rcx, %xmm0
vpbroadcastq %xmm0, %ymm8
vpmovsxbd 0x843aa(%rip), %ymm0 # 0x62dcd0
xorl %ecx, %ecx
vpmovsxbq 0x84297(%rip), %ymm2 # 0x62dbc8
vpmovsxbq 0x843aa(%rip), %ymm5 # 0x62dce4
vpbroadcastq 0x8423d(%rip), %ymm9 # 0x62db80
vpxor %ymm9, %ymm8, %ymm10
vpcmpeqd %ymm11, %ymm11, %ymm11
vpbroadcastd 0x8438a(%rip), %ymm3 # 0x62dce0
movl 0x1c8(%rsp), %edx
testl %edx, %edx
je 0x5a9968
vpxor %xmm12, %xmm12, %xmm12
jmp 0x5a9976
vpaddd %ymm0, %ymm11, %ymm12
vpmulld %ymm4, %ymm12, %ymm12
vpsubd %ymm12, %ymm1, %ymm12
vmovq %rcx, %xmm13
vpbroadcastq %xmm13, %ymm13
vpor %ymm2, %ymm13, %ymm14
vpor %ymm5, %ymm13, %ymm13
vpxor %ymm9, %ymm13, %ymm13
vpcmpgtq %ymm10, %ymm13, %ymm13
vpxor %ymm9, %ymm14, %ymm14
vpcmpgtq %ymm10, %ymm14, %ymm14
vpackssdw %ymm13, %ymm14, %ymm13
vpxor %ymm11, %ymm13, %ymm13
vextracti128 $0x1, %ymm13, %xmm14
vpackssdw %xmm14, %xmm13, %xmm13
vpshufd $0xd8, %xmm13, %xmm13   # xmm13 = xmm13[0,2,1,3]
vpmovzxwd %xmm13, %ymm13  # ymm13 = xmm13[0],zero,xmm13[1],zero,xmm13[2],zero,xmm13[3],zero,xmm13[4],zero,xmm13[5],zero,xmm13[6],zero,xmm13[7],zero
vpslld $0x1f, %ymm13, %ymm13
vpmaskmovd %ymm12, %ymm13, 0x4(%r13,%rcx,4)
addq $0x8, %rcx
vpaddd %ymm3, %ymm0, %ymm0
cmpq %rcx, %r9
jne 0x5a995d
vmovdqu %ymm3, 0x140(%rsp)
vpxor %xmm0, %xmm0, %xmm0
vmovdqu 0x80(%rsp), %ymm3
vpsubd %ymm3, %ymm0, %ymm0
leal -0x1(%rdi), %edx
shlq $0x5, %rdx
movq %rax, %rcx
movq %rdx, 0x18(%rsp)
addq %rdx, %rcx
movl %edi, %edx
vmovdqu %ymm6, 0x100(%rsp)
vmovdqa %ymm6, %ymm2
vmovdqa %ymm0, (%rcx)
vpsubd %ymm4, %ymm0, %ymm0
vpminsd %ymm0, %ymm2, %ymm2
addq $-0x20, %rcx
decl %edx
jg 0x5a9a11
addq %rbp, 0x18(%rsp)
movl 0xc0(%rsp), %r10d
movq %r10, 0x48(%rsp)
shlq $0x5, %r10
addq %rbp, %r10
movq %rdi, %r11
shlq $0x5, %r11
xorl %r12d, %r12d
vpmovsxbd 0x84286(%rip), %ymm9 # 0x62dcd8
movl %edi, %esi
vbroadcastss 0x843f7(%rip), %ymm12 # 0x62de54
vbroadcastss 0x8457a(%rip), %ymm11 # 0x62dfe0
vbroadcastss 0x862bd(%rip), %ymm13 # 0x62fd2c
vpbroadcastd 0x862b8(%rip), %ymm14 # 0x62fd30
vbroadcastss 0x8413f(%rip), %ymm15 # 0x62dbc0
vpcmpeqd 0x84277(%rip), %ymm7, %ymm0 # 0x62dd00
vmovdqu %ymm0, 0x120(%rsp)
xorl %ecx, %ecx
movl (%rsp), %edi
vmovdqu 0x60(%rsp), %ymm0
vmovdqa %ymm0, %ymm7
vmovdqa %ymm0, %ymm5
vmovups %ymm11, 0xc0(%rsp)
vmovdqu %ymm5, 0xa0(%rsp)
movq 0x18(%rsp), %rdx
vpermd (%rdx), %ymm9, %ymm0
vmovd (%r13,%rcx,4), %xmm5
vpblendd $0x1, %ymm5, %ymm0, %ymm1 # ymm1 = ymm5[0],ymm0[1,2,3,4,5,6,7]
movq 0x38(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x40(%rsp), %r8
movzbl (%r8,%rcx), %r8d
movslq (%rdx,%r8,4), %rdx
imulq %rsi, %rdx
shlq $0x5, %rdx
addq 0x58(%rsp), %rdx
vmovdqu 0x60(%rsp), %ymm0
vpsubd (%rax), %ymm0, %ymm5
xorl %r8d, %r8d
vmovdqa %ymm3, %ymm11
vmovups 0x140(%rsp), %ymm3
vpaddd (%rdx,%r8), %ymm1, %ymm10
vmovdqa (%rbp,%r8), %ymm1
vmovdqa (%r15,%r8), %ymm9
vpsubd %ymm11, %ymm1, %ymm6
vpsubd %ymm4, %ymm9, %ymm9
vpcmpgtd %ymm9, %ymm6, %ymm8
vblendvps %ymm8, %ymm3, %ymm12, %ymm8
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r12, %r9
vpaddd (%rax,%r8), %ymm5, %ymm5
vmovaps %ymm8, (%r8,%r9)
vpmaxsd %ymm5, %ymm0, %ymm0
vpmaxsd %ymm9, %ymm6, %ymm6
vpminsd %ymm6, %ymm2, %ymm2
vpmaxsd %ymm10, %ymm6, %ymm5
vmovdqa %ymm6, (%r15,%r8)
vmovdqa %ymm5, (%r14,%r8)
vmovdqa %ymm10, (%rbp,%r8)
addq $0x20, %r8
cmpq %r8, %r11
jne 0x5a9b0c
vpmovsxbd 0x84156(%rip), %ymm9 # 0x62dcd8
vpermd %ymm5, %ymm9, %ymm1
leaq 0x1(%rcx), %rdx
vmovd 0x4(%r13,%rcx,4), %xmm5
vpblendd $0x1, %ymm5, %ymm1, %ymm5 # ymm5 = ymm5[0],ymm1[1,2,3,4,5,6,7]
vpaddd (%rax), %ymm5, %ymm1
vpmaxsd %ymm1, %ymm0, %ymm0
movl $0x6, %r8d
vmovdqu 0x160(%rsp), %ymm6
vperm2i128 $0x28, %ymm0, %ymm0, %ymm1 # ymm1 = zero,zero,ymm0[0,1]
vpalignr $0xc, %ymm1, %ymm0, %ymm1 # ymm1 = ymm1[12,13,14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27]
vpaddd %ymm1, %ymm6, %ymm1
vpmaxsd %ymm1, %ymm0, %ymm0
decl %r8d
jne 0x5a9bb0
vperm2i128 $0x28, %ymm0, %ymm0, %ymm1 # ymm1 = zero,zero,ymm0[0,1]
vpalignr $0xc, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[12,13,14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27]
vpaddd 0xe0(%rsp), %ymm0, %ymm0
vpmaxsd %ymm5, %ymm0, %ymm5
xorl %r8d, %r8d
vmovdqu 0x80(%rsp), %ymm3
vmovups 0xc0(%rsp), %ymm11
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %r12, %r9
vmovdqa (%r14,%r8), %ymm1
vpsubd %ymm3, %ymm5, %ymm5
vpsubd %ymm4, %ymm0, %ymm6
vpmaxsd %ymm6, %ymm5, %ymm0
vpcmpgtd %ymm6, %ymm5, %ymm5
vblendvps %ymm5, %ymm11, %ymm13, %ymm6
vpmaxsd %ymm0, %ymm1, %ymm5
vpcmpeqd (%rbp,%r8), %ymm5, %ymm8
vpcmpgtd %ymm0, %ymm1, %ymm1
vpaddd %ymm1, %ymm14, %ymm1
vblendvps %ymm8, %ymm15, %ymm1, %ymm1
vorps (%r8,%r9), %ymm6, %ymm6
vorps %ymm1, %ymm6, %ymm1
vmovaps %ymm1, (%r8,%r9)
vmovdqa %ymm5, (%rbp,%r8)
vpminsd %ymm0, %ymm2, %ymm1
vpminsd %ymm5, %ymm1, %ymm2
vpmaxsd %ymm5, %ymm7, %ymm7
addq $0x20, %r8
cmpq %r8, %r11
jne 0x5a9bf9
vmovdqa (%r10), %ymm0
vmovdqu 0xa0(%rsp), %ymm5
vpcmpgtd %ymm5, %ymm0, %ymm1
vpmaxsd %ymm5, %ymm0, %ymm5
vtestps 0x120(%rsp), %ymm1
cmovnel %ecx, %edi
addq %r11, %r12
movq %rdx, %rcx
cmpq 0x20(%rsp), %rdx
jne 0x5a9aae
cmpl $0x0, 0x1d0(%rsp)
movl 0x2c(%rsp), %r11d
movq 0x30(%rsp), %r10
movl 0x8(%rsp), %r12d
vmovdqu 0x100(%rsp), %ymm3
je 0x5a9ceb
cmpl $0x6, 0x4(%rsp)
jg 0x5a9cdf
xorl %ecx, %ecx
movl 0xc(%rsp), %edx
vperm2i128 $0x28, %ymm5, %ymm5, %ymm0 # ymm0 = zero,zero,ymm5[0,1]
vpalignr $0xc, %ymm0, %ymm5, %ymm5 # ymm5 = ymm0[12,13,14,15],ymm5[0,1,2,3,4,5,6,7,8,9,10,11],ymm0[28,29,30,31],ymm5[16,17,18,19,20,21,22,23,24,25,26,27]
incl %ecx
cmpl %edx, %ecx
jl 0x5a9ccd
vextracti128 $0x1, %ymm5, %xmm0
vpextrd $0x3, %xmm0, %r12d
cmpl $0x0, 0x1c0(%rsp)
je 0x5a9d69
testl $0x7ffffff8, 0x50(%rsp) # imm = 0x7FFFFFF8
je 0x5a9d69
movq 0x10(%rsp), %rdx
andl $0xfffffff, %edx        # imm = 0xFFFFFFF
shll $0x3, %edx
xorl %esi, %esi
movl %r11d, %ecx
movl %esi, %r9d
shrl $0x3, %r9d
movl %esi, %r8d
andl $0x7, %r8d
imull 0x10(%rsp), %r8d
addl %r9d, %r8d
cmpl %r10d, %r8d
jge 0x5a9d60
movl (%rbp,%rsi,4), %r9d
cmpl %r12d, %r9d
jle 0x5a9d43
movl %r9d, %r12d
movl (%rsp), %edi
movl %r8d, %ecx
jmp 0x5a9d60
xorl %r12d, %r9d
movl %edi, %r10d
xorl (%rsp), %r10d
cmpl %ecx, %r8d
cmovgel %ecx, %r8d
orl %r9d, %r10d
movq 0x30(%rsp), %r10
cmovel %r8d, %ecx
incq %rsi
cmpl %esi, %edx
jne 0x5a9d12
jmp 0x5a9d6c
movl %r11d, %ecx
movl 0x1c0(%rsp), %edx
orl %edx, 0x28(%rsp)
jne 0x5a9db9
movq 0x48(%rsp), %rcx
shlq $0x5, %rcx
vmovdqa (%rbp,%rcx), %ymm0
cmpl $0x6, 0x4(%rsp)
jg 0x5a9da7
xorl %ecx, %ecx
movl 0xc(%rsp), %edx
vperm2i128 $0x28, %ymm0, %ymm0, %ymm1 # ymm1 = zero,zero,ymm0[0,1]
vpalignr $0xc, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[12,13,14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11],ymm1[28,29,30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27]
incl %ecx
cmpl %edx, %ecx
jl 0x5a9d95
vextracti128 $0x1, %ymm0, %xmm0
vpextrd $0x3, %xmm0, %r12d
movl (%rsp), %edi
movl %r11d, %ecx
vmovdqu 0x60(%rsp), %ymm0
vpcmpgtd %ymm2, %ymm0, %ymm0
vpcmpgtd %ymm3, %ymm7, %ymm1
vpor %ymm1, %ymm0, %ymm0
vtestps %ymm0, %ymm0
je 0x5a9ddd
orb $0x40, 0xc(%rbx)
xorl %r12d, %r12d
xorl %edi, %edi
xorl %ecx, %ecx
movl %r12d, (%rbx)
movl %ecx, 0x4(%rbx)
movl %edi, 0x8(%rbx)
movq %rax, %rdi
vzeroupper
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %r13, %rdi
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
jmp 0x5a9e4b
callq 0x1f8181
jmp 0x5a9e49
callq 0x1f815b
jmp 0x5a9e49
callq 0x1f8135
jmp 0x5a9e49
callq 0x1f810f
jmp 0x5a9e49
callq 0x1f80e9
jmp 0x5a9e49
callq 0x1f80c3
jmp 0x5a9e49
callq 0x1f809d
jmp 0x5a9e49
callq 0x1f8077
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq