// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/nw_trace_scan_sse2_128_16.c
// Function: parasail_nw_trace_scan_profile_sse2_128_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;
    __m128i* restrict pvP = NULL;
    __m128i* restrict pvE = NULL;
    int16_t* restrict boundary = NULL;
    __m128i* restrict pvHt = NULL;
    __m128i* restrict pvH = NULL;
    __m128i* restrict pvGapper = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    __m128i vZero;
    int16_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vNegInfFront;
    __m128i vSegLenXgap;
    parasail_result_t *result = NULL;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTDiag;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i 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 = 8; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    pvP = (__m128i*)profile->profile16.score;
    vGapO = _mm_set1_epi16(open);
    vGapE = _mm_set1_epi16(gap);
    NEG_LIMIT = (-open < matrix->min ? INT16_MIN + open : INT16_MIN - matrix->min) + 1;
    POS_LIMIT = INT16_MAX - matrix->max - 1;
    vZero = _mm_setzero_si128();
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi16(NEG_LIMIT);
    vPosLimit = _mm_set1_epi16(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vNegInfFront = vZero;
    vTIns  = _mm_set1_epi16(PARASAIL_INS);
    vTDel  = _mm_set1_epi16(PARASAIL_DEL);
    vTDiag = _mm_set1_epi16(PARASAIL_DIAG);
    vTDiagE = _mm_set1_epi16(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi16(PARASAIL_INS_E);
    vTDiagF = _mm_set1_epi16(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi16(PARASAIL_DEL_F);
    vNegInfFront = _mm_insert_epi16(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_adds_epi16(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi16(-segLen*gap), 2));

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

    /* set known flags */
    result->flag |= PARASAIL_FLAG_NW | PARASAIL_FLAG_SCAN
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_16 | PARASAIL_FLAG_LANES_8;

    /* initialize heap variables */
    pvE = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_int16_t(16, s2Len+1);
    pvHt= parasail_memalign___m128i(16, segLen);
    pvH = parasail_memalign___m128i(16, segLen);
    pvGapper = parasail_memalign___m128i(16, 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;
            __m128i_16_t h;
            __m128i_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;
            }
            _mm_store_si128(&pvH[index], h.m);
            _mm_store_si128(&pvE[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;
        }
    }

    {
        __m128i vGapper = _mm_subs_epi16(vZero,vGapO);
        for (i=segLen-1; i>=0; --i) {
            _mm_store_si128(pvGapper+i, vGapper);
            vGapper = _mm_subs_epi16(vGapper, vGapE);
        }
    }

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        __m128i vE_ext;
        __m128i vE_opn;
        __m128i vHt;
        __m128i vF;
        __m128i vF_ext;
        __m128i vF_opn;
        __m128i vH;
        __m128i vHp;
        __m128i *pvW;
        __m128i vW;
        __m128i case1;
        __m128i case2;
        __m128i vGapper;
        __m128i vT;
        __m128i vET;
        __m128i vFT;

        /* calculate E */
        /* calculate Ht */
        /* calculate F and H first pass */
        vHp = _mm_load_si128(pvH+(segLen-1));
        vHp = _mm_slli_si128(vHp, 2);
        vHp = _mm_insert_epi16(vHp, boundary[j], 0);
        pvW = pvP + matrix->mapper[(unsigned char)s2[j]]*segLen;
        vHt = _mm_subs_epi16(vNegLimit, pvGapper[0]);
        vF = vNegLimit;
        for (i=0; i<segLen; ++i) {
            vH = _mm_load_si128(pvH+i);
            vE = _mm_load_si128(pvE+i);
            vW = _mm_load_si128(pvW+i);
            vGapper = _mm_load_si128(pvGapper+i);
            vE_opn = _mm_subs_epi16(vH, vGapO);
            vE_ext = _mm_subs_epi16(vE, vGapE);
            case1 = _mm_cmpgt_epi16(vE_opn, vE_ext);
            vET = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, case1);
            arr_store(result->trace->trace_table, vET, i, segLen, j);
            vE = _mm_max_epi16(vE_opn, vE_ext);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vE);
            vGapper = _mm_adds_epi16(vHt, vGapper);
            vF = _mm_max_epi16(vF, vGapper);
            vHp = _mm_adds_epi16(vHp, vW);
            vHt = _mm_max_epi16(vE, vHp);
            _mm_store_si128(pvE+i, vE);
            _mm_store_si128(pvHt+i, vHt);
            _mm_store_si128(pvH+i, vHp);
            vHp = vH;
        }

        /* pseudo prefix scan on F and H */
        vHt = _mm_slli_si128(vHt, 2);
        vHt = _mm_insert_epi16(vHt, boundary[j+1], 0);
        vGapper = _mm_load_si128(pvGapper);
        vGapper = _mm_adds_epi16(vHt, vGapper);
        vF = _mm_max_epi16(vF, vGapper);
        for (i=0; i<segWidth-2; ++i) {
            __m128i vFt = _mm_slli_si128(vF, 2);
            vFt = _mm_adds_epi16(vFt, vSegLenXgap);
            vF = _mm_max_epi16(vF, vFt);
        }

        /* calculate final H */
        vF = _mm_slli_si128(vF, 2);
        vF = _mm_adds_epi16(vF, vNegInfFront);
        vH = _mm_max_epi16(vF, vHt);
        for (i=0; i<segLen; ++i) {
            vET = arr_load(result->trace->trace_table, i, segLen, j);
            vHp = _mm_load_si128(pvH+i);
            vHt = _mm_load_si128(pvHt+i);
            vF_opn = _mm_subs_epi16(vH, vGapO);
            vF_ext = _mm_subs_epi16(vF, vGapE);
            vF = _mm_max_epi16(vF_opn, vF_ext);
            case1 = _mm_cmpgt_epi16(vF_opn, vF_ext);
            vFT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, case1);
            vH = _mm_max_epi16(vHt, vF);
            case1 = _mm_cmpeq_epi16(vH, vHp);
            case2 = _mm_cmpeq_epi16(vH, vF);
            vT = _mm_blendv_epi8_rpl(
                    _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                    vTDiag, case1);
            vT = _mm_or_si128(vT, vET);
            vT = _mm_or_si128(vT, vFT);
            arr_store(result->trace->trace_table, vT, i, segLen, j);
            _mm_store_si128(pvH+i, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vF);
            vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vH);
        }
    }

    /* extract last value from the last column */
    {
        __m128i vH = _mm_load_si128(pvH + offset);
        for (k=0; k<position; ++k) {
            vH = _mm_slli_si128(vH, 2);
        }
        score = (int16_t) _mm_extract_epi16 (vH, 7);
    }

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi16(vSaturationCheckMin, vNegLimit),
            _mm_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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, 0x68(%rsp)
testq %rdi, %rdi
je 0x3a677f
movq 0x30(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x3a6786
movq 0x10(%rdi), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x3a678d
movl 0x8(%rdi), %r15d
testl %r15d, %r15d
jle 0x3a6794
cmpq $0x0, 0x68(%rsp)
je 0x3a679b
movl %edx, %r12d
testl %edx, %edx
jle 0x3a67a2
testl %ecx, %ecx
js 0x3a67a9
testl %r8d, %r8d
js 0x3a67b0
movq %r8, 0x50(%rsp)
leal -0x1(%r15), %eax
addq $0x7, %r15
shrq $0x3, %r15
movl %eax, 0x1c(%rsp)
xorl %edx, %edx
divl %r15d
movl %eax, %ebx
movl %edx, %ebp
movl %ecx, %r13d
negl %r13d
movq 0x60(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %esi
negl %esi
cmpl %r13d, %eax
movl %ecx, 0x30(%rsp)
cmovgl %ecx, %esi
movl %esi, 0x40(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x80(%rsp)
movl $0x10, %edx
movl $0x10, %ecx
movl %r15d, %edi
movl %r12d, %esi
callq 0x20adf4
testq %rax, %rax
je 0x3a67b5
movq %rax, %r14
movl %ebp, 0x2c(%rsp)
movl %ebx, 0x18(%rsp)
orl $0x8280401, 0xc(%rax)   # imm = 0x8280401
movl $0x10, %edi
movq %r15, %rsi
callq 0x2f600c
movq %r12, %rcx
movq %rax, %r12
movq %rcx, 0x20(%rsp)
leal 0x1(%rcx), %esi
movl $0x10, %edi
callq 0x20a625
movq %rax, 0x8(%rsp)
movl $0x10, %edi
movq %r15, %rsi
callq 0x2f600c
movq %rax, %rbp
movl $0x10, %edi
movq %r15, %rsi
callq 0x2f600c
movq %rax, %rbx
movl $0x10, %edi
movq %r15, 0x58(%rsp)
movq %r15, %rsi
callq 0x2f600c
movq 0x8(%rsp), %rcx
movq %r12, %xmm0
movq %rcx, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %rbp, %xmm1
movq %rbx, %xmm2
punpcklqdq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0]
pxor %xmm2, %xmm2
pcmpeqd %xmm2, %xmm0
pcmpeqd %xmm2, %xmm1
movdqa %xmm0, %xmm2
shufps $0xdd, %xmm1, %xmm2     # xmm2 = xmm2[1,3],xmm1[1,3]
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
andps %xmm2, %xmm0
movmskps %xmm0, %ecx
xorl %edx, %edx
testl %ecx, %ecx
jne 0x3a67b7
testq %rax, %rax
je 0x3a67b7
movq 0x20(%rsp), %rcx
decl %ecx
movl %ecx, 0x14(%rsp)
movl $0x7, %ecx
subl 0x18(%rsp), %ecx
movl %ecx, 0x28(%rsp)
movl 0x30(%rsp), %esi
movd %esi, %xmm0
movdqa %xmm0, 0xa0(%rsp)
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm2      # xmm2 = xmm0[0,0,0,0]
movq 0x50(%rsp), %rdx
movd %edx, %xmm1
pshuflw $0x0, %xmm1, %xmm0      # xmm0 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm3      # xmm3 = xmm0[0,0,0,0]
movl 0x40(%rsp), %ecx
addl $0xffff8001, %ecx       # imm = 0xFFFF8001
movd %ecx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x40(%rsp)
movd 0x80(%rsp), %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x70(%rsp)
movzwl %cx, %ecx
movd %ecx, %xmm4
movq 0x58(%rsp), %r9
movl %r9d, %ecx
imull %edx, %ecx
negl %ecx
movd %ecx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movdqa %xmm4, 0x80(%rsp)
paddsw %xmm4, %xmm0
movdqa %xmm0, 0xb0(%rsp)
movl %esi, %esi
movl %edx, %ecx
movslq %r13d, %rdx
negq %rsi
movq %rcx, 0x30(%rsp)
imulq %rcx, %r9
xorl %r10d, %r10d
movq $-0x7fff, %r11          # imm = 0x8001
movq $-0x8000, %rcx          # imm = 0x8000
movq %rdx, %r8
xorl %r15d, %r15d
cmpq %r11, %r8
movq $-0x8000, %rdi          # imm = 0x8000
cmovgeq %r8, %rdi
movw %di, 0xd0(%rsp,%r15,2)
leaq (%rsi,%r8), %rdi
cmpq %r11, %rdi
cmovlq %rcx, %rdi
movw %di, 0xc0(%rsp,%r15,2)
incq %r15
subq %r9, %r8
cmpq $0x8, %r15
jne 0x3a6040
movq %r10, %rdi
shlq $0x4, %rdi
movaps 0xd0(%rsp), %xmm0
movaps %xmm0, (%rbx,%rdi)
movdqa 0xc0(%rsp), %xmm0
movdqa %xmm0, (%r12,%rdi)
incq %r10
subq 0x30(%rsp), %rdx
movq 0x58(%rsp), %r15
cmpq %r15, %r10
jne 0x3a603a
movq 0x8(%rsp), %rdx
movw $0x0, (%rdx)
movq 0x20(%rsp), %rsi
movl %esi, %ecx
addl $0x7, %esi
andl $-0x8, %esi
movq %rcx, 0x20(%rsp)
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm7     # xmm7 = xmm0[0,1,0,1]
movd %r13d, %xmm0
movdqa %xmm0, %xmm5
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x30(%rsp)
pshufd $0x0, %xmm1, %xmm10     # xmm10 = xmm1[0,0,0,0]
movq 0x50(%rsp), %r11
movl %r11d, %edi
negl %edi
leal (,%r11,8), %r8d
leal (%r11,%r11,2), %r9d
negl %r9d
addl %r11d, %r11d
xorl %r10d, %r10d
movdqa 0x282d8a(%rip), %xmm15  # 0x628ea0
pxor %xmm15, %xmm7
pcmpeqd %xmm1, %xmm1
movdqa 0x2839e8(%rip), %xmm11  # 0x629b10
movq %r10, %xmm0
pshufd $0x44, %xmm0, %xmm12    # xmm12 = xmm0[0,1,0,1]
movdqa %xmm12, %xmm0
por 0x282d50(%rip), %xmm0   # 0x628e90
pxor %xmm15, %xmm0
movdqa %xmm0, %xmm6
pcmpgtd %xmm7, %xmm6
pshufd $0xa0, %xmm6, %xmm4     # xmm4 = xmm6[0,0,2,2]
pshuflw $0xe8, %xmm4, %xmm13    # xmm13 = xmm4[0,2,2,3,4,5,6,7]
pcmpeqd %xmm7, %xmm0
pshufd $0xf5, %xmm0, %xmm14    # xmm14 = xmm0[1,1,3,3]
pshuflw $0xe8, %xmm14, %xmm9    # xmm9 = xmm14[0,2,2,3,4,5,6,7]
pand %xmm13, %xmm9
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
pshuflw $0xe8, %xmm6, %xmm0     # xmm0 = xmm6[0,2,2,3,4,5,6,7]
por %xmm9, %xmm0
pxor %xmm1, %xmm0
packssdw %xmm0, %xmm0
movd %edi, %xmm9
punpckldq %xmm5, %xmm9    # xmm9 = xmm9[0],xmm5[0],xmm9[1],xmm5[1]
movd %r11d, %xmm13
movdqa 0xa0(%rsp), %xmm8
punpckldq %xmm13, %xmm8   # xmm8 = xmm8[0],xmm13[0],xmm8[1],xmm13[1]
psubd %xmm8, %xmm9
leal (%r9,%r13), %ecx
movd %r13d, %xmm8
movd %ecx, %xmm13
shufps $0xd4, %xmm9, %xmm13    # xmm13 = xmm13[0,1],xmm9[1,3]
punpckldq %xmm8, %xmm9    # xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
shufps $0x21, %xmm13, %xmm9    # xmm9 = xmm9[1,0],xmm13[2,0]
movaps %xmm9, %xmm13
pcmpgtd %xmm11, %xmm13
andps %xmm13, %xmm9
pandn %xmm11, %xmm13
por %xmm9, %xmm13
movd %xmm0, %ecx
testb $0x1, %cl
je 0x3a61ef
movd %xmm13, %ecx
movw %cx, 0x2(%rdx,%r10,2)
pand %xmm4, %xmm14
por %xmm6, %xmm14
packssdw %xmm14, %xmm14
pxor %xmm1, %xmm14
packssdw %xmm14, %xmm14
movd %xmm14, %ecx
shrl $0x10, %ecx
testb $0x1, %cl
je 0x3a6221
pextrw $0x2, %xmm13, %ecx
movw %cx, 0x4(%rdx,%r10,2)
movdqa %xmm12, %xmm4
por 0x282c52(%rip), %xmm4   # 0x628e80
pxor %xmm15, %xmm4
movdqa %xmm4, %xmm6
pcmpgtd %xmm7, %xmm6
pshufd $0xa0, %xmm6, %xmm0     # xmm0 = xmm6[0,0,2,2]
pcmpeqd %xmm7, %xmm4
pshufd $0xf5, %xmm4, %xmm4     # xmm4 = xmm4[1,1,3,3]
movdqa %xmm4, %xmm8
pand %xmm0, %xmm8
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
por %xmm6, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm1, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x2, %xmm8, %ecx
testb $0x1, %cl
je 0x3a6283
pextrw $0x4, %xmm13, %ecx
movw %cx, 0x6(%rdx,%r10,2)
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm4, %xmm4     # xmm4 = xmm4[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm4
pshufhw $0x84, %xmm6, %xmm0     # xmm0 = xmm6[0,1,2,3,4,5,4,6]
por %xmm4, %xmm0
pxor %xmm1, %xmm0
packssdw %xmm0, %xmm0
pextrw $0x3, %xmm0, %ecx
testb $0x1, %cl
je 0x3a62b8
pextrw $0x6, %xmm13, %ecx
movw %cx, 0x8(%rdx,%r10,2)
movdqa %xmm12, %xmm4
por 0x282c0b(%rip), %xmm4   # 0x628ed0
movd %r10d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
por 0x283829(%rip), %xmm0   # 0x629b00
pshufd $0xf5, %xmm0, %xmm6     # xmm6 = xmm0[1,1,3,3]
pmuludq %xmm10, %xmm0
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
pshufd $0xf5, %xmm10, %xmm8    # xmm8 = xmm10[1,1,3,3]
pmuludq %xmm6, %xmm8
pshufd $0xe8, %xmm8, %xmm6     # xmm6 = xmm8[0,2,2,3]
punpckldq %xmm6, %xmm0    # xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
movdqa 0x30(%rsp), %xmm6
psubd %xmm0, %xmm6
movdqa %xmm6, %xmm13
pcmpgtd %xmm11, %xmm13
pand %xmm13, %xmm6
pandn %xmm11, %xmm13
por %xmm6, %xmm13
pxor %xmm15, %xmm4
movdqa %xmm4, %xmm8
pcmpgtd %xmm7, %xmm8
pshufd $0xa0, %xmm8, %xmm6     # xmm6 = xmm8[0,0,2,2]
pshuflw $0xe8, %xmm6, %xmm9     # xmm9 = xmm6[0,2,2,3,4,5,6,7]
pcmpeqd %xmm7, %xmm4
pshufd $0xf5, %xmm4, %xmm0     # xmm0 = xmm4[1,1,3,3]
pshuflw $0xe8, %xmm0, %xmm14    # xmm14 = xmm0[0,2,2,3,4,5,6,7]
pand %xmm9, %xmm14
pshufd $0xf5, %xmm8, %xmm4     # xmm4 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm4, %xmm8     # xmm8 = xmm4[0,2,2,3,4,5,6,7]
por %xmm14, %xmm8
pxor %xmm1, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x4, %xmm8, %ecx
testb $0x1, %cl
je 0x3a637e
movd %xmm13, %ecx
movw %cx, 0xa(%rdx,%r10,2)
pand %xmm6, %xmm0
por %xmm4, %xmm0
packssdw %xmm0, %xmm0
pxor %xmm1, %xmm0
packssdw %xmm0, %xmm0
pextrw $0x5, %xmm0, %ecx
testb $0x1, %cl
je 0x3a63a8
pextrw $0x2, %xmm13, %ecx
movw %cx, 0xc(%rdx,%r10,2)
por 0x282b0f(%rip), %xmm12  # 0x628ec0
pxor %xmm15, %xmm12
movdqa %xmm12, %xmm6
pcmpgtd %xmm7, %xmm6
pshufd $0xa0, %xmm6, %xmm0     # xmm0 = xmm6[0,0,2,2]
pcmpeqd %xmm7, %xmm12
pshufd $0xf5, %xmm12, %xmm4    # xmm4 = xmm12[1,1,3,3]
movdqa %xmm4, %xmm8
pand %xmm0, %xmm8
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
por %xmm6, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm1, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x6, %xmm8, %ecx
testb $0x1, %cl
je 0x3a6409
pextrw $0x4, %xmm13, %ecx
movw %cx, 0xe(%rdx,%r10,2)
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm4, %xmm4     # xmm4 = xmm4[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm4
pshufhw $0x84, %xmm6, %xmm0     # xmm0 = xmm6[0,1,2,3,4,5,4,6]
por %xmm4, %xmm0
pxor %xmm1, %xmm0
packssdw %xmm0, %xmm0
pextrw $0x7, %xmm0, %ecx
testb $0x1, %cl
je 0x3a643e
pextrw $0x6, %xmm13, %ecx
movw %cx, 0x10(%rdx,%r10,2)
addq $0x8, %r10
subl %r8d, %edi
subl %r8d, %r13d
addl %r8d, %r11d
cmpq %r10, %rsi
jne 0x3a6128
pxor %xmm0, %xmm0
psubsw %xmm2, %xmm0
leal -0x1(%r15), %ecx
shlq $0x4, %rcx
movq %rax, %rdx
addq %rcx, %rdx
movl %r15d, %edi
movdqa %xmm0, (%rdx)
psubsw %xmm3, %xmm0
addq $-0x10, %rdx
decl %edi
jg 0x3a646d
movq %rbx, %rdi
addq %rcx, %rdi
movq %r15, %r8
shlq $0x4, %r8
xorl %r9d, %r9d
movl %r15d, %r10d
movdqa 0x285367(%rip), %xmm15  # 0x62b800
movdqa 0x283a9f(%rip), %xmm7   # 0x629f40
movdqa 0x285376(%rip), %xmm9   # 0x62b820
movdqa 0x28537d(%rip), %xmm10  # 0x62b830
movdqa 0x285384(%rip), %xmm11  # 0x62b840
xorl %r11d, %r11d
movdqa 0x40(%rsp), %xmm1
movdqa 0x70(%rsp), %xmm4
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rsi
movdqa (%rdi), %xmm14
pslldq $0x2, %xmm14            # xmm14 = zero,zero,xmm14[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, (%rdx,%r11,2), %xmm14
movq 0x60(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x68(%rsp), %rdx
movzbl (%rdx,%r11), %edx
movslq (%rcx,%rdx,4), %r15
imulq %r10, %r15
shlq $0x4, %r15
addq 0x98(%rsp), %r15
movdqa 0x40(%rsp), %xmm13
movdqa %xmm13, %xmm12
psubsw (%rax), %xmm12
xorl %r13d, %r13d
movdqa %xmm7, %xmm8
movdqa %xmm15, %xmm7
movdqa (%rbx,%r13), %xmm6
movdqa (%r12,%r13), %xmm0
movdqa %xmm6, %xmm5
psubsw %xmm2, %xmm5
psubsw %xmm3, %xmm0
movdqa %xmm5, %xmm15
pcmpgtw %xmm0, %xmm15
pand %xmm7, %xmm15
pxor %xmm8, %xmm15
movq 0x10(%r14), %rcx
movq (%rcx), %rcx
addq %r9, %rcx
paddsw (%rax,%r13), %xmm12
paddsw (%r15,%r13), %xmm14
pmaxsw %xmm12, %xmm13
movdqa %xmm15, (%r13,%rcx)
pmaxsw %xmm5, %xmm0
pminsw %xmm0, %xmm4
movdqa %xmm0, (%r12,%r13)
movdqa %xmm0, %xmm12
pmaxsw %xmm14, %xmm12
movdqa %xmm12, (%rbp,%r13)
movdqa %xmm14, (%rbx,%r13)
addq $0x10, %r13
movdqa %xmm6, %xmm14
cmpq %r13, %r8
jne 0x3a652c
pslldq $0x2, %xmm12            # xmm12 = zero,zero,xmm12[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x8(%rsp), %rdx
pinsrw $0x0, 0x2(%rdx,%r11,2), %xmm12
incq %r11
movdqa (%rax), %xmm0
paddsw %xmm12, %xmm0
pmaxsw %xmm0, %xmm13
movl $0x6, %ecx
movdqa 0xb0(%rsp), %xmm5
movdqa %xmm13, %xmm0
pslldq $0x2, %xmm13            # xmm13 = zero,zero,xmm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
paddsw %xmm5, %xmm13
pmaxsw %xmm0, %xmm13
decl %ecx
jne 0x3a65e3
pslldq $0x2, %xmm13            # xmm13 = zero,zero,xmm13[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
paddsw 0x80(%rsp), %xmm13
pmaxsw %xmm13, %xmm12
xorl %r15d, %r15d
movdqa %xmm7, %xmm15
movdqa %xmm8, %xmm7
movdqa 0x2851e9(%rip), %xmm8   # 0x62b810
movq 0x10(%r14), %rcx
movq (%rcx), %rcx
addq %r9, %rcx
movdqa (%rbp,%r15), %xmm0
psubsw %xmm2, %xmm12
psubsw %xmm3, %xmm13
movdqa %xmm12, %xmm14
pmaxsw %xmm13, %xmm14
pcmpgtw %xmm13, %xmm12
pand %xmm8, %xmm12
pxor %xmm9, %xmm12
movdqa %xmm0, %xmm5
pmaxsw %xmm14, %xmm5
movdqa (%rbx,%r15), %xmm6
pcmpeqw %xmm5, %xmm6
pcmpgtw %xmm14, %xmm0
paddw %xmm10, %xmm0
movdqa %xmm6, %xmm13
pandn %xmm0, %xmm13
pand %xmm11, %xmm6
por %xmm13, %xmm6
por (%r15,%rcx), %xmm12
por %xmm6, %xmm12
movdqa %xmm12, (%r15,%rcx)
movdqa %xmm5, (%rbx,%r15)
pminsw %xmm14, %xmm4
pminsw %xmm5, %xmm4
pmaxsw %xmm5, %xmm1
addq $0x10, %r15
movdqa %xmm5, %xmm12
movdqa %xmm14, %xmm13
cmpq %r15, %r8
jne 0x3a6627
addq %r8, %r9
cmpq %rsi, %r11
jne 0x3a64d5
movl 0x2c(%rsp), %ecx
shlq $0x4, %rcx
movdqa (%rbx,%rcx), %xmm2
cmpl $0x6, 0x18(%rsp)
jg 0x3a6708
xorl %ecx, %ecx
movl 0x1c(%rsp), %edx
movl 0x14(%rsp), %esi
movl 0x28(%rsp), %edi
movdqa 0x70(%rsp), %xmm3
pslldq $0x2, %xmm2             # xmm2 = zero,zero,xmm2[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
incl %ecx
cmpl %edi, %ecx
jl 0x3a66fb
jmp 0x3a6716
movl 0x1c(%rsp), %edx
movl 0x14(%rsp), %esi
movdqa 0x70(%rsp), %xmm3
movdqa 0x40(%rsp), %xmm0
pcmpgtw %xmm4, %xmm0
pcmpgtw %xmm3, %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %ecx
testl %ecx, %ecx
je 0x3a673d
orb $0x40, 0xc(%r14)
xorl %ecx, %ecx
xorl %esi, %esi
xorl %edx, %edx
jmp 0x3a6742
pextrw $0x7, %xmm2, %ecx
movswl %cx, %ecx
movl %ecx, (%r14)
movl %edx, 0x4(%r14)
movl %esi, 0x8(%r14)
movq %rax, %rdi
callq 0x20a60d
movq %rbx, %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq 0x8(%rsp), %rdi
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
movq %r14, %rdx
jmp 0x3a67b7
callq 0x1bcebd
jmp 0x3a67b5
callq 0x1bce97
jmp 0x3a67b5
callq 0x1bce71
jmp 0x3a67b5
callq 0x1bce4b
jmp 0x3a67b5
callq 0x1bce25
jmp 0x3a67b5
callq 0x1bcdff
jmp 0x3a67b5
callq 0x1bcdd9
jmp 0x3a67b5
callq 0x1bcdb3
xorl %edx, %edx
movq %rdx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq