// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_trace_scan_avx2_256_16.c
// Function: parasail_sg_flags_trace_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 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 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;
    __m256i vTIns;
    __m256i vTDel;
    __m256i vTDiag;
    __m256i vTDiagE;
    __m256i vTInsE;
    __m256i vTDiagF;
    __m256i vTDelF;

    /* 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));
    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);

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

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_SCAN
        | PARASAIL_FLAG_TRACE
        | 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;

    /* 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 vE_ext;
        __m256i vE_opn;
        __m256i vHt;
        __m256i vF;
        __m256i vF_ext;
        __m256i vF_opn;
        __m256i vH;
        __m256i vHp;
        __m256i *pvW;
        __m256i vW;
        __m256i case1;
        __m256i case2;
        __m256i vGapper;
        __m256i vT;
        __m256i vET;
        __m256i vFT;

        /* 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);
            vGapper = _mm256_load_si256(pvGapper+i);
            vE_opn = _mm256_subs_epi16(vH, vGapO);
            vE_ext = _mm256_subs_epi16(vE, vGapE);
            case1 = _mm256_cmpgt_epi16(vE_opn, vE_ext);
            vET = _mm256_blendv_epi8(vTInsE, vTDiagE, case1);
            arr_store(result->trace->trace_table, vET, i, segLen, j);
            vE = _mm256_max_epi16(vE_opn, vE_ext);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vE);
            vGapper = _mm256_adds_epi16(vHt, vGapper);
            vF = _mm256_max_epi16(vF, vGapper);
            vHp = _mm256_adds_epi16(vHp, vW);
            vHt = _mm256_max_epi16(vE, vHp);
            _mm256_store_si256(pvE+i, vE);
            _mm256_store_si256(pvHt+i, vHt);
            _mm256_store_si256(pvH+i, vHp);
            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);
        vGapper = _mm256_load_si256(pvGapper);
        vGapper = _mm256_adds_epi16(vHt, vGapper);
        vF = _mm256_max_epi16(vF, vGapper);
        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(vF, vHt);
        for (i=0; i<segLen; ++i) {
            vET = arr_load(result->trace->trace_table, i, segLen, j);
            vHp = _mm256_load_si256(pvH+i);
            vHt = _mm256_load_si256(pvHt+i);
            vF_opn = _mm256_subs_epi16(vH, vGapO);
            vF_ext = _mm256_subs_epi16(vF, vGapE);
            vF = _mm256_max_epi16(vF_opn, vF_ext);
            case1 = _mm256_cmpgt_epi16(vF_opn, vF_ext);
            vFT = _mm256_blendv_epi8(vTDelF, vTDiagF, case1);
            vH = _mm256_max_epi16(vHt, vF);
            case1 = _mm256_cmpeq_epi16(vH, vHp);
            case2 = _mm256_cmpeq_epi16(vH, vF);
            vT = _mm256_blendv_epi8(
                    _mm256_blendv_epi8(vTIns, vTDel, case2),
                    vTDiag, case1);
            vT = _mm256_or_si256(vT, vET);
            vT = _mm256_or_si256(vT, vFT);
            arr_store(result->trace->trace_table, vT, i, segLen, j);
            _mm256_store_si256(pvH+i, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm256_min_epi16(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm256_max_epi16(vSaturationCheckMax, vH);
        }

        /* 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;
            }
        }
    } 

    /* 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 $0x1e0, %rsp            # imm = 0x1E0
movq %rsi, 0x78(%rsp)
testq %rdi, %rdi
je 0x57a192
movq 0x30(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x57a199
movq 0x10(%rdi), %rax
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x57a1a0
movl %edx, %r12d
movl 0x8(%rdi), %edx
testl %edx, %edx
jle 0x57a1a7
cmpq $0x0, 0x78(%rsp)
je 0x57a1ae
testl %r12d, %r12d
jle 0x57a1b5
testl %ecx, %ecx
js 0x57a1bc
testl %r8d, %r8d
js 0x57a1c3
movl %r9d, %r13d
movl %r8d, 0x40(%rsp)
leal -0x1(%rdx), %eax
movq %rdx, 0x90(%rsp)
leaq 0xf(%rdx), %r15
movq %r15, %r14
shrq $0x4, %r14
movl %eax, 0x64(%rsp)
cltd
idivl %r14d
movl %eax, 0x20(%rsp)
movl %edx, 0x100(%rsp)
movl %ecx, %esi
negl %esi
movq 0x70(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %edi
negl %edi
movl %esi, 0xc0(%rsp)
cmpl %esi, %eax
movl %ecx, 0x30(%rsp)
cmovgl %ecx, %edi
movl %edi, 0x24(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0xa0(%rsp)
movl $0x20, %edx
movl $0x20, %ecx
movl %r14d, %edi
movl %r12d, %esi
callq 0x2097d1
testq %rax, %rax
je 0x57a1c8
movq %rax, %rbx
movq %r15, 0x88(%rsp)
movl 0x20(%rbp), %edi
xorl %eax, %eax
testl %r13d, %r13d
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
movl %edi, 0x60(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%rbx), %eax
orl $0x10280402, %eax       # imm = 0x10280402
movl %eax, 0xc(%rbx)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r12, %rcx
movq %rax, %r12
movq %rcx, 0x68(%rsp)
leal 0x1(%rcx), %esi
movl $0x20, %edi
movq %rsi, 0xe0(%rsp)
callq 0x2094cd
movq %rax, 0x48(%rsp)
movl $0x20, %edi
movq %r14, %rsi
callq 0x4c5e3c
movq %r14, %rsi
movq %r14, 0x28(%rsp)
movq %rax, %r14
movl $0x20, %edi
callq 0x4c5e3c
movq %rax, %r15
movl $0x20, %edi
movq 0x28(%rsp), %rsi
callq 0x4c5e3c
testq %r12, %r12
sete %dl
cmpq $0x0, 0x48(%rsp)
sete %cl
orb %dl, %cl
testq %r14, %r14
sete %sil
testq %r15, %r15
sete %dl
orb %sil, %dl
orb %cl, %dl
testq %rax, %rax
sete %cl
orb %dl, %cl
jne 0x57a1c8
movq %rax, 0x58(%rsp)
movq 0x68(%rsp), %rax
decl %eax
movl %eax, 0x1c(%rsp)
movl $0xf, %ecx
subl 0x20(%rsp), %ecx
movl 0x30(%rsp), %esi
vmovd %esi, %xmm0
vpbroadcastw %xmm0, %ymm3
movl 0x40(%rsp), %edx
vmovd %edx, %xmm0
vpbroadcastw %xmm0, %ymm4
movl 0x24(%rsp), %eax
addl $0xffff8001, %eax       # imm = 0xFFFF8001
vmovd %eax, %xmm0
vpbroadcastw %xmm0, %ymm0
vmovdqa %ymm0, 0x120(%rsp)
vmovd 0xa0(%rsp), %xmm0
vpbroadcastw %xmm0, %ymm2
movl %ecx, 0x3c(%rsp)
vmovd %ecx, %xmm0
vpbroadcastw %xmm0, %ymm6
movl %eax, 0x24(%rsp)
movzwl %ax, %eax
vmovd %eax, %xmm1
movq 0x28(%rsp), %rdi
movl %edi, %eax
imull %edx, %eax
negl %eax
vmovd %eax, %xmm0
vpbroadcastw %xmm0, %ymm0
vpand 0x7fc28(%rip), %ymm0, %ymm0 # 0x5f9820
vmovdqa %ymm1, 0x160(%rsp)
vpaddsw %ymm0, %ymm1, %ymm9
movl %esi, %ecx
movl %edx, %eax
movslq 0xc0(%rsp), %rdx
movl %edi, %r8d
movq %r8, 0x30(%rsp)
movq %rax, 0x50(%rsp)
imulq %rax, %r8
xorl %r9d, %r9d
movq $-0x7fff, %r10          # imm = 0x8001
movq $-0x8000, %r11          # imm = 0x8000
movq %rdx, 0xa0(%rsp)
movq %rdx, %rdi
xorl %edx, %edx
testl %r13d, %r13d
je 0x579c49
xorl %esi, %esi
jmp 0x579c4c
movq %rdi, %rsi
cmpq %r10, %rsi
movq $-0x8000, %rax          # imm = 0x8000
cmovgeq %rsi, %rax
movw %ax, 0x1a0(%rsp,%rdx,2)
subq %rcx, %rsi
cmpq %r10, %rsi
cmovlq %r11, %rsi
movw %si, 0x180(%rsp,%rdx,2)
incq %rdx
subq %r8, %rdi
cmpq $0x10, %rdx
jne 0x579c40
movq %r9, %rax
shlq $0x5, %rax
vmovaps 0x1a0(%rsp), %ymm0
vmovaps %ymm0, (%r15,%rax)
vmovdqa 0x180(%rsp), %ymm0
vmovdqa %ymm0, (%r12,%rax)
incq %r9
movq 0xa0(%rsp), %rdx
subq 0x50(%rsp), %rdx
cmpq 0x30(%rsp), %r9
jne 0x579c33
movq 0x48(%rsp), %r13
movw $0x0, (%r13)
movl $0x1, %ecx
xorl %edx, %edx
movl 0x40(%rsp), %esi
movl 0xc0(%rsp), %edi
movl 0x18(%rbp), %r8d
movq 0xe0(%rsp), %r9
cmpl $0xffff8001, %edi       # imm = 0xFFFF8001
movl $0xffff8000, %eax       # imm = 0xFFFF8000
cmovgel %edi, %eax
testl %r8d, %r8d
cmovnel %edx, %eax
movw %ax, (%r13,%rcx,2)
incq %rcx
subl %esi, %edi
cmpq %rcx, %r9
jne 0x579cea
vpxor %xmm0, %xmm0, %xmm0
vpsubsw %ymm3, %ymm0, %ymm0
movq 0x28(%rsp), %rsi
leal -0x1(%rsi), %ecx
movq %rcx, %rax
shlq $0x5, %rax
movq 0x58(%rsp), %rdx
addq %rax, %rdx
vmovdqa %ymm2, 0xe0(%rsp)
vmovdqa %ymm0, (%rdx)
vpsubsw %ymm4, %ymm0, %ymm0
vpminsw %ymm0, %ymm2, %ymm2
addq $-0x20, %rdx
decl %esi
jg 0x579d36
movl %ecx, %eax
shlq $0x5, %rax
addq %r15, %rax
movq %rax, 0x50(%rsp)
movl 0x100(%rsp), %r10d
movq %r10, 0x80(%rsp)
shlq $0x5, %r10
addq %r15, %r10
movq 0x28(%rsp), %r11
cmpl $0x1, %r11d
adcl $0x0, %r11d
movq 0x68(%rsp), %rax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
movq %rcx, 0x40(%rsp)
vpbroadcastw 0x816e4(%rip), %ymm15 # 0x5fb47e
vpbroadcastw 0x816dd(%rip), %ymm10 # 0x5fb480
vpbroadcastw 0x816d6(%rip), %ymm11 # 0x5fb482
movq 0x30(%rsp), %rsi
vpbroadcastw 0x816ca(%rip), %ymm12 # 0x5fb484
shlq $0x5, %rsi
vpbroadcastw 0x816bf(%rip), %ymm13 # 0x5fb486
shlq $0x5, %r11
vpbroadcastw 0x816b4(%rip), %ymm14 # 0x5fb488
xorl %edx, %edx
vpcmpeqw 0x7fa62(%rip), %ymm6, %ymm0 # 0x5f9840
vmovdqa %ymm0, 0x100(%rsp)
xorl %ecx, %ecx
movl 0x1c(%rsp), %r8d
vmovdqa 0x120(%rsp), %ymm0
vmovdqa %ymm0, %ymm6
vmovdqa %ymm0, %ymm5
vmovdqa %ymm9, 0x140(%rsp)
vmovdqa %ymm11, 0xc0(%rsp)
vmovdqa %ymm5, 0xa0(%rsp)
movq 0x50(%rsp), %rax
vmovdqa (%rax), %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, (%r13,%rcx,2), %xmm0, %xmm1
vpblendd $0xf, %ymm1, %ymm0, %ymm1 # ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rsp), %rdi
movzbl (%rdi,%rcx), %edi
movslq (%rax,%rdi,4), %r9
imulq 0x30(%rsp), %r9
shlq $0x5, %r9
addq 0x98(%rsp), %r9
movq 0x58(%rsp), %rdi
vmovdqa 0x120(%rsp), %ymm0
vpsubsw (%rdi), %ymm0, %ymm5
xorl %r13d, %r13d
vmovdqa %ymm10, %ymm11
vmovdqa %ymm15, %ymm10
vpaddsw (%r9,%r13), %ymm1, %ymm1
vmovdqa (%r15,%r13), %ymm15
vmovdqa (%r12,%r13), %ymm8
vpsubsw %ymm3, %ymm15, %ymm7
vpsubsw %ymm4, %ymm8, %ymm8
vpcmpgtw %ymm8, %ymm7, %ymm9
vpblendvb %ymm9, %ymm10, %ymm11, %ymm9
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %rdx, %rax
vpaddsw (%rdi,%r13), %ymm5, %ymm5
vmovdqa %ymm9, (%r13,%rax)
vpmaxsw %ymm5, %ymm0, %ymm0
vpmaxsw %ymm7, %ymm8, %ymm7
vpminsw %ymm7, %ymm2, %ymm2
vpmaxsw %ymm1, %ymm7, %ymm5
vmovdqa %ymm7, (%r12,%r13)
vmovdqa %ymm5, (%r14,%r13)
vmovdqa %ymm1, (%r15,%r13)
addq $0x20, %r13
vmovdqa %ymm15, %ymm1
cmpq %r13, %r11
jne 0x579e84
vinserti128 $0x1, %xmm5, %ymm0, %ymm1
vpalignr $0xe, %ymm1, %ymm5, %ymm1 # ymm1 = ymm1[14,15],ymm5[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm1[30,31],ymm5[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
leaq 0x1(%rcx), %r9
movq 0x48(%rsp), %rax
vpinsrw $0x0, 0x2(%rax,%rcx,2), %xmm1, %xmm5
vpblendd $0xf, %ymm5, %ymm1, %ymm1 # ymm1 = ymm5[0,1,2,3],ymm1[4,5,6,7]
vpaddsw (%rdi), %ymm1, %ymm5
vpmaxsw %ymm5, %ymm0, %ymm0
movl $0xe, %edi
vmovdqa 0x140(%rsp), %ymm9
vperm2i128 $0x28, %ymm0, %ymm0, %ymm5 # ymm5 = zero,zero,ymm0[0,1]
vpalignr $0xe, %ymm5, %ymm0, %ymm5 # ymm5 = ymm5[14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm5[30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpaddsw %ymm5, %ymm9, %ymm5
vpmaxsw %ymm5, %ymm0, %ymm0
decl %edi
jne 0x579f27
vperm2i128 $0x28, %ymm0, %ymm0, %ymm5 # ymm5 = zero,zero,ymm0[0,1]
vpalignr $0xe, %ymm5, %ymm0, %ymm0 # ymm0 = ymm5[14,15],ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm5[30,31],ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
vpaddsw 0x160(%rsp), %ymm0, %ymm0
vpmaxsw %ymm1, %ymm0, %ymm1
xorl %r13d, %r13d
vmovdqa %ymm10, %ymm15
vmovdqa %ymm11, %ymm10
vmovdqa 0xc0(%rsp), %ymm11
movq 0x10(%rbx), %rax
movq (%rax), %rax
addq %rdx, %rax
vmovdqa (%r14,%r13), %ymm5
vpsubsw %ymm3, %ymm1, %ymm1
vpsubsw %ymm4, %ymm0, %ymm7
vpmaxsw %ymm7, %ymm1, %ymm0
vpcmpgtw %ymm7, %ymm1, %ymm1
vpblendvb %ymm1, %ymm11, %ymm12, %ymm7
vpmaxsw %ymm0, %ymm5, %ymm1
vpcmpeqw (%r15,%r13), %ymm1, %ymm8
vpcmpgtw %ymm0, %ymm5, %ymm5
vpaddw %ymm5, %ymm13, %ymm5
vpblendvb %ymm8, %ymm14, %ymm5, %ymm5
vpor (%r13,%rax), %ymm7, %ymm7
vpor %ymm5, %ymm7, %ymm5
vmovdqa %ymm5, (%r13,%rax)
vmovdqa %ymm1, (%r15,%r13)
vpminsw %ymm0, %ymm2, %ymm2
vpminsw %ymm1, %ymm2, %ymm2
vpmaxsw %ymm1, %ymm6, %ymm6
addq $0x20, %r13
cmpq %r13, %r11
jne 0x579f6e
vmovdqa (%r10), %ymm0
vmovdqa 0xa0(%rsp), %ymm5
vpcmpgtw %ymm5, %ymm0, %ymm1
vpand 0x100(%rsp), %ymm1, %ymm1
vpmaxsw %ymm5, %ymm0, %ymm5
vpmovmskb %ymm1, %eax
testl %eax, %eax
cmovnel %ecx, %r8d
addq %rsi, %rdx
movq %r9, %rcx
cmpq 0x40(%rsp), %r9
movq 0x48(%rsp), %r13
jne 0x579e11
cmpl $0x0, 0x20(%rbp)
movl 0x64(%rsp), %r9d
movq 0x90(%rsp), %r10
movl 0x24(%rsp), %r11d
je 0x57a061
cmpl $0xe, 0x20(%rsp)
jg 0x57a056
movl 0x3c(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
vperm2i128 $0x28, %ymm5, %ymm5, %ymm0 # ymm0 = zero,zero,ymm5[0,1]
vpalignr $0xe, %ymm0, %ymm5, %ymm5 # ymm5 = ymm0[14,15],ymm5[0,1,2,3,4,5,6,7,8,9,10,11,12,13],ymm0[30,31],ymm5[16,17,18,19,20,21,22,23,24,25,26,27,28,29]
decl %eax
jne 0x57a046
vextracti128 $0x1, %ymm5, %xmm0
vpextrw $0x7, %xmm0, %r11d
cmpl $0x0, 0x10(%rbp)
je 0x57a0d1
testl $0x7ffffff0, 0x88(%rsp) # imm = 0x7FFFFFF0
je 0x57a0d1
movq 0x28(%rsp), %rdx
andl $0x7ffffff, %edx        # imm = 0x7FFFFFF
shll $0x4, %edx
xorl %esi, %esi
movl %r9d, %ecx
movl %esi, %eax
shrl $0x4, %eax
movl %esi, %edi
andl $0xf, %edi
imull 0x28(%rsp), %edi
addl %eax, %edi
cmpl %r10d, %edi
jge 0x57a0c8
movzwl (%r15,%rsi,2), %eax
cmpw %r11w, %ax
jle 0x57a0b4
movl %eax, %r11d
movl 0x1c(%rsp), %r8d
movl %edi, %ecx
jmp 0x57a0c8
cmpl %ecx, %edi
cmovgel %ecx, %edi
cmpl 0x1c(%rsp), %r8d
cmovnel %ecx, %edi
cmpw %r11w, %ax
cmovel %edi, %ecx
incq %rsi
cmpl %esi, %edx
jne 0x57a087
jmp 0x57a0d4
movl %r9d, %ecx
movl 0x10(%rbp), %eax
orl %eax, 0x60(%rsp)
movq 0x58(%rsp), %rdi
jne 0x57a12d
movq 0x80(%rsp), %rax
shlq $0x5, %rax
vmovdqa (%r15,%rax), %ymm0
cmpl $0xe, 0x20(%rsp)
jg 0x57a11a
movl 0x3c(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
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 %ecx
jne 0x57a10a
vextracti128 $0x1, %ymm0, %xmm0
vpextrw $0x7, %xmm0, %r11d
movl 0x1c(%rsp), %r8d
movl %r9d, %ecx
vmovdqa 0x120(%rsp), %ymm0
vpcmpgtw %ymm2, %ymm0, %ymm0
vpcmpgtw 0xe0(%rsp), %ymm6, %ymm1
vpor %ymm1, %ymm0, %ymm0
vpmovmskb %ymm0, %eax
testl %eax, %eax
je 0x57a15b
orb $0x40, 0xc(%rbx)
xorl %r11d, %r11d
xorl %r8d, %r8d
xorl %ecx, %ecx
movswl %r11w, %eax
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
movl %r8d, 0x8(%rbx)
vzeroupper
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq %r14, %rdi
callq 0x2094b5
movq %r13, %rdi
callq 0x2094b5
movq %r12, %rdi
callq 0x2094b5
jmp 0x57a1ca
callq 0x1f883b
jmp 0x57a1c8
callq 0x1f8815
jmp 0x57a1c8
callq 0x1f87ef
jmp 0x57a1c8
callq 0x1f87c9
jmp 0x57a1c8
callq 0x1f87a3
jmp 0x57a1c8
callq 0x1f877d
jmp 0x57a1c8
callq 0x1f8757
jmp 0x57a1c8
callq 0x1f8731
xorl %ebx, %ebx
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq