// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_diag_sse2_128_32.c
// Function: parasail_sg_flags_rowcol_diag_sse2_128_32
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,
        int s1_beg, int s1_end, int s2_beg, int s2_end)
{
    /* declare local variables */
    int32_t N = 0;
    int32_t PAD = 0;
    int32_t PAD2 = 0;
    int32_t s1Len = 0;
    int32_t s1Len_PAD = 0;
    int32_t s2Len_PAD = 0;
    int32_t * restrict s1 = NULL;
    int32_t * restrict s2B = NULL;
    int32_t * restrict _H_pr = NULL;
    int32_t * restrict _F_pr = NULL;
    int32_t * restrict s2 = NULL;
    int32_t * restrict H_pr = NULL;
    int32_t * restrict F_pr = NULL;
    parasail_result_t *result = NULL;
    int32_t i = 0;
    int32_t j = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    int32_t NEG_LIMIT = 0;
    int32_t POS_LIMIT = 0;
    int32_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 vMaxHRow;
    __m128i vMaxHCol;
    __m128i vLastVal;
    __m128i vEndI;
    __m128i vEndJ;
    __m128i vILimit;
    __m128i vILimit1;
    __m128i vJLimit;
    __m128i vJLimit1;
    __m128i vIBoundary;

    /* 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 = 4; /* 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 = 0;
    end_ref = 0;
    NEG_LIMIT = (-open < matrix->min ? INT32_MIN + open : INT32_MIN - matrix->min) + 1;
    POS_LIMIT = INT32_MAX - matrix->max - 1;
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi32(NEG_LIMIT);
    vPosLimit = _mm_set1_epi32(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vNegInf = _mm_set1_epi32(NEG_LIMIT);
    vOpen = _mm_set1_epi32(open);
    vGap  = _mm_set1_epi32(gap);
    vOne = _mm_set1_epi32(1);
    vN = _mm_set1_epi32(N);
    vGapN = s1_beg ? _mm_set1_epi32(0) : _mm_set1_epi32(gap*N);
    vNegOne = _mm_set1_epi32(-1);
    vI = _mm_set_epi32(0,1,2,3);
    vJreset = _mm_set_epi32(0,-1,-2,-3);
    vMaxHRow = vNegInf;
    vMaxHCol = vNegInf;
    vLastVal = vNegInf;
    vEndI = vNegInf;
    vEndJ = vNegInf;
    vILimit = _mm_set1_epi32(s1Len);
    vILimit1 = _mm_sub_epi32(vILimit, vOne);
    vJLimit = _mm_set1_epi32(s2Len);
    vJLimit1 = _mm_sub_epi32(vJLimit, vOne);
    vIBoundary = s1_beg ? _mm_set1_epi32(0) : _mm_set_epi32(
            -open-0*gap,
            -open-1*gap,
            -open-2*gap,
            -open-3*gap);

    /* initialize result */
#ifdef PARASAIL_TABLE
    result = parasail_result_new_table1(s1Len, s2Len);
#else
#ifdef PARASAIL_ROWCOL
    result = parasail_result_new_rowcol1(s1Len, s2Len);
#else
    result = parasail_result_new();
#endif
#endif
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_DIAG
        | PARASAIL_FLAG_BITS_32 | PARASAIL_FLAG_LANES_4;
    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;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* initialize heap variables */
    s2B= parasail_memalign_int32_t(16, s2Len+PAD2);
    _H_pr = parasail_memalign_int32_t(16, s2Len+PAD2);
    _F_pr = parasail_memalign_int32_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_int32_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 */
    if (s2_beg) {
        for (j=0; j<s2Len; ++j) {
            H_pr[j] = 0;
            F_pr[j] = NEG_LIMIT;
        }
    }
    else {
        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 vF = 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))];
        __m128i vIltLimit = _mm_cmplt_epi32(vI, vILimit);
        __m128i vIeqLimit1 = _mm_cmpeq_epi32(vI, vILimit1);
        vNH = _mm_srli_si128(vNH, 4);
        vNH = _mm_insert_epi32_rpl(vNH, H_pr[-1], 3);
        vWH = _mm_srli_si128(vWH, 4);
        vWH = _mm_insert_epi32_rpl(vWH, s1_beg ? 0 : (-open - i*gap), 3);
        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, 4);
            vNH = _mm_insert_epi32_rpl(vNH, H_pr[j], 3);
            vF = _mm_srli_si128(vF, 4);
            vF = _mm_insert_epi32_rpl(vF, F_pr[j], 3);
            vF = _mm_max_epi32_rpl(
                    _mm_sub_epi32(vNH, vOpen),
                    _mm_sub_epi32(vF, vGap));
            vE = _mm_max_epi32_rpl(
                    _mm_sub_epi32(vWH, vOpen),
                    _mm_sub_epi32(vE, vGap));
            vMat = _mm_set_epi32(
                    matrow0[s2[j-0]],
                    matrow1[s2[j-1]],
                    matrow2[s2[j-2]],
                    matrow3[s2[j-3]]
                    );
            vNWH = _mm_add_epi32(vNWH, vMat);
            vWH = _mm_max_epi32_rpl(vNWH, vE);
            vWH = _mm_max_epi32_rpl(vWH, vF);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi32(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_epi32_rpl(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi32_rpl(vSaturationCheckMax, vWH);
            }
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vWH, i, s1Len, j, s2Len);
#endif
#ifdef PARASAIL_ROWCOL
            arr_store_rowcol(result->rowcols->score_row, result->rowcols->score_col, vWH, i, s1Len, j, s2Len);
#endif
            H_pr[j-3] = (int32_t)_mm_extract_epi32_rpl(vWH,0);
            F_pr[j-3] = (int32_t)_mm_extract_epi32_rpl(vF,0);
            /* as minor diagonal vector passes across the i or j limit
             * boundary, extract the last value of the column or row */
            {
                __m128i vJeqLimit1 = _mm_cmpeq_epi32(vJ, vJLimit1);
                __m128i vJgtNegOne = _mm_cmpgt_epi32(vJ, vNegOne);
                __m128i vJltLimit = _mm_cmplt_epi32(vJ, vJLimit);
                __m128i cond_j = _mm_and_si128(vIltLimit, vJeqLimit1);
                __m128i cond_i = _mm_and_si128(vIeqLimit1,
                        _mm_and_si128(vJgtNegOne, vJltLimit));
                __m128i cond_max_row = _mm_cmpgt_epi32(vWH, vMaxHRow);
                __m128i cond_max_col = _mm_cmpgt_epi32(vWH, vMaxHCol);
                __m128i cond_last_val = _mm_and_si128(vIeqLimit1, vJeqLimit1);
                __m128i cond_all_row = _mm_and_si128(cond_max_row, cond_i);
                __m128i cond_all_col = _mm_and_si128(cond_max_col, cond_j);
                vMaxHRow = _mm_blendv_epi8_rpl(vMaxHRow, vWH, cond_all_row);
                vMaxHCol = _mm_blendv_epi8_rpl(vMaxHCol, vWH, cond_all_col);
                vLastVal = _mm_blendv_epi8_rpl(vLastVal, vWH, cond_last_val);
                vEndI = _mm_blendv_epi8_rpl(vEndI, vI, cond_all_col);
                vEndJ = _mm_blendv_epi8_rpl(vEndJ, vJ, cond_all_row);
            }
            vJ = _mm_add_epi32(vJ, vOne);
        }
        vI = _mm_add_epi32(vI, vN);
        vIBoundary = _mm_sub_epi32(vIBoundary, vGapN);
    }

    /* alignment ending position */
    {
        int32_t max_row = NEG_LIMIT;
        int32_t max_col = NEG_LIMIT;
        int32_t last_val = NEG_LIMIT;
        int32_t *s = (int32_t*)&vMaxHRow;
        int32_t *t = (int32_t*)&vMaxHCol;
        int32_t *u = (int32_t*)&vLastVal;
        int32_t *i = (int32_t*)&vEndI;
        int32_t *j = (int32_t*)&vEndJ;
        int32_t k;
        for (k=0; k<N; ++k, ++s, ++t, ++u, ++i, ++j) {
            if (*t > max_col || (*t == max_col && *i < end_query)) {
                max_col = *t;
                end_query = *i;
            }
            if (*s > max_row) {
                max_row = *s;
                end_ref = *j;
            }
            if (*u > last_val) {
                last_val = *u;
            }
        }
        if (s1_end && s2_end) {
            if (max_col > max_row || (max_col == max_row && end_ref == s2Len-1)) {
                score = max_col;
                end_ref = s2Len-1;
            }
            else {
                score = max_row;
                end_query = s1Len-1;
            }
        }
        else if (s1_end) {
            score = max_col;
            end_ref = s2Len-1;
        }
        else if (s2_end) {
            score = max_row;
            end_query = s1Len-1;
        }
        else {
            score = last_val;
            end_query = s1Len-1;
            end_ref = s2Len-1;
        }
    }

    if (_mm_movemask_epi8(_mm_or_si128(
            _mm_cmplt_epi32(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi32(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 $0x1f8, %rsp            # imm = 0x1F8
testq %rdx, %rdx
je 0x35a1b0
testl %ecx, %ecx
jle 0x35a1ba
movl %r8d, %ebp
testl %r8d, %r8d
js 0x35a1c4
testl %r9d, %r9d
js 0x35a1ce
movq 0x230(%rsp), %r13
testq %r13, %r13
je 0x35a1d8
movq %rdx, %r15
cmpl $0x0, 0x30(%r13)
je 0x35967c
movl 0x34(%r13), %esi
jmp 0x35968d
testq %rdi, %rdi
je 0x35a25d
testl %esi, %esi
jle 0x35a264
movq %rdi, 0x60(%rsp)
leal 0x3(%rsi), %r12d
leal 0x3(%rcx), %r10d
movl %ebp, %r8d
negl %r8d
movl 0x20(%r13), %eax
movl $0x80000000, %edi       # imm = 0x80000000
movl %ebp, %edx
orl %edi, %edx
subl %eax, %edi
movl %r8d, 0xc(%rsp)
cmpl %r8d, %eax
cmovgl %edx, %edi
incl %edi
movl $0x7ffffffe, %ebx       # imm = 0x7FFFFFFE
subl 0x1c(%r13), %ebx
movd %edi, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x50(%rsp)
movd %r9d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pxor %xmm1, %xmm1
movdqa %xmm1, 0x80(%rsp)
cmpl $0x0, 0x238(%rsp)
movdqa %xmm0, 0x1d0(%rsp)
je 0x359704
pxor %xmm0, %xmm0
jmp 0x359709
pslld $0x2, %xmm0
movdqa %xmm0, 0x120(%rsp)
movl %r10d, 0x90(%rsp)
movl %edi, 0x8(%rsp)
movdqa 0x50(%rsp), %xmm0
movdqa %xmm0, 0x160(%rsp)
movdqa %xmm0, 0x150(%rsp)
movdqa %xmm0, 0x140(%rsp)
movdqa %xmm0, 0xd0(%rsp)
movdqa %xmm0, 0x130(%rsp)
jne 0x359795
movl 0xc(%rsp), %r8d
movl %r8d, %eax
subl %r9d, %eax
movl %r8d, %edx
subl %r9d, %edx
subl %r9d, %edx
leal (%r9,%r9,2), %edi
addl %ebp, %edi
negl %edi
movd %edx, %xmm0
movd %edi, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movd %eax, %xmm0
movd %r8d, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
movdqa %xmm2, 0x80(%rsp)
movq %r9, 0x78(%rsp)
movq %rsi, 0x20(%rsp)
movl %esi, %edi
movl %ecx, %esi
movq %rcx, %r14
callq 0x20ac53
testq %rax, %rax
je 0x35a269
movl %r12d, 0x28(%rsp)
movl %ebp, 0x40(%rsp)
xorl %edi, %edi
cmpl $0x0, 0x238(%rsp)
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0x240(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x248(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x250(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x4441002, %ecx        # imm = 0x4441002
movq %rax, 0x10(%rsp)
movl %ecx, 0xc(%rax)
movq %r14, 0x30(%rsp)
addl $0x6, %r14d
movl $0x10, %edi
movq %r14, %rsi
callq 0x20a62d
movq %rax, %r12
movl $0x10, %edi
movq %r14, %rsi
callq 0x20a62d
movq %rax, %rbp
movl $0x10, %edi
movq %r14, %rsi
callq 0x20a62d
testq %r12, %r12
sete %dl
movq %rbp, 0x48(%rsp)
testq %rbp, %rbp
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x35a269
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x30(%r13)
je 0x35988a
movq $0x0, 0x38(%rsp)
movl 0x90(%rsp), %r14d
jmp 0x359904
movslq 0x28(%rsp), %rsi
movl $0x10, %edi
callq 0x20a62d
testq %rax, %rax
movl 0x90(%rsp), %r14d
je 0x35a269
movq 0x20(%rsp), %r8
testl %r8d, %r8d
movq 0x60(%rsp), %r9
jle 0x3598d5
movq 0x10(%r13), %rdi
movl %r8d, %ecx
xorl %edx, %edx
movzbl (%r9,%rdx), %esi
movl (%rdi,%rsi,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x3598c2
movslq %r8d, %rdx
movq %rax, 0x38(%rsp)
leaq (%rax,%rdx,4), %rdi
leal 0x1(%r8), %eax
movl 0x28(%rsp), %ecx
cmpl %eax, %ecx
cmovgl %ecx, %eax
movl %r8d, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %esi, %esi
callq 0x19e090
movd 0x20(%rsp), %xmm0
movq 0x30(%rsp), %rsi
movd %esi, %xmm1
movd %ebx, %xmm2
movd 0x40(%rsp), %xmm3
pshufd $0x0, %xmm0, %xmm4      # xmm4 = xmm0[0,0,0,0]
pcmpeqd %xmm5, %xmm5
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
pshufd $0x0, %xmm2, %xmm0      # xmm0 = xmm2[0,0,0,0]
movdqa %xmm0, 0xa0(%rsp)
pshufd $0x0, %xmm3, %xmm0      # xmm0 = xmm3[0,0,0,0]
movdqa %xmm0, 0x190(%rsp)
movdqa %xmm4, 0x1c0(%rsp)
paddd %xmm5, %xmm4
movdqa %xmm4, 0x180(%rsp)
movdqa %xmm1, 0x1a0(%rsp)
paddd %xmm1, %xmm5
movdqa %xmm5, 0x1b0(%rsp)
movq 0x10(%r13), %rax
movl %esi, %ebx
xorl %ecx, %ecx
movq 0x48(%rsp), %rbp
movzbl (%r15,%rcx), %edx
movl (%rax,%rdx,4), %edx
movl %edx, 0xc(%r12,%rcx,4)
incq %rcx
cmpq %rcx, %rbx
jne 0x359980
movl $0x0, 0x8(%r12)
movq $0x0, (%r12)
leaq (%r12,%rbx,4), %rdi
addq $0xc, %rdi
leal 0x1(%rsi), %eax
cmpl %eax, %r14d
cmovgl %r14d, %eax
movl %esi, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %esi, %esi
callq 0x19e090
xorl %eax, %eax
cmpl $0x0, 0x248(%rsp)
je 0x3599fa
movl 0x8(%rsp), %r9d
movq 0x18(%rsp), %rsi
movl $0x0, 0xc(%rbp,%rax,4)
movl %r9d, 0xc(%rsi,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x3599e3
jmp 0x359a20
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r9d
movq 0x78(%rsp), %rdx
movq 0x18(%rsp), %rsi
movl %ecx, 0xc(%rbp,%rax,4)
movl %r9d, 0xc(%rsi,%rax,4)
incq %rax
subl %edx, %ecx
cmpq %rax, %rbx
jne 0x359a0d
xorl %eax, %eax
movq 0x30(%rsp), %r10
movq 0x20(%rsp), %r11
movl %r9d, (%rbp,%rax,4)
movl %r9d, (%rsi,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x359a2c
leaq 0x3(%rbx), %rax
movl %r10d, %ecx
movl %r9d, (%rbp,%rax,4)
movl %r9d, (%rsi,%rax,4)
incq %rax
incl %ecx
cmpl %ecx, %r14d
jg 0x359a45
movl $0x0, 0x8(%rbp)
movdqa 0x50(%rsp), %xmm0
movdqa %xmm0, %xmm8
movdqa %xmm0, %xmm4
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm1
movdqa 0xa0(%rsp), %xmm2
testl %r11d, %r11d
jle 0x35a0d7
movq 0x8(%r13), %rax
movq %rax, 0xe0(%rsp)
leal -0x1(%r11), %ecx
movdqa 0x50(%rsp), %xmm3
movdqa %xmm3, %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm0, 0x170(%rsp)
leal -0x1(%r10), %eax
movq %rax, 0x108(%rsp)
cmpl $0x2, %r14d
movl $0x1, %eax
cmovgel %r14d, %eax
movq %rax, 0x100(%rsp)
movl %r11d, %edi
leaq 0x1(%rbx), %rax
movq %rax, 0xf8(%rsp)
leaq 0x2(%rbx), %rax
movq %rax, 0xf0(%rsp)
movaps 0x2cff7d(%rip), %xmm0   # 0x629a70
movaps %xmm0, 0x60(%rsp)
pcmpeqd %xmm12, %xmm12
movdqa %xmm3, %xmm9
movdqa %xmm3, %xmm2
xorl %r8d, %r8d
movdqa 0xa0(%rsp), %xmm0
movdqa %xmm0, 0xb0(%rsp)
movdqa %xmm3, 0xc0(%rsp)
movdqa %xmm3, %xmm5
movdqa %xmm3, %xmm4
movdqa %xmm3, %xmm8
movq %r8, %r11
orq $0x3, %r11
cmpl $0x0, 0x30(%r13)
je 0x359b68
movq %r8, %rax
orq $0x1, %rax
cmpq %rdi, %rax
cmovael %ecx, %eax
movq %r8, %rdx
orq $0x2, %rdx
cmpq %rdi, %rdx
cmovael %ecx, %edx
cmpq %rdi, %r11
movl %r11d, %r15d
cmovael %ecx, %r15d
movl %r8d, %r9d
jmp 0x359b7f
movq 0x38(%rsp), %rsi
movl (%rsi,%r8,4), %r9d
movl 0x4(%rsi,%r8,4), %eax
movl 0x8(%rsi,%r8,4), %edx
movl (%rsi,%r11,4), %r15d
movl 0x18(%r13), %r10d
imull %r10d, %eax
imull %r10d, %r9d
imull %r10d, %edx
imull %r10d, %r15d
leaq 0x4(%r8), %rsi
movq %rsi, 0xe8(%rsp)
movl %esi, %r10d
movq 0x78(%rsp), %r13
imull %r13d, %r10d
movl 0xc(%rsp), %r14d
movl %r14d, %esi
subl %r10d, %esi
movl %r8d, %r10d
imull %r13d, %r10d
subl %r10d, %r14d
cmpl $0x0, 0x238(%rsp)
cltq
movq 0xe0(%rsp), %r10
leaq (%r10,%rax,4), %rax
movq %rax, 0x40(%rsp)
movslq %r9d, %r9
leaq (%r10,%r9,4), %rax
movq %rax, 0x28(%rsp)
movslq %edx, %rdx
leaq (%r10,%rdx,4), %rax
movq %rax, 0x118(%rsp)
movslq %r15d, %rdx
leaq (%r10,%rdx,4), %rax
movq %rax, 0x110(%rsp)
movss 0x8(%rbp), %xmm0
movl %esi, 0x8(%rbp)
movl $0x0, %eax
cmovnel %eax, %r14d
movd %r14d, %xmm1
movaps 0x170(%rsp), %xmm15
shufps $0xe4, %xmm15, %xmm1    # xmm1 = xmm1[0,1],xmm15[2,3]
movaps %xmm15, %xmm14
shufps $0x24, %xmm1, %xmm14    # xmm14 = xmm14[0,1],xmm1[2,0]
shufps $0xe4, %xmm15, %xmm0    # xmm0 = xmm0[0,1],xmm15[2,3]
shufps $0x24, %xmm0, %xmm15    # xmm15 = xmm15[0,1],xmm0[2,0]
movq %r8, %r10
orq $0x1, %r10
movq %r8, %rsi
orq $0x2, %rsi
movdqa 0x180(%rsp), %xmm0
pcmpeqd 0x60(%rsp), %xmm0
movdqa %xmm0, 0x1e0(%rsp)
xorl %r9d, %r9d
movdqa 0x2d00b3(%rip), %xmm0   # 0x629d20
movaps 0x50(%rsp), %xmm10
movaps %xmm10, %xmm7
movq 0x18(%rsp), %rdx
movdqa %xmm8, 0x90(%rsp)
movslq 0xc(%r12,%r9,4), %r14
movslq 0x8(%r12,%r9,4), %r13
movslq 0x4(%r12,%r9,4), %rax
movslq (%r12,%r9,4), %rbp
movq 0x28(%rsp), %r15
movd (%r15,%r14,4), %xmm1
movq 0x40(%rsp), %r14
movd (%r14,%r13,4), %xmm8
punpckldq %xmm1, %xmm8    # xmm8 = xmm8[0],xmm1[0],xmm8[1],xmm1[1]
movq 0x118(%rsp), %r14
movd (%r14,%rax,4), %xmm1
movq 0x110(%rsp), %rax
movd (%rax,%rbp,4), %xmm11
punpckldq %xmm1, %xmm11   # xmm11 = xmm11[0],xmm1[0],xmm11[1],xmm1[1]
movq 0x48(%rsp), %rax
movss 0xc(%rax,%r9,4), %xmm1
shufps $0xf4, %xmm14, %xmm1    # xmm1 = xmm1[0,1],xmm14[3,3]
punpcklqdq %xmm8, %xmm11   # xmm11 = xmm11[0],xmm8[0]
paddd %xmm15, %xmm11
movaps %xmm14, %xmm15
shufps $0x29, %xmm1, %xmm15    # xmm15 = xmm15[1,2],xmm1[2,0]
movss 0xc(%rdx,%r9,4), %xmm1
shufps $0xf4, %xmm7, %xmm1     # xmm1 = xmm1[0,1],xmm7[3,3]
shufps $0x29, %xmm1, %xmm7     # xmm7 = xmm7[1,2],xmm1[2,0]
movaps %xmm15, %xmm1
movdqa 0x190(%rsp), %xmm13
psubd %xmm13, %xmm1
movdqa 0x1d0(%rsp), %xmm6
psubd %xmm6, %xmm7
movdqa %xmm1, %xmm8
pcmpgtd %xmm7, %xmm8
pand %xmm8, %xmm1
pandn %xmm7, %xmm8
por %xmm1, %xmm8
psubd %xmm13, %xmm14
psubd %xmm6, %xmm10
movdqa %xmm14, %xmm1
pcmpgtd %xmm10, %xmm1
pand %xmm1, %xmm14
pandn %xmm10, %xmm1
por %xmm14, %xmm1
movdqa %xmm11, %xmm7
pcmpgtd %xmm1, %xmm7
pand %xmm7, %xmm11
pandn %xmm1, %xmm7
por %xmm11, %xmm7
movdqa %xmm7, %xmm11
pcmpgtd %xmm8, %xmm11
pand %xmm11, %xmm7
pandn %xmm8, %xmm11
por %xmm7, %xmm11
movdqa %xmm0, %xmm13
pcmpeqd %xmm12, %xmm13
movdqa %xmm13, %xmm7
pandn %xmm11, %xmm7
movdqa 0x80(%rsp), %xmm14
pand %xmm13, %xmm14
por %xmm7, %xmm14
cmpq $0x4, %r9
jb 0x359e1b
movdqa 0xb0(%rsp), %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm14, %xmm7
movdqa %xmm14, %xmm10
pand %xmm7, %xmm10
pandn %xmm6, %xmm7
por %xmm10, %xmm7
movdqa 0xc0(%rsp), %xmm6
movdqa %xmm6, %xmm10
pcmpgtd %xmm14, %xmm10
pand %xmm10, %xmm6
pandn %xmm14, %xmm10
por %xmm10, %xmm6
movdqa %xmm6, 0xc0(%rsp)
movdqa %xmm7, 0xb0(%rsp)
cmpq %rcx, %r8
setne %al
movq 0x10(%rsp), %r14
movq 0x10(%r14), %r14
movq (%r14), %r13
movq 0x8(%r14), %r14
cmpq %rbx, %r9
setae %bpl
orb %al, %bpl
pshufd $0xff, %xmm14, %xmm7    # xmm7 = xmm14[3,3,3,3]
jne 0x359e4a
movd %xmm7, (%r13,%r9,4)
cmpq %r9, 0x108(%rsp)
jne 0x359e5a
movd %xmm7, (%r14,%r8,4)
cmpq %rcx, %r10
setne %al
leaq -0x1(%r9), %rbp
cmpq %rbx, %rbp
setae %bpl
orb %al, %bpl
pshufd $0xee, %xmm14, %xmm7    # xmm7 = xmm14[2,3,2,3]
jne 0x359e7d
movd %xmm7, -0x4(%r13,%r9,4)
cmpq %rdi, %r10
setae %al
cmpq %r9, %rbx
setne %bpl
orb %al, %bpl
jne 0x359e95
movd %xmm7, (%r14,%r10,4)
cmpq %rcx, %rsi
jne 0x359ec0
leaq -0x2(%r9), %rax
cmpq $0x2, %r9
setae %bpl
cmpq %rbx, %rax
setl %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x359ec0
pshufd $0x55, %xmm14, %xmm7    # xmm7 = xmm14[1,1,1,1]
movd %xmm7, -0x8(%r13,%r9,4)
cmpq %rdi, %rsi
setae %al
cmpq %r9, 0xf8(%rsp)
setne %bpl
orb %al, %bpl
jne 0x359ee3
pshufd $0x55, %xmm14, %xmm7    # xmm7 = xmm14[1,1,1,1]
movd %xmm7, (%r14,%rsi,4)
cmpq %rcx, %r11
setne %al
cmpq $0x3, %r9
setb %bpl
orb %al, %bpl
jne 0x359efd
movd %xmm14, -0xc(%r13,%r9,4)
movdqa %xmm13, %xmm7
pandn %xmm8, %xmm7
movdqa 0x50(%rsp), %xmm10
pand %xmm13, %xmm10
por %xmm10, %xmm7
pandn %xmm1, %xmm13
cmpq %rdi, %r11
setae %al
cmpq %r9, 0xf0(%rsp)
setne %bpl
movd %xmm14, %r13d
orb %al, %bpl
jne 0x359f3d
movl %r13d, (%r14,%r11,4)
por %xmm13, %xmm10
movdqa 0x1c0(%rsp), %xmm1
movdqa 0x60(%rsp), %xmm12
pcmpgtd %xmm12, %xmm1
movdqa 0x1b0(%rsp), %xmm13
pcmpeqd %xmm0, %xmm13
movdqa 0x1a0(%rsp), %xmm6
pcmpgtd %xmm0, %xmm6
movdqa %xmm0, %xmm8
psrad $0x1f, %xmm8
pandn %xmm6, %xmm8
movdqa %xmm14, %xmm6
pcmpgtd %xmm2, %xmm6
movdqa 0x1e0(%rsp), %xmm3
pand %xmm3, %xmm8
pand %xmm6, %xmm8
movdqa %xmm14, %xmm6
pcmpgtd %xmm9, %xmm6
pand %xmm13, %xmm1
pand %xmm6, %xmm1
movdqa %xmm8, %xmm6
pandn %xmm2, %xmm6
pand %xmm3, %xmm13
pand %xmm8, %xmm11
movdqa %xmm11, %xmm2
por %xmm6, %xmm2
movdqa %xmm1, %xmm6
pandn %xmm9, %xmm6
movdqa %xmm14, %xmm9
pand %xmm1, %xmm9
por %xmm6, %xmm9
movdqa %xmm14, %xmm6
pand %xmm13, %xmm6
pandn %xmm5, %xmm13
movdqa %xmm13, %xmm5
por %xmm6, %xmm5
pand %xmm1, %xmm12
pandn %xmm4, %xmm1
movdqa %xmm1, %xmm4
por %xmm12, %xmm4
movdqa %xmm0, %xmm1
pand %xmm8, %xmm1
pandn 0x90(%rsp), %xmm8
por %xmm1, %xmm8
movq 0x48(%rsp), %rbp
movl %r13d, (%rbp,%r9,4)
movq 0x18(%rsp), %rdx
movd %xmm7, (%rdx,%r9,4)
pcmpeqd %xmm12, %xmm12
psubd %xmm12, %xmm0
incq %r9
cmpq %r9, 0x100(%rsp)
jne 0x359c7c
movdqa 0x60(%rsp), %xmm0
paddd 0x2cfa8a(%rip), %xmm0   # 0x629af0
movdqa %xmm0, 0x60(%rsp)
movdqa 0x80(%rsp), %xmm0
psubd 0x120(%rsp), %xmm0
movdqa %xmm0, 0x80(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, %r8
cmpq %rdi, %rax
movq 0x230(%rsp), %r13
jb 0x359b31
movdqa %xmm2, 0x160(%rsp)
movdqa %xmm9, 0x150(%rsp)
movq 0x30(%rsp), %r10
movq 0x20(%rsp), %r11
movl 0x8(%rsp), %r9d
movdqa 0xc0(%rsp), %xmm1
movdqa 0xb0(%rsp), %xmm2
movdqa %xmm5, 0x140(%rsp)
movdqa %xmm4, 0xd0(%rsp)
movdqa %xmm8, 0x130(%rsp)
xorl %edi, %edi
movl %r9d, %eax
movl %r9d, %esi
xorl %ecx, %ecx
xorl %edx, %edx
movl 0x250(%rsp), %r14d
movl 0x240(%rsp), %r15d
movl 0x150(%rsp,%rdi,4), %r8d
cmpl %eax, %r8d
jle 0x35a128
movl 0xd0(%rsp,%rdi,4), %ecx
movl %r8d, %eax
jmp 0x35a143
jne 0x35a143
movl %r9d, %ebx
movl 0xd0(%rsp,%rdi,4), %r9d
cmpl %ecx, %r9d
cmovll %r9d, %ecx
movl %ebx, %r9d
cmovll %r8d, %eax
movl 0x160(%rsp,%rdi,4), %r8d
cmpl %esi, %r8d
jle 0x35a15a
movl 0x130(%rsp,%rdi,4), %edx
movl %r8d, %esi
movl 0x140(%rsp,%rdi,4), %r8d
cmpl %r9d, %r8d
cmovgl %r8d, %r9d
incq %rdi
cmpl $0x4, %edi
jne 0x35a10f
testl %r14d, %r14d
sete %dil
testl %r15d, %r15d
sete %r8b
orb %dil, %r8b
jne 0x35a1a1
cmpl %esi, %eax
movq 0x10(%rsp), %rdi
jg 0x35a1ab
jne 0x35a197
decl %r10d
cmpl %r10d, %edx
je 0x35a1f9
decl %r11d
movl %esi, %eax
movl %edx, %r10d
jmp 0x35a1f6
testl %r15d, %r15d
movq 0x10(%rsp), %rdi
je 0x35a1e2
decl %r10d
jmp 0x35a1f9
callq 0x1b56e5
jmp 0x35a269
callq 0x1b56bf
jmp 0x35a269
callq 0x1b5699
jmp 0x35a269
callq 0x1b5673
jmp 0x35a269
callq 0x1b564d
jmp 0x35a269
decl %r11d
decl %r10d
testl %r14d, %r14d
cmovnel %esi, %r9d
cmovnel %edx, %r10d
movl %r9d, %eax
movl %r11d, %ecx
movdqa 0x50(%rsp), %xmm0
pcmpgtd %xmm2, %xmm0
pcmpgtd 0xa0(%rsp), %xmm1
por %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
je 0x35a222
orb $0x40, 0xc(%rdi)
xorl %eax, %eax
xorl %r10d, %r10d
xorl %ecx, %ecx
movl %eax, (%rdi)
movl %ecx, 0x4(%rdi)
movl %r10d, 0x8(%rdi)
movq 0x18(%rsp), %rdi
callq 0x20a60d
movq %rbp, %rdi
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r13)
jne 0x35a256
movq 0x38(%rsp), %rdi
callq 0x20a60d
movq 0x10(%rsp), %rax
jmp 0x35a26b
callq 0x1b5627
jmp 0x35a269
callq 0x1b5601
xorl %eax, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq