// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/nw_trace_diag_sse2_128_16.c
// Function: parasail_nw_trace_diag_sse2_128_16
parasail_result_t* FNAME(
        const char * const restrict _s1, const int _s1Len,
        const char * const restrict _s2, const int s2Len,
        const int open, const int gap, const parasail_matrix_t *matrix)
{
    /* declare local variables */
    int32_t N = 0;
    int32_t PAD = 0;
    int32_t PAD2 = 0;
    int32_t s1Len_PAD = 0;
    int32_t s2Len_PAD = 0;
    int16_t * restrict s1 = NULL;
    int16_t * restrict s2B = NULL;
    int16_t * restrict _H_pr = NULL;
    int16_t * restrict _F_pr = NULL;
    int16_t * restrict s2 = NULL;
    int16_t * restrict H_pr = NULL;
    int16_t * restrict F_pr = NULL;
    parasail_result_t *result = NULL;
    int32_t i = 0;
    int32_t j = 0;
    int32_t s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    int16_t NEG_LIMIT = 0;
    int16_t POS_LIMIT = 0;
    int16_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vNegInf;
    __m128i vOpen;
    __m128i vGap;
    __m128i vOne;
    __m128i vN;
    __m128i vGapN;
    __m128i vNegOne;
    __m128i vI;
    __m128i vJreset;
    __m128i vMax;
    __m128i vILimit;
    __m128i vILimit1;
    __m128i vJLimit;
    __m128i vJLimit1;
    __m128i vIBoundary;
    __m128i vTDiag;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i vTDelF;

    /* validate inputs */
    PARASAIL_CHECK_NULL(_s2);
    PARASAIL_CHECK_GT0(s2Len);
    PARASAIL_CHECK_GE0(open);
    PARASAIL_CHECK_GE0(gap);
    PARASAIL_CHECK_NULL(matrix);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        PARASAIL_CHECK_NULL(_s1);
        PARASAIL_CHECK_GT0(_s1Len);
    }

    /* initialize stack variables */
    N = 8; /* number of values in vector */
    PAD = N-1;
    PAD2 = PAD*2;
    s1Len = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ? _s1Len : matrix->length;
    s1Len_PAD = s1Len+PAD;
    s2Len_PAD = s2Len+PAD;
    i = 0;
    j = 0;
    end_query = s1Len-1;
    end_ref = s2Len-1;
    NEG_LIMIT = (-open < matrix->min ? INT16_MIN + open : INT16_MIN - matrix->min) + 1;
    POS_LIMIT = INT16_MAX - matrix->max - 1;
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi16(NEG_LIMIT);
    vPosLimit = _mm_set1_epi16(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vNegInf = _mm_set1_epi16(NEG_LIMIT);
    vOpen = _mm_set1_epi16(open);
    vGap  = _mm_set1_epi16(gap);
    vOne = _mm_set1_epi16(1);
    vN = _mm_set1_epi16(N);
    vGapN = _mm_set1_epi16(gap*N);
    vNegOne = _mm_set1_epi16(-1);
    vI = _mm_set_epi16(0,1,2,3,4,5,6,7);
    vJreset = _mm_set_epi16(0,-1,-2,-3,-4,-5,-6,-7);
    vMax = vNegInf;
    vILimit = _mm_set1_epi16(s1Len);
    vILimit1 = _mm_subs_epi16(vILimit, vOne);
    vJLimit = _mm_set1_epi16(s2Len);
    vJLimit1 = _mm_subs_epi16(vJLimit, vOne);
    vIBoundary = _mm_set_epi16(
            -open-0*gap,
            -open-1*gap,
            -open-2*gap,
            -open-3*gap,
            -open-4*gap,
            -open-5*gap,
            -open-6*gap,
            -open-7*gap);
    vTDiag = _mm_set1_epi16(PARASAIL_DIAG);
    vTIns = _mm_set1_epi16(PARASAIL_INS);
    vTDel = _mm_set1_epi16(PARASAIL_DEL);
    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(s1Len, s2Len, 16, sizeof(int8_t));
    if (!result) return NULL;

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

    /* initialize heap variables */
    s2B= parasail_memalign_int16_t(16, s2Len+PAD2);
    _H_pr = parasail_memalign_int16_t(16, s2Len+PAD2);
    _F_pr = parasail_memalign_int16_t(16, s2Len+PAD2);
    s2 = s2B+PAD; /* will allow later for negative indices */
    H_pr = _H_pr+PAD;
    F_pr = _F_pr+PAD;

    /* validate heap variables */
    if (!s2B) return NULL;
    if (!_H_pr) return NULL;
    if (!_F_pr) return NULL;

    /* convert _s1 from char to int in range 0-23 */
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        s1 = parasail_memalign_int16_t(16, s1Len+PAD);
        if (!s1) return NULL;
        for (i=0; i<s1Len; ++i) {
            s1[i] = matrix->mapper[(unsigned char)_s1[i]];
        }
        /* pad back of s1 with dummy values */
        for (i=s1Len; i<s1Len_PAD; ++i) {
            s1[i] = 0; /* point to first matrix row because we don't care */
        }
    }

    /* convert _s2 from char to int in range 0-23 */
    for (j=0; j<s2Len; ++j) {
        s2[j] = matrix->mapper[(unsigned char)_s2[j]];
    }
    /* pad front of s2 with dummy values */
    for (j=-PAD; j<0; ++j) {
        s2[j] = 0; /* point to first matrix row because we don't care */
    }
    /* pad back of s2 with dummy values */
    for (j=s2Len; j<s2Len_PAD; ++j) {
        s2[j] = 0; /* point to first matrix row because we don't care */
    }

    /* set initial values for stored row */
    for (j=0; j<s2Len; ++j) {
        H_pr[j] = -open - j*gap;
        F_pr[j] = NEG_LIMIT;
    }
    /* pad front of stored row values */
    for (j=-PAD; j<0; ++j) {
        H_pr[j] = NEG_LIMIT;
        F_pr[j] = NEG_LIMIT;
    }
    /* pad back of stored row values */
    for (j=s2Len; j<s2Len+PAD; ++j) {
        H_pr[j] = NEG_LIMIT;
        F_pr[j] = NEG_LIMIT;
    }
    H_pr[-1] = 0; /* upper left corner */

    /* iterate over query sequence */
    for (i=0; i<s1Len; i+=N) {
        __m128i vNH = vNegInf;
        __m128i vWH = vNegInf;
        __m128i vE = vNegInf;
        __m128i vE_opn = vNegInf;
        __m128i vE_ext = vNegInf;
        __m128i vF = vNegInf;
        __m128i vF_opn = vNegInf;
        __m128i vF_ext = vNegInf;
        __m128i vJ = vJreset;
        const int * const restrict matrow0 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+0] : ((i+0 >= s1Len) ? s1Len-1 : i+0))];
        const int * const restrict matrow1 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+1] : ((i+1 >= s1Len) ? s1Len-1 : i+1))];
        const int * const restrict matrow2 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+2] : ((i+2 >= s1Len) ? s1Len-1 : i+2))];
        const int * const restrict matrow3 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+3] : ((i+3 >= s1Len) ? s1Len-1 : i+3))];
        const int * const restrict matrow4 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+4] : ((i+4 >= s1Len) ? s1Len-1 : i+4))];
        const int * const restrict matrow5 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+5] : ((i+5 >= s1Len) ? s1Len-1 : i+5))];
        const int * const restrict matrow6 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+6] : ((i+6 >= s1Len) ? s1Len-1 : i+6))];
        const int * const restrict matrow7 = &matrix->matrix[matrix->size * ((matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) ? s1[i+7] : ((i+7 >= s1Len) ? s1Len-1 : i+7))];
        vNH = _mm_srli_si128(vNH, 2);
        vNH = _mm_insert_epi16(vNH, H_pr[-1], 7);
        vWH = _mm_srli_si128(vWH, 2);
        vWH = _mm_insert_epi16(vWH, -open - i*gap, 7);
        H_pr[-1] = -open - (i+N)*gap;
        /* iterate over database sequence */
        for (j=0; j<s2Len+PAD; ++j) {
            __m128i vMat;
            __m128i vNWH = vNH;
            vNH = _mm_srli_si128(vWH, 2);
            vNH = _mm_insert_epi16(vNH, H_pr[j], 7);
            vF = _mm_srli_si128(vF, 2);
            vF = _mm_insert_epi16(vF, F_pr[j], 7);
            vF_opn = _mm_subs_epi16(vNH, vOpen);
            vF_ext = _mm_subs_epi16(vF, vGap);
            vF = _mm_max_epi16(vF_opn, vF_ext);
            vE_opn = _mm_subs_epi16(vWH, vOpen);
            vE_ext = _mm_subs_epi16(vE, vGap);
            vE = _mm_max_epi16(vE_opn, vE_ext);
            vMat = _mm_set_epi16(
                    matrow0[s2[j-0]],
                    matrow1[s2[j-1]],
                    matrow2[s2[j-2]],
                    matrow3[s2[j-3]],
                    matrow4[s2[j-4]],
                    matrow5[s2[j-5]],
                    matrow6[s2[j-6]],
                    matrow7[s2[j-7]]
                    );
            vNWH = _mm_adds_epi16(vNWH, vMat);
            vWH = _mm_max_epi16(vNWH, vE);
            vWH = _mm_max_epi16(vWH, vF);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi16(vJ,vNegOne);
                vWH = _mm_blendv_epi8_rpl(vWH, vIBoundary, cond);
                vF = _mm_blendv_epi8_rpl(vF, vNegInf, cond);
                vE = _mm_blendv_epi8_rpl(vE, vNegInf, cond);
            }
            /* cannot start checking sat until after J clears boundary */
            if (j > PAD) {
                vSaturationCheckMin = _mm_min_epi16(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi16(vSaturationCheckMax, vWH);
            }
            /* trace table */
            {
                __m128i case1 = _mm_cmpeq_epi16(vWH, vNWH);
                __m128i case2 = _mm_cmpeq_epi16(vWH, vF);
                __m128i vT = _mm_blendv_epi8_rpl(
                        _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                        vTDiag,
                        case1);
                __m128i condE = _mm_cmpgt_epi16(vE_opn, vE_ext);
                __m128i condF = _mm_cmpgt_epi16(vF_opn, vF_ext);
                __m128i vET = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, condE);
                __m128i vFT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, condF);
                vT = _mm_or_si128(vT, vET);
                vT = _mm_or_si128(vT, vFT);
                arr_store_si128(result->trace->trace_table, vT, i, s1Len, j, s2Len);
            }
            H_pr[j-7] = (int16_t)_mm_extract_epi16(vWH,0);
            F_pr[j-7] = (int16_t)_mm_extract_epi16(vF,0);
            /* as minor diagonal vector passes across table, extract
               last table value at the i,j bound */
            {
                __m128i cond_valid_I = _mm_cmpeq_epi16(vI, vILimit1);
                __m128i cond_valid_J = _mm_cmpeq_epi16(vJ, vJLimit1);
                __m128i cond_all = _mm_and_si128(cond_valid_I, cond_valid_J);
                vMax = _mm_blendv_epi8_rpl(vMax, vWH, cond_all);
            }
            vJ = _mm_adds_epi16(vJ, vOne);
        }
        vI = _mm_adds_epi16(vI, vN);
        vIBoundary = _mm_subs_epi16(vIBoundary, vGapN);
    }

    /* max in vMax */
    for (i=0; i<N; ++i) {
        int16_t value;
        value = (int16_t) _mm_extract_epi16(vMax, 7);
        if (value > score) {
            score = value;
        }
        vMax = _mm_slli_si128(vMax, 2);
    }

    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(_F_pr);
    parasail_free(_H_pr);
    parasail_free(s2B);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        parasail_free(s1);
    }

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %r9, 0x18(%rsp)
testq %rdx, %rdx
je 0x34e6f9
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x34e71d
movl %r8d, %ebp
testl %r8d, %r8d
js 0x34e741
cmpl $0x0, 0x18(%rsp)
js 0x34f1eb
movq 0x210(%rsp), %rax
testq %rax, %rax
je 0x34f20c
movq %rdx, %rbx
cmpl $0x0, 0x30(%rax)
je 0x34e5ad
movl 0x34(%rax), %r13d
jmp 0x34e5c1
testq %rdi, %rdi
je 0x34f22d
movl %esi, %r13d
testl %esi, %esi
jle 0x34f24e
movq %rdi, 0x10(%rsp)
movl %ebp, %edx
negl %edx
movq %rax, %rcx
movl 0x20(%rax), %eax
movl %eax, %r12d
negl %r12d
movl %edx, 0x4(%rsp)
cmpl %edx, %eax
cmovgl %ebp, %r12d
movw $0x7ffe, %ax            # imm = 0x7FFE
subw 0x1c(%rcx), %ax
movl %eax, 0x70(%rsp)
pushq $0x10
popq %rdx
pushq $0x1
popq %rcx
movl %r13d, %edi
movl %r15d, %esi
callq 0x1abb59
testq %rax, %rax
je 0x34e670
movq %rax, %r14
movl %ebp, 0x40(%rsp)
movq %r13, 0x60(%rsp)
movq %rbx, 0x8(%rsp)
orl $0x8281001, 0xc(%rax)   # imm = 0x8281001
movq %r15, 0x48(%rsp)
leal 0xe(%r15), %r13d
pushq $0x10
popq %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1ab77b
movq %rax, %r15
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1ab77b
movq %rax, %rbx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1ab77b
movq %rax, %rdx
testq %r15, %r15
sete %al
movq %rbx, 0xa8(%rsp)
testq %rbx, %rbx
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
orb %cl, %al
je 0x34e678
xorl %r14d, %r14d
jmp 0x34f277
movq 0x210(%rsp), %rax
cmpl $0x0, 0x30(%rax)
movq 0x60(%rsp), %rbx
movslq %ebx, %rbp
movq %rdx, 0x50(%rsp)
je 0x34e6a6
movq $0x0, 0x28(%rsp)
movq 0x8(%rsp), %r11
jmp 0x34e77c
leal 0x7(%rbx), %eax
movslq %eax, %r13
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x1ab77b
xorl %edi, %edi
testq %rax, %rax
movq 0x8(%rsp), %r11
je 0x34e670
testl %ebx, %ebx
movl $0x0, %ecx
cmovgl %ebx, %ecx
movq 0x10(%rsp), %r8
cmpq %rdi, %rcx
je 0x34e765
movq 0x210(%rsp), %rdx
movq 0x10(%rdx), %rdx
movzbl (%r8,%rdi), %esi
movzwl (%rdx,%rsi,4), %edx
movw %dx, (%rax,%rdi,2)
incq %rdi
jmp 0x34e6d2
movq 0x3ec8d8(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2788e1(%rip), %rsi    # 0x5c6feb
leaq 0x247ad4(%rip), %rdx    # 0x5961e5
leaq 0x278fe5(%rip), %rcx    # 0x5c76fd
jmp 0x34f26d
movq 0x3ec8b4(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x278fd3(%rip), %rsi    # 0x5c7701
leaq 0x247ab0(%rip), %rdx    # 0x5961e5
leaq 0x278fd9(%rip), %rcx    # 0x5c7715
jmp 0x34f26d
movq 0x3ec890(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x278fc9(%rip), %rsi    # 0x5c771b
leaq 0x247a8c(%rip), %rdx    # 0x5961e5
leaq 0x278fd0(%rip), %rcx    # 0x5c7730
jmp 0x34f26d
movq %rbp, %rcx
cmpq %r13, %rcx
jge 0x34e777
andw $0x0, (%rax,%rcx,2)
incq %rcx
jmp 0x34e768
movq %rax, 0x28(%rsp)
movd 0x70(%rsp), %xmm0
movl 0x40(%rsp), %r13d
movd %r13d, %xmm1
movq 0x18(%rsp), %r9
movl 0x4(%rsp), %r10d
movl %r10d, %ecx
subl %r9d, %ecx
subl %r9d, %ecx
imull $0xfffd, %r9d, %eax     # imm = 0xFFFD
subl %r13d, %eax
leal (,%r9,4), %edx
movl %r10d, %esi
subl %edx, %esi
imull $0xfffb, %r9d, %edx     # imm = 0xFFFB
subl %r13d, %edx
imull $0xfffa, %r9d, %edi     # imm = 0xFFFA
subl %r13d, %edi
imull $0xfff9, %r9d, %r8d     # imm = 0xFFF9
subl %r13d, %r8d
movd %esi, %xmm6
movd %edx, %xmm2
movd %edi, %xmm5
movq 0x48(%rsp), %rsi
leal 0x7(%rsi), %edi
movd %ebx, %xmm7
leal -0x1(%rbx), %edx
movl %edx, (%rsp)
movd %r8d, %xmm4
leal -0x1(%rsi), %edx
movl %edx, 0x58(%rsp)
addl $0xffff8001, %r12d      # imm = 0xFFFF8001
movd %r12d, %xmm3
pshuflw $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
movdqa %xmm3, 0x60(%rsp)
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, 0x150(%rsp)
pshuflw $0x0, %xmm1, %xmm0      # xmm0 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x1c0(%rsp)
movd %r9d, %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]
pshuflw $0x0, %xmm7, %xmm0      # xmm0 = xmm7[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm1      # xmm1 = xmm0[0,0,0,0]
pcmpeqd %xmm0, %xmm0
paddsw %xmm0, %xmm1
movdqa %xmm1, 0x180(%rsp)
movd %esi, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
paddsw %xmm0, %xmm1
movdqa %xmm1, 0x1a0(%rsp)
movdqa %xmm3, 0x1b0(%rsp)
psllw $0x3, %xmm3
movdqa %xmm3, 0x170(%rsp)
punpcklwd %xmm6, %xmm2    # xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3]
movd %ecx, %xmm0
movl %r10d, %ecx
subl %r9d, %ecx
punpcklwd %xmm5, %xmm4    # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1],xmm4[2],xmm5[2],xmm4[3],xmm5[3]
punpckldq %xmm2, %xmm4    # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
movd %eax, %xmm1
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movd %ecx, %xmm0
movd %r10d, %xmm2
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
punpcklqdq %xmm1, %xmm4    # xmm4 = xmm4[0],xmm1[0]
movdqa %xmm4, 0x70(%rsp)
movl %esi, %esi
movq 0x210(%rsp), %rax
movq 0x10(%rax), %rax
xorl %ecx, %ecx
movq 0xa8(%rsp), %rbx
cmpq %rcx, %rsi
je 0x34e906
movzbl (%r11,%rcx), %edx
movzwl (%rax,%rdx,4), %edx
movw %dx, 0xe(%r15,%rcx,2)
incq %rcx
jmp 0x34e8ed
xorl %eax, %eax
movq 0x50(%rsp), %r8
cmpq $0x7, %rax
je 0x34e91e
andw $0x0, (%r15,%rax,2)
incq %rax
jmp 0x34e90d
movq %rsi, %rax
cmpl %eax, %edi
jle 0x34e931
andw $0x0, 0xe(%r15,%rax,2)
incq %rax
jmp 0x34e921
xorl %eax, %eax
movl 0x4(%rsp), %ecx
cmpq %rax, %rsi
je 0x34e950
movw %cx, 0xe(%rbx,%rax,2)
subl 0x18(%rsp), %ecx
movw %r12w, 0xe(%r8,%rax,2)
incq %rax
jmp 0x34e937
xorl %eax, %eax
cmpq $0x7, %rax
je 0x34e967
movw %r12w, (%rbx,%rax,2)
movw %r12w, (%r8,%rax,2)
incq %rax
jmp 0x34e952
movq %rsi, %rax
cmpl %eax, %edi
jle 0x34e97f
movw %r12w, 0xe(%rbx,%rax,2)
movw %r12w, 0xe(%r8,%rax,2)
incq %rax
jmp 0x34e96a
andw $0x0, 0xc(%rbx)
movdqa 0x60(%rsp), %xmm0
movdqa %xmm0, %xmm1
psrldq $0x2, %xmm1             # xmm1 = xmm1[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
movdqa %xmm1, 0x160(%rsp)
xorl %ecx, %ecx
testl %edi, %edi
movl $0x0, %eax
movq %rax, 0xa0(%rsp)
cmovlel %ecx, %edi
movq %rdi, 0x48(%rsp)
leaq (,%rsi,8), %rax
movq %rax, 0xd8(%rsp)
movdqa 0x279072(%rip), %xmm12  # 0x5c7a40
xorl %r13d, %r13d
movdqa %xmm0, %xmm11
movdqa %xmm0, 0xc0(%rsp)
movdqa 0x150(%rsp), %xmm0
movdqa %xmm0, 0xb0(%rsp)
movl %r12d, 0x5c(%rsp)
cmpq %rbp, %r13
movq 0x210(%rsp), %rax
jge 0x34f13d
cmpl $0x0, 0x30(%rax)
je 0x34eab4
movq %r13, %rdx
orq $0x1, %rdx
cmpq %rbp, %rdx
movl (%rsp), %ecx
movl %ecx, %r11d
movq %rdx, 0x98(%rsp)
cmovll %edx, %r11d
movq %r13, %rdx
orq $0x2, %rdx
cmpq %rbp, %rdx
movq %rdx, 0x38(%rsp)
cmovgel %ecx, %edx
movl %edx, 0x20(%rsp)
movq %r13, %rdx
orq $0x3, %rdx
cmpq %rbp, %rdx
movq %rdx, 0x10(%rsp)
cmovgel %ecx, %edx
movq %r13, %rdi
orq $0x4, %rdi
cmpq %rbp, %rdi
movq %rdi, 0x8(%rsp)
movl %edi, %r9d
cmovgel %ecx, %r9d
movq %r13, %rdi
orq $0x5, %rdi
cmpq %rbp, %rdi
movq %rdi, 0x30(%rsp)
cmovgel %ecx, %edi
movq %r13, %r8
orq $0x6, %r8
cmpq %rbp, %r8
movq %r8, 0x90(%rsp)
movl %r8d, %r12d
cmovgel %ecx, %r12d
movq %r13, %r8
orq $0x7, %r8
cmpq %rbp, %r8
movq %r8, 0x88(%rsp)
cmovgel %ecx, %r8d
movl %r13d, %r10d
jmp 0x34eb49
movq 0x28(%rsp), %rcx
movswl (%rcx,%r13,2), %r10d
movq %r13, %rdx
orq $0x1, %rdx
movq %rdx, 0x98(%rsp)
movswl 0x2(%rcx,%r13,2), %r11d
movq %r13, %rdx
orq $0x2, %rdx
movq %rdx, 0x38(%rsp)
movswl 0x4(%rcx,%r13,2), %edx
movl %edx, 0x20(%rsp)
movq %r13, %rdx
orq $0x3, %rdx
movq %rdx, 0x10(%rsp)
movswl 0x6(%rcx,%r13,2), %edx
movq %r13, %rdi
orq $0x4, %rdi
movq %rdi, 0x8(%rsp)
movswl 0x8(%rcx,%r13,2), %r9d
movq %r13, %rdi
orq $0x5, %rdi
movq %rdi, 0x30(%rsp)
movswl 0xa(%rcx,%r13,2), %edi
movq %r13, %r8
orq $0x6, %r8
movq %r8, 0x90(%rsp)
movswl 0xc(%rcx,%r13,2), %r12d
movq %r13, %r8
orq $0x7, %r8
movq %r8, 0x88(%rsp)
movswl 0xe(%rcx,%r13,2), %r8d
movq 0x8(%rax), %rcx
movl 0x18(%rax), %eax
imull %eax, %edi
movslq %edi, %rdi
leaq (%rcx,%rdi,4), %rdi
movq %rdi, 0x40(%rsp)
imull %eax, %edx
movslq %edx, %rdx
leaq (%rcx,%rdx,4), %rdx
movq %rdx, 0x148(%rsp)
imull %eax, %r11d
movslq %r11d, %rdx
leaq (%rcx,%rdx,4), %rdx
movq %rdx, 0x140(%rsp)
imull %eax, %r10d
movslq %r10d, %r10
leaq (%rcx,%r10,4), %rdx
movq %rdx, 0x138(%rsp)
movl 0x20(%rsp), %edx
imull %eax, %edx
movslq %edx, %r11
leaq (%rcx,%r11,4), %rdx
movq %rdx, 0x20(%rsp)
imull %eax, %r9d
movslq %r9d, %r9
leaq (%rcx,%r9,4), %rdx
movq %rdx, 0x130(%rsp)
imull %eax, %r12d
movslq %r12d, %r9
leaq (%rcx,%r9,4), %rdx
movq %rdx, 0x128(%rsp)
imull %eax, %r8d
movslq %r8d, %rax
leaq (%rcx,%rax,4), %rax
movq %rax, 0x120(%rsp)
movdqa 0x160(%rsp), %xmm6
movdqa %xmm6, %xmm15
pinsrw $0x7, 0xc(%rbx), %xmm15
movl %r13d, %eax
movq 0x18(%rsp), %rdi
imull %edi, %eax
movl 0x4(%rsp), %r8d
movl %r8d, %ecx
subl %eax, %ecx
pinsrw $0x7, %ecx, %xmm6
addq $0x8, %r13
movq %r13, 0xe0(%rsp)
movl %r13d, %eax
imull %edi, %eax
movl %r8d, %ecx
subl %eax, %ecx
movw %cx, 0xc(%rbx)
movq 0x98(%rsp), %r13
movq %r13, %rax
imulq %rsi, %rax
movq 0x38(%rsp), %rcx
imulq %rsi, %rcx
movq 0x10(%rsp), %rdi
imulq %rsi, %rdi
movq 0x8(%rsp), %r8
imulq %rsi, %r8
movq 0x30(%rsp), %r9
imulq %rsi, %r9
movq 0x90(%rsp), %r12
movq %r12, %r10
imulq %rsi, %r10
movq 0x88(%rsp), %rdx
movq %rdx, %r11
imulq %rsi, %r11
addq $-0x7, %r11
movq %r11, 0x110(%rsp)
addq $-0x2, %rcx
movq %rcx, 0x108(%rsp)
addq $-0x3, %rdi
movq %rdi, 0x100(%rsp)
addq $-0x4, %r8
movq %r8, 0xf8(%rsp)
addq $-0x5, %r9
movq %r9, 0xf0(%rsp)
addq $-0x6, %r10
movq %r10, 0xe8(%rsp)
decq %rax
movq %rax, 0x118(%rsp)
movdqa %xmm12, 0x190(%rsp)
pcmpeqw 0x180(%rsp), %xmm12
movdqa 0x60(%rsp), %xmm1
movdqa %xmm1, %xmm14
movdqa 0x278f17(%rip), %xmm10  # 0x5c7c10
xorl %eax, %eax
movq 0x50(%rsp), %r8
movq 0x38(%rsp), %rdi
movq %rdi, %r10
movq 0x30(%rsp), %r9
movq %rdx, %r11
cmpq %rax, 0x48(%rsp)
je 0x34f0f3
movdqa %xmm6, %xmm8
psrldq $0x2, %xmm8             # xmm8 = xmm8[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%rbx,%rax,2), %xmm8
movswq 0xe(%r15,%rax,2), %rcx
movq 0x138(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm2
movswq 0xc(%r15,%rax,2), %rcx
movq 0x140(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm5
movswq 0xa(%r15,%rax,2), %rcx
movq 0x20(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm7
movswq 0x8(%r15,%rax,2), %rcx
movq 0x148(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm0
movswq 0x6(%r15,%rax,2), %rcx
movq 0x130(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm9
movswq 0x4(%r15,%rax,2), %rcx
movq 0x40(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm3
movswq 0x2(%r15,%rax,2), %rcx
punpcklwd %xmm2, %xmm5    # xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1],xmm5[2],xmm2[2],xmm5[3],xmm2[3]
movq 0x128(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm2
movswq (%r15,%rax,2), %rcx
punpcklwd %xmm7, %xmm0    # xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1],xmm0[2],xmm7[2],xmm0[3],xmm7[3]
movq 0x120(%rsp), %rbx
movd (%rbx,%rcx,4), %xmm4
psrldq $0x2, %xmm1             # xmm1 = xmm1[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pinsrw $0x7, 0xe(%r8,%rax,2), %xmm1
punpckldq %xmm5, %xmm0    # xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
movdqa %xmm8, %xmm13
movdqa 0x1c0(%rsp), %xmm7
psubsw %xmm7, %xmm13
movdqa %xmm1, %xmm5
movdqa 0x1b0(%rsp), %xmm1
psubsw %xmm1, %xmm5
punpcklwd %xmm9, %xmm3    # xmm3 = xmm3[0],xmm9[0],xmm3[1],xmm9[1],xmm3[2],xmm9[2],xmm3[3],xmm9[3]
movdqa %xmm13, %xmm9
pmaxsw %xmm5, %xmm9
psubsw %xmm7, %xmm6
psubsw %xmm1, %xmm14
punpcklwd %xmm2, %xmm4    # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1],xmm4[2],xmm2[2],xmm4[3],xmm2[3]
movdqa %xmm6, %xmm7
pmaxsw %xmm14, %xmm7
punpckldq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
punpcklqdq %xmm0, %xmm4    # xmm4 = xmm4[0],xmm0[0]
paddsw %xmm4, %xmm15
movdqa %xmm7, %xmm1
pmaxsw %xmm9, %xmm1
pmaxsw %xmm15, %xmm1
movdqa %xmm10, %xmm0
pcmpeqw 0x278d16(%rip), %xmm0   # 0x5c7b60
movdqa %xmm0, %xmm3
pandn %xmm1, %xmm3
movdqa 0x70(%rsp), %xmm2
pand %xmm0, %xmm2
por %xmm3, %xmm2
movdqa %xmm0, %xmm1
pandn %xmm9, %xmm1
movdqa 0x60(%rsp), %xmm9
pand %xmm0, %xmm9
por %xmm9, %xmm1
cmpq $0x8, %rax
jb 0x34eeac
movdqa 0xb0(%rsp), %xmm3
pminsw %xmm2, %xmm3
movdqa %xmm3, 0xb0(%rsp)
movdqa 0xc0(%rsp), %xmm3
pmaxsw %xmm2, %xmm3
movdqa %xmm3, 0xc0(%rsp)
pcmpeqw %xmm2, %xmm15
movdqa %xmm2, %xmm3
pcmpeqw %xmm1, %xmm3
movdqa 0x278d5f(%rip), %xmm4   # 0x5c7c20
psubw %xmm3, %xmm4
movdqa %xmm15, %xmm3
pandn %xmm4, %xmm3
pand 0x27a849(%rip), %xmm15  # 0x5c9720
por %xmm3, %xmm15
pcmpgtw %xmm14, %xmm6
pand 0x27a7f7(%rip), %xmm6   # 0x5c96e0
pcmpgtw %xmm5, %xmm13
pand 0x27a7f9(%rip), %xmm13  # 0x5c96f0
por %xmm6, %xmm13
por %xmm15, %xmm13
pxor 0x27a986(%rip), %xmm13  # 0x5c9890
movq 0x10(%r14), %rcx
movq (%rcx), %r8
cmpq %rsi, %rax
jae 0x34ef2e
pextrw $0x7, %xmm13, %ecx
movq 0xa0(%rsp), %rdi
leaq (%r8,%rdi), %rbx
movq %r10, %rdi
movb %cl, (%rax,%rbx)
cmpq %rbp, %r13
setge %cl
leaq -0x1(%rax), %rbx
cmpq %rsi, %rbx
setae %bl
orb %cl, %bl
jne 0x34ef56
pextrw $0x6, %xmm13, %ecx
movq 0x118(%rsp), %rbx
addq %r8, %rbx
movb %cl, (%rax,%rbx)
cmpq %rbp, %rdi
jge 0x34ef88
leaq -0x2(%rax), %rcx
cmpq $0x2, %rax
setae %bl
cmpq %rsi, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x34ef88
pextrw $0x5, %xmm13, %ecx
movq 0x108(%rsp), %rdi
leaq (%r8,%rdi), %rbx
movb %cl, (%rax,%rbx)
cmpq %rbp, 0x10(%rsp)
movq 0x8(%rsp), %rdi
jge 0x34efc0
leaq -0x3(%rax), %rcx
cmpq $0x3, %rax
setae %bl
cmpq %rsi, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x34efc0
pextrw $0x4, %xmm13, %ecx
movq 0x100(%rsp), %rbx
addq %r8, %rbx
movb %cl, (%rax,%rbx)
cmpq %rbp, %rdi
jge 0x34eff2
leaq -0x4(%rax), %rcx
cmpq $0x4, %rax
setae %bl
cmpq %rsi, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x34eff2
pextrw $0x3, %xmm13, %ecx
movq 0xf8(%rsp), %rdi
leaq (%r8,%rdi), %rbx
movb %cl, (%rax,%rbx)
cmpq %rbp, %r9
jge 0x34f024
leaq -0x5(%rax), %rcx
cmpq $0x5, %rax
setae %bl
cmpq %rsi, %rcx
setl %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x34f024
pextrw $0x2, %xmm13, %ecx
movq 0xf0(%rsp), %rdi
leaq (%r8,%rdi), %rbx
movb %cl, (%rax,%rbx)
movq %r14, %rdi
movd %xmm13, %ecx
cmpq %rbp, %r12
jge 0x34f05f
leaq -0x6(%rax), %rbx
cmpq $0x6, %rax
setae %r14b
cmpq %rsi, %rbx
setl %bl
andb %r14b, %bl
cmpb $0x1, %bl
jne 0x34f05f
movl %ecx, %ebx
shrl $0x10, %ebx
movq 0xe8(%rsp), %r14
addq %r8, %r14
movb %bl, (%rax,%r14)
cmpq %rbp, %r11
setge %bl
cmpq $0x7, %rax
setb %r14b
orb %bl, %r14b
jne 0x34f07e
addq 0x110(%rsp), %r8
movb %cl, (%rax,%r8)
pandn %xmm7, %xmm0
por %xmm0, %xmm9
movd %xmm2, %ecx
movq 0xa8(%rsp), %rbx
movw %cx, (%rbx,%rax,2)
movd %xmm1, %ecx
movq 0x50(%rsp), %r8
movw %cx, (%r8,%rax,2)
movdqa %xmm10, %xmm0
pcmpeqw 0x1a0(%rsp), %xmm0
pand %xmm12, %xmm0
movdqa %xmm2, %xmm3
pand %xmm0, %xmm3
pandn %xmm11, %xmm0
por %xmm3, %xmm0
paddsw 0x278b4e(%rip), %xmm10  # 0x5c7c20
incq %rax
movdqa %xmm0, %xmm11
movdqa %xmm8, %xmm15
movdqa %xmm2, %xmm6
movdqa %xmm9, %xmm14
movq %rdi, %r14
movq %r10, %rdi
jmp 0x34ed10
movdqa 0x190(%rsp), %xmm12
paddsw 0x278b2a(%rip), %xmm12  # 0x5c7c30
movdqa 0x70(%rsp), %xmm0
psubsw 0x170(%rsp), %xmm0
movdqa %xmm0, 0x70(%rsp)
movq 0xd8(%rsp), %rax
addq %rax, 0xa0(%rsp)
movl 0x5c(%rsp), %r12d
movq 0xe0(%rsp), %r13
jmp 0x34e9f6
pushq $0x8
popq %rax
movl 0x58(%rsp), %edx
subl $0x1, %eax
jb 0x34f162
pextrw $0x7, %xmm11, %ecx
cmpw %r12w, %cx
cmovlel %r12d, %ecx
pslldq $0x2, %xmm11            # xmm11 = zero,zero,xmm11[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl %ecx, %r12d
jmp 0x34f144
movdqa 0x60(%rsp), %xmm0
pcmpgtw 0xb0(%rsp), %xmm0
movdqa 0xc0(%rsp), %xmm1
pcmpgtw 0x150(%rsp), %xmm1
por %xmm0, %xmm1
pmovmskb %xmm1, %eax
testl %eax, %eax
je 0x34f1a0
orb $0x40, 0xc(%r14)
xorl %r12d, %r12d
xorl %edx, %edx
movl $0x0, (%rsp)
movswl %r12w, %eax
movl %eax, (%r14)
movl (%rsp), %eax
movl %eax, 0x4(%r14)
movl %edx, 0x8(%r14)
movq %r8, %rdi
callq 0x1ab763
movq %rbx, %rdi
callq 0x1ab763
movq %r15, %rdi
callq 0x1ab763
movq 0x210(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x34f277
movq 0x28(%rsp), %rdi
callq 0x1ab763
jmp 0x34f277
movq 0x3ebde6(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x27851f(%rip), %rsi    # 0x5c771b
leaq 0x246fe2(%rip), %rdx    # 0x5961e5
leaq 0x27852b(%rip), %rcx    # 0x5c7735
jmp 0x34f26d
movq 0x3ebdc5(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x277dce(%rip), %rsi    # 0x5c6feb
leaq 0x246fc1(%rip), %rdx    # 0x5961e5
leaq 0x278717(%rip), %rcx    # 0x5c7942
jmp 0x34f26d
movq 0x3ebda4(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x277dad(%rip), %rsi    # 0x5c6feb
leaq 0x246fa0(%rip), %rdx    # 0x5961e5
leaq 0x2784ed(%rip), %rcx    # 0x5c7739
jmp 0x34f26d
movq 0x3ebd83(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2784a2(%rip), %rsi    # 0x5c7701
leaq 0x246f7f(%rip), %rdx    # 0x5961e5
leaq 0x2784d0(%rip), %rcx    # 0x5c773d
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x19e180
movq %r14, %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq