// File: /workspace/github_c_makefile_star2_O2/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 $0x198, %rsp            # imm = 0x198
movq %r9, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
testq %rdx, %rdx
je 0x3f730b
movl %ecx, %r12d
testl %ecx, %ecx
jle 0x3f732f
testl %r8d, %r8d
js 0x3f7353
cmpl $0x0, 0x10(%rsp)
js 0x3f7391
movq 0x1d0(%rsp), %rbp
testq %rbp, %rbp
je 0x3f73b2
cmpl $0x0, 0x30(%rbp)
je 0x3f694c
movl 0x34(%rbp), %r15d
jmp 0x3f6963
cmpq $0x0, 0x18(%rsp)
je 0x3f73d3
movl %esi, %r15d
testl %esi, %esi
jle 0x3f73f4
leal 0x3(%r15), %edi
leal 0x3(%r12), %eax
movq %rax, 0x20(%rsp)
movl %r8d, %esi
negl %esi
movl 0x20(%rbp), %eax
movl $0x80000000, %r13d      # imm = 0x80000000
movl %r8d, %ecx
orl %r13d, %ecx
subl %eax, %r13d
movl %esi, 0x8(%rsp)
cmpl %esi, %eax
cmovgl %ecx, %r13d
incl %r13d
movl $0x7ffffffe, %ebx       # imm = 0x7FFFFFFE
subl 0x1c(%rbp), %ebx
movd %r13d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x60(%rsp)
movd 0x10(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pxor %xmm1, %xmm1
movdqa %xmm1, 0x80(%rsp)
cmpl $0x0, 0x1d8(%rsp)
movdqa %xmm0, 0x170(%rsp)
movl %edi, 0x30(%rsp)
je 0x3f69e2
pxor %xmm0, %xmm0
jmp 0x3f69e7
pslld $0x2, %xmm0
movdqa %xmm0, 0xf0(%rsp)
movq %rdx, 0x28(%rsp)
movdqa 0x60(%rsp), %xmm0
movdqa %xmm0, 0xb0(%rsp)
movdqa %xmm0, 0xa0(%rsp)
movdqa %xmm0, 0x100(%rsp)
movdqa %xmm0, 0x90(%rsp)
jne 0x3f6a59
movl 0x8(%rsp), %edi
movl %edi, %eax
movq 0x10(%rsp), %rsi
subl %esi, %eax
movl %edi, %edx
subl %esi, %edx
subl %esi, %edx
imull $-0x3, %esi, %ecx
subl %r8d, %ecx
movd %ecx, %xmm0
pinsrd $0x1, %edx, %xmm0
pinsrd $0x2, %eax, %xmm0
pinsrd $0x3, %edi, %xmm0
movdqa %xmm0, 0x80(%rsp)
movl %r8d, 0x40(%rsp)
movl %r15d, %edi
movl %r12d, %esi
callq 0x1ab93b
testq %rax, %rax
je 0x3f6b1e
movq %rax, %r14
movl %ebx, 0x50(%rsp)
movl %r13d, 0xc(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x1d8(%rsp)
setne %al
xorl %ecx, %ecx
cmpl $0x0, 0x1e0(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x1e8(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x1f0(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rax,8), %eax
orl %edx, %eax
orl %esi, %eax
orl 0xc(%r14), %eax
orl $0x4441002, %eax        # imm = 0x4441002
movl %eax, 0xc(%r14)
movq %r12, (%rsp)
leal 0x6(%r12), %r13d
pushq $0x10
popq %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1ab783
movq %rax, %r12
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1ab783
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %r13
callq 0x1ab783
movq %rax, %r11
testq %r12, %r12
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
testq %r11, %r11
sete %al
orb %cl, %al
je 0x3f6b25
xorl %ebx, %ebx
jmp 0x3f741c
movq %r14, 0x78(%rsp)
cmpl $0x0, 0x30(%rbp)
movslq %r15d, %r14
movq %r11, 0x48(%rsp)
je 0x3f6c31
xorl %eax, %eax
movl 0xc(%rsp), %r10d
movl 0x1e0(%rsp), %r9d
movq 0x28(%rsp), %r8
movl 0x50(%rsp), %ebx
movd %r15d, %xmm0
movq (%rsp), %rcx
movd %ecx, %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, 0xe0(%rsp)
pshufd $0x0, %xmm3, %xmm0      # xmm0 = xmm3[0,0,0,0]
movdqa %xmm0, 0x130(%rsp)
movdqa %xmm4, 0x160(%rsp)
paddd %xmm5, %xmm4
movdqa %xmm4, 0x120(%rsp)
movdqa %xmm1, 0x140(%rsp)
paddd %xmm1, %xmm5
movdqa %xmm5, 0x150(%rsp)
movl %ecx, %ebx
movq 0x10(%rbp), %rcx
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x3f6be0
movzbl (%r8,%rdx), %esi
movl (%rcx,%rsi,4), %esi
movl %esi, 0xc(%r12,%rdx,4)
incq %rdx
jmp 0x3f6bc9
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x3f6bf2
andl $0x0, (%r12,%rcx,4)
incq %rcx
jmp 0x3f6be2
leaq 0xc(%r12,%rbx,4), %rcx
movq (%rsp), %rdx
cmpl %edx, 0x20(%rsp)
jle 0x3f6c0c
andl $0x0, (%rcx)
addq $0x4, %rcx
incl %edx
jmp 0x3f6bfb
xorl %ecx, %ecx
cmpl $0x0, 0x1e8(%rsp)
je 0x3f6c96
cmpq %rcx, %rbx
je 0x3f6cb2
andl $0x0, 0xc(%r13,%rcx,4)
movl %r10d, 0xc(%r11,%rcx,4)
incq %rcx
jmp 0x3f6c18
movslq 0x30(%rsp), %rsi
pushq $0x10
popq %rdi
movq %rsi, 0x30(%rsp)
callq 0x1ab783
xorl %edi, %edi
testq %rax, %rax
movl 0xc(%rsp), %r10d
movl 0x50(%rsp), %ebx
je 0x3f6b1e
testl %r15d, %r15d
movl $0x0, %ecx
cmovgl %r15d, %ecx
movq 0x48(%rsp), %r11
movl 0x1e0(%rsp), %r9d
movq 0x28(%rsp), %r8
cmpq %rdi, %rcx
je 0x3f7377
movq 0x10(%rbp), %rdx
movq 0x18(%rsp), %rsi
movzbl (%rsi,%rdi), %esi
movl (%rdx,%rsi,4), %edx
movl %edx, (%rax,%rdi,4)
incq %rdi
jmp 0x3f6c75
movl 0x8(%rsp), %edx
cmpq %rcx, %rbx
je 0x3f6cb2
movl %edx, 0xc(%r13,%rcx,4)
movl %r10d, 0xc(%r11,%rcx,4)
incq %rcx
subl 0x10(%rsp), %edx
jmp 0x3f6c9a
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x3f6cc8
movl %r10d, (%r13,%rcx,4)
movl %r10d, (%r11,%rcx,4)
incq %rcx
jmp 0x3f6cb4
movq %rbx, %rcx
cmpl %ecx, 0x20(%rsp)
jle 0x3f6ce0
movl %r10d, 0xc(%r13,%rcx,4)
movl %r10d, 0xc(%r11,%rcx,4)
incq %rcx
jmp 0x3f6ccb
movq %rax, 0x70(%rsp)
andl $0x0, 0x8(%r13)
decl %r15d
movdqa 0x60(%rsp), %xmm2
movdqa %xmm2, %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm0, 0x110(%rsp)
movq (%rsp), %rcx
decl %ecx
movq %rcx, (%rsp)
xorl %ecx, %ecx
movq 0x20(%rsp), %rax
testl %eax, %eax
cmovlel %ecx, %eax
movq %rax, 0x20(%rsp)
movdqa 0xb0(%rsp), %xmm1
movdqa 0xa0(%rsp), %xmm0
leaq 0x2(%rbx), %rax
movq %rax, 0xd8(%rsp)
leaq 0x1(%rbx), %rax
movq %rax, 0xd0(%rsp)
pmovsxbd 0x1d2f76(%rip), %xmm13  # 0x5c9cca
movdqa %xmm2, %xmm9
movdqa %xmm2, %xmm12
xorl %edi, %edi
movdqa %xmm2, %xmm15
movdqa %xmm2, %xmm14
movdqa %xmm2, %xmm5
movdqa %xmm2, 0x30(%rsp)
movdqa 0xe0(%rsp), %xmm2
movdqa %xmm2, 0x50(%rsp)
movq %r13, 0x18(%rsp)
cmpq %r14, %rdi
jge 0x3f71a4
movq %rdi, %r8
orq $0x3, %r8
cmpl $0x0, 0x30(%rbp)
je 0x3f6dce
movq %rdi, %r9
orq $0x1, %r9
cmpq %r14, %r9
movl %r15d, %ecx
cmovll %r9d, %ecx
movq %rdi, %r10
orq $0x2, %r10
cmpq %r14, %r10
movl %r10d, %edx
cmovgel %r15d, %edx
cmpq %r14, %r8
movl %r8d, %esi
cmovgel %r15d, %esi
movl %edi, %eax
jmp 0x3f6df0
movq 0x70(%rsp), %rsi
movl (%rsi,%rdi,4), %eax
movl 0x4(%rsi,%rdi,4), %ecx
movq %rdi, %r9
orq $0x1, %r9
movq %rdi, %r10
orq $0x2, %r10
movl 0x8(%rsi,%rdi,4), %edx
movl (%rsi,%r8,4), %esi
movq 0x8(%rbp), %r11
movl 0x18(%rbp), %ebp
imull %ebp, %ecx
imull %ebp, %eax
imull %ebp, %edx
imull %ebp, %esi
movl %edi, %ebp
imull 0x10(%rsp), %ebp
movl 0x8(%rsp), %r13d
subl %ebp, %r13d
cmpl $0x0, 0x1d8(%rsp)
movslq %ecx, %rcx
leaq (%r11,%rcx,4), %rcx
movq %rcx, 0x28(%rsp)
movslq %eax, %rcx
leaq (%r11,%rcx,4), %rax
movq %rax, 0x40(%rsp)
movslq %edx, %rdx
leaq (%r11,%rdx,4), %rax
movslq %esi, %rdx
movdqa 0x110(%rsp), %xmm6
movdqa %xmm6, %xmm2
movq 0x18(%rsp), %rcx
pinsrd $0x3, 0x8(%rcx), %xmm2
movl $0x0, %esi
cmovnel %esi, %r13d
leaq (%r11,%rdx,4), %rdx
pinsrd $0x3, %r13d, %xmm6
movq %rcx, %r13
leaq 0x4(%rdi), %rcx
movq %rcx, 0xc8(%rsp)
movl %ecx, %esi
imull 0x10(%rsp), %esi
movl 0x8(%rsp), %r11d
subl %esi, %r11d
movl %r11d, 0x8(%r13)
movdqa 0x120(%rsp), %xmm7
pcmpeqd %xmm13, %xmm7
xorl %esi, %esi
movdqa 0x60(%rsp), %xmm11
movdqa %xmm11, %xmm10
pmovsxbd 0x1d2e1e(%rip), %xmm4   # 0x5c9cce
movq 0x48(%rsp), %r11
cmpq %rsi, 0x20(%rsp)
je 0x3f715e
pshufd $0xf9, %xmm6, %xmm8     # xmm8 = xmm6[1,2,3,3]
pinsrd $0x3, 0xc(%r13,%rsi,4), %xmm8
cmpq %r15, %rdi
pshufd $0xf9, %xmm11, %xmm11   # xmm11 = xmm11[1,2,3,3]
pinsrd $0x3, 0xc(%r11,%rsi,4), %xmm11
movdqa %xmm8, %xmm0
movdqa 0x130(%rsp), %xmm3
psubd %xmm3, %xmm0
movdqa 0x170(%rsp), %xmm1
psubd %xmm1, %xmm11
pmaxsd %xmm0, %xmm11
psubd %xmm3, %xmm6
psubd %xmm1, %xmm10
pmaxsd %xmm6, %xmm10
movslq 0xc(%r12,%rsi,4), %r11
movslq 0x8(%r12,%rsi,4), %r13
movslq 0x4(%r12,%rsi,4), %rbp
movslq (%r12,%rsi,4), %rcx
movd (%rdx,%rcx,4), %xmm0
pinsrd $0x1, (%rax,%rbp,4), %xmm0
movq 0x28(%rsp), %rcx
pinsrd $0x2, (%rcx,%r13,4), %xmm0
movq 0x40(%rsp), %rcx
pinsrd $0x3, (%rcx,%r11,4), %xmm0
paddd %xmm2, %xmm0
movdqa %xmm10, %xmm3
pmaxsd %xmm11, %xmm3
pmaxsd %xmm0, %xmm3
movdqa %xmm4, %xmm0
pcmpeqd 0x1d0bf1(%rip), %xmm0   # 0x5c7b60
movdqa %xmm3, %xmm6
blendvps %xmm0, 0x80(%rsp), %xmm6
setne %r11b
movaps 0x60(%rsp), %xmm1
blendvps %xmm0, %xmm1, %xmm11
blendvps %xmm0, %xmm1, %xmm10
cmpq $0x4, %rsi
jb 0x3f6fba
movdqa 0x50(%rsp), %xmm0
pminsd %xmm6, %xmm0
movdqa %xmm0, 0x50(%rsp)
movdqa 0x30(%rsp), %xmm0
pmaxsd %xmm6, %xmm0
movdqa %xmm0, 0x30(%rsp)
movq 0x78(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx), %rbp
movq 0x8(%rcx), %r13
cmpq %rbx, %rsi
setae %cl
orb %cl, %r11b
jne 0x3f6fdd
pextrd $0x3, %xmm6, (%rbp,%rsi,4)
cmpq %rsi, (%rsp)
jne 0x3f6fec
pextrd $0x3, %xmm6, (%r13,%rdi,4)
cmpq %r15, %r9
setne %cl
leaq -0x1(%rsi), %r11
cmpq %rbx, %r11
setae %r11b
orb %cl, %r11b
jne 0x3f700a
pextrd $0x2, %xmm6, -0x4(%rbp,%rsi,4)
cmpq %r14, %r9
setge %cl
cmpq %rsi, %rbx
setne %r11b
orb %cl, %r11b
jne 0x3f7025
pextrd $0x2, %xmm6, (%r13,%r9,4)
cmpq %r15, %r10
jne 0x3f704c
leaq -0x2(%rsi), %rcx
cmpq $0x2, %rsi
setae %r11b
cmpq %rbx, %rcx
setl %cl
andb %r11b, %cl
cmpb $0x1, %cl
jne 0x3f704c
pextrd $0x1, %xmm6, -0x8(%rbp,%rsi,4)
cmpq %r14, %r10
setge %cl
cmpq %rsi, 0xd0(%rsp)
setne %r11b
orb %cl, %r11b
jne 0x3f706c
pextrd $0x1, %xmm6, (%r13,%r10,4)
cmpq %r15, %r8
setne %cl
cmpq $0x3, %rsi
setb %r11b
orb %cl, %r11b
jne 0x3f7085
movd %xmm6, -0xc(%rbp,%rsi,4)
cmpq %r14, %r8
setge %cl
cmpq %rsi, 0xd8(%rsp)
setne %r11b
movd %xmm6, %ebp
orb %cl, %r11b
jne 0x3f70a5
movl %ebp, (%r13,%r8,4)
movdqa 0x160(%rsp), %xmm1
pcmpgtd %xmm13, %xmm1
movdqa 0x140(%rsp), %xmm0
pcmpgtd %xmm4, %xmm0
movdqa %xmm4, %xmm2
pandn %xmm0, %xmm2
movdqa %xmm6, %xmm0
pcmpgtd %xmm12, %xmm0
pand %xmm7, %xmm2
pand %xmm0, %xmm2
movdqa %xmm2, %xmm0
blendvps %xmm0, %xmm3, %xmm12
movdqa 0x150(%rsp), %xmm3
pcmpeqd %xmm4, %xmm3
movdqa %xmm6, %xmm0
pcmpgtd %xmm9, %xmm0
pand %xmm3, %xmm1
pand %xmm0, %xmm1
movdqa %xmm1, %xmm0
blendvps %xmm0, %xmm6, %xmm9
pand %xmm7, %xmm3
movdqa %xmm3, %xmm0
blendvps %xmm0, %xmm6, %xmm5
movq 0x18(%rsp), %r13
movl %ebp, (%r13,%rsi,4)
movq 0x48(%rsp), %r11
movss %xmm11, (%r11,%rsi,4)
movdqa %xmm1, %xmm0
blendvps %xmm0, %xmm13, %xmm14
movdqa %xmm2, %xmm0
blendvps %xmm0, %xmm4, %xmm15
psubd 0x1d0a17(%rip), %xmm4   # 0x5c7b60
incq %rsi
movaps %xmm9, %xmm0
movaps %xmm12, %xmm1
movdqa %xmm8, %xmm2
jmp 0x3f6eb5
paddd 0x1d0a59(%rip), %xmm13  # 0x5c7bc0
movdqa 0x80(%rsp), %xmm2
psubd 0xf0(%rsp), %xmm2
movdqa %xmm2, 0x80(%rsp)
movq 0xc8(%rsp), %rdi
movq 0x1d0(%rsp), %rbp
movl 0xc(%rsp), %r10d
movl 0x1e0(%rsp), %r9d
jmp 0x3f6d88
movdqa %xmm1, 0xb0(%rsp)
movdqa %xmm0, 0xa0(%rsp)
movdqa %xmm5, 0x100(%rsp)
movdqa %xmm14, 0x90(%rsp)
movdqa %xmm15, 0x180(%rsp)
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r10d, %eax
movl %r10d, %esi
movq 0x78(%rsp), %rbx
movl 0x1f0(%rsp), %r14d
cmpl $0x4, %edi
je 0x3f7252
movl 0xa0(%rsp,%rdi,4), %r8d
cmpl %eax, %r8d
jle 0x3f720a
movl 0x90(%rsp,%rdi,4), %ecx
movl %r8d, %eax
jmp 0x3f7227
jne 0x3f7227
movl 0x90(%rsp,%rdi,4), %r9d
cmpl %ecx, %r9d
cmovll %r9d, %ecx
movl 0x1e0(%rsp), %r9d
cmovll %r8d, %eax
movl 0xb0(%rsp,%rdi,4), %r8d
cmpl %r10d, %r8d
jle 0x3f723e
movl 0x180(%rsp,%rdi,4), %edx
movl %r8d, %r10d
movl 0x100(%rsp,%rdi,4), %r8d
cmpl %esi, %r8d
cmovgl %r8d, %esi
incq %rdi
jmp 0x3f71ec
testl %r14d, %r14d
sete %dil
testl %r9d, %r9d
sete %r8b
orb %dil, %r8b
jne 0x3f727c
cmpl %r10d, %eax
jg 0x3f7298
jne 0x3f7271
cmpl (%rsp), %edx
je 0x3f7298
movl %r10d, %eax
movl %edx, %ecx
movq %rcx, (%rsp)
jmp 0x3f7295
testl %r9d, %r9d
jne 0x3f7298
testl %r14d, %r14d
cmovnel %r10d, %esi
movq (%rsp), %rax
cmovnel %edx, %eax
movq %rax, (%rsp)
movl %esi, %eax
movl %r15d, %ecx
movdqa 0x60(%rsp), %xmm0
pcmpgtd 0x50(%rsp), %xmm0
movdqa 0x30(%rsp), %xmm1
pcmpgtd 0xe0(%rsp), %xmm1
por %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
je 0x3f72ce
orb $0x40, 0xc(%rbx)
xorl %eax, %eax
movq $0x0, (%rsp)
xorl %ecx, %ecx
movl %eax, (%rbx)
movl %ecx, 0x4(%rbx)
movq (%rsp), %rax
movl %eax, 0x8(%rbx)
movq %r11, %rdi
callq 0x1ab763
movq %r13, %rdi
callq 0x1ab763
movq %r12, %rdi
callq 0x1ab763
cmpl $0x0, 0x30(%rbp)
jne 0x3f741c
movq 0x70(%rsp), %rdi
callq 0x1ab763
jmp 0x3f741c
movq 0x343cc6(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1cfccf(%rip), %rsi    # 0x5c6feb
leaq 0x1d3a0c(%rip), %rdx    # 0x5cad2f
leaq 0x1d03d3(%rip), %rcx    # 0x5c76fd
jmp 0x3f7413
movq 0x343ca2(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1d03c1(%rip), %rsi    # 0x5c7701
leaq 0x1d39e8(%rip), %rdx    # 0x5cad2f
leaq 0x1d03c7(%rip), %rcx    # 0x5c7715
jmp 0x3f7413
movq 0x343c7e(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1d03b7(%rip), %rsi    # 0x5c771b
leaq 0x1d39c4(%rip), %rdx    # 0x5cad2f
leaq 0x1d03be(%rip), %rcx    # 0x5c7730
jmp 0x3f7413
movq %r14, %rcx
movq 0x30(%rsp), %rdx
cmpq %rdx, %rcx
jge 0x3f6b54
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x3f737f
movq 0x343c40(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1d0379(%rip), %rsi    # 0x5c771b
leaq 0x1d3986(%rip), %rdx    # 0x5cad2f
leaq 0x1d0385(%rip), %rcx    # 0x5c7735
jmp 0x3f7413
movq 0x343c1f(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1cfc28(%rip), %rsi    # 0x5c6feb
leaq 0x1d3965(%rip), %rdx    # 0x5cad2f
leaq 0x1d0571(%rip), %rcx    # 0x5c7942
jmp 0x3f7413
movq 0x343bfe(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1cfc07(%rip), %rsi    # 0x5c6feb
leaq 0x1d3944(%rip), %rdx    # 0x5cad2f
leaq 0x1d0347(%rip), %rcx    # 0x5c7739
jmp 0x3f7413
movq 0x343bdd(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x1d02fc(%rip), %rsi    # 0x5c7701
leaq 0x1d3923(%rip), %rdx    # 0x5cad2f
leaq 0x1d032a(%rip), %rcx    # 0x5c773d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq