// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/sg_diag_sse2_128_64.c
// Function: parasail_sg_flags_rowcol_diag_sse2_128_64
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;
    int64_t * restrict s1 = NULL;
    int64_t * restrict s2B = NULL;
    int64_t * restrict _H_pr = NULL;
    int64_t * restrict _F_pr = NULL;
    int64_t * restrict s2 = NULL;
    int64_t * restrict H_pr = NULL;
    int64_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;
    int64_t NEG_LIMIT = 0;
    int64_t POS_LIMIT = 0;
    int64_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 = 2; /* 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 ? INT64_MIN + open : INT64_MIN - matrix->min) + 1;
    POS_LIMIT = INT64_MAX - matrix->max - 1;
    score = NEG_LIMIT;
    vNegLimit = _mm_set1_epi64x_rpl(NEG_LIMIT);
    vPosLimit = _mm_set1_epi64x_rpl(POS_LIMIT);
    vSaturationCheckMin = vPosLimit;
    vSaturationCheckMax = vNegLimit;
    vNegInf = _mm_set1_epi64x_rpl(NEG_LIMIT);
    vOpen = _mm_set1_epi64x_rpl(open);
    vGap  = _mm_set1_epi64x_rpl(gap);
    vOne = _mm_set1_epi64x_rpl(1);
    vN = _mm_set1_epi64x_rpl(N);
    vGapN = s1_beg ? _mm_set1_epi64x_rpl(0) : _mm_set1_epi64x_rpl(gap*N);
    vNegOne = _mm_set1_epi64x_rpl(-1);
    vI = _mm_set_epi64x_rpl(0,1);
    vJreset = _mm_set_epi64x_rpl(0,-1);
    vMaxHRow = vNegInf;
    vMaxHCol = vNegInf;
    vLastVal = vNegInf;
    vEndI = vNegInf;
    vEndJ = vNegInf;
    vILimit = _mm_set1_epi64x_rpl(s1Len);
    vILimit1 = _mm_sub_epi64(vILimit, vOne);
    vJLimit = _mm_set1_epi64x_rpl(s2Len);
    vJLimit1 = _mm_sub_epi64(vJLimit, vOne);
    vIBoundary = s1_beg ? _mm_set1_epi64x_rpl(0) : _mm_set_epi64x_rpl(
            -open-0*gap,
            -open-1*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_64 | PARASAIL_FLAG_LANES_2;
    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_int64_t(16, s2Len+PAD2);
    _H_pr = parasail_memalign_int64_t(16, s2Len+PAD2);
    _F_pr = parasail_memalign_int64_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_int64_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))];
        __m128i vIltLimit = _mm_cmplt_epi64_rpl(vI, vILimit);
        __m128i vIeqLimit1 = _mm_cmpeq_epi64_rpl(vI, vILimit1);
        vNH = _mm_srli_si128(vNH, 8);
        vNH = _mm_insert_epi64_rpl(vNH, H_pr[-1], 1);
        vWH = _mm_srli_si128(vWH, 8);
        vWH = _mm_insert_epi64_rpl(vWH, s1_beg ? 0 : (-open - i*gap), 1);
        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, 8);
            vNH = _mm_insert_epi64_rpl(vNH, H_pr[j], 1);
            vF = _mm_srli_si128(vF, 8);
            vF = _mm_insert_epi64_rpl(vF, F_pr[j], 1);
            vF = _mm_max_epi64_rpl(
                    _mm_sub_epi64(vNH, vOpen),
                    _mm_sub_epi64(vF, vGap));
            vE = _mm_max_epi64_rpl(
                    _mm_sub_epi64(vWH, vOpen),
                    _mm_sub_epi64(vE, vGap));
            vMat = _mm_set_epi64x_rpl(
                    matrow0[s2[j-0]],
                    matrow1[s2[j-1]]
                    );
            vNWH = _mm_add_epi64(vNWH, vMat);
            vWH = _mm_max_epi64_rpl(vNWH, vE);
            vWH = _mm_max_epi64_rpl(vWH, vF);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi64_rpl(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_epi64_rpl(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi64_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-1] = (int64_t)_mm_extract_epi64_rpl(vWH,0);
            F_pr[j-1] = (int64_t)_mm_extract_epi64_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_epi64_rpl(vJ, vJLimit1);
                __m128i vJgtNegOne = _mm_cmpgt_epi64_rpl(vJ, vNegOne);
                __m128i vJltLimit = _mm_cmplt_epi64_rpl(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_epi64_rpl(vWH, vMaxHRow);
                __m128i cond_max_col = _mm_cmpgt_epi64_rpl(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_epi64(vJ, vOne);
        }
        vI = _mm_add_epi64(vI, vN);
        vIBoundary = _mm_sub_epi64(vIBoundary, vGapN);
    }

    /* alignment ending position */
    {
        int64_t max_row = NEG_LIMIT;
        int64_t max_col = NEG_LIMIT;
        int64_t last_val = NEG_LIMIT;
        int64_t *s = (int64_t*)&vMaxHRow;
        int64_t *t = (int64_t*)&vMaxHCol;
        int64_t *u = (int64_t*)&vLastVal;
        int64_t *i = (int64_t*)&vEndI;
        int64_t *j = (int64_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_epi64_rpl(vSaturationCheckMin, vNegLimit),
            _mm_cmpgt_epi64_rpl(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 $0x2c8, %rsp            # imm = 0x2C8
movq %r9, 0x20(%rsp)
testq %rdx, %rdx
je 0x2f7c30
testl %ecx, %ecx
jle 0x2f7c54
testl %r8d, %r8d
js 0x2f7c78
cmpl $0x0, 0x20(%rsp)
js 0x2f7cb6
movq %rdx, %r12
movq 0x300(%rsp), %rdx
testq %rdx, %rdx
je 0x2f7cd7
movq %rdi, %rbp
cmpl $0x0, 0x30(%rdx)
je 0x2f6f89
movl 0x34(%rdx), %esi
jmp 0x2f6f9a
testq %rbp, %rbp
je 0x2f7cf8
testl %esi, %esi
jle 0x2f7d19
movq %rcx, 0x28(%rsp)
leal 0x1(%rsi), %eax
movl %eax, 0x40(%rsp)
movslq 0x20(%rdx), %rax
movl %r8d, %ebx
negl %r8d
movq %rbx, %rcx
btsq $0x3f, %rcx
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq %r15, %rdi
subq %rax, %rdi
movl %r8d, 0x1c(%rsp)
cmpl %r8d, %eax
cmovgq %rcx, %rdi
incq %rdi
movslq 0x1c(%rdx), %rax
subq %rax, %r15
addq $-0x2, %r15
movq %rdi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, 0xa0(%rsp)
movq 0x20(%rsp), %rax
addl %eax, %eax
pxor %xmm0, %xmm0
movdqa %xmm0, 0xe0(%rsp)
cmpl $0x0, 0x308(%rsp)
jne 0x2f701c
movd %eax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, 0x190(%rsp)
movq %rdi, 0x80(%rsp)
movdqa 0xa0(%rsp), %xmm0
movdqa %xmm0, 0x1d0(%rsp)
movdqa %xmm0, 0x1c0(%rsp)
movdqa %xmm0, 0x1b0(%rsp)
movdqa %xmm0, 0x160(%rsp)
movdqa %xmm0, 0x1a0(%rsp)
jne 0x2f708a
movl 0x1c(%rsp), %ecx
movslq %ecx, %rax
subl 0x20(%rsp), %ecx
movslq %ecx, %rcx
movq %rcx, %xmm1
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa %xmm1, 0xe0(%rsp)
movq %rsi, %r14
movl %esi, %edi
movq 0x28(%rsp), %r13
movl %r13d, %esi
callq 0x1ab93b
testq %rax, %rax
je 0x2f7166
movq %rbx, 0x70(%rsp)
movq %rbp, 0x90(%rsp)
movq %r12, 0x60(%rsp)
xorl %edi, %edi
cmpl $0x0, 0x308(%rsp)
setne %dil
xorl %ecx, %ecx
cmpl $0x0, 0x310(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x318(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
cmpl $0x0, 0x320(%rsp)
setne %sil
shll $0xf, %esi
leal (%rcx,%rdi,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x2841002, %ecx        # imm = 0x2841002
movq %rax, 0xd8(%rsp)
movl %ecx, 0xc(%rax)
leal 0x2(%r13), %ebp
pushq $0x10
popq %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1ab78c
movq %rax, %r13
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1ab78c
movq %rax, %r12
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1ab78c
movq %r13, 0x38(%rsp)
testq %r13, %r13
sete %dl
movq %r12, 0x8(%rsp)
testq %r12, %r12
sete %cl
orb %dl, %cl
movq %rax, 0x10(%rsp)
testq %rax, %rax
sete %al
orb %cl, %al
je 0x2f716d
xorl %ebx, %ebx
jmp 0x2f7d41
movq %r14, %r9
movslq %r9d, %rax
movq %rax, 0x30(%rsp)
movq 0x300(%rsp), %rdi
cmpl $0x0, 0x30(%rdi)
je 0x2f72be
movq $0x0, 0x58(%rsp)
movq 0x80(%rsp), %r10
movq 0x60(%rsp), %r12
movq 0x70(%rsp), %rbx
movl 0x28(%rsp), %r14d
movq 0x30(%rsp), %xmm0
movq %r14, %xmm1
movq %r15, %xmm2
movq %rbx, %xmm3
movd 0x20(%rsp), %xmm4
pshufd $0x44, %xmm0, %xmm5     # xmm5 = xmm0[0,1,0,1]
pcmpeqd %xmm6, %xmm6
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
pshufd $0x44, %xmm2, %xmm0     # xmm0 = xmm2[0,1,0,1]
movdqa %xmm0, 0x180(%rsp)
pshufd $0x44, %xmm3, %xmm0     # xmm0 = xmm3[0,1,0,1]
movdqa %xmm0, 0x220(%rsp)
pshufd $0x44, %xmm4, %xmm0     # xmm0 = xmm4[0,1,0,1]
movdqa %xmm0, 0x210(%rsp)
movdqa %xmm5, 0x200(%rsp)
paddq %xmm6, %xmm5
movdqa %xmm5, 0x1f0(%rsp)
movdqa %xmm1, 0x230(%rsp)
paddq %xmm1, %xmm6
movdqa %xmm6, 0x240(%rsp)
movslq 0x1c(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x10(%rdi), %rax
xorl %ecx, %ecx
movq 0x38(%rsp), %rsi
cmpq %rcx, %r14
je 0x2f7259
movzbl (%r12,%rcx), %edx
movslq (%rax,%rdx,4), %rdx
movq %rdx, 0x8(%rsi,%rcx,8)
incq %rcx
jmp 0x2f7241
movq 0x38(%rsp), %rax
andq $0x0, (%rax)
movq %r14, %rax
movq 0x28(%rsp), %r12
movq 0x38(%rsp), %rcx
cmpl %r12d, %eax
jg 0x2f727f
andq $0x0, 0x8(%rcx,%rax,8)
incq %rax
jmp 0x2f726f
movl 0x20(%rsp), %eax
movq %rax, 0xd0(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x318(%rsp)
je 0x2f7331
cmpq %rax, %r14
je 0x2f735f
movq 0x8(%rsp), %rcx
andq $0x0, 0x8(%rcx,%rax,8)
movq 0x10(%rsp), %rcx
movq %r10, 0x8(%rcx,%rax,8)
incq %rax
jmp 0x2f729b
movslq 0x40(%rsp), %rsi
pushq $0x10
popq %rdi
callq 0x1ab78c
xorl %r11d, %r11d
movq %rax, 0x58(%rsp)
testq %rax, %rax
movq 0x60(%rsp), %r12
movq 0x70(%rsp), %rbx
je 0x2f7166
movq %r14, %r9
testl %r9d, %r9d
movl $0x0, %ecx
cmovgl %r9d, %ecx
movq 0x300(%rsp), %rdi
movq 0x80(%rsp), %r10
movq 0x58(%rsp), %r8
movq 0x90(%rsp), %rax
cmpq %r11, %rcx
je 0x2f7c9c
movq 0x10(%rdi), %rdx
movzbl (%rax,%r11), %esi
movslq (%rdx,%rsi,4), %rdx
movq %rdx, (%r8,%r11,8)
incq %r11
jmp 0x2f7312
movq 0xc8(%rsp), %rcx
cmpq %rax, %r14
je 0x2f735f
movq 0x8(%rsp), %rdx
movq %rcx, 0x8(%rdx,%rax,8)
movq 0x10(%rsp), %rdx
movq %r10, 0x8(%rdx,%rax,8)
incq %rax
subq 0xd0(%rsp), %rcx
jmp 0x2f7339
movq 0x10(%rsp), %rax
movq %r10, (%rax)
movq %r14, %rax
cmpl %r12d, %eax
jg 0x2f7388
movq 0x8(%rsp), %rcx
movq %r10, 0x8(%rcx,%rax,8)
movq 0x10(%rsp), %rcx
movq %r10, 0x8(%rcx,%rax,8)
incq %rax
jmp 0x2f736a
movq 0x8(%rsp), %rax
andq $0x0, (%rax)
decl %r9d
movdqa 0xa0(%rsp), %xmm0
movdqa %xmm0, %xmm1
psrldq $0x8, %xmm1             # xmm1 = xmm1[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
movdqa %xmm1, 0x1e0(%rsp)
decl %r12d
movq %r12, 0x28(%rsp)
movd 0x2d07b1(%rip), %xmm1   # 0x5c7b70
movdqa %xmm1, 0xb0(%rsp)
xorl %r15d, %r15d
movdqa %xmm0, 0x150(%rsp)
movdqa %xmm0, 0x140(%rsp)
movdqa %xmm0, 0x130(%rsp)
movdqa %xmm0, 0x70(%rsp)
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x120(%rsp)
movdqa 0x180(%rsp), %xmm0
movdqa %xmm0, 0x110(%rsp)
movq %r9, 0x88(%rsp)
cmpq 0x30(%rsp), %r15
jge 0x2f7a87
cmpl $0x0, 0x30(%rdi)
je 0x2f7443
movq %r15, %rbx
orq $0x1, %rbx
cmpq 0x30(%rsp), %rbx
movl %r9d, %eax
cmovll %ebx, %eax
movslq %eax, %r13
movq %r15, %r12
jmp 0x2f7458
movq 0x58(%rsp), %rax
movq (%rax,%r15,8), %r12
movq 0x8(%rax,%r15,8), %r13
movq %r15, %rbx
orq $0x1, %rbx
movq 0x8(%rdi), %rbp
movslq 0x18(%rdi), %rax
imulq %rax, %r12
imulq %rax, %r13
movaps 0xb0(%rsp), %xmm0
movaps 0x200(%rsp), %xmm1
callq 0x2f7d56
movaps %xmm0, 0x260(%rsp)
movaps 0xb0(%rsp), %xmm0
movaps 0x1f0(%rsp), %xmm1
callq 0x2f7d8a
movaps %xmm0, 0x250(%rsp)
movl %r15d, %eax
imull 0x20(%rsp), %eax
movl 0x1c(%rsp), %ecx
subl %eax, %ecx
cmpl $0x0, 0x308(%rsp)
leaq (%rbp,%r12,4), %r12
leaq (%rbp,%r13,4), %rbp
movq 0x8(%rsp), %rdx
movq (%rdx), %xmm1
movdqa 0x1e0(%rsp), %xmm2
movdqa %xmm2, %xmm0
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movl $0x0, %eax
cmovnel %eax, %ecx
movslq %ecx, %rax
movq %rax, %xmm1
movdqa %xmm2, %xmm7
punpcklqdq %xmm1, %xmm7    # xmm7 = xmm7[0],xmm1[0]
leaq 0x2(%r15), %rax
movq %rax, 0x178(%rsp)
imulq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rcx
subq %rax, %rcx
movq %rcx, (%rdx)
xorl %r13d, %r13d
movaps 0xa0(%rsp), %xmm1
movaps %xmm1, 0x100(%rsp)
movaps %xmm1, 0xf0(%rsp)
movq 0x2d063e(%rip), %xmm1   # 0x5c7b78
movdqa %xmm1, 0x40(%rsp)
cmpq %r14, %r13
ja 0x2f7a2d
pshufd $0xee, %xmm7, %xmm3     # xmm3 = xmm7[2,3,2,3]
movq 0x8(%rsp), %rax
movq 0x8(%rax,%r13,8), %xmm1
punpcklqdq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0]
pshufd $0xee, 0xf0(%rsp), %xmm2 # xmm2 = mem[2,3,2,3]
movq 0x10(%rsp), %rax
movq 0x8(%rax,%r13,8), %xmm1
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
movdqa %xmm3, 0x2b0(%rsp)
movdqa 0x220(%rsp), %xmm1
psubq %xmm1, %xmm3
movdqa 0x210(%rsp), %xmm4
psubq %xmm4, %xmm2
psubq %xmm1, %xmm7
movdqa 0x100(%rsp), %xmm8
psubq %xmm4, %xmm8
movq 0x38(%rsp), %rcx
movq (%rcx,%r13,8), %rax
movq 0x8(%rcx,%r13,8), %rcx
movslq (%r12,%rcx,4), %rcx
movslq (%rbp,%rax,4), %rax
movq %rcx, %xmm4
movq %rax, %xmm1
punpcklqdq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0]
paddq %xmm0, %xmm1
movdqa %xmm2, %xmm0
movdqa 0x2d032c(%rip), %xmm9   # 0x5c7910
pxor %xmm9, %xmm0
movdqa %xmm3, %xmm4
pxor %xmm9, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pshufd $0xa0, %xmm5, %xmm6     # xmm6 = xmm5[0,0,2,2]
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm0     # xmm0 = xmm4[1,1,3,3]
pand %xmm6, %xmm0
pshufd $0xf5, %xmm5, %xmm5     # xmm5 = xmm5[1,1,3,3]
por %xmm0, %xmm5
pand %xmm5, %xmm3
pandn %xmm2, %xmm5
por %xmm3, %xmm5
movdqa %xmm8, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm7, %xmm2
pxor %xmm9, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
pshufd $0xa0, %xmm3, %xmm4     # xmm4 = xmm3[0,0,2,2]
pcmpeqd %xmm0, %xmm2
pshufd $0xf5, %xmm2, %xmm0     # xmm0 = xmm2[1,1,3,3]
pand %xmm4, %xmm0
pshufd $0xf5, %xmm3, %xmm6     # xmm6 = xmm3[1,1,3,3]
por %xmm0, %xmm6
pand %xmm6, %xmm7
pandn %xmm8, %xmm6
por %xmm7, %xmm6
movdqa %xmm6, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm1, %xmm2
pxor %xmm9, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
pshufd $0xa0, %xmm3, %xmm4     # xmm4 = xmm3[0,0,2,2]
pcmpeqd %xmm0, %xmm2
pshufd $0xf5, %xmm2, %xmm0     # xmm0 = xmm2[1,1,3,3]
pand %xmm4, %xmm0
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm0, %xmm2
pand %xmm2, %xmm1
movdqa %xmm6, 0x100(%rsp)
pandn %xmm6, %xmm2
por %xmm1, %xmm2
movdqa %xmm2, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm5, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm0, %xmm3
pcmpgtd %xmm1, %xmm3
pshufd $0xa0, %xmm3, %xmm4     # xmm4 = xmm3[0,0,2,2]
pcmpeqd %xmm0, %xmm1
pshufd $0xf5, %xmm1, %xmm0     # xmm0 = xmm1[1,1,3,3]
pand %xmm4, %xmm0
pshufd $0xf5, %xmm3, %xmm1     # xmm1 = xmm3[1,1,3,3]
por %xmm0, %xmm1
pand %xmm1, %xmm2
movdqa %xmm5, 0x60(%rsp)
pandn %xmm5, %xmm1
por %xmm2, %xmm1
movdqa %xmm1, 0xf0(%rsp)
pcmpeqd %xmm1, %xmm1
movdqa 0x40(%rsp), %xmm0
callq 0x2f7d8a
movdqa %xmm0, %xmm1
pandn 0xf0(%rsp), %xmm1
movdqa %xmm0, %xmm5
pand 0xe0(%rsp), %xmm5
por %xmm1, %xmm5
cmpq $0x2, %r13
jb 0x2f77d7
movdqa 0x110(%rsp), %xmm4
movdqa %xmm4, %xmm6
movdqa 0x2d01c6(%rip), %xmm7   # 0x5c7910
pxor %xmm7, %xmm6
movdqa %xmm5, %xmm1
pxor %xmm7, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm6, %xmm2
pshufd $0xa0, %xmm2, %xmm3     # xmm3 = xmm2[0,0,2,2]
pcmpeqd %xmm1, %xmm6
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
pand %xmm3, %xmm6
pshufd $0xf5, %xmm2, %xmm2     # xmm2 = xmm2[1,1,3,3]
por %xmm6, %xmm2
pand %xmm2, %xmm4
pandn %xmm5, %xmm2
por %xmm2, %xmm4
movdqa %xmm4, 0x110(%rsp)
movdqa 0x120(%rsp), %xmm4
movdqa %xmm4, %xmm6
pxor %xmm7, %xmm6
movdqa %xmm6, %xmm2
pcmpgtd %xmm1, %xmm2
pshufd $0xa0, %xmm2, %xmm3     # xmm3 = xmm2[0,0,2,2]
pcmpeqd %xmm1, %xmm6
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
pand %xmm3, %xmm6
pshufd $0xf5, %xmm2, %xmm1     # xmm1 = xmm2[1,1,3,3]
por %xmm6, %xmm1
pand %xmm1, %xmm4
pandn %xmm5, %xmm1
por %xmm1, %xmm4
movdqa %xmm4, 0x120(%rsp)
movq 0x88(%rsp), %rdi
cmpq %rdi, %r15
setne %dl
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
cmpq %r14, %r13
setae %sil
orb %dl, %sil
pshufd $0xee, %xmm5, %xmm1     # xmm1 = xmm5[2,3,2,3]
jne 0x2f780f
movd %xmm1, (%rcx,%r13,4)
cmpq %r13, 0x28(%rsp)
jne 0x2f781c
movd %xmm1, (%rax,%r15,4)
cmpq %rdi, %rbx
setne %dl
testq %r13, %r13
sete %sil
orb %dl, %sil
jne 0x2f7835
movd %xmm5, -0x4(%rcx,%r13,4)
movdqa %xmm0, %xmm2
pandn 0x60(%rsp), %xmm2
movdqa %xmm0, %xmm1
pand 0xa0(%rsp), %xmm1
por %xmm1, %xmm2
pandn 0x100(%rsp), %xmm0
cmpq 0x30(%rsp), %rbx
setge %cl
cmpq %r13, %r14
setne %dl
orb %cl, %dl
jne 0x2f7870
movd %xmm5, (%rax,%rbx,4)
por %xmm1, %xmm0
movdqa %xmm0, 0x100(%rsp)
movq 0x8(%rsp), %rax
movq %xmm5, (%rax,%r13,8)
movq 0x10(%rsp), %rax
movdqa %xmm2, 0xf0(%rsp)
movq %xmm2, (%rax,%r13,8)
movaps 0x40(%rsp), %xmm0
movdqa 0x240(%rsp), %xmm1
movdqa %xmm5, 0x60(%rsp)
callq 0x2f7d8a
movaps %xmm0, 0x2a0(%rsp)
pcmpeqd %xmm1, %xmm1
movaps 0x40(%rsp), %xmm0
callq 0x2f7d98
movaps %xmm0, 0x290(%rsp)
movaps 0x40(%rsp), %xmm0
movaps 0x230(%rsp), %xmm1
callq 0x2f7d56
movaps %xmm0, 0x280(%rsp)
movaps 0x60(%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
callq 0x2f7d98
movaps %xmm0, 0x270(%rsp)
movdqa 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
callq 0x2f7d98
movdqa 0x60(%rsp), %xmm7
movdqa 0x280(%rsp), %xmm3
pand 0x290(%rsp), %xmm3
movdqa 0x250(%rsp), %xmm2
pand %xmm2, %xmm3
pand 0x270(%rsp), %xmm3
movdqa 0x260(%rsp), %xmm1
movdqa 0x2a0(%rsp), %xmm5
pand %xmm5, %xmm1
pand %xmm2, %xmm5
pand %xmm0, %xmm1
movdqa %xmm3, %xmm0
pandn 0x90(%rsp), %xmm0
movdqa %xmm3, %xmm2
movdqa %xmm3, %xmm4
pand %xmm7, %xmm2
por %xmm0, %xmm2
movdqa %xmm2, 0x90(%rsp)
movdqa %xmm1, %xmm0
pandn 0x70(%rsp), %xmm0
movdqa %xmm1, %xmm2
pand %xmm7, %xmm2
por %xmm0, %xmm2
movdqa %xmm2, 0x70(%rsp)
movdqa %xmm5, %xmm2
movdqa %xmm5, %xmm0
pandn 0x130(%rsp), %xmm0
pand %xmm7, %xmm2
por %xmm0, %xmm2
movdqa %xmm1, %xmm0
pandn 0x140(%rsp), %xmm0
pand 0xb0(%rsp), %xmm1
por %xmm0, %xmm1
movdqa %xmm3, %xmm0
pandn 0x150(%rsp), %xmm0
movdqa 0x40(%rsp), %xmm3
pand %xmm3, %xmm4
por %xmm0, %xmm4
psubq 0x2d0165(%rip), %xmm3   # 0x5c7b60
movdqa %xmm3, 0x40(%rsp)
incq %r13
movdqa %xmm4, 0x150(%rsp)
movdqa %xmm1, 0x140(%rsp)
movdqa %xmm2, 0x130(%rsp)
movdqa 0x2b0(%rsp), %xmm0
jmp 0x2f7540
movdqa 0xb0(%rsp), %xmm0
paddq 0x2d0112(%rip), %xmm0   # 0x5c7b50
movdqa %xmm0, 0xb0(%rsp)
movdqa 0xe0(%rsp), %xmm0
psubq 0x190(%rsp), %xmm0
movdqa %xmm0, 0xe0(%rsp)
movq 0x178(%rsp), %r15
movq 0x300(%rsp), %rdi
movq 0x88(%rsp), %r9
movq 0x80(%rsp), %r10
jmp 0x2f7418
movaps 0x90(%rsp), %xmm0
movaps %xmm0, 0x1d0(%rsp)
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0x1c0(%rsp)
movaps 0x130(%rsp), %xmm0
movaps %xmm0, 0x1b0(%rsp)
movaps 0x140(%rsp), %xmm0
movaps %xmm0, 0x160(%rsp)
movdqa 0x150(%rsp), %xmm0
movdqa %xmm0, 0x1a0(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %ebp, %ebp
movq %r10, %rbx
movq %r10, %rcx
movq 0x28(%rsp), %r15
movl 0x320(%rsp), %r11d
movl 0x310(%rsp), %r14d
cmpl $0x2, %edx
je 0x2f7b55
movq 0x1c0(%rsp,%rdx,8), %rsi
cmpq %rbx, %rsi
jle 0x2f7b18
movq 0x160(%rsp,%rdx,8), %rdi
movl %edi, %ebp
movq %rsi, %rbx
jmp 0x2f7b2a
jne 0x2f7b2a
movq 0x160(%rsp,%rdx,8), %rdi
movslq %ebp, %r8
cmpq %r8, %rdi
jl 0x2f7b11
movq 0x1d0(%rsp,%rdx,8), %rsi
cmpq %r10, %rsi
jle 0x2f7b41
movl 0x1a0(%rsp,%rdx,8), %eax
movq %rsi, %r10
movq 0x1b0(%rsp,%rdx,8), %rsi
cmpq %rcx, %rsi
cmovgq %rsi, %rcx
incq %rdx
jmp 0x2f7af7
testl %r11d, %r11d
sete %dl
testl %r14d, %r14d
sete %sil
orb %dl, %sil
jne 0x2f7b7b
cmpq %r10, %rbx
jg 0x2f7b91
jne 0x2f7b73
cmpl %r15d, %eax
je 0x2f7b91
movq %r10, %rbx
movl %eax, %r15d
jmp 0x2f7b8e
testl %r14d, %r14d
jne 0x2f7b91
testl %r11d, %r11d
cmovneq %r10, %rcx
cmovnel %eax, %r15d
movq %rcx, %rbx
movl %r9d, %ebp
movaps 0x110(%rsp), %xmm0
movaps 0xa0(%rsp), %xmm1
callq 0x2f7d56
movaps %xmm0, 0x40(%rsp)
movdqa 0x120(%rsp), %xmm0
movaps 0x180(%rsp), %xmm1
callq 0x2f7d98
por 0x40(%rsp), %xmm0
pmovmskb %xmm0, %eax
testl %eax, %eax
movq 0xd8(%rsp), %r14
je 0x2f7be3
orb $0x40, 0xc(%r14)
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %ebp, %ebp
movl %ebx, (%r14)
movl %ebp, 0x4(%r14)
movl %r15d, 0x8(%r14)
movq 0x10(%rsp), %rdi
callq 0x1ab763
movq 0x8(%rsp), %rdi
callq 0x1ab763
movq 0x38(%rsp), %rdi
callq 0x1ab763
movq 0x300(%rsp), %rax
cmpl $0x0, 0x30(%rax)
movq %r14, %rbx
jne 0x2f7d41
movq 0x58(%rsp), %rdi
callq 0x1ab763
jmp 0x2f7d41
movq 0x4433a1(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cf3aa(%rip), %rsi    # 0x5c6feb
leaq 0x2d12e0(%rip), %rdx    # 0x5c8f28
leaq 0x2cfaae(%rip), %rcx    # 0x5c76fd
jmp 0x2f7d38
movq 0x44337d(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cfa9c(%rip), %rsi    # 0x5c7701
leaq 0x2d12bc(%rip), %rdx    # 0x5c8f28
leaq 0x2cfaa2(%rip), %rcx    # 0x5c7715
jmp 0x2f7d38
movq 0x443359(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cfa92(%rip), %rsi    # 0x5c771b
leaq 0x2d1298(%rip), %rdx    # 0x5c8f28
leaq 0x2cfa99(%rip), %rcx    # 0x5c7730
jmp 0x2f7d38
movq 0x30(%rsp), %rax
cmpq 0x30(%rsp), %rax
jg 0x2f71a5
andq $0x0, (%r8,%rax,8)
incq %rax
jmp 0x2f7ca1
movq 0x44331b(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cfa54(%rip), %rsi    # 0x5c771b
leaq 0x2d125a(%rip), %rdx    # 0x5c8f28
leaq 0x2cfa60(%rip), %rcx    # 0x5c7735
jmp 0x2f7d38
movq 0x4432fa(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cf303(%rip), %rsi    # 0x5c6feb
leaq 0x2d1239(%rip), %rdx    # 0x5c8f28
leaq 0x2cfc4c(%rip), %rcx    # 0x5c7942
jmp 0x2f7d38
movq 0x4432d9(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cf2e2(%rip), %rsi    # 0x5c6feb
leaq 0x2d1218(%rip), %rdx    # 0x5c8f28
leaq 0x2cfa22(%rip), %rcx    # 0x5c7739
jmp 0x2f7d38
movq 0x4432b8(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x2cf9d7(%rip), %rsi    # 0x5c7701
leaq 0x2d11f7(%rip), %rdx    # 0x5c8f28
leaq 0x2cfa05(%rip), %rcx    # 0x5c773d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
movq %rbx, %rax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq