// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sg_trace_scan_sse2_128_16.c
// Function: parasail_sg_flags_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,
        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;
    __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 vMaxH;
    __m128i vPosMask;
    __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;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi16(_mm_set1_epi16(position),
            _mm_set_epi16(0,1,2,3,4,5,6,7));
    vNegInfFront = vZero;
    vNegInfFront = _mm_insert_epi16(vNegInfFront, NEG_LIMIT, 0);
    vSegLenXgap = _mm_adds_epi16(vNegInfFront,
            _mm_slli_si128(_mm_set1_epi16(-segLen*gap), 2));
    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);

    /* initialize result */
    result = parasail_result_new_trace(segLen, s2Len, 16, sizeof(__m128i));
    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_8;
    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___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 = 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;
            }
            _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 = s2_beg ? 0 : (-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);
            /* long queries and/or large penalties will break the pseudo prefix scan */
            vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vGapper);
        }
    }

    /* 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 vector containing last value from column */
        {
            __m128i vCompare;
            vH = _mm_load_si128(pvH + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi16(vH, vMaxH));
            vMaxH = _mm_max_epi16(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
        }
    } 

    /* max last value from all columns */
    if (s2_end)
    {
        for (k=0; k<position; ++k) {
            vMaxH = _mm_slli_si128(vMaxH, 2);
        }
        score = (int16_t) _mm_extract_epi16(vMaxH, 7);
        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 */
        {
            __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);
            end_ref = s2Len - 1;
            end_query = s1Len - 1;
        }
    }

    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 $0xd8, %rsp
movq %rsi, 0x78(%rsp)
testq %rdi, %rdi
je 0x3467c4
movq 0x30(%rdi), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x3467e8
movq 0x10(%rdi), %rax
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x34680c
movl 0x8(%rdi), %eax
movq %rax, 0x68(%rsp)
testl %eax, %eax
jle 0x346830
cmpq $0x0, 0x78(%rsp)
je 0x346854
movl %edx, %r13d
testl %edx, %edx
jle 0x346875
movl %ecx, %r14d
testl %ecx, %ecx
js 0x346896
testl %r8d, %r8d
js 0x3468b7
movl %r9d, %r12d
movl %r8d, 0x20(%rsp)
movq 0x68(%rsp), %rcx
leal -0x1(%rcx), %eax
leaq 0x7(%rcx), %r15
shrq $0x3, %r15
movl %eax, 0x2c(%rsp)
xorl %edx, %edx
divl %r15d
movl %eax, 0x40(%rsp)
movl %edx, %ebp
movl %r14d, %esi
negl %esi
movq 0x70(%rsp), %rdx
movl 0x20(%rdx), %eax
movl %eax, %ecx
negl %ecx
movl %esi, 0x1c(%rsp)
cmpl %esi, %eax
cmovgl %r14d, %ecx
movl %ecx, 0x4(%rsp)
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rdx), %ax
movl %eax, 0x50(%rsp)
pushq $0x10
popq %rcx
movl %r15d, %edi
movl %r13d, %esi
movq %rcx, %rdx
callq 0x1abb59
testq %rax, %rax
je 0x346374
movq %rax, %rbx
movl %r14d, 0x30(%rsp)
movl %ebp, 0x24(%rsp)
movl 0x120(%rsp), %edi
xorl %eax, %eax
testl %r12d, %r12d
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x110(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x118(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x28(%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 $0x8280402, %eax        # imm = 0x8280402
movl %eax, 0xc(%rbx)
pushq $0x10
popq %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r14
movq %r13, 0x60(%rsp)
leal 0x1(%r13), %esi
movq %rbp, %rdi
movq %rsi, 0x90(%rsp)
callq 0x1ab77b
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %r13
movq %rbp, %rdi
movq %r15, %rsi
callq 0x297cd8
movq %rax, %rbp
pushq $0x10
popq %rdi
movq %r15, 0x10(%rsp)
movq %r15, %rsi
callq 0x297cd8
movq %r14, %xmm0
movq 0x8(%rsp), %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq %r13, %xmm1
movq %rbp, %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 %r15d, %r15d
testl %ecx, %ecx
jne 0x3468e0
testq %rax, %rax
je 0x3468e0
movq 0x60(%rsp), %rcx
decl %ecx
movl %ecx, (%rsp)
pushq $0x7
popq %rcx
subl 0x40(%rsp), %ecx
movl 0x30(%rsp), %esi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm3      # xmm3 = xmm0[0,0,0,0]
movl 0x20(%rsp), %edx
movd %edx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm4      # xmm4 = xmm0[0,0,0,0]
movl 0x4(%rsp), %r15d
addl $0xffff8001, %r15d      # imm = 0xFFFF8001
movd %r15d, %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 0x50(%rsp), %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm2      # xmm2 = xmm0[0,0,0,0]
movl %ecx, 0x18(%rsp)
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, 0x80(%rsp)
movl %r15d, 0x4(%rsp)
movzwl %r15w, %ecx
movd %ecx, %xmm1
movq 0x10(%rsp), %rdi
movl %edi, %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, %xmm7      # xmm7 = xmm0[0,0,0,0]
pslldq $0x2, %xmm7             # xmm7 = zero,zero,xmm7[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movdqa %xmm1, 0xa0(%rsp)
paddsw %xmm1, %xmm7
movl %esi, %ecx
movl %edx, %edx
movslq 0x1c(%rsp), %rsi
movq %rdi, %r8
movq %rdx, 0x30(%rsp)
imulq %rdx, %r8
xorl %r9d, %r9d
movq $-0x7fff, %rdx          # imm = 0x8001
movq $-0x8000, %r10          # imm = 0x8000
cmpq %rdi, %r9
je 0x34637c
movq %rsi, 0x50(%rsp)
movq %rsi, %rdi
xorl %esi, %esi
cmpq $0x8, %rsi
je 0x34633a
testl %r12d, %r12d
je 0x346305
xorl %r11d, %r11d
jmp 0x346308
movq %rdi, %r11
cmpq %rdx, %r11
movq $-0x8000, %r15          # imm = 0x8000
cmovgeq %r11, %r15
subq %rcx, %r11
cmpq %rdx, %r11
cmovlq %r10, %r11
movw %r15w, 0xc0(%rsp,%rsi,2)
movw %r11w, 0xb0(%rsp,%rsi,2)
incq %rsi
subq %r8, %rdi
jmp 0x3462f5
movq %r9, %rsi
shlq $0x4, %rsi
movaps 0xc0(%rsp), %xmm0
movaps %xmm0, (%rbp,%rsi)
movdqa 0xb0(%rsp), %xmm0
movdqa %xmm0, (%r14,%rsi)
incq %r9
movq 0x50(%rsp), %rsi
subq 0x30(%rsp), %rsi
movq 0x10(%rsp), %rdi
jmp 0x3462e2
xorl %r15d, %r15d
jmp 0x3468e0
movq 0x8(%rsp), %rcx
andw $0x0, (%rcx)
pushq $0x1
popq %rcx
xorl %edx, %edx
movl 0x20(%rsp), %r9d
movl 0x1c(%rsp), %r10d
movl 0x118(%rsp), %r11d
movq 0x90(%rsp), %r15
movq 0x8(%rsp), %r8
cmpq %rcx, %r15
je 0x3463d1
cmpl $0xffff8001, %r10d      # imm = 0xFFFF8001
movl $0xffff8000, %esi       # imm = 0xFFFF8000
cmovgel %r10d, %esi
testl %r11d, %r11d
cmovnel %edx, %esi
movw %si, (%r8,%rcx,2)
incq %rcx
subl %r9d, %r10d
jmp 0x3463a9
pxor %xmm0, %xmm0
psubsw %xmm3, %xmm0
leal -0x1(%rdi), %ecx
movdqa %xmm2, 0x30(%rsp)
movl %ecx, %edx
testl %edx, %edx
js 0x3463ff
movl %edx, %esi
shlq $0x4, %rsi
movdqa %xmm0, (%rax,%rsi)
psubsw %xmm4, %xmm0
pminsw %xmm0, %xmm2
decl %edx
jmp 0x3463e4
movl %ecx, %r8d
shlq $0x4, %r8
addq %rbp, %r8
movl 0x24(%rsp), %esi
shlq $0x4, %rsi
addq %rbp, %rsi
movl 0x60(%rsp), %r9d
movq %rdi, %r10
shlq $0x4, %r10
xorl %r11d, %r11d
movdqa 0x80(%rsp), %xmm0
pcmpeqw 0x28160c(%rip), %xmm0   # 0x5c7a40
movdqa %xmm0, 0x80(%rsp)
movdqa 0x2832ca(%rip), %xmm12  # 0x5c9710
movdqa 0x2832d1(%rip), %xmm13  # 0x5c9720
movdqa 0x283288(%rip), %xmm14  # 0x5c96e0
movdqa 0x28196f(%rip), %xmm15  # 0x5c7dd0
xorl %r12d, %r12d
movdqa 0x40(%rsp), %xmm8
movdqa %xmm8, %xmm5
movl (%rsp), %edi
cmpq %r9, %r12
je 0x346685
movdqa %xmm5, 0x50(%rsp)
movdqa (%r8), %xmm5
pslldq $0x2, %xmm5             # xmm5 = zero,zero,xmm5[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movq 0x8(%rsp), %rcx
pinsrw $0x0, (%rcx,%r12,2), %xmm5
movq 0x70(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x78(%rsp), %rdx
movzbl (%rdx,%r12), %edx
movl (%rcx,%rdx,4), %ecx
imull 0x10(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq 0x98(%rsp), %rcx
movdqa 0x40(%rsp), %xmm9
movdqa %xmm9, %xmm1
psubsw (%rax), %xmm1
xorl %edx, %edx
cmpq %rdx, %r10
je 0x346558
movdqa (%rbp,%rdx), %xmm11
movdqa (%r14,%rdx), %xmm0
movdqa %xmm11, %xmm10
psubsw %xmm3, %xmm10
psubsw %xmm4, %xmm0
movdqa %xmm10, %xmm6
pcmpgtw %xmm0, %xmm6
pand %xmm14, %xmm6
pxor %xmm15, %xmm6
movq 0x10(%rbx), %r15
movq (%r15), %r15
paddsw (%rax,%rdx), %xmm1
paddsw (%rcx,%rdx), %xmm5
addq %r11, %r15
movdqa %xmm6, (%rdx,%r15)
pmaxsw %xmm10, %xmm0
pminsw %xmm0, %xmm2
pmaxsw %xmm1, %xmm9
movdqa %xmm0, (%r14,%rdx)
pmaxsw %xmm5, %xmm0
movdqa %xmm0, (%r13,%rdx)
movdqa %xmm5, (%rbp,%rdx)
addq $0x10, %rdx
movdqa %xmm0, %xmm1
movdqa %xmm11, %xmm5
jmp 0x3464d4
pslldq $0x2, %xmm1             # xmm1 = zero,zero,xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
leaq 0x1(%r12), %rcx
movq 0x8(%rsp), %rdx
pinsrw $0x0, 0x2(%rdx,%r12,2), %xmm1
movdqa (%rax), %xmm0
paddsw %xmm1, %xmm0
pmaxsw %xmm0, %xmm9
pushq $0x6
popq %rdx
movdqa 0x283168(%rip), %xmm11  # 0x5c96f0
movdqa %xmm9, %xmm5
pslldq $0x2, %xmm5             # xmm5 = zero,zero,xmm5[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
subl $0x1, %edx
jb 0x3465a2
paddsw %xmm7, %xmm5
pmaxsw %xmm5, %xmm9
jmp 0x346588
paddsw 0xa0(%rsp), %xmm5
pmaxsw %xmm5, %xmm1
xorl %edx, %edx
cmpq %rdx, %r10
je 0x346651
movq 0x10(%rbx), %r15
movq (%r15), %r15
addq %r11, %r15
movdqa (%r13,%rdx), %xmm9
psubsw %xmm3, %xmm1
psubsw %xmm4, %xmm5
movdqa %xmm1, %xmm0
pmaxsw %xmm5, %xmm0
pcmpgtw %xmm5, %xmm1
pand %xmm11, %xmm1
pxor 0x283114(%rip), %xmm1   # 0x5c9700
movdqa %xmm9, %xmm6
pmaxsw %xmm0, %xmm6
movdqa (%rbp,%rdx), %xmm5
pcmpeqw %xmm6, %xmm5
pcmpgtw %xmm0, %xmm9
paddw %xmm12, %xmm9
movdqa %xmm5, %xmm10
pandn %xmm9, %xmm10
pand %xmm13, %xmm5
por %xmm10, %xmm5
por (%rdx,%r15), %xmm1
por %xmm5, %xmm1
movdqa %xmm1, (%rdx,%r15)
movdqa %xmm6, (%rbp,%rdx)
pminsw %xmm0, %xmm2
pminsw %xmm6, %xmm2
pmaxsw %xmm6, %xmm8
addq $0x10, %rdx
movdqa %xmm0, %xmm5
movdqa %xmm6, %xmm1
jmp 0x3465b1
movdqa (%rsi), %xmm0
movdqa %xmm0, %xmm1
movdqa 0x50(%rsp), %xmm5
pcmpgtw %xmm5, %xmm1
pand 0x80(%rsp), %xmm1
pmaxsw %xmm0, %xmm5
pmovmskb %xmm1, %edx
testl %edx, %edx
cmovnel %r12d, %edi
addq %r10, %r11
movq %rcx, %r12
jmp 0x346473
cmpl $0x0, 0x120(%rsp)
movl 0x2c(%rsp), %r11d
movq 0x68(%rsp), %r15
movl 0x4(%rsp), %r12d
je 0x3466b7
xorl %ecx, %ecx
movl 0x18(%rsp), %edx
cmpl %edx, %ecx
jge 0x3466b1
pslldq $0x2, %xmm5             # xmm5 = zero,zero,xmm5[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
incl %ecx
jmp 0x3466a4
pextrw $0x7, %xmm5, %r12d
cmpl $0x0, 0x110(%rsp)
je 0x346729
movq 0x10(%rsp), %r8
andl $0xfffffff, %r8d        # imm = 0xFFFFFFF
shll $0x3, %r8d
xorl %edx, %edx
movl %r11d, %ecx
cmpl %edx, %r8d
je 0x34672c
movl %edx, %r10d
shrl $0x3, %r10d
movl %edx, %r9d
andl $0x7, %r9d
imull 0x10(%rsp), %r9d
addl %r10d, %r9d
cmpl %r15d, %r9d
jge 0x346724
movzwl (%rbp,%rdx,2), %r10d
cmpw %r12w, %r10w
jle 0x34670e
movl %r10d, %r12d
movl (%rsp), %edi
movl %r9d, %ecx
jmp 0x346724
cmpl %ecx, %r9d
cmovgel %ecx, %r9d
cmpl (%rsp), %edi
cmovnel %ecx, %r9d
cmpw %r12w, %r10w
cmovel %r9d, %ecx
incq %rdx
jmp 0x3466d6
movl %r11d, %ecx
movl 0x110(%rsp), %edx
orl %edx, 0x28(%rsp)
jne 0x34675c
movdqa (%rsi), %xmm0
xorl %ecx, %ecx
movl 0x18(%rsp), %edx
cmpl %edx, %ecx
jge 0x346750
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
incl %ecx
jmp 0x346743
pextrw $0x7, %xmm0, %r12d
movl (%rsp), %edi
movl %r11d, %ecx
movdqa 0x40(%rsp), %xmm0
pcmpgtw %xmm2, %xmm0
pcmpgtw 0x30(%rsp), %xmm8
por %xmm0, %xmm8
pmovmskb %xmm8, %edx
testl %edx, %edx
je 0x346786
orb $0x40, 0xc(%rbx)
xorl %r12d, %r12d
xorl %edi, %edi
xorl %ecx, %ecx
movswl %r12w, %edx
movl %edx, (%rbx)
movl %ecx, 0x4(%rbx)
movl %edi, 0x8(%rbx)
movq %rax, %rdi
callq 0x1ab763
movq %rbp, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq 0x8(%rsp), %rdi
callq 0x1ab763
movq %r14, %rdi
callq 0x1ab763
movq %rbx, %r15
jmp 0x3468e0
movq 0x3f480d(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280816(%rip), %rsi    # 0x5c6feb
leaq 0x282f7d(%rip), %rdx    # 0x5c9759
leaq 0x256cfa(%rip), %rcx    # 0x59d4dd
jmp 0x3468d6
movq 0x3f47e9(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2807f2(%rip), %rsi    # 0x5c6feb
leaq 0x282f59(%rip), %rdx    # 0x5c9759
leaq 0x281217(%rip), %rcx    # 0x5c7a1e
jmp 0x3468d6
movq 0x3f47c5(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2807ce(%rip), %rsi    # 0x5c6feb
leaq 0x282f35(%rip), %rdx    # 0x5c9759
leaq 0x28110e(%rip), %rcx    # 0x5c7939
jmp 0x3468d6
movq 0x3f47a1(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280ec0(%rip), %rsi    # 0x5c7701
leaq 0x282f11(%rip), %rdx    # 0x5c9759
leaq 0x2810fa(%rip), %rcx    # 0x5c7949
jmp 0x3468d6
movq 0x3f477d(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280786(%rip), %rsi    # 0x5c6feb
leaq 0x282eed(%rip), %rdx    # 0x5c9759
leaq 0x280e8b(%rip), %rcx    # 0x5c76fe
jmp 0x3468d6
movq 0x3f475c(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280e7b(%rip), %rsi    # 0x5c7701
leaq 0x282ecc(%rip), %rdx    # 0x5c9759
leaq 0x280e81(%rip), %rcx    # 0x5c7715
jmp 0x3468d6
movq 0x3f473b(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280e74(%rip), %rsi    # 0x5c771b
leaq 0x282eab(%rip), %rdx    # 0x5c9759
leaq 0x280e7b(%rip), %rcx    # 0x5c7730
jmp 0x3468d6
movq 0x3f471a(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x280e53(%rip), %rsi    # 0x5c771b
leaq 0x282e8a(%rip), %rdx    # 0x5c9759
leaq 0x280e5f(%rip), %rcx    # 0x5c7735
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x19e180
movq %r15, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq