// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/sg_striped_sse2_128_64.c
// Function: parasail_sg_flags_table_striped_profile_sse2_128_64
parasail_result_t* PNAME(
        const parasail_profile_t * const restrict profile,
        const char * const restrict s2, const int s2Len,
        const int open, const int gap,
        int s1_beg, int s1_end, int s2_beg, int s2_end)
{
    /* declare local variables */
    int32_t i = 0;
    int32_t j = 0;
    int32_t k = 0;
    int32_t s1Len = 0;
    int32_t end_query = 0;
    int32_t end_ref = 0;
    const parasail_matrix_t *matrix = NULL;
    int32_t segWidth = 0;
    int32_t segLen = 0;
    int32_t offset = 0;
    int32_t position = 0;
    __m128i* restrict vProfile = NULL;
    __m128i* restrict pvHStore = NULL;
    __m128i* restrict pvHLoad = NULL;
    __m128i* restrict pvE = NULL;
    int64_t* restrict boundary = NULL;
    __m128i vGapO;
    __m128i vGapE;
    int64_t NEG_LIMIT = 0;
    int64_t POS_LIMIT = 0;
    int64_t score = 0;
    __m128i vNegLimit;
    __m128i vPosLimit;
    __m128i vSaturationCheckMin;
    __m128i vSaturationCheckMax;
    __m128i vMaxH;
    __m128i vPosMask;
    parasail_result_t *result = NULL;

    /* validate inputs */
    PARASAIL_CHECK_NULL(profile);
    PARASAIL_CHECK_NULL(profile->profile64.score);
    PARASAIL_CHECK_NULL(profile->matrix);
    PARASAIL_CHECK_GT0(profile->s1Len);
    PARASAIL_CHECK_NULL(s2);
    PARASAIL_CHECK_GT0(s2Len);
    PARASAIL_CHECK_GE0(open);
    PARASAIL_CHECK_GE0(gap);

    /* initialize stack variables */
    i = 0;
    j = 0;
    k = 0;
    s1Len = profile->s1Len;
    end_query = s1Len-1;
    end_ref = s2Len-1;
    matrix = profile->matrix;
    segWidth = 2; /* number of values in vector unit */
    segLen = (s1Len + segWidth - 1) / segWidth;
    offset = (s1Len - 1) % segLen;
    position = (segWidth - 1) - (s1Len - 1) / segLen;
    vProfile = (__m128i*)profile->profile64.score;
    vGapO = _mm_set1_epi64x_rpl(open);
    vGapE = _mm_set1_epi64x_rpl(gap);
    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;
    vMaxH = vNegLimit;
    vPosMask = _mm_cmpeq_epi64_rpl(_mm_set1_epi64x_rpl(position),
            _mm_set_epi64x_rpl(0,1));

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

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SG | PARASAIL_FLAG_STRIPED
        | 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 */
    pvHStore = parasail_memalign___m128i(16, segLen);
    pvHLoad =  parasail_memalign___m128i(16, segLen);
    pvE      = parasail_memalign___m128i(16, segLen);
    boundary = parasail_memalign_int64_t(16, s2Len+1);

    /* validate heap variables */
    if (!pvHStore) return NULL;
    if (!pvHLoad) return NULL;
    if (!pvE) return NULL;
    if (!boundary) return NULL;

    /* initialize H and E */
    {
        int32_t index = 0;
        for (i=0; i<segLen; ++i) {
            int32_t segNum = 0;
            __m128i_64_t h;
            __m128i_64_t e;
            for (segNum=0; segNum<segWidth; ++segNum) {
                int64_t tmp = s1_beg ? 0 : (-open-gap*(segNum*segLen+i));
                h.v[segNum] = tmp < INT64_MIN ? INT64_MIN : tmp;
                tmp = tmp - open;
                e.v[segNum] = tmp < INT64_MIN ? INT64_MIN : tmp;
            }
            _mm_store_si128(&pvHStore[index], h.m);
            _mm_store_si128(&pvE[index], e.m);
            ++index;
        }
    }

    /* initialize uppder boundary */
    {
        boundary[0] = 0;
        for (i=1; i<=s2Len; ++i) {
            int64_t tmp = s2_beg ? 0 : (-open-gap*(i-1));
            boundary[i] = tmp < INT64_MIN ? INT64_MIN : tmp;
        }
    }

    /* outer loop over database sequence */
    for (j=0; j<s2Len; ++j) {
        __m128i vE;
        /* Initialize F value to -inf.  Any errors to vH values will be
         * corrected in the Lazy_F loop.  */
        __m128i vF = vNegLimit;

        /* load final segment of pvHStore and shift left by 2 bytes */
        __m128i vH = _mm_slli_si128(pvHStore[segLen - 1], 8);

        /* Correct part of the vProfile */
        const __m128i* vP = vProfile + matrix->mapper[(unsigned char)s2[j]] * segLen;

        /* Swap the 2 H buffers. */
        __m128i* pv = pvHLoad;
        pvHLoad = pvHStore;
        pvHStore = pv;

        /* insert upper boundary condition */
        vH = _mm_insert_epi64_rpl(vH, boundary[j], 0);

        /* inner loop to process the query sequence */
        for (i=0; i<segLen; ++i) {
            vH = _mm_add_epi64(vH, _mm_load_si128(vP + i));
            vE = _mm_load_si128(pvE + i);

            /* Get max from vH, vE and vF. */
            vH = _mm_max_epi64_rpl(vH, vE);
            vH = _mm_max_epi64_rpl(vH, vF);
            /* Save vH values. */
            _mm_store_si128(pvHStore + i, vH);
            vSaturationCheckMax = _mm_max_epi64_rpl(vSaturationCheckMax, vH);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vH);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vE);
            vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vF);
#ifdef PARASAIL_TABLE
            arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif

            /* Update vE value. */
            vH = _mm_sub_epi64(vH, vGapO);
            vE = _mm_sub_epi64(vE, vGapE);
            vE = _mm_max_epi64_rpl(vE, vH);
            _mm_store_si128(pvE + i, vE);

            /* Update vF value. */
            vF = _mm_sub_epi64(vF, vGapE);
            vF = _mm_max_epi64_rpl(vF, vH);

            /* Load the next vH. */
            vH = _mm_load_si128(pvHLoad + i);
        }

        /* Lazy_F loop: has been revised to disallow adjecent insertion and
         * then deletion, so don't update E(i, i), learn from SWPS3 */
        for (k=0; k<segWidth; ++k) {
            int64_t tmp = s2_beg ? -open : (boundary[j+1]-open);
            int64_t tmp2 = tmp < INT64_MIN ? INT64_MIN : tmp;
            vF = _mm_slli_si128(vF, 8);
            vF = _mm_insert_epi64_rpl(vF, tmp2, 0);
            for (i=0; i<segLen; ++i) {
                vH = _mm_load_si128(pvHStore + i);
                vH = _mm_max_epi64_rpl(vH,vF);
                _mm_store_si128(pvHStore + i, vH);
                vSaturationCheckMin = _mm_min_epi64_rpl(vSaturationCheckMin, vH);
                vSaturationCheckMax = _mm_max_epi64_rpl(vSaturationCheckMax, vH);
#ifdef PARASAIL_TABLE
                arr_store_si128(result->tables->score_table, vH, i, segLen, j, s2Len);
#endif
                vH = _mm_sub_epi64(vH, vGapO);
                vF = _mm_sub_epi64(vF, vGapE);
                if (! _mm_movemask_epi8(_mm_cmpgt_epi64_rpl(vF, vH))) goto end;
                /*vF = _mm_max_epi64_rpl(vF, vH);*/
            }
        }
end:
        {
            /* extract vector containing last value from the column */
            __m128i vCompare;
            vH = _mm_load_si128(pvHStore + offset);
            vCompare = _mm_and_si128(vPosMask, _mm_cmpgt_epi64_rpl(vH, vMaxH));
            vMaxH = _mm_max_epi64_rpl(vH, vMaxH);
            if (_mm_movemask_epi8(vCompare)) {
                end_ref = j;
            }
#ifdef PARASAIL_ROWCOL
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 8);
            }
            result->rowcols->score_row[j] = (int64_t) _mm_extract_epi64_rpl (vH, 1);
#endif
        }
    }

#ifdef PARASAIL_ROWCOL
    for (i=0; i<segLen; ++i) {
        __m128i vH = _mm_load_si128(pvHStore + i);
        arr_store_col(result->rowcols->score_col, vH, i, segLen);
    }
#endif

    /* max last value from all columns */
    if (s2_end)
    {
        for (k=0; k<position; ++k) {
            vMaxH = _mm_slli_si128(vMaxH, 8);
        }
        score = (int64_t) _mm_extract_epi64_rpl(vMaxH, 1);
        end_query = s1Len-1;
    }

    /* max of last column */
    if (s1_end)
    {
        /* Trace the alignment ending position on read. */
        int64_t *t = (int64_t*)pvHStore;
        int32_t column_len = segLen * segWidth;
        for (i = 0; i<column_len; ++i, ++t) {
            int32_t temp = i / segWidth + i % segWidth * segLen;
            if (temp >= s1Len) continue;
            if (*t > score) {
                score = *t;
                end_query = temp;
                end_ref = s2Len-1;
            }
            else if (*t == score && end_ref == s2Len-1 && temp < end_query) {
                end_query = temp;
            }
        }
    }

    if (!s1_end && !s2_end) {
        /* extract last value from the last column */
        {
            __m128i vH = _mm_load_si128(pvHStore + offset);
            for (k=0; k<position; ++k) {
                vH = _mm_slli_si128(vH, 8);
            }
            score = (int64_t) _mm_extract_epi64_rpl (vH, 1);
            end_ref = s2Len - 1;
            end_query = s1Len - 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(boundary);
    parasail_free(pvE);
    parasail_free(pvHLoad);
    parasail_free(pvHStore);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, 0x88(%rsp)
testq %rdi, %rdi
je 0x2fec88
movq 0x60(%rdi), %rax
movq %rax, 0xd8(%rsp)
testq %rax, %rax
je 0x2fec8f
movq 0x10(%rdi), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x2fec96
movl %r9d, %r15d
movl %ecx, %r9d
movl 0x8(%rdi), %ecx
testl %ecx, %ecx
jle 0x2fec9d
cmpq $0x0, 0x88(%rsp)
je 0x2feca4
movl %edx, %ebx
testl %edx, %edx
jle 0x2fecab
testl %r9d, %r9d
js 0x2fecb2
testl %r8d, %r8d
js 0x2fecb9
movl %r8d, 0x10(%rsp)
leal -0x1(%rcx), %eax
movq %rcx, 0xb0(%rsp)
leaq 0x1(%rcx), %rdi
movq %rdi, %r12
shrq %r12
movl %eax, 0xc(%rsp)
cltd
idivl %r12d
movl %edx, 0x38(%rsp)
xorl %r14d, %r14d
cmpl $0x1, %eax
movl $0x0, %r13d
sbbq %r13, %r13
movl %eax, 0x74(%rsp)
cmpl $0x1, %eax
sete %bpl
movl %r9d, %ecx
negl %r9d
movq 0x80(%rsp), %rsi
movslq 0x20(%rsi), %rax
movq %rcx, 0x90(%rsp)
btsq $0x3f, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
subq %rax, %rdx
movl %r9d, 0x50(%rsp)
cmpl %r9d, %eax
cmovgq %rcx, %rdx
movq %rdx, 0x78(%rsp)
movslq 0x1c(%rsi), %rax
movq %rax, 0x20(%rsp)
andl $0x7ffffffe, %edi       # imm = 0x7FFFFFFE
movq %rdi, 0xa8(%rsp)
movl %ebx, %esi
callq 0x20959f
testq %rax, %rax
je 0x2fed8c
movq %r13, 0x18(%rsp)
movb %bpl, 0x30(%rsp)
movl 0x150(%rsp), %edi
xorl %r8d, %r8d
testl %r15d, %r15d
setne %r8b
xorl %ecx, %ecx
cmpl $0x0, 0x140(%rsp)
setne %cl
shll $0x4, %ecx
xorl %edx, %edx
cmpl $0x0, 0x148(%rsp)
setne %dl
shll $0xe, %edx
xorl %esi, %esi
movl %edi, 0x70(%rsp)
testl %edi, %edi
setne %sil
shll $0xf, %esi
leal (%rcx,%r8,8), %ecx
orl %edx, %ecx
orl %esi, %ecx
orl 0xc(%rax), %ecx
orl $0x2820802, %ecx        # imm = 0x2820802
movq %rax, 0x68(%rsp)
movl %ecx, 0xc(%rax)
movl $0x10, %edi
movq %r12, %rsi
callq 0x2ea474
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x2ea474
movq %rax, %r13
movl $0x10, %edi
movq %r12, %rsi
callq 0x2ea474
movq %r12, 0x58(%rsp)
movq %rax, %r12
leal 0x1(%rbx), %esi
movl $0x10, %edi
movq %rsi, 0x60(%rsp)
callq 0x2094de
movq %rax, %r11
testq %r14, %r14
sete %al
movq %r13, 0x40(%rsp)
testq %r13, %r13
sete %cl
orb %al, %cl
testq %r12, %r12
sete %al
testq %r11, %r11
sete %dl
orb %al, %dl
orb %cl, %dl
jne 0x2fecbe
movq %r14, %rbp
movq %r12, 0x48(%rsp)
movq %rbx, (%rsp)
leal -0x1(%rbx), %eax
movl %eax, 0x8(%rsp)
movq 0x90(%rsp), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movl 0x10(%rsp), %edx
movd %edx, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movq 0x78(%rsp), %rax
incq %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
subq 0x20(%rsp), %rsi
addq $-0x2, %rsi
movq %rax, 0x28(%rsp)
movq %rax, %xmm2
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
movq %rsi, 0xa0(%rsp)
movq %rsi, %xmm3
pshufd $0x44, %xmm3, %xmm4     # xmm4 = xmm3[0,1,0,1]
xorl %eax, %eax
movb 0x30(%rsp), %sil
movb %sil, %al
negq %rax
movq 0x18(%rsp), %xmm3
movl %edx, %r13d
movq %rax, %xmm5
punpcklqdq %xmm5, %xmm3    # xmm3 = xmm3[0],xmm5[0]
movl %edx, %eax
movl 0x50(%rsp), %ebx
movslq %ebx, %rdx
movq 0x58(%rsp), %r12
movl %r12d, %esi
movq %rsi, 0x20(%rsp)
imulq %rax, %rsi
xorl %edi, %edi
movq %rcx, %r14
movq 0x48(%rsp), %rcx
movq %rdx, %r8
xorl %r9d, %r9d
testl %r15d, %r15d
je 0x2fe645
xorl %r10d, %r10d
jmp 0x2fe648
movq %r8, %r10
movq %r10, 0xf0(%rsp,%r9,8)
subq %r14, %r10
movq %r10, 0xe0(%rsp,%r9,8)
incq %r9
subq %rsi, %r8
cmpq $0x1, %r9
je 0x2fe63b
movq %rdi, %r8
shlq $0x4, %r8
movaps 0xf0(%rsp), %xmm5
movaps %xmm5, (%rbp,%r8)
movdqa 0xe0(%rsp), %xmm5
movdqa %xmm5, (%rcx,%r8)
incq %rdi
subq %rax, %rdx
cmpq 0x20(%rsp), %rdi
jne 0x2fe635
movq $0x0, (%r11)
movl $0x1, %eax
movl %ebx, %edx
movl 0x148(%rsp), %ecx
movq 0x60(%rsp), %rdi
testl %ecx, %ecx
movl $0x0, %esi
cmovel %edx, %esi
movslq %esi, %rsi
movq %rsi, (%r11,%rax,8)
incq %rax
subl %r13d, %edx
cmpq %rax, %rdi
jne 0x2fe6b2
movq %r11, 0x18(%rsp)
leal -0x1(%r12), %ecx
movq (%rsp), %rsi
movl %esi, %r9d
movslq %ebx, %rax
movq %rax, 0x60(%rsp)
movl 0x38(%rsp), %eax
cmpl $0x1, %r12d
movl %r12d, %r11d
adcl $0x0, %r11d
cmpl $0x2, %esi
movl $0x1, %edx
cmovgel %esi, %edx
movq %rdx, 0xc8(%rsp)
movq 0x20(%rsp), %rdx
imulq %r9, %rdx
shlq $0x2, %rdx
movq %rdx, 0x50(%rsp)
shlq $0x2, %r9
shlq $0x4, %r11
xorl %r10d, %r10d
shlq $0x4, %rcx
movq %rcx, 0xd0(%rsp)
movslq %r12d, %rcx
movq %rcx, 0xc0(%rsp)
movq %rax, 0x98(%rsp)
shlq $0x4, %rax
movq %rax, 0xb8(%rsp)
xorl %ebx, %ebx
movl 0x8(%rsp), %eax
movl %eax, (%rsp)
movdqa %xmm2, %xmm5
movdqa %xmm2, %xmm6
movq 0x40(%rsp), %r15
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rcx
movzbl (%rcx,%rbx), %edx
movslq (%rax,%rdx,4), %rcx
imulq 0xc0(%rsp), %rcx
shlq $0x4, %rcx
movq 0x18(%rsp), %rax
movq %rbx, 0x30(%rsp)
movq (%rax,%rbx,8), %xmm8
movq 0xd0(%rsp), %rax
movq %rbp, 0x40(%rsp)
punpcklqdq (%rbp,%rax), %xmm8 # xmm8 = xmm8[0],mem[0]
addq 0xd8(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %r10, 0x38(%rsp)
movq %r10, %rdx
xorl %esi, %esi
movdqa %xmm2, %xmm7
movq 0x10(%rsp), %rax
paddq (%rax,%rsi), %xmm8
movq %r11, %r8
movq %xmm8, %r11
movq 0x48(%rsp), %rax
movq (%rax,%rsi), %r13
movq 0x8(%rax,%rsi), %r12
cmpq %r13, %r11
cmovleq %r13, %r11
pshufd $0xee, %xmm8, %xmm8     # xmm8 = xmm8[2,3,2,3]
movq %r9, %rdi
movq %xmm8, %r9
cmpq %r12, %r9
cmovleq %r12, %r9
movq %xmm7, %rax
cmpq %rax, %r11
cmovleq %rax, %r11
pshufd $0xee, %xmm7, %xmm8     # xmm8 = xmm7[2,3,2,3]
movq %xmm8, %rbp
cmpq %rbp, %r9
cmovleq %rbp, %r9
movq %xmm6, %rbx
cmpq %r11, %rbx
cmovleq %r11, %rbx
pshufd $0xee, %xmm6, %xmm6     # xmm6 = xmm6[2,3,2,3]
movq %xmm6, %rcx
cmpq %r9, %rcx
cmovleq %r9, %rcx
movq %xmm4, %r10
cmpq %r11, %r10
cmovgeq %r11, %r10
pshufd $0xee, %xmm4, %xmm4     # xmm4 = xmm4[2,3,2,3]
movq %xmm4, %r14
cmpq %r9, %r14
cmovgeq %r9, %r14
cmpq %r13, %r10
cmovgeq %r13, %r10
movq %rbx, %xmm6
cmpq %r12, %r14
cmovgeq %r12, %r14
movq %rcx, %xmm8
cmpq %rax, %r10
cmovgeq %rax, %r10
movq 0x48(%rsp), %r12
movdqa (%r12,%rsi), %xmm9
movq %r11, %xmm10
movq %r9, %xmm4
punpcklqdq %xmm4, %xmm10   # xmm10 = xmm10[0],xmm4[0]
movdqa %xmm10, (%r15,%rsi)
cmpq %rbp, %r14
cmovgeq %rbp, %r14
movq %r10, %xmm4
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl %r11d, (%rax,%rdx)
movq %r8, %r11
addq %rdx, %rax
psubq %xmm0, %xmm10
psubq %xmm1, %xmm9
movq %xmm9, %rcx
movq %xmm10, %r10
cmpq %r10, %rcx
cmovleq %r10, %rcx
movq 0x50(%rsp), %rbx
movl %r9d, (%rbx,%rax)
pshufd $0xee, %xmm9, %xmm9     # xmm9 = xmm9[2,3,2,3]
movq %xmm9, %rax
pshufd $0xee, %xmm10, %xmm9    # xmm9 = xmm10[2,3,2,3]
movq %xmm9, %r9
cmpq %r9, %rax
cmovleq %r9, %rax
movq %r14, %xmm9
movq %rcx, %xmm10
psubq %xmm1, %xmm7
movq %xmm7, %rcx
cmpq %r10, %rcx
cmovgq %rcx, %r10
pshufd $0xee, %xmm7, %xmm7     # xmm7 = xmm7[2,3,2,3]
movq %xmm7, %rcx
cmpq %r9, %rcx
cmovgq %rcx, %r9
movq %rax, %xmm11
movq %r10, %xmm7
movq %r9, %xmm12
movq %rdi, %r9
punpcklqdq %xmm8, %xmm6    # xmm6 = xmm6[0],xmm8[0]
punpcklqdq %xmm9, %xmm4    # xmm4 = xmm4[0],xmm9[0]
punpcklqdq %xmm11, %xmm10  # xmm10 = xmm10[0],xmm11[0]
movdqa %xmm10, (%r12,%rsi)
punpcklqdq %xmm12, %xmm7   # xmm7 = xmm7[0],xmm12[0]
movq 0x40(%rsp), %rax
movdqa (%rax,%rsi), %xmm8
addq $0x10, %rsi
addq %rdi, %rdx
cmpq %rsi, %r8
jne 0x2fe7cf
movq $0x0, 0x10(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x0, 0x148(%rsp)
movq 0x38(%rsp), %r9
jne 0x2fe9ac
movq 0x18(%rsp), %rax
movq 0x30(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
subq 0x90(%rsp), %rax
movq %rax, %xmm8
punpcklqdq %xmm7, %xmm8    # xmm8 = xmm8[0],xmm7[0]
movb $0x1, %bpl
movl $0x1, %r11d
xorl %r12d, %r12d
movdqa %xmm8, %xmm7
movq %xmm7, %rbx
movq (%r15,%r12), %rax
cmpq %rbx, %rax
cmovgq %rax, %rbx
movq 0x8(%r15,%r12), %rcx
movq %rbx, %xmm8
pshufd $0xee, %xmm7, %xmm9     # xmm9 = xmm7[2,3,2,3]
movq %xmm9, %rax
cmpq %rax, %rcx
cmovgq %rcx, %rax
movq %rax, %xmm9
punpcklqdq %xmm9, %xmm8    # xmm8 = xmm8[0],xmm9[0]
movdqa %xmm8, (%r15,%r12)
movq %xmm4, %rdx
cmpq %rbx, %rdx
cmovgeq %rbx, %rdx
pshufd $0xee, %xmm4, %xmm4     # xmm4 = xmm4[2,3,2,3]
movq %xmm4, %r14
cmpq %rax, %r14
cmovgeq %rax, %r14
movq %rdx, %xmm4
movq %r14, %xmm9
punpcklqdq %xmm9, %xmm4    # xmm4 = xmm4[0],xmm9[0]
movq %xmm6, %r13
cmpq %rbx, %r13
cmovleq %rbx, %r13
pshufd $0xee, %xmm6, %xmm6     # xmm6 = xmm6[2,3,2,3]
movq %xmm6, %rsi
cmpq %rax, %rsi
cmovleq %rax, %rsi
movq %r13, %xmm6
movq %rsi, %xmm9
punpcklqdq %xmm9, %xmm6    # xmm6 = xmm6[0],xmm9[0]
movq 0x68(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx), %rcx
movl %ebx, (%rcx,%r9)
addq %r9, %rcx
movq 0x50(%rsp), %r10
movl %eax, (%r10,%rcx)
psubq %xmm0, %xmm8
psubq %xmm1, %xmm7
movq %xmm7, %rax
movq %xmm8, %rcx
xorl %r10d, %r10d
cmpq %rcx, %rax
setg %r10b
negq %r10
pshufd $0xee, %xmm7, %xmm9     # xmm9 = xmm7[2,3,2,3]
movq %xmm9, %rax
pshufd $0xee, %xmm8, %xmm8     # xmm8 = xmm8[2,3,2,3]
movq %xmm8, %rcx
xorl %ebx, %ebx
cmpq %rcx, %rax
setg %bl
negq %rbx
movq %r10, %xmm8
movq %rbx, %xmm9
punpcklqdq %xmm9, %xmm8    # xmm8 = xmm8[0],xmm9[0]
pmovmskb %xmm8, %eax
testl %eax, %eax
je 0x2feaec
cmpq 0x20(%rsp), %r11
setb %bpl
addq $0x10, %r12
addq %rdi, %r9
incq %r11
cmpq %r12, %r8
jne 0x2fe9c7
testb $0x1, %bpl
jne 0x2feb07
movq 0x10(%rsp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
movq %rax, 0x10(%rsp)
je 0x2fe981
movq %xmm5, %rax
movq 0xb8(%rsp), %r9
movq (%r15,%r9), %rcx
movq 0x8(%r15,%r9), %r9
pshufd $0xee, %xmm5, %xmm5     # xmm5 = xmm5[2,3,2,3]
movq %xmm5, %r10
xorl %r11d, %r11d
cmpq %r10, %r9
setg %r11b
cmovgq %r9, %r10
xorl %r9d, %r9d
cmpq %rax, %rcx
setg %r9b
cmovgq %rcx, %rax
negq %r9
negq %r11
movq %r11, %xmm5
movq %r9, %xmm7
punpcklqdq %xmm5, %xmm7    # xmm7 = xmm7[0],xmm5[0]
pand %xmm3, %xmm7
movq %r10, %xmm8
movq %rax, %xmm5
punpcklqdq %xmm8, %xmm5    # xmm5 = xmm5[0],xmm8[0]
pmovmskb %xmm7, %eax
testl %eax, %eax
movl (%rsp), %eax
movq 0x30(%rsp), %rbx
cmovnel %ebx, %eax
movl %eax, (%rsp)
incq %rbx
movq 0x38(%rsp), %r10
addq $0x4, %r10
movq %r15, %rbp
cmpq 0xc8(%rsp), %rbx
movq %rdi, %r9
movq %r8, %r11
jne 0x2fe762
cmpl $0x0, 0x150(%rsp)
movq 0x68(%rsp), %rbx
movl 0xc(%rsp), %eax
movl 0x74(%rsp), %ebp
movq 0xb0(%rsp), %r12
je 0x2febd8
testl %ebp, %ebp
jg 0x2febcd
pslldq $0x8, %xmm5             # xmm5 = zero,zero,zero,zero,zero,zero,zero,zero,xmm5[0,1,2,3,4,5,6,7]
testl %ebp, %ebp
js 0x2febc4
pshufd $0xee, %xmm5, %xmm0     # xmm0 = xmm5[2,3,2,3]
movq %xmm0, 0x28(%rsp)
cmpl $0x0, 0x140(%rsp)
je 0x2fec5a
cmpl $0x0, 0xa8(%rsp)
je 0x2fec5a
movq 0x58(%rsp), %rcx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %ecx
xorl %edi, %edi
movl %edi, %r9d
shrl %r9d
testb $0x1, %dil
movl $0x0, %r8d
cmovnel 0x58(%rsp), %r8d
addl %r9d, %r8d
cmpl %r12d, %r8d
jge 0x2fec53
movq (%r15,%rdi,8), %r9
movq 0x28(%rsp), %r11
cmpq %r11, %r9
jle 0x2fec38
movq %r9, 0x28(%rsp)
movl 0x8(%rsp), %eax
movl %eax, (%rsp)
movl %r8d, %eax
jmp 0x2fec53
cmpl %eax, %r8d
cmovgel %eax, %r8d
movl (%rsp), %r10d
cmpl 0x8(%rsp), %r10d
cmovnel %eax, %r8d
cmpq %r11, %r9
cmovel %r8d, %eax
incq %rdi
cmpl %edi, %ecx
jne 0x2febfb
movl 0x140(%rsp), %ecx
orl %ecx, 0x70(%rsp)
movq 0x28(%rsp), %r8
jne 0x2fece6
movq 0x98(%rsp), %rax
shlq $0x4, %rax
movdqa (%r15,%rax), %xmm0
testl %ebp, %ebp
jle 0x2fecc6
movl 0xc(%rsp), %ecx
jmp 0x2fecd3
callq 0x1ada7f
jmp 0x2fecbe
callq 0x1ada59
jmp 0x2fecbe
callq 0x1ada33
jmp 0x2fecbe
callq 0x1ada0d
jmp 0x2fecbe
callq 0x1ad9e7
jmp 0x2fecbe
callq 0x1ad9c1
jmp 0x2fecbe
callq 0x1ad99b
jmp 0x2fecbe
callq 0x1ad975
xorl %r14d, %r14d
jmp 0x2fed8c
movl 0xc(%rsp), %ecx
pslldq $0x8, %xmm0             # xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
testl %ebp, %ebp
js 0x2fecca
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %r8
movl 0x8(%rsp), %eax
movl %eax, (%rsp)
movl %ecx, %eax
xorl %ecx, %ecx
movq 0x78(%rsp), %rdi
cmpq %rdi, %rdx
setle %cl
negq %rcx
xorl %edx, %edx
cmpq %rdi, %r14
setle %dl
negq %rdx
movq %rdx, %xmm0
movq %rcx, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
xorl %ecx, %ecx
movq 0xa0(%rsp), %rdi
cmpq %rdi, %r13
setg %cl
negq %rcx
xorl %edx, %edx
cmpq %rdi, %rsi
setg %dl
negq %rdx
movq %rdx, %xmm0
movq %rcx, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
por %xmm1, %xmm2
pmovmskb %xmm2, %ecx
testl %ecx, %ecx
je 0x2fed57
orb $0x40, 0xc(%rbx)
xorl %r8d, %r8d
movl $0x0, (%rsp)
xorl %eax, %eax
movl %r8d, (%rbx)
movl %eax, 0x4(%rbx)
movl (%rsp), %eax
movl %eax, 0x8(%rbx)
movq 0x18(%rsp), %rdi
callq 0x2094b5
movq 0x48(%rsp), %rdi
callq 0x2094b5
movq 0x40(%rsp), %rdi
callq 0x2094b5
movq %r15, %rdi
callq 0x2094b5
movq %rbx, %r14
movq %r14, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq