// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sg_scan_avx2_256_16.c
// Function: parasail_sg_flags_table_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 $0x160, %rsp            # imm = 0x160
movq %rsi, 0xa8(%rsp)
testq %rdi, %rdi
je 0x49d775
movq 0x30(%rdi), %rax
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x49d799
movq 0x10(%rdi), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x49d7bd
movl 0x8(%rdi), %eax
testl %eax, %eax
jle 0x49d7e1
cmpq $0x0, 0xa8(%rsp)
je 0x49d805
movl %edx, %r15d
testl %edx, %edx
jle 0x49d826
movl %ecx, %r13d
testl %ecx, %ecx
js 0x49d847
testl %r8d, %r8d
js 0x49d868
movl %r9d, %r12d
movl %r8d, 0x50(%rsp)
leal -0x1(%rax), %r14d
movq %rax, 0xc8(%rsp)
leaq 0xf(%rax), %rdi
movq %rdi, %rcx
shrq $0x4, %rcx
movl %r14d, %eax
xorl %edx, %edx
movq %rcx, 0x20(%rsp)
divl %ecx
movl %eax, 0x70(%rsp)
movl %edx, 0x80(%rsp)
movl %r13d, %ebx
negl %ebx
movq 0xa0(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negl %ecx
cmpl %ebx, %eax
cmovgl %r13d, %ecx
movl %ecx, 0x1c(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x78(%rsp)
andl $0x7ffffff0, %edi       # imm = 0x7FFFFFF0
movl %r15d, %esi
callq 0x1ab876
testq %rax, %rax
je 0x49d044
movl %r13d, 0x68(%rsp)
movl %r14d, 0x94(%rsp)
movq %rax, %rdi
xorl %eax, %eax
testl %r12d, %r12d
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
cmpl $0x0, 0x20(%rbp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%rdi), %eax
orl $0x10220402, %eax       # imm = 0x10220402
movq %rdi, 0xc0(%rsp)
movl %eax, 0xc(%rdi)
pushq $0x20
popq %r14
movq %r14, %rdi
movq 0x20(%rsp), %r13
movq %r13, %rsi
callq 0x496aa4
movq %rax, 0x38(%rsp)
leal 0x1(%r15), %esi
movq %r14, %rdi
movq %rsi, 0x60(%rsp)
callq 0x1ab77b
movq %r15, 0x58(%rsp)
movq %rax, 0x28(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x496aa4
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x496aa4
movq %rax, %r14
pushq $0x20
popq %rdi
movq %r13, %rsi
callq 0x496aa4
movq 0x38(%rsp), %rcx
testq %rcx, %rcx
sete %dl
cmpq $0x0, 0x28(%rsp)
sete %cl
orb %dl, %cl
movq %r15, 0x88(%rsp)
testq %r15, %r15
sete %dil
movq %r14, 0x30(%rsp)
testq %r14, %r14
sete %dl
orb %dil, %dl
orb %cl, %dl
movq %rax, 0x40(%rsp)
testq %rax, %rax
sete %al
orb %dl, %al
je 0x49d04b
xorl %ebx, %ebx
jmp 0x49d890
movq 0x58(%rsp), %rax
movq %rax, %r14
decl %eax
movl %eax, 0x4c(%rsp)
pushq $0xf
popq %rax
subl 0x70(%rsp), %eax
movl 0x68(%rsp), %edx
vmovd %edx, %xmm0
vpbroadcastw %xmm0, %ymm3
movl 0x50(%rsp), %ecx
vmovd %ecx, %xmm0
vpbroadcastw %xmm0, %ymm4
movl 0x1c(%rsp), %r13d
addl $0xffff8001, %r13d      # imm = 0xFFFF8001
vmovd %r13d, %xmm0
vpbroadcastw %xmm0, %ymm0
vmovd 0x78(%rsp), %xmm1
vpbroadcastw %xmm1, %ymm1
movl %eax, 0x90(%rsp)
vmovd %eax, %xmm2
vpbroadcastw %xmm2, %ymm7
movl %r13d, 0x1c(%rsp)
movzwl %r13w, %eax
vmovd %eax, %xmm5
movq 0x20(%rsp), %rsi
movl %esi, %eax
imull %ecx, %eax
negl %eax
vmovd %eax, %xmm2
vpbroadcastw %xmm2, %ymm2
vpand 0x12e84b(%rip), %ymm2, %ymm2 # 0x5cb920
vpaddsw %ymm2, %ymm5, %ymm6
movl %edx, %eax
movl %ecx, %ecx
movslq %ebx, %rdx
imulq %rcx, %rsi
xorl %edi, %edi
movq $-0x7fff, %r8           # imm = 0x8001
movq $-0x8000, %r9           # imm = 0x8000
cmpq 0x20(%rsp), %rdi
je 0x49d184
movq %rdx, %r10
xorl %r11d, %r11d
cmpq $0x10, %r11
je 0x49d14a
testl %r12d, %r12d
je 0x49d115
xorl %r15d, %r15d
jmp 0x49d118
movq %r10, %r15
cmpq %r8, %r15
movq $-0x8000, %r13          # imm = 0x8000
cmovgeq %r15, %r13
subq %rax, %r15
cmpq %r8, %r15
cmovlq %r9, %r15
movw %r13w, 0x120(%rsp,%r11,2)
movw %r15w, 0x100(%rsp,%r11,2)
incq %r11
subq %rsi, %r10
jmp 0x49d105
movq %rdi, %r10
shlq $0x5, %r10
vmovaps 0x120(%rsp), %ymm2
movq 0x30(%rsp), %r11
vmovaps %ymm2, (%r11,%r10)
vmovdqa 0x100(%rsp), %ymm2
movq 0x38(%rsp), %r11
vmovdqa %ymm2, (%r11,%r10)
incq %rdi
subq %rcx, %rdx
jmp 0x49d0f4
movq 0x28(%rsp), %rax
andw $0x0, (%rax)
pushq $0x1
popq %rax
xorl %ecx, %ecx
movq 0x38(%rsp), %r9
movl 0x50(%rsp), %edi
movl 0x18(%rbp), %r8d
movq 0x60(%rsp), %r10
movq 0x28(%rsp), %rsi
cmpq %rax, %r10
je 0x49d1cd
cmpl $0xffff8001, %ebx       # imm = 0xFFFF8001
movl $0xffff8000, %edx       # imm = 0xFFFF8000
cmovgel %ebx, %edx
testl %r8d, %r8d
cmovnel %ecx, %edx
movw %dx, (%rsi,%rax,2)
incq %rax
subl %edi, %ebx
jmp 0x49d1a9
vpxor %xmm2, %xmm2, %xmm2
vpsubsw %ymm3, %ymm2, %ymm8
movq 0x20(%rsp), %r15
leal -0x1(%r15), %eax
vmovdqa %ymm1, %ymm2
movl %eax, %ecx
movq 0x40(%rsp), %rdi
testl %ecx, %ecx
js 0x49d204
movl %ecx, %edx
shlq $0x5, %rdx
vmovdqa %ymm8, (%rdi,%rdx)
vpsubsw %ymm4, %ymm8, %ymm8
vpminsw %ymm2, %ymm8, %ymm2
decl %ecx
jmp 0x49d1e9
movl %eax, %ecx
shlq $0x5, %rcx
movq 0x30(%rsp), %rax
addq %rax, %rcx
movq %rcx, 0xd0(%rsp)
movl %r14d, %edx
movl 0x80(%rsp), %ecx
shlq $0x5, %rcx
addq %rax, %rcx
movq %rcx, 0x98(%rsp)
movq %r15, %r10
shlq $0x5, %r10
imulq %rdx, %r15
imulq $0x3c, %r15, %rax
movq %rax, 0x50(%rsp)
imulq $0x38, %r15, %rax
movq %rax, 0x80(%rsp)
imulq $0x34, %r15, %rax
movq %rax, 0x78(%rsp)
imulq $0x30, %r15, %rax
movq %rax, 0x70(%rsp)
imulq $0x2c, %r15, %rax
movq %rax, 0x68(%rsp)
imulq $0x28, %r15, %rax
movq %rax, 0x60(%rsp)
movq %r15, %rax
shlq $0x5, %rax
movq %rax, 0x58(%rsp)
movq %r15, %rdi
shlq $0x4, %rdi
imulq $0x24, %r15, %rax
movq %rax, 0xf8(%rsp)
imulq $0x1c, %r15, %rax
movq %rax, 0xf0(%rsp)
imulq $0x18, %r15, %r13
imulq $0x14, %r15, %r12
imulq $0xc, %r15, %rax
leaq (,%r15,8), %rcx
shlq $0x2, %r15
vpcmpeqw 0x12e67e(%rip), %ymm7, %ymm9 # 0x5cb940
vmovdqa %ymm0, %ymm7
vmovdqa %ymm0, %ymm8
movq %rdx, 0xd8(%rsp)
leaq (,%rdx,4), %rdx
movq $0x0, 0xb0(%rsp)
movl 0x4c(%rsp), %esi
movl %esi, 0x18(%rsp)
xorl %esi, %esi
cmpq 0xd8(%rsp), %rsi
je 0x49d604
movq %rsi, %r11
movq 0xd0(%rsp), %rsi
vmovdqa (%rsi), %ymm10
vinserti128 $0x1, %xmm10, %ymm0, %ymm11
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]
movq 0x28(%rsp), %rsi
vpinsrw $0x0, (%rsi,%r11,2), %xmm10, %xmm11
vpblendd $0xf, %ymm11, %ymm10, %ymm12 # ymm12 = ymm11[0,1,2,3],ymm10[4,5,6,7]
movq 0xa0(%rsp), %rsi
movq 0x10(%rsi), %rsi
movq 0xa8(%rsp), %r8
movq %r11, 0xb8(%rsp)
movzbl (%r8,%r11), %r8d
movl (%rsi,%r8,4), %esi
imull 0x20(%rsp), %esi
movslq %esi, %rsi
shlq $0x5, %rsi
addq 0xe0(%rsp), %rsi
movq 0x40(%rsp), %r8
vpsubsw (%r8), %ymm0, %ymm11
xorl %r8d, %r8d
vmovdqa %ymm0, %ymm10
cmpq %r8, %r10
je 0x49d3d2
vpaddsw (%rsi,%r8), %ymm12, %ymm12
movq 0x30(%rsp), %r11
vmovdqa (%r11,%r8), %ymm13
vmovdqa (%r9,%r8), %ymm14
vpsubsw %ymm4, %ymm14, %ymm14
vpsubsw %ymm3, %ymm13, %ymm15
movq 0x40(%rsp), %r11
vpaddsw (%r11,%r8), %ymm11, %ymm11
vpmaxsw %ymm15, %ymm14, %ymm14
vpmaxsw %ymm11, %ymm10, %ymm10
vmovdqa %ymm14, (%r9,%r8)
vpmaxsw %ymm12, %ymm14, %ymm11
movq 0x88(%rsp), %r11
vmovdqa %ymm11, (%r11,%r8)
addq $0x20, %r8
vmovdqa %ymm13, %ymm12
jmp 0x49d375
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 0xb8(%rsp), %r8
leaq 0x1(%r8), %rsi
movq %rsi, 0xe8(%rsp)
movq 0x28(%rsp), %rsi
vpinsrw $0x0, 0x2(%rsi,%r8,2), %xmm11, %xmm12
vpblendd $0xf, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[0,1,2,3],ymm11[4,5,6,7]
movq 0x40(%rsp), %rsi
vpaddsw (%rsi), %ymm11, %ymm12
vpmaxsw %ymm12, %ymm10, %ymm10
pushq $0xe
popq %rsi
vperm2i128 $0x8, %ymm10, %ymm10, %ymm12 # ymm12 = zero,zero,ymm10[0,1]
vpalignr $0xe, %ymm12, %ymm10, %ymm12 # ymm12 = 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]
subl $0x1, %esi
jb 0x49d432
vpaddsw %ymm6, %ymm12, %ymm12
vpmaxsw %ymm12, %ymm10, %ymm10
jmp 0x49d416
vpaddsw %ymm5, %ymm12, %ymm10
vpmaxsw %ymm10, %ymm11, %ymm11
movq 0xb0(%rsp), %rsi
xorl %r9d, %r9d
cmpq %r9, %r10
je 0x49d5b7
vpsubsw %ymm4, %ymm10, %ymm10
vpsubsw %ymm3, %ymm11, %ymm11
vpmaxsw %ymm11, %ymm10, %ymm10
movq 0x88(%rsp), %r8
vpmaxsw (%r8,%r9), %ymm10, %ymm11
movq 0x30(%rsp), %r8
vmovdqa %ymm11, (%r8,%r9)
movq 0xc0(%rsp), %r8
movq 0x10(%r8), %r8
movq (%r8), %r8
vmovd %xmm11, %ebx
movswl %bx, %ebx
movl %ebx, (%r8,%rsi)
vpextrw $0x1, %xmm11, %ebx
addq %rsi, %r8
movswl %bx, %ebx
vpextrw $0x2, %xmm11, %r11d
movl %ebx, (%r15,%r8)
movswl %r11w, %r11d
vpextrw $0x3, %xmm11, %ebx
movl %r11d, (%rcx,%r8)
movswl %bx, %r11d
vpextrw $0x4, %xmm11, %ebx
movl %r11d, (%rax,%r8)
movswl %bx, %r11d
vpextrw $0x5, %xmm11, %ebx
movl %r11d, (%rdi,%r8)
movswl %bx, %r11d
vpextrw $0x6, %xmm11, %ebx
movl %r11d, (%r12,%r8)
movswl %bx, %r11d
vpextrw $0x7, %xmm11, %ebx
movl %r11d, (%r13,%r8)
movswl %bx, %r11d
movq 0xf0(%rsp), %rbx
movl %r11d, (%rbx,%r8)
vextracti128 $0x1, %ymm11, %xmm12
vmovd %xmm12, %r11d
movswl %r11w, %r11d
vpextrw $0x1, %xmm12, %ebx
movq 0x58(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x2, %xmm12, %ebx
movq 0xf8(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x3, %xmm12, %ebx
movq 0x60(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x4, %xmm12, %ebx
movq 0x68(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x5, %xmm12, %ebx
movq 0x70(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x6, %xmm12, %ebx
movq 0x78(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
vpextrw $0x7, %xmm12, %ebx
movq 0x80(%rsp), %r14
movl %r11d, (%r14,%r8)
movswl %bx, %r11d
movq 0x50(%rsp), %rbx
movl %r11d, (%rbx,%r8)
vpminsw %ymm2, %ymm10, %ymm2
vpminsw %ymm2, %ymm11, %ymm2
vpmaxsw %ymm7, %ymm11, %ymm7
addq $0x20, %r9
addq %rdx, %rsi
jmp 0x49d446
movq 0x98(%rsp), %rsi
vmovdqa (%rsi), %ymm10
vpcmpgtw %ymm8, %ymm10, %ymm11
vpand %ymm9, %ymm11, %ymm11
vpmaxsw %ymm8, %ymm10, %ymm8
vpmovmskb %ymm11, %esi
testl %esi, %esi
movl 0x18(%rsp), %esi
cmovnel 0xb8(%rsp), %esi
movl %esi, 0x18(%rsp)
addq $0x4, 0xb0(%rsp)
movq 0xe8(%rsp), %rsi
movq 0x38(%rsp), %r9
jmp 0x49d2f0
movl 0x20(%rbp), %r14d
testl %r14d, %r14d
movq 0xc0(%rsp), %rbx
movl 0x94(%rsp), %r8d
movq 0xc8(%rsp), %r9
movl 0x1c(%rsp), %r10d
movq 0x20(%rsp), %r11
movl 0x10(%rbp), %r15d
movl 0x4c(%rsp), %r12d
movl 0x90(%rsp), %r13d
je 0x49d662
xorl %eax, %eax
cmpl %r13d, %eax
jge 0x49d657
vperm2i128 $0x28, %ymm8, %ymm8, %ymm3 # ymm3 = zero,zero,ymm8[0,1]
vpalignr $0xe, %ymm3, %ymm8, %ymm8 # ymm8 = ymm3[14,15],ymm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm3[30,31],ymm8[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
incl %eax
jmp 0x49d642
vextracti128 $0x1, %ymm8, %xmm3
vpextrw $0x7, %xmm3, %r10d
testl %r15d, %r15d
je 0x49d6c5
movl %r11d, %ecx
andl $0x7ffffff, %ecx        # imm = 0x7FFFFFF
shll $0x4, %ecx
xorl %edx, %edx
movl %r8d, %eax
cmpl %edx, %ecx
je 0x49d6c8
movl %edx, %edi
shrl $0x4, %edi
movl %edx, %esi
andl $0xf, %esi
imull %r11d, %esi
addl %edi, %esi
cmpl %r9d, %esi
jge 0x49d6c0
movq 0x30(%rsp), %rdi
movzwl (%rdi,%rdx,2), %edi
cmpw %r10w, %di
jle 0x49d6ac
movl %edi, %r10d
movl %r12d, 0x18(%rsp)
movl %esi, %eax
jmp 0x49d6c0
cmpl %eax, %esi
cmovgel %eax, %esi
cmpl %r12d, 0x18(%rsp)
cmovnel %eax, %esi
cmpw %r10w, %di
cmovel %esi, %eax
incq %rdx
jmp 0x49d678
movl %r8d, %eax
orl %r15d, %r14d
jne 0x49d703
movq 0x98(%rsp), %rax
vmovdqa (%rax), %ymm3
xorl %eax, %eax
cmpl %r13d, %eax
jge 0x49d6f0
vperm2i128 $0x28, %ymm3, %ymm3, %ymm4 # ymm4 = zero,zero,ymm3[0,1]
vpalignr $0xe, %ymm4, %ymm3, %ymm3 # ymm3 = ymm4[14,15],ymm3[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm4[30,31],ymm3[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
incl %eax
jmp 0x49d6db
vextracti128 $0x1, %ymm3, %xmm3
vpextrw $0x7, %xmm3, %r10d
movl %r12d, 0x18(%rsp)
movl %r8d, %eax
vpcmpgtw %ymm2, %ymm0, %ymm0
vpcmpgtw %ymm1, %ymm7, %ymm1
vpor %ymm0, %ymm1, %ymm0
vpmovmskb %ymm0, %ecx
testl %ecx, %ecx
je 0x49d728
orb $0x40, 0xc(%rbx)
xorl %r10d, %r10d
movl $0x0, 0x18(%rsp)
xorl %eax, %eax
movswl %r10w, %ecx
movl %ecx, (%rbx)
movl %eax, 0x4(%rbx)
movl 0x18(%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0x40(%rsp), %rdi
vzeroupper
callq 0x1ab763
movq 0x30(%rsp), %rdi
callq 0x1ab763
movq 0x88(%rsp), %rdi
callq 0x1ab763
movq 0x28(%rsp), %rdi
callq 0x1ab763
movq 0x38(%rsp), %rdi
callq 0x1ab763
jmp 0x49d890
movq 0x29d85c(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129865(%rip), %rsi    # 0x5c6feb
leaq 0x12f040(%rip), %rdx    # 0x5cc7cd
leaq 0xffd49(%rip), %rcx     # 0x59d4dd
jmp 0x49d887
movq 0x29d838(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129841(%rip), %rsi    # 0x5c6feb
leaq 0x12f01c(%rip), %rdx    # 0x5cc7cd
leaq 0x12a266(%rip), %rcx    # 0x5c7a1e
jmp 0x49d887
movq 0x29d814(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12981d(%rip), %rsi    # 0x5c6feb
leaq 0x12eff8(%rip), %rdx    # 0x5cc7cd
leaq 0x12a15d(%rip), %rcx    # 0x5c7939
jmp 0x49d887
movq 0x29d7f0(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129f0f(%rip), %rsi    # 0x5c7701
leaq 0x12efd4(%rip), %rdx    # 0x5cc7cd
leaq 0x12a149(%rip), %rcx    # 0x5c7949
jmp 0x49d887
movq 0x29d7cc(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1297d5(%rip), %rsi    # 0x5c6feb
leaq 0x12efb0(%rip), %rdx    # 0x5cc7cd
leaq 0x129eda(%rip), %rcx    # 0x5c76fe
jmp 0x49d887
movq 0x29d7ab(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129eca(%rip), %rsi    # 0x5c7701
leaq 0x12ef8f(%rip), %rdx    # 0x5cc7cd
leaq 0x129ed0(%rip), %rcx    # 0x5c7715
jmp 0x49d887
movq 0x29d78a(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129ec3(%rip), %rsi    # 0x5c771b
leaq 0x12ef6e(%rip), %rdx    # 0x5cc7cd
leaq 0x129eca(%rip), %rcx    # 0x5c7730
jmp 0x49d887
movq 0x29d769(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x129ea2(%rip), %rsi    # 0x5c771b
leaq 0x12ef4d(%rip), %rdx    # 0x5cc7cd
leaq 0x129eae(%rip), %rcx    # 0x5c7735
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq