// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_16.c
// Function: parasail_sg_flags_rowcol_scan_profile_avx2_256_16
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;
    int16_t* restrict boundary = NULL;
    __m256i* restrict pvHt = NULL;
    __m256i* restrict pvH = NULL;
    __m256i* restrict pvGapper = NULL;
    __m256i vGapO;
    __m256i vGapE;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    __m256i vZero;
    int16_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->profile16.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 = 16; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m256i*)profile->profile16.score;
    vGapO = _mm256_set1_epi16(open);
    vGapE = _mm256_set1_epi16(gap);
    NEG_LIMIT = (-open < matrix->min ? INT16_MIN + open : INT16_MIN - matrix->min) + 1;
    POS_LIMIT = INT16_MAX - matrix->max - 1;
    vZero = _mm256_setzero_si256();
    score = NEG_LIMIT;
    vNegLimit = _mm256_set1_epi16(NEG_LIMIT);
    vPosLimit = _mm256_set1_epi16(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vMaxH = vNegLimit;
    vPosMask = _mm256_cmpeq_epi16(_mm256_set1_epi16(position),
            _mm256_set_epi16(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15));
    vNegInfFront = vZero;
    vNegInfFront = _mm256_insert_epi16_rpl(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm256_adds_epi16(vNegInfFront,
            _mm256_slli_si256_rpl(_mm256_set1_epi16(-segLen*gap), 2));

    /* 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_16 | PARASAIL_FLAG_LANES_16;
    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_int16_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_16_t h;
            __m256i_16_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT16_MIN ? INT16_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT16_MIN ? INT16_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 < INT16_MIN ? INT16_MIN : tmp;
        }
    }

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

        /* calculate final H */
        vF = _mm256_slli_si256_rpl(vF, 2);
        vF = _mm256_adds_epi16(vF, vNegInfFront);
        vH = _mm256_max_epi16(vHt, vF);
        for (i=0; i<segLen; ++i) {
            vHt = _mm256_load_si256(pvHt+i);
            vF = _mm256_max_epi16(
                    _mm256_subs_epi16(vF, vGapE),
                    _mm256_subs_epi16(vH, vGapO));
            vH = _mm256_max_epi16(vHt, vF);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi16(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_epi16(vH, vMaxH));
            vMaxH = _mm256_max_epi16(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, 2);
            }
            result->rowcols->score_row[j] = (int16_t) _mm256_extract_epi16_rpl (vH, 15);
#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, 2);
        }
        score = (int16_t) _mm256_extract_epi16_rpl(vMaxH, 15);
        end_query = s1Len-1;
    }

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

    if (_mm256_movemask_epi8(_mm256_or_si256(
            _mm256_cmplt_epi16_rpl(vSaturationCheckMin, vNegLimit),
            _mm256_cmpgt_epi16(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 $0x120, %rsp            # imm = 0x120
movq %rsi, 0x58(%rsp)
testq %rdi, %rdi
je 0x524000
movq 0x30(%rdi), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x524007
movq 0x10(%rdi), %rax
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x52400e
movl %ecx, %r13d
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x524015
cmpq $0x0, 0x58(%rsp)
je 0x52401c
movl %edx, %r12d
testl %edx, %edx
jle 0x524023
testl %r13d, %r13d
js 0x52402a
testl %r8d, %r8d
js 0x524031
movl %r9d, %ebx
movl %r8d, 0x48(%rsp)
leal -0x1(%rcx), %eax
movq %rcx, 0xa0(%rsp)
leaq 0xf(%rcx), %r15
movq %r15, %r14
shrq $0x4, %r14
movl %eax, 0x8c(%rsp)
cltd
idivl %r14d
movl %eax, 0x18(%rsp)
movl %edx, 0x78(%rsp)
movl %r13d, %esi
negl %esi
movq 0x50(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negl %ecx
movl %esi, 0x40(%rsp)
cmpl %esi, %eax
cmovgl %r13d, %ecx
movl %ecx, 0x2c(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x10(%rsp)
andl $0x7ffffff0, %r15d      # imm = 0x7FFFFFF0
movl %r15d, %edi
movl %r12d, %esi
callq 0x209630
testq %rax, %rax
je 0x524036
movl %r13d, 0x20(%rsp)
movq %r15, 0x98(%rsp)
xorl %edi, %edi
testl %ebx, %ebx
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
cmpl $0x0, 0x20(%rbp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x10240402, %ecx       # imm = 0x10240402
movq %rax, 0x70(%rsp)
movl %ecx, 0xc(%rax)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, %r15
leal 0x1(%r12), %esi
movl $0x20, %edi
callq 0x2094cd
movq %rax, %r13
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r12, 0x38(%rsp)
movq %rax, %r12
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r14, %rsi
movq %rax, %r14
movl $0x20, %edi
movq %rsi, 0x30(%rsp)
callq 0x4c5e3c
testq %r15, %r15
sete %cl
movq %r13, 0x68(%rsp)
testq %r13, %r13
sete %dl
orb %cl, %dl
testq %r12, %r12
sete %cl
testq %r14, %r14
sete %sil
orb %cl, %sil
orb %dl, %sil
testq %rax, %rax
sete %cl
orb %sil, %cl
jne 0x524036
movq %rax, 0x60(%rsp)
movq 0x38(%rsp), %rax
decl %eax
movl %eax, 0x1c(%rsp)
movl $0xf, %ecx
subl 0x18(%rsp), %ecx
movl 0x20(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastw %xmm0, %ymm4
movl 0x48(%rsp), %edx
vmovd %edx, %xmm0
vpbroadcastw %xmm0, %ymm5
movl 0x2c(%rsp), %eax
addl $0xffff8001, %eax       # imm = 0xFFFF8001
vmovd %eax, %xmm0
vpbroadcastw %xmm0, %ymm0
vmovd 0x10(%rsp), %xmm1
vpbroadcastw %xmm1, %ymm1
movl %ecx, 0x28(%rsp)
vmovd %ecx, %xmm2
vpbroadcastw %xmm2, %ymm3
movl %eax, 0x2c(%rsp)
movzwl %ax, %ecx
vmovd %ecx, %xmm6
movq 0x30(%rsp), %rdi
movl %edi, %ecx
imull %edx, %ecx
negl %ecx
vmovd %ecx, %xmm2
vpbroadcastw %xmm2, %ymm2
vpand 0xd5ec6(%rip), %ymm2, %ymm2 # 0x5f9820
vpaddsw %ymm2, %ymm6, %ymm7
movl %esi, %ecx
movl %edx, %edx
movslq 0x40(%rsp), %rax
movl %edi, %edi
movq %rdi, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
imulq %rdx, %rdi
xorl %r8d, %r8d
movq $-0x7fff, %r9           # imm = 0x8001
movq $-0x8000, %r10          # imm = 0x8000
movq %rax, %rsi
xorl %edx, %edx
testl %ebx, %ebx
je 0x523996
xorl %r11d, %r11d
jmp 0x523999
movq %rsi, %r11
cmpq %r9, %r11
movq $-0x8000, %r13          # imm = 0x8000
cmovgeq %r11, %r13
movw %r13w, 0xe0(%rsp,%rdx,2)
subq %rcx, %r11
cmpq %r9, %r11
cmovlq %r10, %r11
movw %r11w, 0xc0(%rsp,%rdx,2)
incq %rdx
subq %rdi, %rsi
cmpq $0x10, %rdx
jne 0x52398d
movq %r8, %rdx
shlq $0x5, %rdx
vmovaps 0xe0(%rsp), %ymm2
vmovaps %ymm2, (%r14,%rdx)
vmovdqa 0xc0(%rsp), %ymm2
vmovdqa %ymm2, (%r15,%rdx)
incq %r8
subq 0x10(%rsp), %rax
cmpq 0x20(%rsp), %r8
jne 0x523988
movq 0x68(%rsp), %rdi
movw $0x0, (%rdi)
movq 0x38(%rsp), %rax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl 0x48(%rsp), %r8d
movl 0x40(%rsp), %r9d
movl 0x18(%rbp), %r10d
cmpl $0xffff8001, %r9d       # imm = 0xFFFF8001
movl $0xffff8000, %eax       # imm = 0xFFFF8000
cmovgel %r9d, %eax
testl %r10d, %r10d
cmovnel %edx, %eax
movw %ax, 0x2(%rdi,%rsi,2)
subl %r8d, %r9d
incq %rsi
cmpq %rsi, %rcx
jne 0x523a2f
movq 0x30(%rsp), %rsi
leal -0x1(%rsi), %ecx
vpxor %xmm2, %xmm2, %xmm2
vpsubsw %ymm4, %ymm2, %ymm8
movq %rcx, %rax
shlq $0x5, %rax
movq 0x60(%rsp), %rdx
addq %rax, %rdx
vmovdqa %ymm1, %ymm2
movq 0x70(%rsp), %rdi
movl 0x18(%rsp), %r8d
vmovdqa %ymm8, (%rdx)
vpsubsw %ymm5, %ymm8, %ymm8
vpminsw %ymm2, %ymm8, %ymm2
addq $-0x20, %rdx
decl %esi
jg 0x523a82
movl %ecx, %r9d
shlq $0x5, %r9
addq %r14, %r9
movl 0x78(%rsp), %r10d
movq %r10, 0x90(%rsp)
shlq $0x5, %r10
addq %r14, %r10
movl $0x1, %r11d
movq 0x30(%rsp), %rbx
cmpl %r11d, %ebx
adcl $0x0, %ebx
movl 0x28(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %r13d
cmovgel %eax, %r13d
movq 0x38(%rsp), %rax
cmpl $0x2, %eax
cmovgel %eax, %r11d
shlq $0x5, %rbx
xorl %edx, %edx
vpcmpeqw 0xd5d50(%rip), %ymm3, %ymm9 # 0x5f9840
movl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
vmovdqa %ymm0, %ymm8
vmovdqa %ymm0, %ymm3
movq %rdx, %rsi
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rsp), %rcx
movzbl (%rcx,%rdx), %ecx
movslq (%rax,%rcx,4), %rcx
imulq 0x20(%rsp), %rcx
shlq $0x5, %rcx
movq 0x60(%rsp), %rdx
vpsubsw (%rdx), %ymm0, %ymm10
addq 0x80(%rsp), %rcx
vmovdqa (%r9), %ymm11
vinserti128 $0x1, %xmm11, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[14,15],ymm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm11[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
movq 0x68(%rsp), %rax
vpinsrw $0x0, (%rax,%rsi,2), %xmm11, %xmm12
movq %rdx, %rax
vpblendd $0xf, %ymm12, %ymm11, %ymm12 # ymm12 = ymm12[0,1,2,3],ymm11[4,5,6,7]
xorl %edx, %edx
vmovdqa %ymm0, %ymm11
vpaddsw (%rcx,%rdx), %ymm12, %ymm12
vmovdqa (%r14,%rdx), %ymm13
vmovdqa (%r15,%rdx), %ymm14
vpsubsw %ymm5, %ymm14, %ymm14
vpsubsw %ymm4, %ymm13, %ymm15
vpmaxsw %ymm15, %ymm14, %ymm14
vpaddsw (%rax,%rdx), %ymm10, %ymm10
vpmaxsw %ymm10, %ymm11, %ymm11
vpmaxsw %ymm12, %ymm14, %ymm10
vmovdqa %ymm14, (%r15,%rdx)
vmovdqa %ymm10, (%r12,%rdx)
addq $0x20, %rdx
vmovdqa %ymm13, %ymm12
cmpq %rdx, %rbx
jne 0x523b5f
vinserti128 $0x1, %xmm10, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm10, %ymm10 # ymm10 = ymm12[14,15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
leaq 0x1(%rsi), %rdx
movq 0x68(%rsp), %rax
vpinsrw $0x0, 0x2(%rax,%rsi,2), %xmm10, %xmm12
vpblendd $0xf, %ymm12, %ymm10, %ymm12 # ymm12 = ymm12[0,1,2,3],ymm10[4,5,6,7]
movq 0x60(%rsp), %rax
vpaddsw (%rax), %ymm12, %ymm10
vpmaxsw %ymm10, %ymm11, %ymm10
movl $0xe, %ecx
vperm2i128 $0x28, %ymm10, %ymm10, %ymm11 # ymm11 = zero,zero,ymm10[0,1]
vpalignr $0xe, %ymm11, %ymm10, %ymm11 # ymm11 = ymm11[14,15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm11[30,31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpaddsw %ymm7, %ymm11, %ymm11
vpmaxsw %ymm11, %ymm10, %ymm10
decl %ecx
jne 0x523bdb
vperm2i128 $0x28, %ymm10, %ymm10, %ymm11 # ymm11 = zero,zero,ymm10[0,1]
vpalignr $0xe, %ymm11, %ymm10, %ymm10 # ymm10 = ymm11[14,15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm11[30,31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpaddsw %ymm6, %ymm10, %ymm10
vpmaxsw %ymm10, %ymm12, %ymm11
xorl %ecx, %ecx
vpsubsw %ymm5, %ymm10, %ymm10
vpsubsw %ymm4, %ymm11, %ymm11
vpmaxsw %ymm11, %ymm10, %ymm10
vpmaxsw (%r12,%rcx), %ymm10, %ymm11
vmovdqa %ymm11, (%r14,%rcx)
vpminsw %ymm2, %ymm10, %ymm2
vpminsw %ymm2, %ymm11, %ymm2
vpmaxsw %ymm3, %ymm11, %ymm3
addq $0x20, %rcx
cmpq %rcx, %rbx
jne 0x523c0b
vmovdqa (%r10), %ymm10
vpcmpgtw %ymm8, %ymm10, %ymm11
vpand %ymm9, %ymm11, %ymm11
vpmovmskb %ymm11, %eax
testl %eax, %eax
movl 0x10(%rsp), %eax
cmovnel %esi, %eax
movl %eax, 0x10(%rsp)
vmovdqa %ymm10, %ymm11
cmpl $0xe, %r8d
jg 0x523c7d
movl %r13d, %ecx
vmovdqa %ymm10, %ymm11
vperm2i128 $0x28, %ymm11, %ymm11, %ymm12 # ymm12 = zero,zero,ymm11[0,1]
vpalignr $0xe, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[14,15],ymm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm11[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
decl %ecx
jne 0x523c6d
vpmaxsw %ymm8, %ymm10, %ymm8
vextracti128 $0x1, %ymm11, %xmm10
vpextrw $0x7, %xmm10, %eax
cwtl
movq 0x10(%rdi), %rcx
movq (%rcx), %rcx
movl %eax, (%rcx,%rsi,4)
cmpq %r11, %rdx
jne 0x523b00
movq 0x30(%rsp), %r9
leal (,%r9,4), %r13d
cmpl $0x1, %r9d
movl %r9d, %r8d
adcl $0x0, %r8d
movq 0x20(%rsp), %rsi
imulq $0x3c, %rsi, %rax
movq %rax, 0x58(%rsp)
imulq $0x38, %rsi, %rax
movq %rax, 0x50(%rsp)
imulq $0x34, %rsi, %rax
movq %rax, 0x80(%rsp)
movq %rsi, %rbx
shlq $0x4, %rbx
imulq $0x2c, %rsi, %rax
movq %rax, 0x48(%rsp)
leal (,%rsi,8), %eax
leaq (%rax,%rax,4), %rcx
movq %rcx, 0x40(%rsp)
leal (,%rsi,4), %ecx
leaq (%rcx,%rcx,8), %rdx
movq %rdx, 0x38(%rsp)
leaq (%rsi,%rsi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rsi, %rdx
movq %rdx, 0x78(%rsp)
shlq $0x5, %rsi
leaq (%rax,%rax,2), %rax
movq %rax, 0x20(%rsp)
leaq (%rcx,%rcx,4), %rax
movq %rax, 0xb0(%rsp)
shll $0x2, %r8d
movq %r8, 0xb8(%rsp)
leal (,%r9,8), %eax
movq %rax, 0xa8(%rsp)
movq %r13, %r10
leaq (%r13,%r13,2), %r13
movq %rbx, %r11
leaq (%rbx,%rbx,2), %rcx
movq %rdi, %r9
xorl %edi, %edi
movq 0x10(%r9), %rax
movq 0x8(%rax), %rdx
vmovdqa (%r14,%rdi,8), %xmm5
vmovdqa 0x10(%r14,%rdi,8), %xmm4
vmovd %xmm5, %eax
cwtl
movl %eax, (%rdx,%rdi)
vpextrw $0x1, %xmm5, %eax
addq %rdi, %rdx
cwtl
vpextrw $0x2, %xmm5, %ebx
movl %eax, (%r10,%rdx)
movswl %bx, %eax
vpextrw $0x3, %xmm5, %ebx
movq 0xa8(%rsp), %r8
movl %eax, (%r8,%rdx)
movswl %bx, %eax
vpextrw $0x4, %xmm5, %ebx
movl %eax, (%r13,%rdx)
movswl %bx, %eax
vpextrw $0x5, %xmm5, %ebx
movl %eax, (%r11,%rdx)
movswl %bx, %eax
vpextrw $0x6, %xmm5, %ebx
movq 0xb0(%rsp), %r8
movl %eax, (%r8,%rdx)
movswl %bx, %eax
vpextrw $0x7, %xmm5, %ebx
movq 0x20(%rsp), %r8
movl %eax, (%r8,%rdx)
movswl %bx, %eax
movq 0x78(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vmovd %xmm4, %eax
cwtl
movl %eax, (%rsi,%rdx)
vpextrw $0x1, %xmm4, %eax
cwtl
movq 0x38(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vpextrw $0x2, %xmm4, %eax
cwtl
movq 0x40(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vpextrw $0x3, %xmm4, %eax
cwtl
movq 0x48(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vpextrw $0x4, %xmm4, %eax
cwtl
movl %eax, (%rcx,%rdx)
vpextrw $0x5, %xmm4, %eax
cwtl
movq 0x80(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vpextrw $0x6, %xmm4, %eax
cwtl
movq 0x50(%rsp), %rbx
movl %eax, (%rbx,%rdx)
vpextrw $0x7, %xmm4, %eax
cwtl
movq 0x58(%rsp), %rbx
movl %eax, (%rbx,%rdx)
addq $0x4, %rdi
cmpq %rdi, 0xb8(%rsp)
jne 0x523d66
movl 0x20(%rbp), %r13d
testl %r13d, %r13d
movl 0x8c(%rsp), %r9d
movq 0xa0(%rsp), %r10
movl 0x18(%rsp), %r8d
movq 0x68(%rsp), %rbx
movl 0x2c(%rsp), %r11d
je 0x523ec4
cmpl $0xe, %r8d
jg 0x523eb9
movl 0x28(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
vperm2i128 $0x28, %ymm8, %ymm8, %ymm4 # ymm4 = zero,zero,ymm8[0,1]
vpalignr $0xe, %ymm4, %ymm8, %ymm8 # ymm8 = ymm4[14,15],ymm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm4[30,31],ymm8[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
decl %ecx
jne 0x523ea9
vextracti128 $0x1, %ymm8, %xmm4
vpextrw $0x7, %xmm4, %r11d
cmpl $0x0, 0x10(%rbp)
je 0x523f3c
cmpl $0x0, 0x98(%rsp)
je 0x523f3c
movq 0x30(%rsp), %rdx
andl $0x7ffffff, %edx        # imm = 0x7FFFFFF
shll $0x4, %edx
xorl %esi, %esi
movl %r9d, %ecx
movl %esi, %eax
shrl $0x4, %eax
movl %esi, %edi
andl $0xf, %edi
imull 0x30(%rsp), %edi
addl %eax, %edi
cmpl %r10d, %edi
jge 0x523f33
movzwl (%r14,%rsi,2), %r8d
cmpw %r11w, %r8w
jle 0x523f17
movl %r8d, %r11d
movl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl %edi, %ecx
jmp 0x523f2e
cmpl %ecx, %edi
cmovgel %ecx, %edi
movl 0x10(%rsp), %eax
cmpl 0x1c(%rsp), %eax
cmovnel %ecx, %edi
cmpw %r11w, %r8w
cmovel %edi, %ecx
movl 0x18(%rsp), %r8d
incq %rsi
cmpl %esi, %edx
jne 0x523ee7
jmp 0x523f3f
movl %r9d, %ecx
orl 0x10(%rbp), %r13d
movq 0x70(%rsp), %rdx
jne 0x523f97
movq 0x90(%rsp), %rax
shlq $0x5, %rax
vmovdqa (%r14,%rax), %ymm4
cmpl $0xe, %r8d
jg 0x523f81
movl 0x28(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
vperm2i128 $0x28, %ymm4, %ymm4, %ymm5 # ymm5 = zero,zero,ymm4[0,1]
vpalignr $0xe, %ymm5, %ymm4, %ymm4 # ymm4 = ymm5[14,15],ymm4[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm5[30,31],ymm4[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
decl %ecx
jne 0x523f71
vextracti128 $0x1, %ymm4, %xmm4
vpextrw $0x7, %xmm4, %r11d
movl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl %r9d, %ecx
vpcmpgtw %ymm2, %ymm0, %ymm0
vpcmpgtw %ymm1, %ymm3, %ymm1
vpor %ymm0, %ymm1, %ymm0
vpmovmskb %ymm0, %eax
testl %eax, %eax
je 0x523fbc
orb $0x40, 0xc(%rdx)
xorl %r11d, %r11d
movl $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movswl %r11w, %eax
movl %eax, (%rdx)
movl %ecx, 0x4(%rdx)
movl 0x10(%rsp), %eax
movl %eax, 0x8(%rdx)
movq 0x60(%rsp), %rdi
vzeroupper
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
movq %rbx, %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq 0x70(%rsp), %rax
jmp 0x524038
callq 0x1f000f
jmp 0x524036
callq 0x1effe9
jmp 0x524036
callq 0x1effc3
jmp 0x524036
callq 0x1eff9d
jmp 0x524036
callq 0x1eff77
jmp 0x524036
callq 0x1eff51
jmp 0x524036
callq 0x1eff2b
jmp 0x524036
callq 0x1eff05
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq