// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sw_striped_avx2_256_16.c
// Function: parasail_sw_table_striped_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)
{
    /* 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;
#ifdef PARASAIL_ROWCOL
    int32_t offset = 0;
    int32_t position = 0;
#endif
    __m256i* restrict vProfile = NULL;
    __m256i* restrict pvHStore = NULL;
    __m256i* restrict pvHLoad = NULL;
    __m256i* restrict pvHMax = NULL;
    __m256i* restrict pvE = NULL;
    __m256i vGapO;
    __m256i vGapE;
    __m256i vZero;
    int16_t bias = 0;
    int16_t score = 0;
    __m256i vBias;
    __m256i vMaxH;
    __m256i vMaxHUnit;
    int16_t maxp = 0;
    __m256i insert_mask;
    /*int16_t stop = 0;*/
    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;
    end_query = 0;
    end_ref = 0;
    s1Len = profile->s1Len;
    matrix = profile->matrix;
    segWidth = 16; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
#ifdef PARASAIL_ROWCOL
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
#endif
    vProfile = (__m256i*)profile->profile16.score;
    vGapO = _mm256_set1_epi16(open);
    vGapE = _mm256_set1_epi16(gap);
    vZero = _mm256_set1_epi16(0);
    bias = INT16_MIN;
    score = bias;
    vBias = _mm256_set1_epi16(bias);
    vMaxH = vBias;
    vMaxHUnit = vBias;
    maxp = INT16_MAX - (int16_t)(matrix->max+1);
    insert_mask = _mm256_cmpgt_epi16(
            _mm256_set_epi16(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),
            vZero);
    /*stop = profile->stop == INT32_MAX ?  INT16_MAX : (int16_t)profile->stop-bias;*/

    /* 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_SW | PARASAIL_FLAG_STRIPED
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_16;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* initialize heap variables */
    pvHStore = parasail_memalign___m256i(32, segLen);
    pvHLoad = parasail_memalign___m256i(32, segLen);
    pvHMax = parasail_memalign___m256i(32, segLen);
    pvE = parasail_memalign___m256i(32, segLen);

    /* validate heap variables */
    if (!pvHStore) return NULL;
    if (!pvHLoad) return NULL;
    if (!pvHMax) return NULL;
    if (!pvE) return NULL;

    /* initialize H and E */
    parasail_memset___m256i(pvHStore, vBias, segLen);
    parasail_memset___m256i(pvE, vBias, segLen);

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m256i vE;
        __m256i vF;
        __m256i vH;
        const __m256i* vP = NULL;
        __m256i* pv = NULL;

        /* Initialize F value to 0.  Any errors to vH values will be
         * corrected in the Lazy_F loop.  */
        vF = vBias;

        /* load final segment of pvHStore and shift left by 2 bytes */
        vH = _mm256_slli_si256_rpl(pvHStore[segLen - 1], 2);
        vH = _mm256_blendv_epi8(vH, vBias, insert_mask);

        /* Correct part of the vProfile */
        vP = vProfile + matrix->mapper[(unsigned char)s2[j]] * segLen;

        if (end_ref == j-2) {
            /* Swap in the max buffer. */
            pv = pvHMax;
            pvHMax = pvHLoad;
            pvHLoad = pvHStore;
            pvHStore = pv;
        }
        else {
            /* Swap the 2 H buffers. */
            pv = pvHLoad;
            pvHLoad = pvHStore;
            pvHStore = pv;
        }

        /* inner loop to process the query sequence */
        for (i=0; i<segLen; ++i) {
            vH = _mm256_adds_epi16(vH, _mm256_load_si256(vP + i));
            vE = _mm256_load_si256(pvE + i);

            /* Get max from vH, vE and vF. */
            vH = _mm256_max_epi16(vH, vE);
            vH = _mm256_max_epi16(vH, vF);
            /* Save vH values. */
            _mm256_store_si256(pvHStore + i, vH);
#ifdef PARASAIL_TABLE
            arr_store_si256(result->tables->score_table, vH, i, segLen, j, s2Len, bias);
#endif
            vMaxH = _mm256_max_epi16(vH, vMaxH);

            /* Update vE value. */
            vH = _mm256_subs_epi16(vH, vGapO);
            vE = _mm256_subs_epi16(vE, vGapE);
            vE = _mm256_max_epi16(vE, vH);
            _mm256_store_si256(pvE + i, vE);

            /* Update vF value. */
            vF = _mm256_subs_epi16(vF, vGapE);
            vF = _mm256_max_epi16(vF, vH);

            /* Load the next vH. */
            vH = _mm256_load_si256(pvHLoad + i);
        }

        /* Lazy_F loop: has been revised to disallow adjecent insertion and
         * then deletion, so don't update E(i, i), learn from SWPS3 */
        for (k=0; k<segWidth; ++k) {
            vF = _mm256_slli_si256_rpl(vF, 2);
            vF = _mm256_blendv_epi8(vF, vBias, insert_mask);
            for (i=0; i<segLen; ++i) {
                vH = _mm256_load_si256(pvHStore + i);
                vH = _mm256_max_epi16(vH,vF);
                _mm256_store_si256(pvHStore + i, vH);
#ifdef PARASAIL_TABLE
                arr_store_si256(result->tables->score_table, vH, i, segLen, j, s2Len, bias);
#endif
                vMaxH = _mm256_max_epi16(vH, vMaxH);
                vH = _mm256_subs_epi16(vH, vGapO);
                vF = _mm256_subs_epi16(vF, vGapE);
                if (! _mm256_movemask_epi8(_mm256_cmpgt_epi16(vF, vH))) goto end;
                /*vF = _mm256_max_epi16(vF, vH);*/
            }
        }
end:
        {
        }

#ifdef PARASAIL_ROWCOL
        /* extract last value from the column */
        {
            vH = _mm256_load_si256(pvHStore + offset);
            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) - bias;
        }
#endif

        {
            __m256i vCompare = _mm256_cmpgt_epi16(vMaxH, vMaxHUnit);
            if (_mm256_movemask_epi8(vCompare)) {
                score = _mm256_hmax_epi16_rpl(vMaxH);
                /* if score has potential to overflow, abort early */
                if (score > maxp) {
                    result->flag |= PARASAIL_FLAG_SATURATED;
                    break;
                }
                vMaxHUnit = _mm256_set1_epi16(score);
                end_ref = j;
            }
        }

        /*if (score == stop) break;*/
    }

#ifdef PARASAIL_ROWCOL
    for (i=0; i<segLen; ++i) {
        __m256i vH = _mm256_load_si256(pvHStore+i);
        arr_store_col(result->rowcols->score_col, vH, i, segLen, bias);
    }
#endif

    if (score == INT16_MAX) {
        result->flag |= PARASAIL_FLAG_SATURATED;
    }

    if (parasail_result_is_saturated(result)) {
        score = INT16_MAX;
        end_query = 0;
        end_ref = 0;
    }
    else {
        if (end_ref == j-1) {
            /* end_ref was the last store column */
            __m256i *pv = pvHMax;
            pvHMax = pvHStore;
            pvHStore = pv;
        }
        else if (end_ref == j-2) {
            /* end_ref was the last load column */
            __m256i *pv = pvHMax;
            pvHMax = pvHLoad;
            pvHLoad = pv;
        }
        /* Trace the alignment ending position on read. */
        {
            int16_t *t = (int16_t*)pvHMax;
            int32_t column_len = segLen * segWidth;
            end_query = s1Len - 1;
            for (i = 0; i<column_len; ++i, ++t) {
                if (*t == score) {
                    int32_t temp = i / segWidth + i % segWidth * segLen;
                    if (temp < end_query) {
                        end_query = temp;
                    }
                }
            }
        }
    }

    result->score = score - bias;
    result->end_query = end_query;
    result->end_ref = end_ref;

    parasail_free(pvE);
    parasail_free(pvHMax);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, 0x80(%rsp)
testq %rdi, %rdi
je 0x510fa9
movq 0x30(%rdi), %rax
movq %rax, 0x118(%rsp)
testq %rax, %rax
je 0x510fb0
movq 0x10(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x510fb7
movl 0x8(%rdi), %r15d
testl %r15d, %r15d
jle 0x510fbe
cmpq $0x0, 0x80(%rsp)
je 0x510fc5
movl %edx, %ebp
testl %edx, %edx
jle 0x510fcc
testl %ecx, %ecx
js 0x510fd3
movl %r8d, %r13d
testl %r8d, %r8d
js 0x510fda
movl %ecx, 0x120(%rsp)
leaq 0xf(%r15), %rbx
movq 0x78(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0x28(%rsp)
movl %ebx, %r12d
andl $0x7ffffff0, %r12d      # imm = 0x7FFFFFF0
movl %r12d, %edi
movl %ebp, %esi
callq 0x20abc2
testq %rax, %rax
je 0x510fdf
movq %rax, %r14
movl %r13d, 0x20(%rsp)
movq %rbp, 0x70(%rsp)
movq %r12, 0x100(%rsp)
shrq $0x4, %rbx
orl $0x10220804, 0xc(%rax)  # imm = 0x10220804
movl $0x20, %edi
movq %rbx, %rsi
callq 0x4f1904
movq %rax, %r12
movl $0x20, %edi
movq %rbx, %rsi
callq 0x4f1904
movq %rax, %r13
movl $0x20, %edi
movq %rbx, %rsi
callq 0x4f1904
movq %rax, %rbp
movl $0x20, %edi
movq %rbx, %rsi
callq 0x4f1904
testq %r12, %r12
sete %dl
testq %r13, %r13
sete %cl
orb %dl, %cl
movq %rbp, 0x48(%rsp)
testq %rbp, %rbp
sete %sil
testq %rax, %rax
sete %dl
orb %sil, %dl
orb %cl, %dl
jne 0x510fdf
movq %r15, 0xf8(%rsp)
vmovd 0x120(%rsp), %xmm0
vpbroadcastw %xmm0, %ymm0
vmovdqu %ymm0, 0x160(%rsp)
vmovd 0x20(%rsp), %xmm0
vpbroadcastw %xmm0, %ymm0
vmovdqu %ymm0, 0x140(%rsp)
vbroadcastsd 0x11dd83(%rip), %ymm0 # 0x62e570
vmovups %ymm0, 0x120(%rsp)
movq %rax, %r15
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4f190d
movq %r15, 0x38(%rsp)
movq %r15, %rdi
vmovups 0x120(%rsp), %ymm0
movq %rbx, %rsi
callq 0x4f190d
vmovdqu 0x140(%rsp), %ymm9
vmovdqu 0x160(%rsp), %ymm8
leal -0x1(%rbx), %ecx
movl 0x70(%rsp), %edx
movl $0x7ffe, %eax           # imm = 0x7FFE
subl 0x28(%rsp), %eax
cwtl
movl %eax, 0x6c(%rsp)
movq %rbx, %rbp
imulq %rdx, %rbp
leaq (,%rbp,4), %rsi
movq %rdx, 0x108(%rsp)
leaq (,%rdx,4), %rax
movq %rax, 0xd0(%rsp)
leaq (,%rbp,8), %r9
leaq (%rsi,%rsi,2), %rax
movq %rax, 0xf0(%rsp)
leaq (,%rbp,8), %rax
addq %rbp, %rax
leaq (%rax,%rax,2), %rax
addq %rbp, %rax
movq %rax, 0xc8(%rsp)
movq %rbp, %rax
imulq $0x2c, %rbp, %r10
imulq $0x34, %rbp, %rdx
imulq $0x38, %rbp, %rdi
movq %rdi, 0xa8(%rsp)
imulq $0x3c, %rbp, %rdi
movq %rdi, 0x28(%rsp)
shlq $0x4, %rbp
shlq $0x5, %rax
movq %rax, 0xe8(%rsp)
movq %rbx, %rax
vpbroadcastw 0x11e73b(%rip), %ymm0 # 0x62f010
shlq $0x5, %rax
movq %rax, 0x98(%rsp)
shlq $0x5, %rcx
movq %rcx, 0x110(%rsp)
vpbroadcastw 0x11e71a(%rip), %xmm1 # 0x62f010
vmovdqa %ymm0, %ymm3
vmovdqa %ymm0, %ymm2
leaq (%rsi,%rsi,4), %rdi
leaq (%r9,%r9,2), %rcx
movq %rsi, 0xd8(%rsp)
leaq (%rsi,%rsi,8), %rsi
movq %r9, %r8
leaq (%r9,%r9,4), %rax
movq %rax, 0x90(%rsp)
movq %rbp, 0xa0(%rsp)
leaq (%rbp,%rbp,2), %rax
movq %rax, 0x88(%rsp)
movw $0x8000, %ax            # imm = 0x8000
movl %eax, 0xc(%rsp)
movl $0x8000, %r9d           # imm = 0x8000
xorl %r11d, %r11d
xorl %eax, %eax
xorl %r15d, %r15d
movq %rbx, 0x30(%rsp)
movq %rdx, 0x120(%rsp)
movq %rcx, 0x20(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdi, 0xc0(%rsp)
movq %r10, 0xb8(%rsp)
movq %r8, 0xb0(%rsp)
movq 0x78(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x80(%rsp), %rdx
movzbl (%rdx,%rax), %edx
movslq (%rcx,%rdx,4), %rcx
movl %ebx, %edx
imulq %rcx, %rdx
shlq $0x5, %rdx
addq 0x118(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rax, 0x40(%rsp)
leal -0x2(%rax), %ecx
movq %r15, 0x10(%rsp)
cmpl %ecx, %r15d
movq %r13, %rcx
movq 0x48(%rsp), %rax
cmoveq %rax, %rcx
movq %rcx, 0xe0(%rsp)
cmoveq %r13, %rax
movq %rax, 0x48(%rsp)
movq 0x110(%rsp), %rax
movq %r12, 0x58(%rsp)
vmovdqa (%r12,%rax), %ymm4
vinserti128 $0x1, %xmm4, %ymm0, %ymm5
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]
vpblendw $0x1, %xmm0, %xmm4, %xmm5 # xmm5 = xmm0[0],xmm4[1,2,3,4,5,6,7]
vpblendd $0xf0, %ymm4, %ymm5, %ymm5 # ymm5 = ymm5[0,1,2,3],ymm4[4,5,6,7]
movq %r11, 0x60(%rsp)
movq %r11, %rdx
xorl %r11d, %r11d
vmovdqa %ymm0, %ymm4
movq 0x38(%rsp), %rbx
movq 0xa8(%rsp), %r10
movq 0xa0(%rsp), %r8
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %r15
movq 0x88(%rsp), %r12
movq 0x18(%rsp), %rax
vpaddsw (%rax,%r11), %ymm5, %ymm6
vmovdqa (%rbx,%r11), %ymm5
vpmaxsw %ymm4, %ymm5, %ymm7
vpmaxsw %ymm7, %ymm6, %ymm6
movq 0xe0(%rsp), %rax
vmovdqa %ymm6, (%rax,%r11)
movq 0x10(%r14), %rcx
movq (%rcx), %rcx
vmovd %xmm6, %eax
cwtl
addl %r9d, %eax
movl %eax, (%rcx,%rdx)
addq %rdx, %rcx
vpextrw $0x1, %xmm6, %eax
cwtl
addl %r9d, %eax
movq 0xd8(%rsp), %r13
movl %eax, (%r13,%rcx)
vpextrw $0x2, %xmm6, %eax
cwtl
addl %r9d, %eax
movq %r14, %r13
vpextrw $0x3, %xmm6, %r14d
movq 0xb0(%rsp), %rbp
movl %eax, (%rbp,%rcx)
movswl %r14w, %eax
addl %r9d, %eax
movq 0xf0(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x4, %xmm6, %eax
cwtl
addl %r9d, %eax
movl %eax, (%r8,%rcx)
vpextrw $0x5, %xmm6, %eax
cwtl
addl %r9d, %eax
movq 0xc0(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x6, %xmm6, %eax
cwtl
addl %r9d, %eax
vpextrw $0x7, %xmm6, %r14d
movq 0x20(%rsp), %rbp
movl %eax, (%rbp,%rcx)
movswl %r14w, %eax
addl %r9d, %eax
movq 0xc8(%rsp), %r14
movl %eax, (%r14,%rcx)
vextracti128 $0x1, %ymm6, %xmm7
vmovd %xmm7, %eax
cwtl
addl %r9d, %eax
movq 0xe8(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x1, %xmm7, %eax
cwtl
addl %r9d, %eax
movl %eax, (%rsi,%rcx)
vpextrw $0x2, %xmm7, %eax
cwtl
addl %r9d, %eax
vpextrw $0x3, %xmm7, %r14d
movl %eax, (%r15,%rcx)
movswl %r14w, %eax
addl %r9d, %eax
movq 0xb8(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x4, %xmm7, %eax
cwtl
addl %r9d, %eax
movl %eax, (%r12,%rcx)
vpextrw $0x5, %xmm7, %eax
cwtl
addl %r9d, %eax
movq 0x120(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x6, %xmm7, %eax
cwtl
addl %r9d, %eax
vpextrw $0x7, %xmm7, %r14d
movl %eax, (%r10,%rcx)
movswl %r14w, %eax
movq %r13, %r14
addl %r9d, %eax
movq 0x28(%rsp), %rbp
movl %eax, (%rbp,%rcx)
vpmaxsw %ymm2, %ymm6, %ymm2
vpsubsw %ymm8, %ymm6, %ymm6
vpsubsw %ymm9, %ymm5, %ymm5
vpmaxsw %ymm6, %ymm5, %ymm5
vmovdqa %ymm5, (%rbx,%r11)
vpsubsw %ymm9, %ymm4, %ymm4
vpmaxsw %ymm6, %ymm4, %ymm4
movq 0x58(%rsp), %rax
vmovdqa (%rax,%r11), %ymm5
addq $0x20, %r11
addq 0xd0(%rsp), %rdx
cmpq %r11, %rdi
jne 0x510a3f
movq 0xc0(%rsp), %rdi
movq 0xb8(%rsp), %r10
movl $0x0, 0x18(%rsp)
movq 0xd8(%rsp), %rbx
movq 0xd0(%rsp), %rbp
movq 0xb0(%rsp), %r8
movq 0xc8(%rsp), %rsi
movq 0xe0(%rsp), %r12
movq 0x60(%rsp), %r15
vinserti128 $0x1, %xmm4, %ymm0, %ymm5
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]
vpblendw $0x1, %xmm1, %xmm4, %xmm5 # xmm5 = xmm1[0],xmm4[1,2,3,4,5,6,7]
vpblendd $0xf0, %ymm4, %ymm5, %ymm4 # ymm4 = ymm5[0,1,2,3],ymm4[4,5,6,7]
movq %r15, %rdx
xorl %r11d, %r11d
vpmaxsw (%r12,%r11), %ymm4, %ymm5
vmovdqa %ymm5, (%r12,%r11)
movq 0x10(%r14), %rax
movq (%rax), %rcx
vmovd %xmm5, %eax
cwtl
addl %r9d, %eax
movl %eax, (%rcx,%rdx)
vpextrw $0x1, %xmm5, %eax
addq %rdx, %rcx
cwtl
addl %r9d, %eax
movl %eax, (%rbx,%rcx)
vpextrw $0x2, %xmm5, %eax
cwtl
addl %r9d, %eax
movl %eax, (%r8,%rcx)
vpextrw $0x3, %xmm5, %eax
cwtl
addl %r9d, %eax
movq 0xf0(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x4, %xmm5, %eax
cwtl
addl %r9d, %eax
vpextrw $0x5, %xmm5, %r14d
movq 0xa0(%rsp), %r15
movl %eax, (%r15,%rcx)
movswl %r14w, %eax
addl %r9d, %eax
movl %eax, (%rdi,%rcx)
vpextrw $0x6, %xmm5, %eax
cwtl
addl %r9d, %eax
movq 0x20(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x7, %xmm5, %eax
cwtl
addl %r9d, %eax
movl %eax, (%rsi,%rcx)
vextracti128 $0x1, %ymm5, %xmm6
vmovd %xmm6, %eax
cwtl
addl %r9d, %eax
vpextrw $0x1, %xmm6, %r14d
movq 0xe8(%rsp), %r15
movl %eax, (%r15,%rcx)
movswl %r14w, %eax
addl %r9d, %eax
movq 0x50(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x2, %xmm6, %eax
cwtl
addl %r9d, %eax
movq 0x90(%rsp), %r14
movl %eax, (%r14,%rcx)
vpextrw $0x3, %xmm6, %eax
cwtl
addl %r9d, %eax
movl %eax, (%r10,%rcx)
vpextrw $0x4, %xmm6, %eax
cwtl
addl %r9d, %eax
vpextrw $0x5, %xmm6, %r14d
movq 0x88(%rsp), %r15
movl %eax, (%r15,%rcx)
movswl %r14w, %eax
movq %r13, %r14
addl %r9d, %eax
movq 0x120(%rsp), %r15
movl %eax, (%r15,%rcx)
vpextrw $0x6, %xmm6, %eax
cwtl
addl %r9d, %eax
movq 0xa8(%rsp), %r15
movl %eax, (%r15,%rcx)
vpextrw $0x7, %xmm6, %eax
cwtl
addl %r9d, %eax
movq 0x28(%rsp), %r15
movl %eax, (%r15,%rcx)
movq 0x60(%rsp), %r15
movq 0x98(%rsp), %rcx
vpmaxsw %ymm2, %ymm5, %ymm2
vpsubsw %ymm8, %ymm5, %ymm5
vpsubsw %ymm9, %ymm4, %ymm4
vpcmpgtw %ymm5, %ymm4, %ymm5
vpmovmskb %ymm5, %eax
testl %eax, %eax
je 0x510dc6
addq $0x20, %r11
addq %rbp, %rdx
cmpq %r11, %rcx
jne 0x510c43
movl 0x18(%rsp), %eax
incl %eax
movl %eax, 0x18(%rsp)
cmpl $0x10, %eax
jne 0x510c25
vpcmpgtw %ymm3, %ymm2, %ymm4
vpmovmskb %ymm4, %eax
testl %eax, %eax
je 0x510e39
vpermq $0x44, %ymm2, %ymm3     # ymm3 = ymm2[0,1,0,1]
vpmaxsw %ymm3, %ymm2, %ymm3
vpslldq $0x8, %ymm3, %ymm4      # ymm4 = zero,zero,zero,zero,zero,zero,zero,zero,ymm3[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm3[16,17,18,19,20,21,22,23]
vpmaxsw %ymm4, %ymm3, %ymm3
vpslldq $0x4, %ymm3, %ymm4      # ymm4 = zero,zero,zero,zero,ymm3[0,1,2,3,4,5,6,7,8,9,10,11],zero,zero,zero,zero,ymm3[16,17,18,19,20,21,22,23,24,25,26,27]
vpmaxsw %ymm4, %ymm3, %ymm3
vpslldq $0x2, %ymm3, %ymm4      # ymm4 = zero,zero,ymm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13],zero,zero,ymm3[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpmaxsw %ymm4, %ymm3, %ymm3
vextracti128 $0x1, %ymm3, %xmm4
vpextrw $0x7, %xmm4, %eax
movl %eax, 0xc(%rsp)
cwtl
cmpl %eax, 0x6c(%rsp)
movq 0x30(%rsp), %rbx
movq 0x58(%rsp), %rbp
movq 0x50(%rsp), %rsi
jl 0x510e7b
vpshufhw $0xff, %ymm3, %ymm3     # ymm3 = ymm3[0,1,2,3,7,7,7,7,8,9,10,11,15,15,15,15]
vpbroadcastd 0x11d0a6(%rip), %ymm4 # 0x62ded0
vpermd %ymm3, %ymm4, %ymm3
movq 0x40(%rsp), %rax
movl %eax, %r15d
jmp 0x510e52
movq 0x10(%rsp), %r15
movq 0x30(%rsp), %rbx
movq 0x58(%rsp), %rbp
movq 0x50(%rsp), %rsi
movq 0x40(%rsp), %rax
incq %rax
movq 0x60(%rsp), %r11
addq $0x4, %r11
movq %rbp, %r13
cmpq 0x108(%rsp), %rax
jne 0x51097b
movq %r15, 0x10(%rsp)
movq 0x70(%rsp), %r13
jmp 0x510e85
orb $0x40, 0xc(%r14)
movq 0x40(%rsp), %r13
movzwl 0xc(%rsp), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
movq 0xf8(%rsp), %rbx
movq 0x48(%rsp), %r15
jne 0x510ea3
orb $0x40, 0xc(%r14)
movq %r14, %rdi
vzeroupper
callq 0x20be2e
testl %eax, %eax
je 0x510ec8
xorl %ecx, %ecx
movl $0xffff, %eax           # imm = 0xFFFF
movq %r12, %r13
xorl %ebx, %ebx
movq 0x38(%rsp), %rdi
jmp 0x511025
leal -0x1(%r13), %eax
addl $-0x2, %r13d
movq 0x10(%rsp), %rdx
cmpl %r13d, %edx
movq %rbp, %rsi
cmoveq %r15, %rbp
movq %r15, %r13
cmoveq %rsi, %r15
cmpl %eax, %edx
cmovneq %r12, %r13
cmoveq %rsi, %rbp
cmoveq %r12, %r15
decl %ebx
movq 0x100(%rsp), %rdx
testl %edx, %edx
movq 0x38(%rsp), %rdi
je 0x510ff7
movl 0xc(%rsp), %esi
je 0x510ffd
vmovd %ebx, %xmm0
vpbroadcastd %xmm0, %ymm0
vmovd %esi, %xmm1
vpbroadcastw %xmm1, %xmm1
vmovd 0x30(%rsp), %xmm2
vpbroadcastd %xmm2, %ymm2
vpmovsxbd 0x11d63d(%rip), %ymm3 # 0x62e578
xorl %eax, %eax
vpbroadcastd 0x11cf8e(%rip), %ymm4 # 0x62ded4
vpbroadcastd 0x11cd91(%rip), %ymm5 # 0x62dce0
vpcmpeqw (%r15,%rax,2), %xmm1, %xmm6
vpmovsxwd %xmm6, %ymm6
vpsrld $0x4, %ymm3, %ymm7
vpand %ymm4, %ymm3, %ymm8
vpmulld %ymm2, %ymm8, %ymm8
vpaddd %ymm7, %ymm8, %ymm7
vpminsd %ymm0, %ymm7, %ymm7
vblendvps %ymm6, %ymm7, %ymm0, %ymm0
addq $0x8, %rax
vpaddd %ymm5, %ymm3, %ymm3
cmpq %rax, %rdx
jne 0x510f4f
vextracti128 $0x1, %ymm0, %xmm1
vpminsd %xmm1, %xmm0, %xmm0
vpshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
vpminsd %xmm1, %xmm0, %xmm0
vpshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
vpminsd %xmm1, %xmm0, %xmm0
vmovd %xmm0, %ebx
jmp 0x511018
callq 0x1ea141
jmp 0x510fdf
callq 0x1ea11b
jmp 0x510fdf
callq 0x1ea0f5
jmp 0x510fdf
callq 0x1ea0cf
jmp 0x510fdf
callq 0x1ea0a9
jmp 0x510fdf
callq 0x1ea083
jmp 0x510fdf
callq 0x1ea05d
jmp 0x510fdf
callq 0x1ea037
xorl %r14d, %r14d
movq %r14, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xc(%rsp), %esi
jmp 0x511018
xorl %eax, %eax
movl %eax, %ecx
shrl $0x4, %ecx
cmpl %ebx, %ecx
cmovgel %ebx, %ecx
cmpw %si, (%r15,%rax,2)
cmovel %ecx, %ebx
incq %rax
cmpl %eax, %edx
jne 0x510fff
movswl %si, %eax
addl $0x8000, %eax           # imm = 0x8000
movq 0x10(%rsp), %rcx
movl %eax, (%r14)
movl %ebx, 0x4(%r14)
movl %ecx, 0x8(%r14)
vzeroupper
callq 0x20a60d
movq %r15, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq %r13, %rdi
callq 0x20a60d
jmp 0x510fe2
nop