// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/nw_trace_striped_avx2_256_16.c
// Function: parasail_nw_trace_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 s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    const parasail_matrix_t *matrix = NULL;
    int32_t segWidth = 0;
    int32_t segLen = 0;
    int32_t offset = 0;
    int32_t position = 0;
    __m256i* restrict vProfile = NULL;
    __m256i* restrict pvHStore = NULL;
    __m256i* restrict pvHLoad = NULL;
    __m256i* restrict pvE = NULL;
    __m256i* restrict pvEaStore = NULL;
    __m256i* restrict pvEaLoad = NULL;
    __m256i* restrict pvHT = NULL;
    int16_t* restrict boundary = NULL;
    __m256i vGapO;
    __m256i vGapE;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    int16_t score = 0;
    __m256i vNegLimit;
    __m256i vPosLimit;
    __m256i vSaturationCheckMin;
    __m256i vSaturationCheckMax;
    parasail_result_t *result = NULL;
    __m256i vTIns;
    __m256i vTDel;
    __m256i vTDiag;
    __m256i vTDiagE;
    __m256i vTInsE;
    __m256i vTDiagF;
    __m256i vTDelF;
    __m256i vTMask;
    __m256i vFTMask;

    /* 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;
    vProfile = (__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;
    score = NEG_LIMIT;
    vNegLimit = _mm256_set1_epi16(NEG_LIMIT);
    vPosLimit = _mm256_set1_epi16(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vTIns  = _mm256_set1_epi16(PARASAIL_INS);
    vTDel  = _mm256_set1_epi16(PARASAIL_DEL);
    vTDiag = _mm256_set1_epi16(PARASAIL_DIAG);
    vTDiagE = _mm256_set1_epi16(PARASAIL_DIAG_E);
    vTInsE = _mm256_set1_epi16(PARASAIL_INS_E);
    vTDiagF = _mm256_set1_epi16(PARASAIL_DIAG_F);
    vTDelF = _mm256_set1_epi16(PARASAIL_DEL_F);
    vTMask = _mm256_set1_epi16(PARASAIL_ZERO_MASK);
    vFTMask = _mm256_set1_epi16(PARASAIL_F_MASK);

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

    /* set known flags */
    result->flag |= PARASAIL_FLAG_NW | PARASAIL_FLAG_STRIPED
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_16;

    /* initialize heap variables */
    pvHStore = parasail_memalign___m256i(32, segLen);
    pvHLoad = parasail_memalign___m256i(32, segLen);
    pvE = parasail_memalign___m256i(32, segLen);
    pvEaStore = parasail_memalign___m256i(32, segLen);
    pvEaLoad = parasail_memalign___m256i(32, segLen);
    pvHT = parasail_memalign___m256i(32, segLen);
    boundary = parasail_memalign_int16_t(32, s2Len+1);

    /* validate heap variables */
    if (!pvHStore) return NULL;
    if (!pvHLoad) return NULL;
    if (!pvE) return NULL;
    if (!pvEaStore) return NULL;
    if (!pvEaLoad) return NULL;
    if (!pvHT) return NULL;
    if (!boundary) 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 = -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(&pvHStore[index], h.m);
            _mm256_store_si256(&pvE[index], e.m);
            _mm256_store_si256(&pvEaStore[index], e.m);
            ++index;
        }
    }

    /* initialize uppder boundary */
    {
        boundary[0] = 0;
        for (i=1; i<=s2Len; ++i) {
            int64_t tmp = -open-gap*(i-1);
            boundary[i] = tmp < INT16_MIN ? INT16_MIN : tmp;
        }
    }

    for (i=0; i<segLen; ++i) {
        arr_store(result->trace->trace_table, vTDiagE, i, segLen, 0);
    }

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m256i vEF_opn;
        __m256i vE;
        __m256i vE_ext;
        __m256i vF;
        __m256i vF_ext;
        __m256i vFa;
        __m256i vFa_ext;
        __m256i vH;
        __m256i vH_dag;
        const __m256i* vP = NULL;

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

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

        /* insert upper boundary condition */
        vH = _mm256_insert_epi16_rpl(vH, boundary[j], 0);

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

        /* Swap the 2 H buffers. */
        SWAP(pvHLoad, pvHStore)
        SWAP(pvEaLoad, pvEaStore)

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

            /* Get max from vH, vE and vF. */
            vH_dag = _mm256_adds_epi16(vH, _mm256_load_si256(vP + i));
            vH = _mm256_max_epi16(vH_dag, vE);
            vH = _mm256_max_epi16(vH, vF);
            /* Save vH values. */
            _mm256_store_si256(pvHStore + i, vH);
            vSaturationCheckMax = _mm256_max_epi16(vSaturationCheckMax, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vE);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vF);

            {
                __m256i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                __m256i case1 = _mm256_cmpeq_epi16(vH, vH_dag);
                __m256i case2 = _mm256_cmpeq_epi16(vH, vF);
                __m256i vT = _mm256_blendv_epi8(
                        _mm256_blendv_epi8(vTIns, vTDel, case2),
                        vTDiag, case1);
                _mm256_store_si256(pvHT + i, vT);
                vT = _mm256_or_si256(vT, vTAll);
                arr_store(result->trace->trace_table, vT, i, segLen, j);
            }

            vEF_opn = _mm256_subs_epi16(vH, vGapO);

            /* Update vE value. */
            vE_ext = _mm256_subs_epi16(vE, vGapE);
            vE = _mm256_max_epi16(vEF_opn, vE_ext);
            _mm256_store_si256(pvE + i, vE);
            {
                __m256i vEa = _mm256_load_si256(pvEaLoad + i);
                __m256i vEa_ext = _mm256_subs_epi16(vEa, vGapE);
                vEa = _mm256_max_epi16(vEF_opn, vEa_ext);
                _mm256_store_si256(pvEaStore + i, vEa);
                if (j+1<s2Len) {
                    __m256i cond = _mm256_cmpgt_epi16(vEF_opn, vEa_ext);
                    __m256i vT = _mm256_blendv_epi8(vTInsE, vTDiagE, cond);
                    arr_store(result->trace->trace_table, vT, i, segLen, j+1);
                }
            }

            /* Update vF value. */
            vF_ext = _mm256_subs_epi16(vF, vGapE);
            vF = _mm256_max_epi16(vEF_opn, vF_ext);
            if (i+1<segLen) {
                __m256i vTAll = arr_load(result->trace->trace_table, i+1, segLen, j);
                __m256i cond = _mm256_cmpgt_epi16(vEF_opn, vF_ext);
                __m256i vT = _mm256_blendv_epi8(vTDelF, vTDiagF, cond);
                vT = _mm256_or_si256(vT, vTAll);
                arr_store(result->trace->trace_table, vT, i+1, segLen, j);
            }

            /* 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 */
        vFa_ext = vF_ext;
        vFa = vF;
        for (k=0; k<segWidth; ++k) {
            int64_t tmp = boundary[j+1]-open;
            int16_t tmp2 = tmp < INT16_MIN ? INT16_MIN : tmp;
            __m256i vHp = _mm256_load_si256(&pvHLoad[segLen - 1]);
            vHp = _mm256_slli_si256_rpl(vHp, 2);
            vHp = _mm256_insert_epi16_rpl(vHp, boundary[j], 0);
            vEF_opn = _mm256_slli_si256_rpl(vEF_opn, 2);
            vEF_opn = _mm256_insert_epi16_rpl(vEF_opn, tmp2, 0);
            vF_ext = _mm256_slli_si256_rpl(vF_ext, 2);
            vF_ext = _mm256_insert_epi16_rpl(vF_ext, NEG_LIMIT, 0);
            vF = _mm256_slli_si256_rpl(vF, 2);
            vF = _mm256_insert_epi16_rpl(vF, tmp2, 0);
            vFa_ext = _mm256_slli_si256_rpl(vFa_ext, 2);
            vFa_ext = _mm256_insert_epi16_rpl(vFa_ext, NEG_LIMIT, 0);
            vFa = _mm256_slli_si256_rpl(vFa, 2);
            vFa = _mm256_insert_epi16_rpl(vFa, tmp2, 0);
            for (i=0; i<segLen; ++i) {
                vH = _mm256_load_si256(pvHStore + i);
                vH = _mm256_max_epi16(vH,vF);
                _mm256_store_si256(pvHStore + i, vH);
                vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vH);
                vSaturationCheckMax = _mm256_max_epi16(vSaturationCheckMax, vH);
                {
                    __m256i vTAll;
                    __m256i vT;
                    __m256i case1;
                    __m256i case2;
                    __m256i cond;
                    vHp = _mm256_adds_epi16(vHp, _mm256_load_si256(vP + i));
                    case1 = _mm256_cmpeq_epi16(vH, vHp);
                    case2 = _mm256_cmpeq_epi16(vH, vF);
                    cond = _mm256_andnot_si256(case1,case2);
                    vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                    vT = _mm256_load_si256(pvHT + i);
                    vT = _mm256_blendv_epi8(vT, vTDel, cond);
                    _mm256_store_si256(pvHT + i, vT);
                    vTAll = _mm256_and_si256(vTAll, vTMask);
                    vTAll = _mm256_or_si256(vTAll, vT);
                    arr_store(result->trace->trace_table, vTAll, i, segLen, j);
                }
                /* Update vF value. */
                {
                    __m256i vTAll = arr_load(result->trace->trace_table, i, segLen, j);
                    __m256i cond = _mm256_cmpgt_epi16(vEF_opn, vFa_ext);
                    __m256i vT = _mm256_blendv_epi8(vTDelF, vTDiagF, cond);
                    vTAll = _mm256_and_si256(vTAll, vFTMask);
                    vTAll = _mm256_or_si256(vTAll, vT);
                    arr_store(result->trace->trace_table, vTAll, i, segLen, j);
                }
                vEF_opn = _mm256_subs_epi16(vH, vGapO);
                vF_ext = _mm256_subs_epi16(vF, vGapE);
                {
                    __m256i vEa = _mm256_load_si256(pvEaLoad + i);
                    __m256i vEa_ext = _mm256_subs_epi16(vEa, vGapE);
                    vEa = _mm256_max_epi16(vEF_opn, vEa_ext);
                    _mm256_store_si256(pvEaStore + i, vEa);
                    if (j+1<s2Len) {
                        __m256i cond = _mm256_cmpgt_epi16(vEF_opn, vEa_ext);
                        __m256i vT = _mm256_blendv_epi8(vTInsE, vTDiagE, cond);
                        arr_store(result->trace->trace_table, vT, i, segLen, j+1);
                    }
                }
                if (! _mm256_movemask_epi8(
                            _mm256_or_si256(
                                _mm256_cmpgt_epi16(vF_ext, vEF_opn),
                                _mm256_cmpeq_epi16(vF_ext, vEF_opn))))
                    goto end;
                /*vF = _mm256_max_epi16(vEF_opn, vF_ext);*/
                vF = vF_ext;
                vFa_ext = _mm256_subs_epi16(vFa, vGapE);
                vFa = _mm256_max_epi16(vEF_opn, vFa_ext);
                vHp = _mm256_load_si256(pvHLoad + i);
            }
        }
end:
        {
        }
    }

    /* extract last value from the last column */
    {
        __m256i vH = _mm256_load_si256(pvHStore + offset);
        for (k=0; k<position; ++k) {
            vH = _mm256_slli_si256_rpl (vH, 2);
        }
        score = (int16_t) _mm256_extract_epi16_rpl (vH, 15);
    }

    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(boundary);
    parasail_free(pvHT);
    parasail_free(pvEaLoad);
    parasail_free(pvEaStore);
    parasail_free(pvE);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
andq $-0x20, %rsp
subq $0x100, %rsp            # imm = 0x100
movl %ecx, 0x1c(%rsp)
movq %rsi, 0x90(%rsp)
testq %rdi, %rdi
je 0x5630db
movq 0x30(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x5630ff
movq 0x10(%rdi), %rax
movq %rax, 0x88(%rsp)
testq %rax, %rax
je 0x563123
movl 0x8(%rdi), %r12d
testl %r12d, %r12d
jle 0x563147
cmpq $0x0, 0x90(%rsp)
je 0x56316b
movl %edx, %r9d
testl %edx, %edx
jle 0x56318c
cmpl $0x0, 0x1c(%rsp)
js 0x5631ad
testl %r8d, %r8d
js 0x5631ce
movl %r8d, 0x58(%rsp)
leal -0x1(%r12), %r15d
addq $0xf, %r12
shrq $0x4, %r12
movl %r15d, %eax
xorl %edx, %edx
divl %r12d
movl %eax, 0x70(%rsp)
movl %edx, %r13d
movl 0x1c(%rsp), %ecx
movl %ecx, %r14d
negl %r14d
movq 0x88(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negl %esi
cmpl %r14d, %eax
cmovgl %ecx, %esi
movl %esi, 0x2c(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x30(%rsp)
pushq $0x20
popq %rcx
movl %r12d, %edi
movl %r9d, %esi
movq %rcx, %rdx
movq %r9, 0x38(%rsp)
callq 0x1abb59
testq %rax, %rax
je 0x562a73
movq %rax, %rbx
movl %r13d, 0x84(%rsp)
movl %r15d, 0x80(%rsp)
orl $0x10280801, 0xc(%rax)  # imm = 0x10280801
pushq $0x20
popq %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x50(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x60(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x48(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x496aa4
movq %r12, 0x20(%rsp)
movq %rax, %r12
movq 0x38(%rsp), %rax
leal 0x1(%rax), %esi
movq %r15, %rdi
movq %rsi, 0x68(%rsp)
callq 0x1ab77b
cmpq $0x0, 0x10(%rsp)
sete %dl
cmpq $0x0, 0x50(%rsp)
sete %cl
orb %dl, %cl
cmpq $0x0, 0x60(%rsp)
sete %sil
testq %r13, %r13
sete %dl
orb %sil, %dl
orb %cl, %dl
cmpq $0x0, 0x48(%rsp)
sete %sil
testq %r12, %r12
sete %cl
orb %sil, %cl
movq %rax, 0x40(%rsp)
testq %rax, %rax
sete %al
orb %cl, %al
orb %dl, %al
testb $0x1, %al
je 0x562a7a
xorl %ebx, %ebx
jmp 0x5631f6
movq %r13, %r15
movq 0x38(%rsp), %r11
leal -0x1(%r11), %eax
movl %eax, 0x7c(%rsp)
pushq $0xf
popq %rax
subl 0x70(%rsp), %eax
movl %eax, 0x78(%rsp)
movl 0x1c(%rsp), %eax
vmovd %eax, %xmm0
vpbroadcastw %xmm0, %ymm2
movl 0x58(%rsp), %edx
vmovd %edx, %xmm0
vpbroadcastw %xmm0, %ymm3
movl 0x2c(%rsp), %ecx
addl $0xffff8001, %ecx       # imm = 0xFFFF8001
movl %ecx, 0x2c(%rsp)
vmovd %ecx, %xmm0
vpbroadcastw %xmm0, %ymm0
vmovd 0x30(%rsp), %xmm1
vpbroadcastw %xmm1, %ymm1
movl %eax, %eax
movl %edx, %ecx
movslq %r14d, %rdx
negq %rax
movq 0x20(%rsp), %rsi
movq %rcx, 0x30(%rsp)
imulq %rcx, %rsi
xorl %edi, %edi
movq $-0x7fff, %r8           # imm = 0x8001
movq $-0x8000, %r9           # imm = 0x8000
cmpq 0x20(%rsp), %rdi
je 0x562b8a
movq %rdx, %r10
xorl %r11d, %r11d
cmpq $0x10, %r11
je 0x562b43
cmpq %r8, %r10
movq $-0x8000, %r13          # imm = 0x8000
cmovgeq %r10, %r13
leaq (%rax,%r10), %rcx
cmpq %r8, %rcx
cmovlq %r9, %rcx
movw %r13w, 0xc0(%rsp,%r11,2)
movw %cx, 0xa0(%rsp,%r11,2)
incq %r11
subq %rsi, %r10
jmp 0x562b0a
movq %rdi, %rcx
shlq $0x5, %rcx
vmovaps 0xc0(%rsp), %ymm4
movq 0x10(%rsp), %r10
vmovaps %ymm4, (%r10,%rcx)
vmovaps 0xa0(%rsp), %ymm4
movq 0x60(%rsp), %r10
vmovaps %ymm4, (%r10,%rcx)
vmovaps %ymm4, (%r15,%rcx)
incq %rdi
subq 0x30(%rsp), %rdx
movq 0x38(%rsp), %r11
jmp 0x562af9
movq 0x40(%rsp), %rax
andw $0x0, (%rax)
pushq $0x1
popq %rax
movl 0x58(%rsp), %esi
movq 0x68(%rsp), %rdi
movq 0x40(%rsp), %rdx
cmpq %rax, %rdi
je 0x562bc5
cmpl $0xffff8001, %r14d      # imm = 0xFFFF8001
movl $0xffff8000, %ecx       # imm = 0xFFFF8000
cmovgel %r14d, %ecx
movw %cx, (%rdx,%rax,2)
incq %rax
subl %esi, %r14d
jmp 0x562ba4
movq 0x20(%rsp), %rsi
shlq $0x5, %rsi
xorl %eax, %eax
vbroadcastsd 0x6ae9f(%rip), %ymm4 # 0x5cda78
cmpq %rax, %rsi
je 0x562bf0
movq 0x10(%rbx), %rcx
movq (%rcx), %rcx
vmovaps %ymm4, (%rcx,%rax)
addq $0x20, %rax
jmp 0x562bd9
movq 0x20(%rsp), %rax
decl %eax
movl %r11d, %ecx
movq %rcx, 0x70(%rsp)
xorl %edx, %edx
shlq $0x5, %rax
movq %rax, 0x68(%rsp)
movq %rsi, 0x30(%rsp)
xorl %r10d, %r10d
vmovdqa %ymm0, %ymm4
vmovdqa %ymm1, %ymm5
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rax, %r14
movq %rcx, %r13
cmpq 0x70(%rsp), %r10
je 0x563027
movq 0x10(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rcx), %rdi
movq %rdi, 0x50(%rsp)
vmovdqa (%rax,%rcx), %ymm7
vinserti128 $0x1, %xmm7, %ymm0, %ymm9
vpalignr $0xe, %ymm9, %ymm7, %ymm7 # ymm7 = ymm9[14,15],ymm7[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm9[30,31],ymm7[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
movq 0x40(%rsp), %rax
vpinsrw $0x0, (%rax,%r10,2), %xmm7, %xmm9
vpblendd $0xf, %ymm9, %ymm7, %ymm10 # ymm10 = ymm9[0,1,2,3],ymm7[4,5,6,7]
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x90(%rsp), %rdi
movzbl (%rdi,%r10), %edi
movl (%rax,%rdi,4), %eax
imull 0x20(%rsp), %eax
movslq %eax, %r8
shlq $0x5, %r8
addq 0x98(%rsp), %r8
movq %r10, 0x58(%rsp)
incq %r10
pushq $0x1
popq %rax
xorl %edi, %edi
vmovdqa %ymm0, %ymm7
cmpq %rdi, %rsi
je 0x562de2
movq 0x60(%rsp), %rcx
vmovdqa (%rcx,%rdi), %ymm9
vpaddsw (%r8,%rdi), %ymm10, %ymm6
vpmaxsw %ymm6, %ymm9, %ymm8
vpmaxsw %ymm7, %ymm8, %ymm10
vmovdqa %ymm10, (%r14,%rdi)
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %rdx, %r9
vpcmpeqw %ymm6, %ymm10, %ymm6
vpcmpgtw %ymm7, %ymm8, %ymm8
vpbroadcastw 0x6ada2(%rip), %ymm11 # 0x5cda90
vpaddw %ymm11, %ymm8, %ymm8
vpbroadcastw 0x6ad96(%rip), %ymm11 # 0x5cda92
vpblendvb %ymm6, %ymm11, %ymm8, %ymm6
vpor (%rdi,%r9), %ymm6, %ymm8
vmovdqa %ymm6, (%r12,%rdi)
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq %rdx, %r9
vmovdqa %ymm8, (%rdi,%r9)
vpsubsw %ymm2, %ymm10, %ymm6
vpsubsw %ymm3, %ymm9, %ymm8
vpmaxsw %ymm6, %ymm8, %ymm8
vmovdqa %ymm8, (%rcx,%rdi)
vmovdqa (%r15,%rdi), %ymm8
vpsubsw %ymm3, %ymm8, %ymm8
vpmaxsw %ymm6, %ymm8, %ymm11
vmovdqa %ymm11, (%r13,%rdi)
cmpl %r11d, %r10d
jge 0x562d78
vpbroadcastw 0x6ad42(%rip), %ymm11 # 0x5cda94
vpbroadcastw 0x6ad3b(%rip), %ymm12 # 0x5cda96
vpcmpgtw %ymm8, %ymm6, %ymm8
vpblendvb %ymm8, %ymm11, %ymm12, %ymm8
movq 0x10(%rbx), %r9
movq (%r9), %r9
addq 0x30(%rsp), %r9
vmovdqa %ymm8, (%rdi,%r9)
vpsubsw %ymm3, %ymm7, %ymm8
cmpq 0x20(%rsp), %rax
jae 0x562db8
movq 0x10(%rbx), %r9
vpbroadcastw 0x6ad08(%rip), %ymm11 # 0x5cda98
movq (%r9), %r9
vpbroadcastw 0x6acfe(%rip), %ymm12 # 0x5cda9a
addq %rdx, %r9
vpcmpgtw %ymm8, %ymm6, %ymm13
vpblendvb %ymm13, %ymm11, %ymm12, %ymm11
vpor 0x20(%rdi,%r9), %ymm11, %ymm11
vmovdqa %ymm11, 0x20(%rdi,%r9)
vpmaxsw %ymm4, %ymm10, %ymm4
vpminsw %ymm5, %ymm9, %ymm5
vpminsw %ymm7, %ymm5, %ymm5
vpminsw %ymm5, %ymm10, %ymm5
vpmaxsw %ymm6, %ymm8, %ymm7
movq 0x10(%rsp), %rcx
vmovdqa (%rcx,%rdi), %ymm10
addq $0x20, %rdi
incq %rax
jmp 0x562cac
xorl %eax, %eax
vmovdqa %ymm7, %ymm9
vmovdqa %ymm8, %ymm10
cmpl $0x10, %eax
je 0x56300a
movl %eax, 0x48(%rsp)
movq 0x40(%rsp), %rcx
movswl (%rcx,%r10,2), %eax
subl 0x1c(%rsp), %eax
cmpl $0xffff8001, %eax       # imm = 0xFFFF8001
movl $0xffff8000, %edi       # imm = 0xFFFF8000
cmovll %edi, %eax
movq 0x50(%rsp), %rdi
vmovdqa (%rdi), %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 0x58(%rsp), %rdi
vpinsrw $0x0, (%rcx,%rdi,2), %xmm11, %xmm12
vpblendd $0xf, %ymm12, %ymm11, %ymm11 # ymm11 = ymm12[0,1,2,3],ymm11[4,5,6,7]
vinserti128 $0x1, %xmm6, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm6, %ymm6 # ymm6 = ymm12[14,15],ymm6[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm6[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm6, %xmm12
vpblendd $0xf, %ymm12, %ymm6, %ymm6 # ymm6 = ymm12[0,1,2,3],ymm6[4,5,6,7]
vinserti128 $0x1, %xmm8, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm8, %ymm8 # ymm8 = ymm12[14,15],ymm8[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm8[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
movl 0x2c(%rsp), %ecx
vpinsrw $0x0, %ecx, %xmm8, %xmm12
vpblendd $0xf, %ymm12, %ymm8, %ymm8 # ymm8 = ymm12[0,1,2,3],ymm8[4,5,6,7]
vinserti128 $0x1, %xmm7, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm7, %ymm7 # ymm7 = ymm12[14,15],ymm7[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm7[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm7, %xmm12
vinserti128 $0x1, %xmm10, %ymm0, %ymm13
vpalignr $0xe, %ymm13, %ymm10, %ymm10 # ymm10 = ymm13[14,15],ymm10[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm13[30,31],ymm10[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %ecx, %xmm10, %xmm13
vpblendd $0xf, %ymm12, %ymm7, %ymm7 # ymm7 = ymm12[0,1,2,3],ymm7[4,5,6,7]
vpblendd $0xf, %ymm13, %ymm10, %ymm10 # ymm10 = ymm13[0,1,2,3],ymm10[4,5,6,7]
vinserti128 $0x1, %xmm9, %ymm0, %ymm12
vpalignr $0xe, %ymm12, %ymm9, %ymm9 # ymm9 = ymm12[14,15],ymm9[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm12[30,31],ymm9[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm9, %xmm12
vpblendd $0xf, %ymm12, %ymm9, %ymm9 # ymm9 = ymm12[0,1,2,3],ymm9[4,5,6,7]
xorl %r11d, %r11d
movq %rdx, %r9
movq 0x20(%rsp), %rax
subq $0x1, %rax
jb 0x562ff1
vmovdqa (%r14,%r11), %ymm12
vpmaxsw %ymm7, %ymm12, %ymm8
vmovdqa %ymm8, (%r14,%r11)
vpaddsw (%r8,%r11), %ymm11, %ymm11
vpcmpeqw %ymm11, %ymm8, %ymm11
vpcmpgtw %ymm7, %ymm12, %ymm12
vpor %ymm12, %ymm11, %ymm11
vpbroadcastw 0x6ab9c(%rip), %ymm12 # 0x5cda90
movq 0x10(%rbx), %rdi
vpblendvb %ymm11, (%r12,%r11), %ymm12, %ymm11
movq (%rdi), %rdi
vpbroadcastq 0x6ab75(%rip), %ymm12 # 0x5cda80
vpand (%rdi,%r9), %ymm12, %ymm12
vmovdqa %ymm11, (%r12,%r11)
vpor %ymm11, %ymm12, %ymm11
movq 0x10(%rbx), %rdi
movq (%rdi), %rdi
vmovdqa %ymm11, (%rdi,%r9)
vpbroadcastw 0x6ab66(%rip), %ymm11 # 0x5cda98
vpbroadcastw 0x6ab5f(%rip), %ymm12 # 0x5cda9a
movq 0x10(%rbx), %rdi
vpcmpgtw %ymm10, %ymm6, %ymm6
vpblendvb %ymm6, %ymm11, %ymm12, %ymm6
movq (%rdi), %rdi
vpbroadcastq 0x6ab32(%rip), %ymm10 # 0x5cda88
vpand (%rdi,%r9), %ymm10, %ymm10
vpor %ymm6, %ymm10, %ymm6
vmovdqa %ymm6, (%rdi,%r9)
vpsubsw %ymm2, %ymm8, %ymm6
vmovdqa (%r15,%r11), %ymm10
vpsubsw %ymm3, %ymm10, %ymm10
vpmaxsw %ymm6, %ymm10, %ymm11
vmovdqa %ymm11, (%r13,%r11)
cmpl 0x38(%rsp), %r10d
jge 0x562fb3
vpbroadcastw 0x6ab05(%rip), %ymm11 # 0x5cda94
vpbroadcastw 0x6aafe(%rip), %ymm12 # 0x5cda96
vpcmpgtw %ymm10, %ymm6, %ymm10
vpblendvb %ymm10, %ymm11, %ymm12, %ymm10
movq 0x10(%rbx), %rdi
movq (%rdi), %rdi
addq %rsi, %rdi
vmovdqa %ymm10, (%r9,%rdi)
vpminsw %ymm5, %ymm8, %ymm5
vpmaxsw %ymm4, %ymm8, %ymm4
vpsubsw %ymm3, %ymm7, %ymm7
vpcmpgtw %ymm7, %ymm6, %ymm8
vpmovmskb %ymm8, %edi
cmpl $-0x1, %edi
je 0x563001
vpsubsw %ymm3, %ymm9, %ymm10
vpmaxsw %ymm6, %ymm10, %ymm9
movq 0x10(%rsp), %rcx
vmovdqa (%rcx,%r11), %ymm11
addq $0x20, %r9
addq $0x20, %r11
vmovdqa %ymm7, %ymm8
jmp 0x562ebd
movl 0x48(%rsp), %eax
incl %eax
movq 0x38(%rsp), %r11
jmp 0x562ded
vmovdqa %ymm7, %ymm8
movq 0x38(%rsp), %r11
addq %rsi, 0x30(%rsp)
addq %rsi, %rdx
movq %r15, %rcx
movq %r13, %r15
movq 0x10(%rsp), %rax
movq %r14, 0x10(%rsp)
jmp 0x562c24
movl 0x84(%rsp), %eax
shlq $0x5, %rax
movq 0x10(%rsp), %rcx
vmovdqa (%rcx,%rax), %ymm2
xorl %eax, %eax
movl 0x7c(%rsp), %edx
movl 0x78(%rsp), %ecx
cmpl %ecx, %eax
jge 0x56305a
vperm2i128 $0x28, %ymm2, %ymm2, %ymm3 # ymm3 = zero,zero,ymm2[0,1]
vpalignr $0xe, %ymm3, %ymm2, %ymm2 # ymm2 = ymm3[14,15],ymm2[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm3[30,31],ymm2[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
incl %eax
jmp 0x563046
vpcmpgtw %ymm5, %ymm0, %ymm0
vpcmpgtw %ymm1, %ymm4, %ymm1
vpor %ymm1, %ymm0, %ymm0
vpmovmskb %ymm0, %eax
testl %eax, %eax
je 0x56307a
orb $0x40, 0xc(%rbx)
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x56308c
vextracti128 $0x1, %ymm2, %xmm0
vpextrw $0x7, %xmm0, %eax
movl 0x80(%rsp), %ecx
cwtl
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
movl %edx, 0x8(%rbx)
movq 0x40(%rsp), %rdi
vzeroupper
callq 0x1ab763
movq %r12, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq %r15, %rdi
callq 0x1ab763
movq 0x60(%rsp), %rdi
callq 0x1ab763
movq %r14, %rdi
callq 0x1ab763
movq 0x10(%rsp), %rdi
callq 0x1ab763
jmp 0x5631f6
movq 0x1d7ef6(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x63eff(%rip), %rsi     # 0x5c6feb
leaq 0x5e560(%rip), %rdx     # 0x5c1653
leaq 0x3a3e3(%rip), %rcx     # 0x59d4dd
jmp 0x5631ed
movq 0x1d7ed2(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x63edb(%rip), %rsi     # 0x5c6feb
leaq 0x5e53c(%rip), %rdx     # 0x5c1653
leaq 0x64900(%rip), %rcx     # 0x5c7a1e
jmp 0x5631ed
movq 0x1d7eae(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x63eb7(%rip), %rsi     # 0x5c6feb
leaq 0x5e518(%rip), %rdx     # 0x5c1653
leaq 0x647f7(%rip), %rcx     # 0x5c7939
jmp 0x5631ed
movq 0x1d7e8a(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x645a9(%rip), %rsi     # 0x5c7701
leaq 0x5e4f4(%rip), %rdx     # 0x5c1653
leaq 0x647e3(%rip), %rcx     # 0x5c7949
jmp 0x5631ed
movq 0x1d7e66(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x63e6f(%rip), %rsi     # 0x5c6feb
leaq 0x5e4d0(%rip), %rdx     # 0x5c1653
leaq 0x64574(%rip), %rcx     # 0x5c76fe
jmp 0x5631ed
movq 0x1d7e45(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x64564(%rip), %rsi     # 0x5c7701
leaq 0x5e4af(%rip), %rdx     # 0x5c1653
leaq 0x6456a(%rip), %rcx     # 0x5c7715
jmp 0x5631ed
movq 0x1d7e24(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x6455d(%rip), %rsi     # 0x5c771b
leaq 0x5e48e(%rip), %rdx     # 0x5c1653
leaq 0x64564(%rip), %rcx     # 0x5c7730
jmp 0x5631ed
movq 0x1d7e03(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x6453c(%rip), %rsi     # 0x5c771b
leaq 0x5e46d(%rip), %rdx     # 0x5c1653
leaq 0x64548(%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