// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_64.c
// Function: parasail_sg_flags_rowcol_scan_profile_avx2_256_64
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;
    int64_t* restrict boundary = NULL;
    __m256i* restrict pvHt = NULL;
    __m256i* restrict pvH = NULL;
    __m256i* restrict pvGapper = NULL;
    __m256i vGapO;
    __m256i vGapE;
    int64_t NEG_LIMIT = 0;
    int64_t POS_LIMIT = 0;
    __m256i vZero;
    int64_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->profile64.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 = 4; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m256i*)profile->profile64.score;
    vGapO = _mm256_set1_epi64x_rpl(open);
    vGapE = _mm256_set1_epi64x_rpl(gap);
    NEG_LIMIT = (-open < matrix->min ? INT64_MIN + open : INT64_MIN - matrix->min) + 1;
    POS_LIMIT = INT64_MAX - matrix->max - 1;
    vZero = _mm256_setzero_si256();
    score = NEG_LIMIT;
    vNegLimit = _mm256_set1_epi64x_rpl(NEG_LIMIT);
    vPosLimit = _mm256_set1_epi64x_rpl(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm256_cmpeq_epi64(_mm256_set1_epi64x_rpl(position),
            _mm256_set_epi64x_rpl(0,1,2,3));
    vNegInfFront = vZero;
    vNegInfFront = _mm256_insert_epi64_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm256_add_epi64(vNegInfFront,
            _mm256_slli_si256_rpl(_mm256_set1_epi64x_rpl(-segLen*gap), 8));

    /* 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_64 | PARASAIL_FLAG_LANES_4;
    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_int64_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_64_t h;
            __m256i_64_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT64_MIN ? INT64_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT64_MIN ? INT64_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 < INT64_MIN ? INT64_MIN : tmp;
        }
    }

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

        /* calculate final H */
        vF = _mm256_slli_si256_rpl(vF, 8);
        vF = _mm256_add_epi64(vF, vNegInfFront);
        vH = _mm256_max_epi64_rpl(vHt, vF);
        for (i=0; i<segLen; ++i) {
            vHt = _mm256_load_si256(pvHt+i);
            vF = _mm256_max_epi64_rpl(
                    _mm256_sub_epi64(vF, vGapE),
                    _mm256_sub_epi64(vH, vGapO));
            vH = _mm256_max_epi64_rpl(vHt, vF);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi64_rpl(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi64_rpl(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi64_rpl(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_epi64(vH, vMaxH));
            vMaxH = _mm256_max_epi64_rpl(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, 8);
            }
            result->rowcols->score_row[j] = (int64_t) _mm256_extract_epi64_rpl (vH, 3);
#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, 8);
        }
        score = (int64_t) _mm256_extract_epi64_rpl(vMaxH, 3);
        end_query = s1Len-1;
    }

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

    if (_mm256_movemask_epi8(_mm256_or_si256(
            _mm256_cmplt_epi64_rpl(vSaturationCheckMin, vNegLimit),
            _mm256_cmpgt_epi64(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 $0x220, %rsp            # imm = 0x220
movq %rsi, 0x98(%rsp)
testq %rdi, %rdi
je 0x52048d
movq 0x60(%rdi), %rax
movq %rax, 0xf0(%rsp)
testq %rax, %rax
je 0x520494
movq 0x10(%rdi), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x52049b
movl %edx, %r12d
movl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x5204a2
cmpq $0x0, 0x98(%rsp)
je 0x5204a9
testl %r12d, %r12d
jle 0x5204b0
testl %ecx, %ecx
js 0x5204b7
testl %r8d, %r8d
js 0x5204be
movl %r9d, %ebx
movl %r8d, 0x60(%rsp)
leal -0x1(%rdx), %eax
movq %rdx, 0xd0(%rsp)
leaq 0x3(%rdx), %r15
movq %r15, %rsi
shrq $0x2, %rsi
movl %eax, 0x18(%rsp)
cltd
movq %rsi, 0x20(%rsp)
idivl %esi
movl %eax, 0x1c(%rsp)
movl %edx, 0xb0(%rsp)
movl %ecx, %r13d
negl %ecx
movq 0x90(%rsp), %rsi
movslq 0x20(%rsi), %rax
movq %r13, %rdi
btsq $0x3f, %rdi
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
subq %rax, %rdx
movl %ecx, 0xa0(%rsp)
cmpl %ecx, %eax
cmovgq %rdi, %rdx
movq %rdx, 0x68(%rsp)
movslq 0x1c(%rsi), %rax
movq %rax, 0x40(%rsp)
andl $0x7ffffffc, %r15d      # imm = 0x7FFFFFFC
movl %r15d, %edi
movl %r12d, %esi
callq 0x209630
testq %rax, %rax
je 0x5204c3
movq %rax, %r14
movq %r15, 0xc8(%rsp)
movl 0x20(%rbp), %edi
xorl %eax, %eax
testl %ebx, %ebx
setne %al
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 %edi, 0x80(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%r14), %eax
orl $0x4840402, %eax        # imm = 0x4840402
movl %eax, 0xc(%r14)
movl $0x20, %edi
movq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x4c5e3c
movq %rax, 0x70(%rsp)
movq %r12, 0x10(%rsp)
leal 0x1(%r12), %esi
movl $0x20, %edi
movq %rsi, 0x30(%rsp)
callq 0x2094de
movq %rax, 0x38(%rsp)
movl $0x20, %edi
movq %r15, %rsi
callq 0x4c5e3c
movq %rax, %r12
movl $0x20, %edi
movq %r15, %rsi
callq 0x4c5e3c
movq %rax, 0x50(%rsp)
movl $0x20, %edi
movq %r15, %rsi
movq %r12, %r15
callq 0x4c5e3c
movq 0x70(%rsp), %r12
testq %r12, %r12
sete %cl
cmpq $0x0, 0x38(%rsp)
sete %dl
orb %cl, %dl
testq %r15, %r15
sete %cl
cmpq $0x0, 0x50(%rsp)
sete %sil
orb %cl, %sil
orb %dl, %sil
movq %rax, 0x48(%rsp)
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x5204c3
movq 0x10(%rsp), %rax
decl %eax
movl %eax, 0x5c(%rsp)
movl $0x3, %edx
subl 0x1c(%rsp), %edx
vmovq %r13, %xmm0
vpbroadcastq %xmm0, %ymm3
movl 0x60(%rsp), %r11d
movl %r11d, %ecx
vmovq %rcx, %xmm0
vpbroadcastq %xmm0, %ymm6
movq 0x68(%rsp), %rax
incq %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
subq 0x40(%rsp), %rsi
addq $-0x2, %rsi
vmovq %rax, %xmm0
vpbroadcastq %xmm0, %ymm0
vmovq %rsi, %xmm1
vpbroadcastq %xmm1, %ymm2
movl %edx, 0x2c(%rsp)
movslq %edx, %rdx
vmovq %rdx, %xmm1
vpbroadcastq %xmm1, %ymm7
vmovdqa %ymm0, 0x100(%rsp)
vmovq %xmm0, %xmm0            # xmm0 = xmm0[0],zero
movq 0x20(%rsp), %rsi
movl %esi, %edx
imull %r11d, %edx
negl %edx
movslq %edx, %rdx
vmovq %rdx, %xmm1
vpbroadcastq %xmm1, %ymm1
vpxor %xmm4, %xmm4, %xmm4
vpblendd $0x3, %ymm4, %ymm1, %ymm1 # ymm1 = ymm4[0,1],ymm1[2,3,4,5,6,7]
vmovdqa %ymm0, 0x180(%rsp)
vpaddq %ymm1, %ymm0, %ymm0
movslq 0xa0(%rsp), %rdx
movl %esi, %esi
movq %rsi, 0x78(%rsp)
imulq %rcx, %rsi
xorl %edi, %edi
movq %rdx, %r8
xorl %r9d, %r9d
testl %ebx, %ebx
je 0x51f9bd
xorl %r10d, %r10d
jmp 0x51f9c0
movq %r8, %r10
movq %r10, 0x1e0(%rsp,%r9,8)
subq %r13, %r10
movq %r10, 0x1c0(%rsp,%r9,8)
incq %r9
subq %rsi, %r8
cmpq $0x4, %r9
jne 0x51f9b4
movq %rdi, %r8
shlq $0x5, %r8
vmovaps 0x1e0(%rsp), %ymm1
movq 0x50(%rsp), %r9
vmovaps %ymm1, (%r9,%r8)
vmovdqa 0x1c0(%rsp), %ymm1
vmovdqa %ymm1, (%r12,%r8)
incq %rdi
subq %rcx, %rdx
cmpq 0x78(%rsp), %rdi
jne 0x51f9ae
movq %rax, 0x68(%rsp)
movq 0x38(%rsp), %r13
movq $0x0, (%r13)
movl $0x1, %ecx
movl 0xa0(%rsp), %eax
movl 0x18(%rbp), %esi
movq 0x30(%rsp), %rdi
testl %esi, %esi
movl $0x0, %edx
cmovel %eax, %edx
movslq %edx, %rdx
movq %rdx, (%r13,%rcx,8)
incq %rcx
subl %r11d, %eax
cmpq %rcx, %rdi
jne 0x51fa3c
movq %r15, 0x30(%rsp)
vpxor %xmm1, %xmm1, %xmm1
vpsubq %ymm3, %ymm1, %ymm8
movq 0x20(%rsp), %rax
leal -0x1(%rax), %ecx
movq %rcx, %rsi
shlq $0x5, %rsi
movq 0x48(%rsp), %rdi
movq %rdi, %rdx
addq %rsi, %rdx
movl %eax, %esi
vmovdqa %ymm2, 0x120(%rsp)
vmovdqa %ymm2, %ymm4
movl 0x5c(%rsp), %ebx
vmovdqa %ymm8, (%rdx)
vpsubq %ymm6, %ymm8, %ymm8
vmovq %xmm4, %rax
vmovq %xmm8, %r8
cmpq %r8, %rax
cmovlq %rax, %r8
vpextrq $0x1, %xmm4, %rax
vpextrq $0x1, %xmm8, %r9
cmpq %r9, %rax
cmovlq %rax, %r9
vextracti128 $0x1, %ymm4, %xmm1
vmovq %xmm1, %rax
vextracti128 $0x1, %ymm8, %xmm4
vmovq %xmm4, %r10
cmpq %r10, %rax
cmovlq %rax, %r10
vpextrq $0x1, %xmm1, %rax
vpextrq $0x1, %xmm4, %r11
cmpq %r11, %rax
cmovlq %rax, %r11
vmovq %r11, %xmm1
vmovq %r10, %xmm4
vpunpcklqdq %xmm1, %xmm4, %xmm1 # xmm1 = xmm4[0],xmm1[0]
vmovq %r9, %xmm4
vmovq %r8, %xmm5
vpunpcklqdq %xmm4, %xmm5, %xmm4 # xmm4 = xmm5[0],xmm4[0]
vinserti128 $0x1, %xmm1, %ymm4, %ymm4
addq $-0x20, %rdx
decl %esi
jg 0x51fa93
movl %ecx, %eax
shlq $0x5, %rax
movq 0x50(%rsp), %r12
addq %r12, %rax
movq %rax, 0xe8(%rsp)
movl 0xb0(%rsp), %eax
movq %rax, 0xc0(%rsp)
shlq $0x5, %rax
addq %r12, %rax
movq %rax, 0xe0(%rsp)
movl $0x1, %ecx
movq 0x20(%rsp), %rax
cmpl %ecx, %eax
movl %eax, %r15d
adcl $0x0, %r15d
movl 0x2c(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
movl %edx, 0x84(%rsp)
movq 0x10(%rsp), %rax
cmpl $0x2, %eax
cmovgel %eax, %ecx
movq %rcx, 0xd8(%rsp)
shlq $0x5, %r15
xorl %edx, %edx
vpcmpeqq 0xd9b24(%rip), %ymm7, %ymm1 # 0x5f96c0
vmovdqa %ymm1, 0x140(%rsp)
movl %ebx, 0x10(%rsp)
vmovdqa 0x100(%rsp), %ymm7
vmovdqa %ymm7, %ymm5
movq %r14, 0x88(%rsp)
vmovdqa %ymm0, 0x160(%rsp)
movq %r15, 0x60(%rsp)
vmovdqa %ymm5, 0x1a0(%rsp)
movq 0xe8(%rsp), %rax
vmovdqa (%rax), %ymm1
vinserti128 $0x1, %xmm1, %ymm0, %ymm5
vpalignr $0x8, %ymm5, %ymm1, %ymm1 # ymm1 = ymm5[8,9,10,11,12,13,14,15],ymm1[0,1,2,3,4,5,6,7],ymm5[24,25,26,27,28,29,30,31],ymm1[16,17,18,19,20,21,22,23]
vmovq (%r13,%rdx,8), %xmm5
vpblendd $0x3, %ymm5, %ymm1, %ymm11 # ymm11 = ymm5[0,1],ymm1[2,3,4,5,6,7]
movq 0x90(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x98(%rsp), %rax
movq %rdx, 0x40(%rsp)
movzbl (%rax,%rdx), %edx
movslq (%rcx,%rdx,4), %rcx
movq 0x78(%rsp), %rdx
imulq %rcx, %rdx
shlq $0x5, %rdx
addq 0xf0(%rsp), %rdx
vmovdqa 0x100(%rsp), %ymm12
vpsubq (%rdi), %ymm12, %ymm13
xorl %r9d, %r9d
movq 0x70(%rsp), %rax
movq 0x30(%rsp), %rbx
vpaddq (%rdx,%r9), %ymm11, %ymm14
vmovdqa (%r12,%r9), %ymm11
vmovdqa (%rax,%r9), %ymm1
vpsubq %ymm6, %ymm1, %ymm1
vpsubq %ymm3, %ymm11, %ymm5
vmovq %xmm1, %rcx
vmovq %xmm5, %r13
cmpq %r13, %rcx
cmovgq %rcx, %r13
vpextrq $0x1, %xmm1, %rsi
vpextrq $0x1, %xmm5, %rcx
cmpq %rcx, %rsi
cmovgq %rsi, %rcx
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %rsi
vextracti128 $0x1, %ymm5, %xmm5
vmovq %xmm5, %r11
cmpq %r11, %rsi
cmovgq %rsi, %r11
vpextrq $0x1, %xmm1, %rsi
vpextrq $0x1, %xmm5, %r14
cmpq %r14, %rsi
cmovgq %rsi, %r14
vmovq %rcx, %xmm15
movq 0x48(%rsp), %rsi
vpaddq (%rsi,%r9), %ymm13, %ymm1
vmovq %xmm12, %rsi
vmovq %xmm1, %r8
cmpq %r8, %rsi
cmovgq %rsi, %r8
vpextrq $0x1, %xmm12, %rsi
vpextrq $0x1, %xmm1, %rdi
cmpq %rdi, %rsi
cmovgq %rsi, %rdi
vextracti128 $0x1, %ymm12, %xmm5
vmovq %xmm5, %rsi
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %r10
cmpq %r10, %rsi
cmovgq %rsi, %r10
vpextrq $0x1, %xmm5, %r12
vmovq %r13, %xmm12
vpextrq $0x1, %xmm1, %rsi
cmpq %rsi, %r12
cmovgq %r12, %rsi
vmovq %xmm14, %r12
cmpq %r12, %r13
cmovleq %r12, %r13
vpextrq $0x1, %xmm14, %r12
vmovq %r14, %xmm1
cmpq %r12, %rcx
cmovleq %r12, %rcx
vmovq %r11, %xmm5
vextracti128 $0x1, %ymm14, %xmm9
vmovq %xmm9, %r12
cmpq %r12, %r11
cmovleq %r12, %r11
vpextrq $0x1, %xmm9, %r12
cmpq %r12, %r14
cmovleq %r12, %r14
movq 0x50(%rsp), %r12
vmovq %r14, %xmm9
vpunpcklqdq %xmm15, %xmm12, %xmm14 # xmm14 = xmm12[0],xmm15[0]
vpunpcklqdq %xmm1, %xmm5, %xmm15 # xmm15 = xmm5[0],xmm1[0]
vmovq %rsi, %xmm1
vmovq %r10, %xmm5
vpunpcklqdq %xmm1, %xmm5, %xmm1 # xmm1 = xmm5[0],xmm1[0]
vmovq %rdi, %xmm5
vmovq %r8, %xmm12
vpunpcklqdq %xmm5, %xmm12, %xmm5 # xmm5 = xmm12[0],xmm5[0]
vinserti128 $0x1, %xmm1, %ymm5, %ymm12
vmovq %rcx, %xmm1
vmovq %r13, %xmm5
vpunpcklqdq %xmm1, %xmm5, %xmm5 # xmm5 = xmm5[0],xmm1[0]
vmovq %r11, %xmm13
vinserti128 $0x1, %xmm13, %ymm5, %ymm5
vpbroadcastq %xmm9, %ymm9
vpblendd $0xc0, %ymm9, %ymm5, %ymm13 # ymm13 = ymm5[0,1,2,3,4,5],ymm9[6,7]
vmovdqa %xmm15, 0x10(%rax,%r9)
vmovdqa %xmm14, (%rax,%r9)
vmovdqa %ymm13, (%rbx,%r9)
addq $0x20, %r9
cmpq %r9, %r15
jne 0x51fc4a
vpbroadcastq %xmm1, %ymm1
vpunpcklqdq %ymm5, %ymm1, %ymm1 # ymm1 = ymm1[0],ymm5[0],ymm1[2],ymm5[2]
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rbx
movq 0x8(%rax,%rbx,8), %r9
vmovq %r9, %xmm5
vpblendd $0x3, %ymm5, %ymm1, %ymm1 # ymm1 = ymm5[0,1],ymm1[2,3,4,5,6,7]
movq 0x48(%rsp), %rax
vpaddq (%rax), %ymm1, %ymm1
vmovq %xmm1, %rdx
cmpq %rdx, %r8
cmovgq %r8, %rdx
vpextrq $0x1, %xmm1, %r8
cmpq %r8, %rdi
cmovgq %rdi, %r8
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %rdi
cmpq %rdi, %r10
cmovgq %r10, %rdi
vpextrq $0x1, %xmm1, %r10
leaq 0x1(%rbx), %rax
movq %rax, 0xf8(%rsp)
cmpq %r10, %rsi
cmovgq %rsi, %r10
vmovq %r10, %xmm1
vmovq %rdi, %xmm5
vpunpcklqdq %xmm1, %xmm5, %xmm1 # xmm1 = xmm5[0],xmm1[0]
vmovq %r8, %xmm5
vmovq %rdx, %xmm9
vpunpcklqdq %xmm5, %xmm9, %xmm5 # xmm5 = xmm9[0],xmm5[0]
vinserti128 $0x1, %xmm1, %ymm5, %ymm1
movl $0x1, %edx
vperm2i128 $0x8, %ymm1, %ymm1, %ymm5 # ymm5 = zero,zero,ymm1[0,1]
vpalignr $0x8, %ymm5, %ymm1, %ymm5 # ymm5 = ymm5[8,9,10,11,12,13,14,15],ymm1[0,1,2,3,4,5,6,7],ymm5[24,25,26,27,28,29,30,31],ymm1[16,17,18,19,20,21,22,23]
vpaddq %ymm5, %ymm0, %ymm5
vmovq %xmm1, %rsi
vmovq %xmm5, %rdi
cmpq %rdi, %rsi
cmovgq %rsi, %rdi
vpextrq $0x1, %xmm1, %rsi
vpextrq $0x1, %xmm5, %r8
cmpq %r8, %rsi
cmovgq %rsi, %r8
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %rsi
vextracti128 $0x1, %ymm5, %xmm9
vmovq %xmm9, %r10
cmpq %r10, %rsi
cmovgq %rsi, %r10
vmovq %r8, %xmm5
vmovq %rdi, %xmm11
vpunpcklqdq %xmm5, %xmm11, %xmm11 # xmm11 = xmm11[0],xmm5[0]
vmovq %r10, %xmm12
vpextrq $0x1, %xmm1, %rsi
vpextrq $0x1, %xmm9, %rdi
vinserti128 $0x1, %xmm12, %ymm11, %ymm9
cmpq %rdi, %rsi
cmovgq %rsi, %rdi
vmovq %rdi, %xmm1
vpbroadcastq %xmm1, %ymm1
vpblendd $0xc0, %ymm1, %ymm9, %ymm1 # ymm1 = ymm9[0,1,2,3,4,5],ymm1[6,7]
decl %edx
je 0x51fe73
vpbroadcastq %xmm5, %xmm1
vpxor %xmm0, %xmm0, %xmm0
vinserti128 $0x1, %xmm1, %ymm0, %ymm1
vpalignr $0x8, %ymm1, %ymm9, %ymm1 # ymm1 = ymm1[8,9,10,11,12,13,14,15],ymm9[0,1,2,3,4,5,6,7],ymm1[24,25,26,27,28,29,30,31],ymm9[16,17,18,19,20,21,22,23]
vpaddq 0x180(%rsp), %ymm1, %ymm11
vmovq %xmm11, %rdx
cmpq %rdx, %r9
cmovgq %r9, %rdx
vpextrq $0x1, %xmm11, %rsi
cmpq %rsi, %r13
cmovgq %r13, %rsi
vextracti128 $0x1, %ymm11, %xmm1
vmovq %xmm1, %rdi
cmpq %rdi, %rcx
cmovgq %rcx, %rdi
vpextrq $0x1, %xmm1, %rcx
cmpq %rcx, %r11
cmovgq %r11, %rcx
vmovq %rcx, %xmm1
vmovq %rdi, %xmm5
vpunpcklqdq %xmm1, %xmm5, %xmm1 # xmm1 = xmm5[0],xmm1[0]
vmovq %rsi, %xmm5
vmovq %rdx, %xmm9
vpunpcklqdq %xmm5, %xmm9, %xmm5 # xmm5 = xmm9[0],xmm5[0]
vinserti128 $0x1, %xmm1, %ymm5, %ymm1
xorl %ecx, %ecx
movq 0x30(%rsp), %r15
vpsubq %ymm6, %ymm11, %ymm5
vpsubq %ymm3, %ymm1, %ymm1
vmovq %xmm5, %rdx
vmovq %xmm1, %r8
cmpq %r8, %rdx
cmovgq %rdx, %r8
vpextrq $0x1, %xmm5, %rdx
vpextrq $0x1, %xmm1, %r11
cmpq %r11, %rdx
cmovgq %rdx, %r11
vextracti128 $0x1, %ymm5, %xmm5
vmovq %xmm5, %rdx
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %r13
cmpq %r13, %rdx
cmovgq %rdx, %r13
vpextrq $0x1, %xmm5, %rsi
vpextrq $0x1, %xmm1, %rdx
cmpq %rdx, %rsi
cmovgq %rsi, %rdx
movq (%r15,%rcx), %rsi
movq 0x8(%r15,%rcx), %rdi
cmpq %r8, %rsi
cmovleq %r8, %rsi
cmpq %r11, %rdi
cmovleq %r11, %rdi
movq 0x10(%r15,%rcx), %r9
cmpq %r13, %r9
cmovleq %r13, %r9
movq 0x18(%r15,%rcx), %r10
cmpq %rdx, %r10
cmovleq %rdx, %r10
vmovq %xmm4, %r14
cmpq %rsi, %r14
cmovgeq %rsi, %r14
vpextrq $0x1, %xmm4, %r12
cmpq %rdi, %r12
cmovgeq %rdi, %r12
vextracti128 $0x1, %ymm4, %xmm1
vmovq %xmm1, %rbx
cmpq %r9, %rbx
cmovgeq %r9, %rbx
vpextrq $0x1, %xmm1, %rax
cmpq %r10, %rax
cmovgeq %r10, %rax
cmpq %r8, %r14
cmovgeq %r8, %r14
vmovq %r11, %xmm0
vmovdqa %xmm0, 0xa0(%rsp)
cmpq %r11, %r12
cmovgeq %r11, %r12
vmovq %r13, %xmm11
cmpq %r13, %rbx
cmovgeq %r13, %rbx
vmovq %rdx, %xmm4
cmpq %rdx, %rax
cmovgeq %rdx, %rax
vmovq %r8, %xmm15
vmovq %rax, %xmm0
vmovdqa %xmm0, 0xb0(%rsp)
vmovq %rbx, %xmm14
vmovq %rdi, %xmm12
vmovq %rsi, %xmm1
vmovq %r12, %xmm13
movq 0x50(%rsp), %r12
vmovq %xmm7, %rax
cmpq %rsi, %rax
cmovgq %rax, %rsi
vpextrq $0x1, %xmm7, %rax
cmpq %rdi, %rax
cmovgq %rax, %rdi
vmovq %r9, %xmm10
vmovq %r14, %xmm0
vextracti128 $0x1, %ymm7, %xmm7
vmovq %xmm7, %rax
cmpq %r9, %rax
cmovgq %rax, %r9
vpextrq $0x1, %xmm7, %rax
vmovq %r10, %xmm7
cmpq %r10, %rax
cmovgq %rax, %r10
vmovq %r10, %xmm9
vmovdqa %ymm6, %ymm8
vmovq %r9, %xmm6
vmovq %rdi, %xmm2
vmovdqa %ymm3, %ymm5
vmovq %rsi, %xmm3
vpunpcklqdq %xmm4, %xmm11, %xmm11 # xmm11 = xmm11[0],xmm4[0]
vpunpcklqdq 0xa0(%rsp), %xmm15, %xmm4 # xmm4 = xmm15[0],mem[0]
vinserti128 $0x1, %xmm11, %ymm4, %ymm11
vpunpcklqdq %xmm7, %xmm10, %xmm4 # xmm4 = xmm10[0],xmm7[0]
vpunpcklqdq %xmm12, %xmm1, %xmm1 # xmm1 = xmm1[0],xmm12[0]
vinserti128 $0x1, %xmm4, %ymm1, %ymm1
vpunpcklqdq 0xb0(%rsp), %xmm14, %xmm4 # xmm4 = xmm14[0],mem[0]
vpunpcklqdq %xmm13, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm13[0]
vinserti128 $0x1, %xmm4, %ymm0, %ymm4
vpunpcklqdq %xmm9, %xmm6, %xmm0 # xmm0 = xmm6[0],xmm9[0]
vmovdqa %ymm8, %ymm6
vmovdqa %ymm1, (%r12,%rcx)
vpunpcklqdq %xmm2, %xmm3, %xmm2 # xmm2 = xmm3[0],xmm2[0]
vmovdqa %ymm5, %ymm3
vinserti128 $0x1, %xmm0, %ymm2, %ymm7
addq $0x20, %rcx
cmpq %rcx, 0x60(%rsp)
jne 0x51ff87
movq 0xe0(%rsp), %rdi
vmovdqa (%rdi), %ymm11
vmovdqa 0x1a0(%rsp), %ymm1
vpcmpgtq %ymm1, %ymm11, %ymm0
movq (%rdi), %rax
vmovq %xmm1, %rcx
cmpq %rcx, %rax
cmovgq %rax, %rcx
vpextrq $0x1, %xmm1, %rdx
movq 0x8(%rdi), %rax
cmpq %rdx, %rax
cmovgq %rax, %rdx
movq 0x10(%rdi), %rax
vextracti128 $0x1, %ymm1, %xmm1
vmovq %xmm1, %rsi
cmpq %rsi, %rax
cmovgq %rax, %rsi
vpextrq $0x1, %xmm1, %r9
movq 0x18(%rdi), %rax
cmpq %r9, %rax
cmovgq %rax, %r9
vtestpd 0x140(%rsp), %ymm0
movl 0x10(%rsp), %eax
cmovnel 0x40(%rsp), %eax
movl %eax, 0x10(%rsp)
cmpl $0x2, 0x1c(%rsp)
movq 0x60(%rsp), %r15
jg 0x520220
movl 0x84(%rsp), %r8d
movq 0x88(%rsp), %r14
movq 0x38(%rsp), %r13
movq 0x48(%rsp), %rdi
vperm2i128 $0x8, %ymm11, %ymm11, %ymm0 # ymm0 = zero,zero,ymm11[0,1]
vpalignr $0x8, %ymm0, %ymm11, %ymm11 # ymm11 = ymm0[8,9,10,11,12,13,14,15],ymm11[0,1,2,3,4,5,6,7],ymm0[24,25,26,27,28,29,30,31],ymm11[16,17,18,19,20,21,22,23]
decl %r8d
jne 0x52020d
jmp 0x520232
movq 0x88(%rsp), %r14
movq 0x38(%rsp), %r13
movq 0x48(%rsp), %rdi
vmovq %r9, %xmm0
vmovq %rsi, %xmm1
vpunpcklqdq %xmm0, %xmm1, %xmm0 # xmm0 = xmm1[0],xmm0[0]
vmovq %rdx, %xmm1
vmovq %rcx, %xmm2
vpunpcklqdq %xmm1, %xmm2, %xmm1 # xmm1 = xmm2[0],xmm1[0]
vinserti128 $0x1, %xmm0, %ymm1, %ymm5
vextracti128 $0x1, %ymm11, %xmm0
movq 0x10(%r14), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
vpextrd $0x2, %xmm0, (%rax,%rcx,4)
movq 0xf8(%rsp), %rdx
cmpq 0xd8(%rsp), %rdx
vmovdqa 0x160(%rsp), %ymm0
jne 0x51fbcc
movq 0x20(%rsp), %rcx
cmpl $0x1, %ecx
adcl $0x0, %ecx
movq 0x78(%rsp), %rax
leaq (,%rax,4), %rdx
leaq (%rdx,%rdx,2), %rsi
leaq (,%rax,8), %rbx
shlq $0x2, %rcx
xorl %r8d, %r8d
movq 0xd0(%rsp), %r10
movq 0x68(%rsp), %r11
movq 0x10(%r14), %rax
movq 0x8(%rax), %rax
vmovdqa (%r12,%r8,8), %xmm0
vmovdqa 0x10(%r12,%r8,8), %xmm1
vmovd %xmm0, (%rax,%r8)
addq %r8, %rax
vpextrd $0x2, %xmm0, (%rdx,%rax)
vmovd %xmm1, (%rbx,%rax)
vpextrd $0x2, %xmm1, (%rsi,%rax)
addq $0x4, %r8
cmpq %r8, %rcx
jne 0x5202c4
cmpl $0x0, 0x20(%rbp)
movq 0x20(%rsp), %r8
movl 0x5c(%rsp), %ebx
vmovdqa 0x120(%rsp), %ymm2
movq 0x30(%rsp), %r15
je 0x52034d
cmpl $0x2, 0x1c(%rsp)
jg 0x520341
movl 0x2c(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
vperm2i128 $0x8, %ymm5, %ymm5, %ymm0 # ymm0 = zero,zero,ymm5[0,1]
vpalignr $0x8, %ymm0, %ymm5, %ymm5 # ymm5 = ymm0[8,9,10,11,12,13,14,15],ymm5[0,1,2,3,4,5,6,7],ymm0[24,25,26,27,28,29,30,31],ymm5[16,17,18,19,20,21,22,23]
decl %ecx
jne 0x520331
vextracti128 $0x1, %ymm5, %xmm0
vpextrq $0x1, %xmm0, %r11
movq %r13, %r9
cmpl $0x0, 0x10(%rbp)
je 0x5203c3
cmpl $0x0, 0xc8(%rsp)
je 0x5203c3
movl %r8d, %edx
andl $0x1fffffff, %edx       # imm = 0x1FFFFFFF
shll $0x2, %edx
xorl %esi, %esi
movl 0x18(%rsp), %ecx
movl %esi, %eax
shrl $0x2, %eax
movl %esi, %r13d
andl $0x3, %r13d
imull %r8d, %r13d
addl %eax, %r13d
cmpl %r10d, %r13d
jge 0x5203ba
movq (%r12,%rsi,8), %r8
cmpq %r11, %r8
jle 0x52039f
movq %r8, %r11
movl %ebx, 0x10(%rsp)
movl %r13d, %ecx
jmp 0x5203b5
cmpl %ecx, %r13d
cmovgel %ecx, %r13d
cmpl %ebx, 0x10(%rsp)
cmovnel %ecx, %r13d
cmpq %r11, %r8
cmovel %r13d, %ecx
movq 0x20(%rsp), %r8
incq %rsi
cmpl %esi, %edx
jne 0x520372
jmp 0x5203c7
movl 0x18(%rsp), %ecx
movl 0x10(%rbp), %eax
orl %eax, 0x80(%rsp)
movq %r9, %r13
jne 0x520422
movq 0xc0(%rsp), %rax
shlq $0x5, %rax
vmovdqa (%r12,%rax), %ymm1
cmpl $0x2, 0x1c(%rsp)
jg 0x52040e
movl 0x2c(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
vperm2i128 $0x8, %ymm1, %ymm1, %ymm0 # ymm0 = zero,zero,ymm1[0,1]
vpalignr $0x8, %ymm0, %ymm1, %ymm1 # ymm1 = ymm0[8,9,10,11,12,13,14,15],ymm1[0,1,2,3,4,5,6,7],ymm0[24,25,26,27,28,29,30,31],ymm1[16,17,18,19,20,21,22,23]
decl %ecx
jne 0x5203fe
vextracti128 $0x1, %ymm1, %xmm0
vpextrq $0x1, %xmm0, %r11
movl %ebx, 0x10(%rsp)
movl 0x18(%rsp), %ecx
vmovdqa 0x100(%rsp), %ymm0
vpcmpgtq %ymm4, %ymm0, %ymm0
vpcmpgtq %ymm2, %ymm7, %ymm1
vpor %ymm0, %ymm1, %ymm0
vtestpd %ymm0, %ymm0
je 0x520452
orb $0x40, 0xc(%r14)
xorl %r11d, %r11d
movl $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movl %r11d, (%r14)
movl %ecx, 0x4(%r14)
movl 0x10(%rsp), %eax
movl %eax, 0x8(%r14)
vzeroupper
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq %r13, %rdi
callq 0x2094b5
movq 0x70(%rsp), %rdi
callq 0x2094b5
jmp 0x5204c6
callq 0x1ef2b3
jmp 0x5204c3
callq 0x1ef28d
jmp 0x5204c3
callq 0x1ef267
jmp 0x5204c3
callq 0x1ef241
jmp 0x5204c3
callq 0x1ef21b
jmp 0x5204c3
callq 0x1ef1f5
jmp 0x5204c3
callq 0x1ef1cf
jmp 0x5204c3
callq 0x1ef1a9
xorl %r14d, %r14d
movq %r14, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq