// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sg_diag_sse41_128_32.c
// Function: parasail_sg_flags_rowcol_diag_sse41_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(vNH, H_pr[-1], 3);
        vWH = _mm_srli_si128(vWH, 4);
        vWH = _mm_insert_epi32(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(vNH, H_pr[j], 3);
            vF = _mm_srli_si128(vF, 4);
            vF = _mm_insert_epi32(vF, F_pr[j], 3);
            vF = _mm_max_epi32(
                    _mm_sub_epi32(vNH, vOpen),
                    _mm_sub_epi32(vF, vGap));
            vE = _mm_max_epi32(
                    _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(vNWH, vE);
            vWH = _mm_max_epi32(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(vWH, vIBoundary, cond);
                vF = _mm_blendv_epi8(vF, vNegInf, cond);
                vE = _mm_blendv_epi8(vE, vNegInf, cond);
            }
            /* cannot start checking sat until after J clears boundary */
            if (j > PAD) {
                vSaturationCheckMin = _mm_min_epi32(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi32(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(vWH,0);
            F_pr[j-3] = (int32_t)_mm_extract_epi32(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(vMaxHRow, vWH, cond_all_row);
                vMaxHCol = _mm_blendv_epi8(vMaxHCol, vWH, cond_all_col);
                vLastVal = _mm_blendv_epi8(vLastVal, vWH, cond_last_val);
                vEndI = _mm_blendv_epi8(vEndI, vI, cond_all_col);
                vEndJ = _mm_blendv_epi8(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 $0x1c8, %rsp            # imm = 0x1C8
testq %rdx, %rdx
je 0x453193
movl %ecx, %r12d
testl %ecx, %ecx
jle 0x45319d
movl %r8d, %ebp
testl %r8d, %r8d
js 0x4531a7
testl %r9d, %r9d
js 0x4531b1
movq 0x200(%rsp), %r13
testq %r13, %r13
je 0x4531bb
cmpl $0x0, 0x30(%r13)
je 0x4527b0
movl 0x34(%r13), %esi
jmp 0x4527c1
testq %rdi, %rdi
je 0x453252
testl %esi, %esi
jle 0x453259
movq %rdi, 0x58(%rsp)
movq %rdx, 0x40(%rsp)
leal 0x3(%rsi), %r14d
leal 0x3(%r12), %r15d
movl %ebp, %edi
negl %edi
movl 0x20(%r13), %eax
movl $0x80000000, %edx       # imm = 0x80000000
movl %ebp, %ecx
orl %edx, %ecx
subl %eax, %edx
movl %edi, 0x14(%rsp)
cmpl %edi, %eax
cmovgl %ecx, %edx
incl %edx
movl $0x7ffffffe, %ebx       # imm = 0x7FFFFFFE
subl 0x1c(%r13), %ebx
movd %edx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x60(%rsp)
movd %r9d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorps %xmm1, %xmm1
movaps %xmm1, 0x80(%rsp)
cmpl $0x0, 0x208(%rsp)
movdqa %xmm0, 0x1b0(%rsp)
je 0x452838
pxor %xmm0, %xmm0
jmp 0x45283d
pslld $0x2, %xmm0
movdqa %xmm0, 0x100(%rsp)
movl %edx, 0x10(%rsp)
movdqa 0x60(%rsp), %xmm0
movdqa %xmm0, 0x140(%rsp)
movdqa %xmm0, 0x130(%rsp)
movdqa %xmm0, 0x120(%rsp)
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm0, 0x110(%rsp)
jne 0x4528b7
movl 0x14(%rsp), %edi
movl %edi, %eax
subl %r9d, %eax
movl %edi, %edx
subl %r9d, %edx
subl %r9d, %edx
leal (%r9,%r9,2), %ecx
addl %ebp, %ecx
negl %ecx
movd %ecx, %xmm0
pinsrd $0x1, %edx, %xmm0
pinsrd $0x2, %eax, %xmm0
pinsrd $0x3, %edi, %xmm0
movdqa %xmm0, 0x80(%rsp)
movq %r9, 0x78(%rsp)
movq %rsi, 0x18(%rsp)
movl %esi, %edi
movl %r12d, %esi
callq 0x20ac53
testq %rax, %rax
je 0x45325e
movl %r14d, 0x30(%rsp)
movl %ebp, 0x50(%rsp)
xorl %edi, %edi
cmpl $0x0, 0x208(%rsp)
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0x210(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x218(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x220(%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, 0x28(%rsp)
movl %ecx, 0xc(%rax)
movq %r12, 0x8(%rsp)
leal 0x6(%r12), %ebp
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20a62d
movq %rax, %r12
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20a62d
movq %rax, %r14
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20a62d
testq %r12, %r12
sete %dl
movq %r14, 0x38(%rsp)
testq %r14, %r14
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x45325e
cmpl $0x0, 0x30(%r13)
movq %rax, 0x20(%rsp)
je 0x4529a0
xorl %r14d, %r14d
movl %r15d, %ebp
jmp 0x452a13
movslq 0x30(%rsp), %rsi
movl $0x10, %edi
callq 0x20a62d
testq %rax, %rax
je 0x45325e
movq %rax, %r14
movl %r15d, %ebp
movq 0x18(%rsp), %r8
testl %r8d, %r8d
movq 0x58(%rsp), %rdi
jle 0x4529e9
movq 0x10(%r13), %rax
movl %r8d, %ecx
xorl %edx, %edx
movzbl (%rdi,%rdx), %esi
movl (%rax,%rsi,4), %esi
movl %esi, (%r14,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x4529d6
movslq %r8d, %rax
leaq (%r14,%rax,4), %rdi
leal 0x1(%r8), %eax
movl 0x30(%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
movq 0x40(%rsp), %rsi
movl 0x218(%rsp), %r15d
movd %ebx, %xmm0
movd 0x18(%rsp), %xmm1
movq 0x8(%rsp), %rcx
movd %ecx, %xmm2
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x90(%rsp)
movd 0x50(%rsp), %xmm0
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
pcmpeqd %xmm3, %xmm3
pshufd $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x170(%rsp)
movdqa %xmm1, 0x1a0(%rsp)
paddd %xmm3, %xmm1
movdqa %xmm1, 0x160(%rsp)
movdqa %xmm2, 0x180(%rsp)
paddd %xmm2, %xmm3
movdqa %xmm3, 0x190(%rsp)
movq 0x10(%r13), %rax
movl %ecx, %ebx
xorl %ecx, %ecx
movzbl (%rsi,%rcx), %edx
movl (%rax,%rdx,4), %edx
movl %edx, 0xc(%r12,%rcx,4)
incq %rcx
cmpq %rcx, %rbx
jne 0x452a97
movq %r14, 0x70(%rsp)
movl $0x0, 0x8(%r12)
movq $0x0, (%r12)
leaq 0xc(%r12,%rbx,4), %rdi
movq 0x8(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl %eax, %ebp
cmovgl %ebp, %eax
notl %ecx
addl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %esi, %esi
callq 0x19e090
xorl %eax, %eax
testl %r15d, %r15d
je 0x452b14
movl 0x10(%rsp), %r10d
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %rdi
movl $0x0, 0xc(%r14,%rax,4)
movl %r10d, 0xc(%rdi,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x452afc
jmp 0x452b40
movl 0x14(%rsp), %ecx
movl 0x10(%rsp), %r10d
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %rdi
movq 0x78(%rsp), %rdx
movl %ecx, 0xc(%r14,%rax,4)
movl %r10d, 0xc(%rdi,%rax,4)
incq %rax
subl %edx, %ecx
cmpq %rax, %rbx
jne 0x452b2c
xorl %eax, %eax
movq 0x18(%rsp), %rdx
movl %r10d, (%r14,%rax,4)
movl %r10d, (%rdi,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x452b47
leaq 0x3(%rbx), %rax
movq 0x8(%rsp), %rcx
movl %r10d, (%r14,%rax,4)
movl %r10d, (%rdi,%rax,4)
incq %rax
incl %ecx
cmpl %ecx, %ebp
jg 0x452b61
movl $0x0, 0x8(%r14)
testl %edx, %edx
jle 0x453089
movq 0x8(%r13), %rax
movq %rax, 0xd0(%rsp)
leal -0x1(%rdx), %ecx
movdqa 0x60(%rsp), %xmm7
movdqa %xmm7, %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm0, 0x150(%rsp)
movq 0x8(%rsp), %rax
decl %eax
movq %rax, 0xf8(%rsp)
cmpl $0x2, %ebp
movl $0x1, %eax
cmovgel %ebp, %eax
movq %rax, 0xf0(%rsp)
movl %edx, %edi
leaq 0x1(%rbx), %rax
movq %rax, 0xe8(%rsp)
leaq 0x2(%rbx), %rax
movq %rax, 0xe0(%rsp)
movaps 0x1d6e84(%rip), %xmm0   # 0x629a70
movaps %xmm0, 0x40(%rsp)
movdqa %xmm7, %xmm12
movdqa %xmm7, %xmm15
xorl %r8d, %r8d
movdqa 0x90(%rsp), %xmm0
movdqa %xmm0, 0xa0(%rsp)
movdqa %xmm7, 0xb0(%rsp)
movdqa %xmm7, %xmm9
movdqa %xmm7, %xmm8
movq %r8, %r11
orq $0x3, %r11
cmpl $0x0, 0x30(%r13)
je 0x452c59
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, %esi
cmovael %ecx, %esi
movl %r8d, %r9d
jmp 0x452c70
movq 0x70(%rsp), %rsi
movl (%rsi,%r8,4), %r9d
movl 0x4(%rsi,%r8,4), %eax
movl 0x8(%rsi,%r8,4), %edx
movl (%rsi,%r11,4), %esi
movl 0x18(%r13), %r10d
imull %r10d, %eax
imull %r10d, %r9d
imull %r10d, %edx
imull %r10d, %esi
leaq 0x4(%r8), %r10
movq %r10, 0xd8(%rsp)
movq 0x78(%rsp), %r15
imull %r15d, %r10d
movl 0x14(%rsp), %r13d
movl %r13d, %ebp
subl %r10d, %ebp
movl %r8d, %r10d
imull %r15d, %r10d
subl %r10d, %r13d
cmpl $0x0, 0x208(%rsp)
cltq
movq 0xd0(%rsp), %r10
leaq (%r10,%rax,4), %rax
movq %rax, 0x58(%rsp)
movslq %r9d, %rax
leaq (%r10,%rax,4), %rax
movq %rax, 0x50(%rsp)
movslq %edx, %rax
leaq (%r10,%rax,4), %rax
movq %rax, 0x30(%rsp)
movslq %esi, %rax
leaq (%r10,%rax,4), %rdx
movdqa 0x150(%rsp), %xmm6
movdqa %xmm6, %xmm13
pinsrd $0x3, 0x8(%r14), %xmm13
movl %ebp, 0x8(%r14)
movl $0x0, %eax
cmovnel %eax, %r13d
pinsrd $0x3, %r13d, %xmm6
movq %r8, %r10
orq $0x1, %r10
movq %r8, %rsi
orq $0x2, %rsi
movdqa 0x160(%rsp), %xmm14
pcmpeqd 0x40(%rsp), %xmm14
xorl %r9d, %r9d
pmovsxbd 0x1d91b0(%rip), %xmm11  # 0x62beee
movdqa 0x60(%rsp), %xmm5
movdqa %xmm5, %xmm4
movq 0x20(%rsp), %r15
movslq 0xc(%r12,%r9,4), %rax
movslq 0x8(%r12,%r9,4), %r13
movslq 0x4(%r12,%r9,4), %rbp
movslq (%r12,%r9,4), %r14
movd (%rdx,%r14,4), %xmm0
movq 0x30(%rsp), %r14
pinsrd $0x1, (%r14,%rbp,4), %xmm0
movq 0x58(%rsp), %r14
pinsrd $0x2, (%r14,%r13,4), %xmm0
movq 0x50(%rsp), %r14
pinsrd $0x3, (%r14,%rax,4), %xmm0
paddd %xmm13, %xmm0
pshufd $0xf9, %xmm6, %xmm13    # xmm13 = xmm6[1,2,3,3]
movq 0x38(%rsp), %rax
pinsrd $0x3, 0xc(%rax,%r9,4), %xmm13
cmpq %rcx, %r8
pshufd $0xf9, %xmm4, %xmm4     # xmm4 = xmm4[1,2,3,3]
pinsrd $0x3, 0xc(%r15,%r9,4), %xmm4
pcmpeqd %xmm10, %xmm10
movdqa %xmm13, %xmm1
movdqa 0x170(%rsp), %xmm3
psubd %xmm3, %xmm1
movdqa 0x1b0(%rsp), %xmm2
psubd %xmm2, %xmm4
pmaxsd %xmm1, %xmm4
psubd %xmm3, %xmm6
psubd %xmm2, %xmm5
pmaxsd %xmm6, %xmm5
movdqa %xmm5, %xmm3
pmaxsd %xmm4, %xmm3
pmaxsd %xmm0, %xmm3
movdqa %xmm11, %xmm0
pcmpeqd %xmm10, %xmm0
movdqa %xmm3, %xmm6
blendvps %xmm0, 0x80(%rsp), %xmm6
setne %al
movaps 0x60(%rsp), %xmm1
blendvps %xmm0, %xmm1, %xmm4
blendvps %xmm0, %xmm1, %xmm5
cmpq $0x4, %r9
jb 0x452e59
movdqa 0xa0(%rsp), %xmm0
pminsd %xmm6, %xmm0
movdqa %xmm0, 0xa0(%rsp)
movdqa 0xb0(%rsp), %xmm0
pmaxsd %xmm6, %xmm0
movdqa %xmm0, 0xb0(%rsp)
movq 0x28(%rsp), %r14
movq 0x10(%r14), %r14
movq (%r14), %r13
movq 0x8(%r14), %rbp
cmpq %rbx, %r9
setae %r14b
orb %r14b, %al
jne 0x452e7e
pextrd $0x3, %xmm6, (%r13,%r9,4)
cmpq %r9, 0xf8(%rsp)
jne 0x452e91
pextrd $0x3, %xmm6, (%rbp,%r8,4)
cmpq %rcx, %r10
setne %al
leaq -0x1(%r9), %r14
cmpq %rbx, %r14
setae %r14b
orb %al, %r14b
jne 0x452eb0
pextrd $0x2, %xmm6, -0x4(%r13,%r9,4)
cmpq %rdi, %r10
setae %al
cmpq %r9, %rbx
setne %r14b
orb %al, %r14b
jne 0x452ecb
pextrd $0x2, %xmm6, (%rbp,%r10,4)
cmpq %rcx, %rsi
jne 0x452ef2
leaq -0x2(%r9), %rax
cmpq $0x2, %r9
setae %r14b
cmpq %rbx, %rax
setl %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x452ef2
pextrd $0x1, %xmm6, -0x8(%r13,%r9,4)
cmpq %rdi, %rsi
setae %al
cmpq %r9, 0xe8(%rsp)
setne %r14b
orb %al, %r14b
jne 0x452f11
pextrd $0x1, %xmm6, (%rbp,%rsi,4)
cmpq %rcx, %r11
setne %al
cmpq $0x3, %r9
setb %r14b
orb %al, %r14b
jne 0x452f2b
movd %xmm6, -0xc(%r13,%r9,4)
cmpq %rdi, %r11
setae %al
cmpq %r9, 0xe0(%rsp)
setne %r14b
movd %xmm6, %r13d
orb %al, %r14b
jne 0x452f4c
movl %r13d, (%rbp,%r11,4)
movdqa 0x1a0(%rsp), %xmm1
movdqa 0x40(%rsp), %xmm10
pcmpgtd %xmm10, %xmm1
movdqa 0x180(%rsp), %xmm0
pcmpgtd %xmm11, %xmm0
movdqa %xmm11, %xmm2
pandn %xmm0, %xmm2
movdqa %xmm6, %xmm0
pcmpgtd %xmm15, %xmm0
pand %xmm14, %xmm2
pand %xmm0, %xmm2
movdqa %xmm2, %xmm0
blendvps %xmm0, %xmm3, %xmm15
movdqa 0x190(%rsp), %xmm3
pcmpeqd %xmm11, %xmm3
movdqa %xmm6, %xmm0
pcmpgtd %xmm12, %xmm0
pand %xmm3, %xmm1
pand %xmm0, %xmm1
movdqa %xmm1, %xmm0
blendvps %xmm0, %xmm6, %xmm12
pand %xmm14, %xmm3
movdqa %xmm3, %xmm0
blendvps %xmm0, %xmm6, %xmm9
movdqa %xmm1, %xmm0
blendvps %xmm0, %xmm10, %xmm8
movdqa %xmm2, %xmm0
blendvps %xmm0, %xmm11, %xmm7
movq 0x38(%rsp), %r14
movl %r13d, (%r14,%r9,4)
movq 0x20(%rsp), %r15
movss %xmm4, (%r15,%r9,4)
pcmpeqd %xmm0, %xmm0
psubd %xmm0, %xmm11
incq %r9
cmpq %r9, 0xf0(%rsp)
jne 0x452d4d
movdqa 0x40(%rsp), %xmm0
paddd 0x1d6ad4(%rip), %xmm0   # 0x629af0
movdqa %xmm0, 0x40(%rsp)
movdqa 0x80(%rsp), %xmm0
psubd 0x100(%rsp), %xmm0
movdqa %xmm0, 0x80(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, %r8
cmpq %rdi, %rax
movq 0x200(%rsp), %r13
jb 0x452c23
movaps %xmm15, 0x140(%rsp)
movaps %xmm12, 0x130(%rsp)
movl 0x10(%rsp), %r10d
movq 0x20(%rsp), %rdi
movdqa 0xb0(%rsp), %xmm1
movdqa 0xa0(%rsp), %xmm2
jmp 0x4530aa
movdqa 0x60(%rsp), %xmm0
movdqa %xmm0, %xmm7
movdqa %xmm0, %xmm8
movdqa %xmm0, %xmm9
movdqa %xmm0, %xmm1
movdqa 0x90(%rsp), %xmm2
movaps %xmm9, 0x120(%rsp)
movaps %xmm8, 0xc0(%rsp)
movaps %xmm7, 0x110(%rsp)
xorl %r11d, %r11d
movl %r10d, %eax
movl %r10d, %esi
xorl %ecx, %ecx
xorl %edx, %edx
movl 0x210(%rsp), %ebx
movl 0x130(%rsp,%r11,4), %r8d
cmpl %eax, %r8d
jle 0x4530f2
movl 0xc0(%rsp,%r11,4), %ecx
movl %r8d, %eax
jmp 0x453107
jne 0x453107
movl 0xc0(%rsp,%r11,4), %r9d
cmpl %ecx, %r9d
cmovll %r9d, %ecx
cmovll %r8d, %eax
movl 0x140(%rsp,%r11,4), %r8d
cmpl %esi, %r8d
jle 0x45311f
movl 0x110(%rsp,%r11,4), %edx
movl %r8d, %esi
movl 0x120(%rsp,%r11,4), %r8d
cmpl %r10d, %r8d
cmovgl %r8d, %r10d
incq %r11
cmpl $0x4, %r11d
jne 0x4530d8
movl 0x220(%rsp), %r11d
testl %r11d, %r11d
sete %r9b
testl %ebx, %ebx
sete %r8b
orb %r9b, %r8b
jne 0x45317c
cmpl %esi, %eax
movq 0x18(%rsp), %r8
jg 0x453185
jne 0x45316e
movq 0x8(%rsp), %r9
decl %r9d
movq %r9, 0x8(%rsp)
cmpl %r9d, %edx
je 0x4531e4
decl %r8d
movl %esi, %eax
movl %edx, %ecx
movq %rcx, 0x8(%rsp)
jmp 0x4531e1
testl %ebx, %ebx
movq 0x18(%rsp), %r8
je 0x4531c5
movq 0x8(%rsp), %rdx
decl %edx
movq %rdx, 0x8(%rsp)
jmp 0x4531e4
callq 0x1d3151
jmp 0x45325e
callq 0x1d312b
jmp 0x45325e
callq 0x1d3105
jmp 0x45325e
callq 0x1d30df
jmp 0x45325e
callq 0x1d30b9
jmp 0x45325e
decl %r8d
movq 0x8(%rsp), %rax
decl %eax
testl %r11d, %r11d
cmovnel %esi, %r10d
cmovnel %edx, %eax
movq %rax, 0x8(%rsp)
movl %r10d, %eax
movl %r8d, %ecx
movdqa 0x60(%rsp), %xmm0
pcmpgtd %xmm2, %xmm0
pcmpgtd 0x90(%rsp), %xmm1
por %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
movq 0x28(%rsp), %rdx
je 0x453218
orb $0x40, 0xc(%rdx)
xorl %eax, %eax
movq $0x0, 0x8(%rsp)
xorl %ecx, %ecx
movl %eax, (%rdx)
movl %ecx, 0x4(%rdx)
movq 0x8(%rsp), %rax
movl %eax, 0x8(%rdx)
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r13)
jne 0x45324b
movq 0x70(%rsp), %rdi
callq 0x20a60d
movq 0x28(%rsp), %rax
jmp 0x453260
callq 0x1d3093
jmp 0x45325e
callq 0x1d306d
xorl %eax, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq