// File: /workspace/github_c_makefile_star2_O1/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 $0x180, %rsp            # imm = 0x180
movl %ecx, 0x4(%rsp)
movq %rsi, 0x80(%rsp)
testq %rdi, %rdi
je 0x591541
movq 0x30(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x591548
movq 0x10(%rdi), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x59154f
movl 0x8(%rdi), %r14d
testl %r14d, %r14d
jle 0x591556
cmpq $0x0, 0x80(%rsp)
je 0x59155d
movl %edx, %r12d
testl %edx, %edx
jle 0x591564
cmpl $0x0, 0x4(%rsp)
js 0x59156b
testl %r8d, %r8d
js 0x591572
movl %r8d, 0x28(%rsp)
leal -0x1(%r14), %eax
addq $0xf, %r14
shrq $0x4, %r14
movl %eax, 0x74(%rsp)
cltd
idivl %r14d
movl %eax, 0x34(%rsp)
movl %edx, %r15d
movl 0x4(%rsp), %ecx
movl %ecx, %r13d
negl %r13d
movq 0x78(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negl %esi
cmpl %r13d, %eax
cmovgl %ecx, %esi
movl %esi, 0x14(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x8(%rsp)
movl $0x20, %edx
movl $0x20, %ecx
movl %r14d, %edi
movl %r12d, %esi
callq 0x2097d1
testq %rax, %rax
je 0x591577
movq %rax, %rbx
movl %r15d, 0x70(%rsp)
orl $0x10280801, 0xc(%rax)  # imm = 0x10280801
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, 0x58(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, 0x18(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, 0x50(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, 0xa0(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, 0x20(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %rax, %r15
movq %r12, 0x38(%rsp)
leal 0x1(%r12), %esi
movl $0x20, %edi
movq %rsi, 0x48(%rsp)
callq 0x2094cd
movq 0x58(%rsp), %r11
testq %r11, %r11
sete %dl
cmpq $0x0, 0x18(%rsp)
sete %cl
orb %dl, %cl
cmpq $0x0, 0x50(%rsp)
sete %sil
cmpq $0x0, 0xa0(%rsp)
sete %dl
orb %sil, %dl
orb %cl, %dl
cmpq $0x0, 0x20(%rsp)
sete %sil
testq %r15, %r15
sete %cl
orb %sil, %cl
testq %rax, %rax
sete %sil
orb %cl, %sil
orb %dl, %sil
testb $0x1, %sil
jne 0x591577
movq %rax, 0x60(%rsp)
movq 0x38(%rsp), %rax
decl %eax
movl %eax, 0x30(%rsp)
movl $0xf, %eax
subl 0x34(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x4(%rsp), %eax
vmovd %eax, %xmm0
vpbroadcastw %xmm0, %ymm2
movl 0x28(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastw %xmm0, %ymm3
movl 0x14(%rsp), %ecx
addl $0xffff8001, %ecx       # imm = 0xFFFF8001
movl %ecx, 0x14(%rsp)
vmovd %ecx, %xmm0
vpbroadcastw %xmm0, %ymm0
vmovdqa %ymm0, 0xe0(%rsp)
vmovd 0x8(%rsp), %xmm0
vpbroadcastw %xmm0, %ymm5
movl %eax, %eax
movl %esi, %ecx
movslq %r13d, %rsi
movq %r14, 0xc0(%rsp)
movl %r14d, %edi
negq %rax
movq %rdi, 0x40(%rsp)
movq %rcx, 0x8(%rsp)
imulq %rcx, %rdi
xorl %r8d, %r8d
movq $-0x7fff, %r9           # imm = 0x8001
movq $-0x8000, %r10          # imm = 0x8000
movq 0x50(%rsp), %r14
movq %r11, %rdx
movq %rsi, %r11
xorl %r12d, %r12d
cmpq %r9, %r11
movq $-0x8000, %rcx          # imm = 0x8000
cmovgeq %r11, %rcx
movw %cx, 0x140(%rsp,%r12,2)
leaq (%rax,%r11), %rcx
cmpq %r9, %rcx
cmovlq %r10, %rcx
movw %cx, 0x120(%rsp,%r12,2)
incq %r12
subq %rdi, %r11
cmpq $0x10, %r12
jne 0x590ec3
movq %r8, %rcx
shlq $0x5, %rcx
vmovaps 0x140(%rsp), %ymm0
movq %rdx, %r11
vmovaps %ymm0, (%rdx,%rcx)
vmovdqa 0x120(%rsp), %ymm0
vmovdqa %ymm0, (%r14,%rcx)
movq 0xa0(%rsp), %rdx
vmovdqa %ymm0, (%rdx,%rcx)
incq %r8
subq 0x8(%rsp), %rsi
cmpq 0x40(%rsp), %r8
jne 0x590eba
movq 0x60(%rsp), %rdi
movw $0x0, (%rdi)
movl $0x1, %eax
movl 0x28(%rsp), %edx
movq 0x48(%rsp), %rsi
cmpl $0xffff8001, %r13d      # imm = 0xFFFF8001
movl $0xffff8000, %ecx       # imm = 0xFFFF8000
cmovgel %r13d, %ecx
movw %cx, (%rdi,%rax,2)
incq %rax
subl %edx, %r13d
cmpq %rax, %rsi
jne 0x590f59
movq 0xc0(%rsp), %rdx
cmpl $0x1, %edx
adcl $0x0, %edx
shlq $0x5, %rdx
xorl %eax, %eax
vbroadcastsd 0x6a79b(%rip), %ymm0 # 0x5fb730
movq 0x38(%rsp), %rsi
movq 0x10(%rbx), %rcx
movq (%rcx), %rcx
vmovaps %ymm0, (%rcx,%rax)
addq $0x20, %rax
cmpq %rax, %rdx
jne 0x590f9a
movq 0xc0(%rsp), %rax
decl %eax
cmpl $0x2, %esi
movl $0x1, %ecx
cmovgel %esi, %ecx
movq %rcx, 0x90(%rsp)
movl %esi, %r10d
movq 0x40(%rsp), %rsi
vpbroadcastw 0x6a76b(%rip), %ymm6 # 0x5fb748
shlq $0x5, %rsi
vpbroadcastw 0x6a760(%rip), %ymm0 # 0x5fb74a
vmovdqa %ymm0, 0xc0(%rsp)
xorl %ecx, %ecx
vpbroadcastw 0x6a752(%rip), %ymm8 # 0x5fb750
shlq $0x5, %rax
movq %rax, 0x48(%rsp)
vpbroadcastw 0x6a742(%rip), %ymm9 # 0x5fb752
vpbroadcastq 0x6a71f(%rip), %ymm10 # 0x5fb738
vpbroadcastq 0x6a71e(%rip), %ymm11 # 0x5fb740
movq %rsi, 0x88(%rsp)
movq %rsi, 0x8(%rsp)
xorl %r8d, %r8d
vmovdqa %ymm5, 0x100(%rsp)
vmovdqa 0xe0(%rsp), %ymm4
movq 0xa0(%rsp), %rax
movq 0x20(%rsp), %r12
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %r13
movq 0x48(%rsp), %rsi
leaq (%r11,%rsi), %r9
movq %r9, 0x58(%rsp)
movq %r11, 0x18(%rsp)
vmovdqa (%r11,%rsi), %ymm0
vinserti128 $0x1, %xmm0, %ymm0, %ymm1
vpalignr $0xe, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm1[30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, (%rdi,%r8,2), %xmm0, %xmm1
vpblendd $0xf, %ymm1, %ymm0, %ymm12 # ymm12 = ymm1[0,1,2,3],ymm0[4,5,6,7]
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x80(%rsp), %rsi
movzbl (%rsi,%r8), %esi
movslq (%rax,%rsi,4), %rax
movq 0x40(%rsp), %rdi
movq %rdi, %rsi
imulq %rax, %rsi
shlq $0x5, %rsi
addq 0x98(%rsp), %rsi
movq %r8, 0x38(%rsp)
incq %r8
movl $0x1, %eax
xorl %r9d, %r9d
vmovdqa 0xe0(%rsp), %ymm0
vmovdqa (%r14,%r9), %ymm1
vpaddsw (%rsi,%r9), %ymm12, %ymm13
vpmaxsw %ymm1, %ymm13, %ymm14
vpmaxsw %ymm0, %ymm14, %ymm12
vmovdqa %ymm12, (%r13,%r9)
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rcx, %r11
vpcmpeqw %ymm13, %ymm12, %ymm13
vpcmpgtw %ymm0, %ymm14, %ymm14
vpaddw %ymm6, %ymm14, %ymm14
vpblendvb %ymm13, 0xc0(%rsp), %ymm14, %ymm13
vpor (%r9,%r11), %ymm13, %ymm14
vmovdqa %ymm13, (%r15,%r9)
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rcx, %r11
vmovdqa %ymm14, (%r9,%r11)
vpsubsw %ymm2, %ymm12, %ymm13
vpsubsw %ymm3, %ymm1, %ymm14
vpmaxsw %ymm14, %ymm13, %ymm14
vmovdqa %ymm14, (%r14,%r9)
movq 0x20(%rsp), %r11
vmovdqa (%r11,%r9), %ymm14
vpsubsw %ymm3, %ymm14, %ymm14
vpmaxsw %ymm14, %ymm13, %ymm15
vmovdqa %ymm15, (%r12,%r9)
cmpq %r10, %r8
jae 0x591192
vpbroadcastw 0x6a5e0(%rip), %ymm15 # 0x5fb74c
vpbroadcastw 0x6a5d9(%rip), %ymm7 # 0x5fb74e
vpcmpgtw %ymm14, %ymm13, %ymm14
vpblendvb %ymm14, %ymm15, %ymm7, %ymm7
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq 0x8(%rsp), %r11
vmovdqa %ymm7, (%r9,%r11)
vpsubsw %ymm3, %ymm0, %ymm14
cmpq %rdi, %rax
jae 0x5911be
movq 0x10(%rbx), %r11
movq (%r11), %r11
addq %rcx, %r11
vpcmpgtw %ymm14, %ymm13, %ymm7
vpblendvb %ymm7, %ymm8, %ymm9, %ymm7
vpor 0x20(%r9,%r11), %ymm7, %ymm7
vmovdqa %ymm7, 0x20(%r9,%r11)
vpmaxsw %ymm4, %ymm12, %ymm4
vpminsw %ymm1, %ymm5, %ymm1
vpminsw %ymm0, %ymm1, %ymm0
vpminsw %ymm0, %ymm12, %ymm5
vpmaxsw %ymm14, %ymm13, %ymm0
movq 0x18(%rsp), %r11
vmovdqa (%r11,%r9), %ymm12
addq $0x20, %r9
incq %rax
cmpq %r9, %rdx
jne 0x5910d8
movq $0x0, 0x28(%rsp)
vmovdqa %ymm0, %ymm12
movq 0x60(%rsp), %rdi
movswl (%rdi,%r8,2), %eax
subl 0x4(%rsp), %eax
cmpl $0xffff8001, %eax       # imm = 0xFFFF8001
movl $0xffff8000, %r9d       # imm = 0xFFFF8000
cmovll %r9d, %eax
movq 0x58(%rsp), %r9
vmovdqa (%r9), %ymm1
vinserti128 $0x1, %xmm1, %ymm0, %ymm7
vpalignr $0xe, %ymm7, %ymm1, %ymm1 # ymm1 = ymm7[14,15],ymm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm7[30,31],ymm1[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
movq 0x38(%rsp), %r9
vpinsrw $0x0, (%rdi,%r9,2), %xmm1, %xmm7
vinserti128 $0x1, %xmm13, %ymm0, %ymm15
vpalignr $0xe, %ymm15, %ymm13, %ymm13 # ymm13 = ymm15[14,15],ymm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm15[30,31],ymm13[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm13, %xmm15
vpblendd $0xf, %ymm7, %ymm1, %ymm1 # ymm1 = ymm7[0,1,2,3],ymm1[4,5,6,7]
vpblendd $0xf, %ymm15, %ymm13, %ymm13 # ymm13 = ymm15[0,1,2,3],ymm13[4,5,6,7]
vinserti128 $0x1, %xmm12, %ymm0, %ymm7
vpalignr $0xe, %ymm7, %ymm12, %ymm7 # ymm7 = ymm7[14,15],ymm12[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm7[30,31],ymm12[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm7, %xmm12
vpblendd $0xf, %ymm12, %ymm7, %ymm15 # ymm15 = ymm12[0,1,2,3],ymm7[4,5,6,7]
vinserti128 $0x1, %xmm14, %ymm0, %ymm7
vpalignr $0xe, %ymm7, %ymm14, %ymm7 # ymm7 = ymm7[14,15],ymm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm7[30,31],ymm14[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, 0x14(%rsp), %xmm7, %xmm12
vpblendd $0xf, %ymm12, %ymm7, %ymm14 # ymm14 = ymm12[0,1,2,3],ymm7[4,5,6,7]
vinserti128 $0x1, %xmm0, %ymm0, %ymm7
vpalignr $0xe, %ymm7, %ymm0, %ymm0 # ymm0 = ymm7[14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm7[30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpinsrw $0x0, %eax, %xmm0, %xmm7
vpblendd $0xf, %ymm7, %ymm0, %ymm0 # ymm0 = ymm7[0,1,2,3],ymm0[4,5,6,7]
movb $0x1, %al
movl $0x1, %r9d
xorl %r11d, %r11d
movq 0x40(%rsp), %rdi
vmovdqa (%r13,%r11), %ymm7
vpmaxsw %ymm7, %ymm15, %ymm12
vmovdqa %ymm12, (%r13,%r11)
vpaddsw (%rsi,%r11), %ymm1, %ymm1
vpcmpeqw %ymm1, %ymm12, %ymm1
vpcmpgtw %ymm15, %ymm7, %ymm7
vpor %ymm7, %ymm1, %ymm1
movq 0x10(%rbx), %r14
vpblendvb %ymm1, (%r15,%r11), %ymm6, %ymm1
movq (%r14), %r14
addq %rcx, %r14
vpand (%r11,%r14), %ymm10, %ymm7
vmovdqa %ymm1, (%r15,%r11)
vpor %ymm1, %ymm7, %ymm1
movq 0x10(%rbx), %r14
movq (%r14), %r14
addq %rcx, %r14
vmovdqa %ymm1, (%r11,%r14)
movq 0x10(%rbx), %r14
movq (%r14), %r14
addq %rcx, %r14
vpcmpgtw %ymm14, %ymm13, %ymm1
vpblendvb %ymm1, %ymm8, %ymm9, %ymm1
vpand (%r11,%r14), %ymm11, %ymm7
vpor %ymm1, %ymm7, %ymm1
vmovdqa %ymm1, (%r11,%r14)
vpsubsw %ymm2, %ymm12, %ymm13
movq 0x20(%rsp), %r14
vmovdqa (%r14,%r11), %ymm1
vpsubsw %ymm3, %ymm1, %ymm1
vpmaxsw %ymm1, %ymm13, %ymm7
vmovdqa %ymm7, (%r12,%r11)
cmpq %r10, %r8
jae 0x5913e5
vpbroadcastw 0x6a3f4(%rip), %ymm7 # 0x5fb74c
vmovdqa %ymm14, 0xa0(%rsp)
vmovdqa %ymm4, %ymm14
vmovdqa %ymm5, %ymm4
vmovdqa %ymm0, %ymm5
vmovdqa %ymm3, %ymm0
vmovdqa %ymm6, %ymm3
vmovdqa %ymm9, %ymm6
vmovdqa %ymm8, %ymm9
vmovdqa %ymm11, %ymm8
vmovdqa %ymm10, %ymm11
vmovdqa %ymm2, %ymm10
vpbroadcastw 0x6a3b9(%rip), %ymm2 # 0x5fb74e
vpcmpgtw %ymm1, %ymm13, %ymm1
vpblendvb %ymm1, %ymm7, %ymm2, %ymm1
vmovdqa %ymm10, %ymm2
vmovdqa %ymm11, %ymm10
vmovdqa %ymm8, %ymm11
vmovdqa %ymm9, %ymm8
vmovdqa %ymm6, %ymm9
vmovdqa %ymm3, %ymm6
vmovdqa %ymm0, %ymm3
vmovdqa %ymm5, %ymm0
vmovdqa %ymm4, %ymm5
vmovdqa %ymm14, %ymm4
vmovdqa 0xa0(%rsp), %ymm14
movq 0x10(%rbx), %r14
movq (%r14), %r14
addq 0x8(%rsp), %r14
vmovdqa %ymm1, (%r11,%r14)
vpminsw %ymm5, %ymm12, %ymm5
vpmaxsw %ymm4, %ymm12, %ymm4
vpsubsw %ymm3, %ymm15, %ymm12
vpcmpgtw %ymm12, %ymm13, %ymm1
vpmovmskb %ymm1, %r14d
cmpl $-0x1, %r14d
je 0x591431
vpsubsw %ymm3, %ymm0, %ymm14
vpmaxsw %ymm14, %ymm13, %ymm0
movq 0x18(%rsp), %rax
vmovdqa (%rax,%r11), %ymm1
cmpq %rdi, %r9
setb %al
addq $0x20, %r11
incq %r9
vmovdqa %ymm12, %ymm15
cmpq %r11, %rdx
jne 0x5912ae
jmp 0x591436
vmovdqa %ymm15, %ymm12
testb $0x1, %al
jne 0x591450
movq 0x28(%rsp), %rdi
leal 0x1(%rdi), %eax
cmpl $0xf, %edi
movq %rax, 0x28(%rsp)
jb 0x5911fb
movq 0x88(%rsp), %rax
addq %rax, 0x8(%rsp)
addq %rax, %rcx
movq %r13, %r11
movq %r12, %rax
cmpq 0x90(%rsp), %r8
movq 0x50(%rsp), %r14
movq 0x60(%rsp), %rdi
jne 0x59104c
movl 0x70(%rsp), %eax
shlq $0x5, %rax
vmovdqa (%r13,%rax), %ymm0
cmpl $0xe, 0x34(%rsp)
jg 0x5914b9
movl 0x6c(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
movl 0x30(%rsp), %edx
vperm2i128 $0x28, %ymm0, %ymm0, %ymm1 # ymm1 = zero,zero,ymm0[0,1]
vpalignr $0xe, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm1[30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
decl %eax
jne 0x5914a7
jmp 0x5914bd
movl 0x30(%rsp), %edx
vmovdqa 0xe0(%rsp), %ymm1
vpcmpgtw %ymm5, %ymm1, %ymm1
vpcmpgtw 0x100(%rsp), %ymm4, %ymm2
vpor %ymm2, %ymm1, %ymm1
vpmovmskb %ymm1, %eax
testl %eax, %eax
je 0x5914eb
orb $0x40, 0xc(%rbx)
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x5914fa
vextracti128 $0x1, %ymm0, %xmm0
vpextrw $0x7, %xmm0, %eax
movl 0x74(%rsp), %ecx
cwtl
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
movl %edx, 0x8(%rbx)
vzeroupper
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq 0x20(%rsp), %rdi
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq 0x18(%rsp), %rdi
callq 0x2094b5
movq %r13, %rdi
callq 0x2094b5
jmp 0x591579
callq 0x1fad31
jmp 0x591577
callq 0x1fad0b
jmp 0x591577
callq 0x1face5
jmp 0x591577
callq 0x1facbf
jmp 0x591577
callq 0x1fac99
jmp 0x591577
callq 0x1fac73
jmp 0x591577
callq 0x1fac4d
jmp 0x591577
callq 0x1fac27
xorl %ebx, %ebx
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop