// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/sw_trace_diag_sse2_128_32.c
// Function: parasail_sw_trace_diag_sse2_128_32
parasail_result_t* FNAME(
        const char * const restrict _s1, const int _s1Len,
        const char * const restrict _s2, const int s2Len,
        const int open, const int gap, const parasail_matrix_t *matrix)
{
    /* declare local variables */
    int32_t N = 0;
    int32_t PAD = 0;
    int32_t PAD2 = 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 s1Len = 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 vNegInf0;
    __m128i vOpen;
    __m128i vGap;
    __m128i vZero;
    __m128i vOne;
    __m128i vN;
    __m128i vNegOne;
    __m128i vI;
    __m128i vJreset;
    __m128i vMaxH;
    __m128i vEndI;
    __m128i vEndJ;
    __m128i vILimit;
    __m128i vJLimit;
    __m128i vTDiag;
    __m128i vTIns;
    __m128i vTDel;
    __m128i vTZero;
    __m128i vTDiagE;
    __m128i vTInsE;
    __m128i vTDiagF;
    __m128i vTDelF;

    /* 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);
    vNegInf0 = _mm_srli_si128(vNegInf, 4); /* shift in a 0 */
    vOpen = _mm_set1_epi32(open);
    vGap  = _mm_set1_epi32(gap);
    vZero = _mm_set1_epi32(0);
    vOne = _mm_set1_epi32(1);
    vN = _mm_set1_epi32(N);
    vNegOne = _mm_set1_epi32(-1);
    vI = _mm_set_epi32(0,1,2,3);
    vJreset = _mm_set_epi32(0,-1,-2,-3);
    vMaxH = vNegInf;
    vEndI = vNegInf;
    vEndJ = vNegInf;
    vILimit = _mm_set1_epi32(s1Len);
    vJLimit = _mm_set1_epi32(s2Len);
    vTDiag = _mm_set1_epi32(PARASAIL_DIAG);
    vTIns = _mm_set1_epi32(PARASAIL_INS);
    vTDel = _mm_set1_epi32(PARASAIL_DEL);
    vTZero = _mm_set1_epi32(PARASAIL_ZERO);
    vTDiagE = _mm_set1_epi32(PARASAIL_DIAG_E);
    vTInsE = _mm_set1_epi32(PARASAIL_INS_E);
    vTDiagF = _mm_set1_epi32(PARASAIL_DIAG_F);
    vTDelF = _mm_set1_epi32(PARASAIL_DEL_F);

    /* initialize result */
    result = parasail_result_new_trace(s1Len, s2Len, 16, sizeof(int8_t));
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SW | PARASAIL_FLAG_DIAG
        | PARASAIL_FLAG_TRACE
        | PARASAIL_FLAG_BITS_32 | PARASAIL_FLAG_LANES_4;

    /* 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 */
    for (j=0; j<s2Len; ++j) {
        H_pr[j] = 0;
        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;
    }

    /* iterate over query sequence */
    for (i=0; i<s1Len; i+=N) {
        __m128i vNH = vNegInf0;
        __m128i vWH = vNegInf0;
        __m128i vE = vNegInf;
        __m128i vE_opn = vNegInf;
        __m128i vE_ext = vNegInf;
        __m128i vF = vNegInf;
        __m128i vF_opn = vNegInf;
        __m128i vF_ext = 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);
        /* iterate over database sequence */
        for (j=0; j<s2Len+PAD; ++j) {
            __m128i vMat;
            __m128i vNWH = vNH;
            vNH = _mm_srli_si128(vWH, 4);
            vNH = _mm_insert_epi32_rpl(vNH, H_pr[j], 3);
            vF = _mm_srli_si128(vF, 4);
            vF = _mm_insert_epi32_rpl(vF, F_pr[j], 3);
            vF_opn = _mm_sub_epi32(vNH, vOpen);
            vF_ext = _mm_sub_epi32(vF, vGap);
            vF = _mm_max_epi32_rpl(vF_opn, vF_ext);
            vE_opn = _mm_sub_epi32(vWH, vOpen);
            vE_ext = _mm_sub_epi32(vE, vGap);
            vE = _mm_max_epi32_rpl(vE_opn, vE_ext);
            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);
            vNWH = _mm_max_epi32_rpl(vNWH, vZero);
            vWH = _mm_max_epi32_rpl(vNWH, vE);
            vWH = _mm_max_epi32_rpl(vWH, vF);
            /* as minor diagonal vector passes across the j=-1 boundary,
             * assign the appropriate boundary conditions */
            {
                __m128i cond = _mm_cmpeq_epi32(vJ,vNegOne);
                vWH = _mm_andnot_si128(cond, vWH);
                vF = _mm_blendv_epi8_rpl(vF, vNegInf, cond);
                vE = _mm_blendv_epi8_rpl(vE, vNegInf, cond);
            }
            /* cannot start checking sat until after J clears boundary */
            if (j > PAD) {
                vSaturationCheckMin = _mm_min_epi32_rpl(vSaturationCheckMin, vWH);
                vSaturationCheckMax = _mm_max_epi32_rpl(vSaturationCheckMax, vWH);
            }
            /* trace table */
            {
                __m128i cond_zero = _mm_cmpeq_epi32(vWH, vZero);
                __m128i case1 = _mm_cmpeq_epi32(vWH, vNWH);
                __m128i case2 = _mm_cmpeq_epi32(vWH, vF);
                __m128i vT = _mm_blendv_epi8_rpl(
                        _mm_blendv_epi8_rpl(vTIns, vTDel, case2),
                        _mm_blendv_epi8_rpl(vTDiag, vTZero, cond_zero),
                        case1);
                __m128i condE = _mm_cmpgt_epi32(vE_opn, vE_ext);
                __m128i condF = _mm_cmpgt_epi32(vF_opn, vF_ext);
                __m128i vET = _mm_blendv_epi8_rpl(vTInsE, vTDiagE, condE);
                __m128i vFT = _mm_blendv_epi8_rpl(vTDelF, vTDiagF, condF);
                vT = _mm_or_si128(vT, vET);
                vT = _mm_or_si128(vT, vFT);
                arr_store_si128(result->trace->trace_table, vT, i, s1Len, j, s2Len);
            }
            H_pr[j-3] = (int32_t)_mm_extract_epi32_rpl(vWH,0);
            F_pr[j-3] = (int32_t)_mm_extract_epi32_rpl(vF,0);
            /* as minor diagonal vector passes across table, extract
             * max values within the i,j bounds */
            {
                __m128i cond_valid_J = _mm_and_si128(
                        _mm_cmpgt_epi32(vJ, vNegOne),
                        _mm_cmplt_epi32(vJ, vJLimit));
                __m128i cond_valid_IJ = _mm_and_si128(cond_valid_J, vIltLimit);
                __m128i cond_eq = _mm_cmpeq_epi32(vWH, vMaxH);
                __m128i cond_max = _mm_cmpgt_epi32(vWH, vMaxH);
                __m128i cond_all = _mm_and_si128(cond_max, cond_valid_IJ);
                __m128i cond_Jlt = _mm_cmplt_epi32(vJ, vEndJ);
                vMaxH = _mm_blendv_epi8_rpl(vMaxH, vWH, cond_all);
                vEndI = _mm_blendv_epi8_rpl(vEndI, vI, cond_all);
                vEndJ = _mm_blendv_epi8_rpl(vEndJ, vJ, cond_all);
                cond_all = _mm_and_si128(cond_Jlt, cond_eq);
                cond_all = _mm_and_si128(cond_all, cond_valid_IJ);
                vEndI = _mm_blendv_epi8_rpl(vEndI, vI, cond_all);
                vEndJ = _mm_blendv_epi8_rpl(vEndJ, vJ, cond_all);
            }
            vJ = _mm_add_epi32(vJ, vOne);
        }
        vI = _mm_add_epi32(vI, vN);
    }

    /* alignment ending position */
    {
        int32_t *t = (int32_t*)&vMaxH;
        int32_t *i = (int32_t*)&vEndI;
        int32_t *j = (int32_t*)&vEndJ;
        int32_t k;
        for (k=0; k<N; ++k, ++t, ++i, ++j) {
            if (*t > score) {
                score = *t;
                end_query = *i;
                end_ref = *j;
            }
            else if (*t == score) {
                if (*j < end_ref) {
                    end_query = *i;
                    end_ref = *j;
                }
                else if (*j == end_ref && *i < end_query) {
                    end_query = *i;
                    end_ref = *j;
                }
            }
        }
    }

    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 $0x178, %rsp            # imm = 0x178
testq %rdx, %rdx
je 0x3af397
movl %ecx, %r13d
testl %ecx, %ecx
jle 0x3af39e
movl %r8d, %r12d
testl %r8d, %r8d
js 0x3af3a5
movl %r9d, %r14d
testl %r9d, %r9d
js 0x3af3ac
movq 0x1b0(%rsp), %r15
testq %r15, %r15
je 0x3af3b3
cmpl $0x0, 0x30(%r15)
je 0x3aea73
movl 0x34(%r15), %ebx
jmp 0x3aea86
testq %rdi, %rdi
je 0x3af3ba
movl %esi, %ebx
testl %esi, %esi
jle 0x3af3c1
movq %rdi, 0x20(%rsp)
movq %rdx, 0x60(%rsp)
movl %r12d, %eax
negl %eax
movl 0x20(%r15), %ecx
movl $0x80000000, %esi       # imm = 0x80000000
movl %r12d, %edx
orl %esi, %edx
subl %ecx, %esi
cmpl %eax, %ecx
cmovgl %edx, %esi
incl %esi
movl $0x7ffffffe, %ebp       # imm = 0x7FFFFFFE
subl 0x1c(%r15), %ebp
movl %esi, 0x4(%rsp)
movd %esi, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x100(%rsp)
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x50(%rsp)
movdqa %xmm0, 0xd0(%rsp)
movl $0x10, %edx
movl $0x1, %ecx
movl %ebx, %edi
movl %r13d, %esi
callq 0x20adf4
testq %rax, %rax
je 0x3af3c6
movl %r12d, 0x38(%rsp)
movl %r14d, 0x40(%rsp)
movq %rax, 0x10(%rsp)
orl $0x4481004, 0xc(%rax)   # imm = 0x4481004
leal 0x6(%r13), %r12d
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a62d
movq %rax, %r14
movl $0x10, %edi
movq %r12, %rsi
callq 0x20a62d
movl $0x10, %edi
movq %r12, %rsi
movq %rax, %r12
callq 0x20a62d
testq %r14, %r14
sete %dl
testq %r12, %r12
sete %cl
orb %dl, %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x3af3c6
cmpl $0x0, 0x30(%r15)
movq %rax, 0x18(%rsp)
je 0x3aeb73
xorl %eax, %eax
jmp 0x3aebee
leal 0x3(%rbx), %eax
movl %eax, 0x30(%rsp)
movslq %eax, %rsi
movl $0x10, %edi
callq 0x20a62d
testq %rax, %rax
je 0x3af3c6
movq %rbx, %r8
testl %ebx, %ebx
movq 0x20(%rsp), %r9
jle 0x3aebb8
movq 0x10(%r15), %rdi
movl %r8d, %ecx
xorl %edx, %edx
movzbl (%r9,%rdx), %esi
movl (%rdi,%rsi,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x3aeba5
movq %r8, %rbx
movslq %ebx, %rcx
leaq (%rax,%rcx,4), %rdi
leal 0x1(%r8), %edx
movl 0x30(%rsp), %ecx
cmpl %edx, %ecx
cmovgl %ecx, %edx
movl %ebx, %ecx
notl %ecx
addl %edx, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %esi, %esi
movq %rax, 0x8(%rsp)
callq 0x19e090
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rsp)
leal 0x3(%r13), %r8d
movd %ebp, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0xa0(%rsp)
movdqa 0x50(%rsp), %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm0, 0x120(%rsp)
movd 0x38(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x150(%rsp)
movd 0x40(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x140(%rsp)
movq %rbx, 0x20(%rsp)
movd %ebx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x110(%rsp)
movd %r13d, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0x130(%rsp)
movq 0x10(%r15), %rax
movl %r13d, %ebp
xorl %ecx, %ecx
movq 0x60(%rsp), %rsi
movzbl (%rsi,%rcx), %edx
movl (%rax,%rdx,4), %edx
movl %edx, 0xc(%r14,%rcx,4)
incq %rcx
cmpq %rcx, %rbp
jne 0x3aec7d
movl $0x0, 0x8(%r14)
movq $0x0, (%r14)
leaq (%r14,%rbp,4), %rdi
addq $0xc, %rdi
leal 0x1(%r13), %eax
cmpl %eax, %r8d
movl %r8d, 0x60(%rsp)
cmovgl %r8d, %eax
movl %r13d, %ecx
notl %ecx
addl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x19e090
movl 0x4(%rsp), %r8d
movq 0x18(%rsp), %rdi
movl $0x0, 0xc(%r12,%rbx,4)
movl %r8d, 0xc(%rdi,%rbx,4)
incq %rbx
cmpq %rbx, %rbp
jne 0x3aecda
xorl %eax, %eax
movl %r8d, (%r12,%rax,4)
movl %r8d, (%rdi,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x3aecf2
leaq 0x3(%rbp), %rax
movq 0x20(%rsp), %rcx
movl 0x60(%rsp), %edx
movl %r8d, (%r12,%rax,4)
movl %r8d, (%rdi,%rax,4)
incq %rax
incl %r13d
cmpl %r13d, %edx
jg 0x3aed10
movdqa 0x50(%rsp), %xmm0
movdqa %xmm0, %xmm5
movdqa %xmm0, %xmm1
movdqa 0xa0(%rsp), %xmm2
testl %ecx, %ecx
jle 0x3af2d7
leal -0x1(%rcx), %eax
movl %eax, 0x4c(%rsp)
cmpl $0x2, %edx
movl $0x1, %eax
cmovgel %edx, %eax
movq %rax, 0xf8(%rsp)
movl %ecx, %edx
leaq -0x3(%rbp,%rbp,2), %rax
movq %rax, 0x88(%rsp)
leaq (,%rbp,4), %rax
movq %rax, 0xe8(%rsp)
leaq -0x2(%rbp,%rbp), %rax
movq %rax, 0x70(%rsp)
leaq -0x1(%rbp), %rax
movq %rax, 0x80(%rsp)
movaps 0x27acd8(%rip), %xmm0   # 0x629a70
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x78(%rsp)
pcmpeqd %xmm7, %xmm7
movdqa 0x50(%rsp), %xmm0
movdqa %xmm0, %xmm12
movdqa %xmm0, %xmm6
xorl %ebx, %ebx
movdqa 0xa0(%rsp), %xmm1
movdqa %xmm1, 0xb0(%rsp)
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm0, %xmm5
movq %rbx, %r13
orq $0x3, %r13
cmpl $0x0, 0x30(%r15)
je 0x3aee14
movq %rbx, %rax
orq $0x1, %rax
cmpq %rdx, %rax
movl 0x4c(%rsp), %ecx
cmovael %ecx, %eax
movq %rbx, %rsi
orq $0x2, %rsi
cmpq %rdx, %rsi
cmovael %ecx, %esi
cmpq %rdx, %r13
movl %r13d, %r8d
cmovael %ecx, %r8d
movl %ebx, %edi
jmp 0x3aee28
movq 0x8(%rsp), %rcx
movl (%rcx,%rbx,4), %edi
movl 0x4(%rcx,%rbx,4), %eax
movl 0x8(%rcx,%rbx,4), %esi
movl (%rcx,%r13,4), %r8d
movq 0x8(%r15), %r9
movl 0x18(%r15), %r10d
imull %r10d, %eax
cltq
leaq (%r9,%rax,4), %rax
movq %rax, 0x40(%rsp)
imull %r10d, %edi
movslq %edi, %rdi
leaq (%r9,%rdi,4), %rax
movq %rax, 0x38(%rsp)
imull %r10d, %esi
movslq %esi, %rsi
leaq (%r9,%rsi,4), %rax
movq %rax, 0x30(%rsp)
imull %r10d, %r8d
movslq %r8d, %rsi
leaq (%r9,%rsi,4), %r8
movq %rbx, %rsi
orq $0x1, %rbx
movq %rsi, 0xf0(%rsp)
orq $0x2, %rsi
movdqa 0x110(%rsp), %xmm0
pcmpgtd 0x20(%rsp), %xmm0
movdqa %xmm0, 0x160(%rsp)
xorl %r9d, %r9d
movdqa 0x27ae80(%rip), %xmm0   # 0x629d20
movaps 0x50(%rsp), %xmm9
movaps %xmm9, %xmm10
movaps 0x120(%rsp), %xmm11
movaps %xmm11, %xmm15
movq 0x18(%rsp), %rax
movq %r13, %rdi
movdqa %xmm5, 0x60(%rsp)
movq %r12, %r13
movss 0xc(%r12,%r9,4), %xmm1
shufps $0xf4, %xmm15, %xmm1    # xmm1 = xmm1[0,1],xmm15[3,3]
movslq 0xc(%r14,%r9,4), %r10
movslq 0x8(%r14,%r9,4), %rcx
movslq 0x4(%r14,%r9,4), %r15
movslq (%r14,%r9,4), %r12
movq 0x38(%rsp), %r11
movd (%r11,%r10,4), %xmm2
movq 0x40(%rsp), %r10
movd (%r10,%rcx,4), %xmm3
punpckldq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
movq 0x30(%rsp), %rcx
movd (%rcx,%r15,4), %xmm2
movd (%r8,%r12,4), %xmm13
punpckldq %xmm2, %xmm13   # xmm13 = xmm13[0],xmm2[0],xmm13[1],xmm2[1]
punpcklqdq %xmm3, %xmm13   # xmm13 = xmm13[0],xmm3[0]
paddd %xmm11, %xmm13
movaps %xmm15, %xmm11
shufps $0x29, %xmm1, %xmm11    # xmm11 = xmm11[1,2],xmm1[2,0]
movss 0xc(%rax,%r9,4), %xmm1
shufps $0xf4, %xmm10, %xmm1    # xmm1 = xmm1[0,1],xmm10[3,3]
shufps $0x29, %xmm1, %xmm10    # xmm10 = xmm10[1,2],xmm1[2,0]
movaps %xmm11, %xmm8
movdqa 0x150(%rsp), %xmm2
psubd %xmm2, %xmm8
movdqa 0x140(%rsp), %xmm3
psubd %xmm3, %xmm10
movdqa %xmm8, %xmm14
pcmpgtd %xmm10, %xmm14
movdqa %xmm14, %xmm1
pandn %xmm10, %xmm1
pand %xmm14, %xmm8
por %xmm1, %xmm8
psubd %xmm2, %xmm15
psubd %xmm3, %xmm9
movdqa %xmm15, %xmm3
pcmpgtd %xmm9, %xmm3
movdqa %xmm3, %xmm1
pandn %xmm9, %xmm1
pand %xmm3, %xmm15
movdqa %xmm15, %xmm2
por %xmm1, %xmm2
movdqa %xmm13, %xmm1
pcmpgtd 0x27adaf(%rip), %xmm1   # 0x629d60
pand %xmm13, %xmm1
movdqa %xmm1, %xmm4
pcmpgtd %xmm2, %xmm4
movdqa %xmm1, %xmm9
pand %xmm4, %xmm9
pandn %xmm2, %xmm4
por %xmm9, %xmm4
movdqa %xmm4, %xmm13
pcmpgtd %xmm8, %xmm13
pand %xmm13, %xmm4
pandn %xmm8, %xmm13
por %xmm4, %xmm13
movdqa %xmm0, %xmm5
pcmpeqd %xmm7, %xmm5
movdqa %xmm5, %xmm15
pandn %xmm13, %xmm15
movdqa %xmm5, %xmm10
pandn %xmm8, %xmm10
movdqa 0x50(%rsp), %xmm9
pand %xmm5, %xmm9
por %xmm9, %xmm10
cmpq $0x4, %r9
jb 0x3af076
movdqa 0xb0(%rsp), %xmm7
movdqa %xmm7, %xmm8
pcmpgtd %xmm15, %xmm8
movdqa %xmm15, %xmm4
pand %xmm8, %xmm4
pandn %xmm7, %xmm8
por %xmm4, %xmm8
movdqa 0xc0(%rsp), %xmm7
movdqa %xmm7, %xmm4
pcmpgtd %xmm15, %xmm4
pand %xmm4, %xmm7
pandn %xmm15, %xmm4
por %xmm4, %xmm7
movdqa %xmm7, 0xc0(%rsp)
movdqa %xmm8, 0xb0(%rsp)
pcmpeqd %xmm15, %xmm1
movdqa %xmm15, %xmm4
pcmpeqd 0x27acd8(%rip), %xmm4   # 0x629d60
pandn %xmm1, %xmm4
movdqa %xmm15, %xmm8
pcmpeqd %xmm10, %xmm8
movdqa 0x27b0f2(%rip), %xmm7   # 0x62a190
psubd %xmm8, %xmm7
pandn %xmm7, %xmm1
pand 0x27aa41(%rip), %xmm4   # 0x629af0
por %xmm1, %xmm4
pand 0x27c695(%rip), %xmm3   # 0x62b750
pand 0x27c6ac(%rip), %xmm14  # 0x62b770
por %xmm3, %xmm14
por %xmm4, %xmm14
pxor 0x27c8c9(%rip), %xmm14  # 0x62b9a0
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx), %r10
cmpq %rbp, %r9
movq %r13, %r12
jae 0x3af0fe
pextrw $0x6, %xmm14, %ecx
movq 0x78(%rsp), %rax
leaq (%r10,%rax), %r15
movb %cl, (%r9,%r15)
cmpq %rdx, %rbx
setae %cl
leaq -0x1(%r9), %r15
cmpq %rbp, %r15
setae %r15b
orb %cl, %r15b
pcmpeqd %xmm7, %xmm7
movq %rdi, %r13
jne 0x3af131
pextrw $0x4, %xmm14, %ecx
movq 0x80(%rsp), %rax
leaq (%r10,%rax), %r15
movb %cl, (%r9,%r15)
cmpq %rdx, %rsi
jae 0x3af163
leaq -0x2(%r9), %rcx
cmpq $0x2, %r9
setae %r15b
cmpq %rbp, %rcx
setl %cl
andb %r15b, %cl
cmpb $0x1, %cl
jne 0x3af163
pextrw $0x2, %xmm14, %ecx
movq 0x70(%rsp), %rax
leaq (%r10,%rax), %r15
movb %cl, (%r9,%r15)
cmpq %rdx, %r13
setae %cl
cmpq $0x3, %r9
setb %r15b
orb %cl, %r15b
jne 0x3af187
movd %xmm14, %ecx
addq 0x88(%rsp), %r10
movb %cl, (%r9,%r10)
pandn %xmm2, %xmm5
por %xmm5, %xmm9
movdqa 0x130(%rsp), %xmm2
pcmpgtd %xmm0, %xmm2
pand 0x160(%rsp), %xmm2
movdqa %xmm0, %xmm1
psrad $0x1f, %xmm1
pandn %xmm2, %xmm1
movdqa %xmm15, %xmm3
pcmpeqd %xmm6, %xmm3
movdqa %xmm15, %xmm4
pcmpgtd %xmm6, %xmm4
movdqa %xmm12, %xmm2
pcmpgtd %xmm0, %xmm2
pand %xmm3, %xmm2
movdqa %xmm1, %xmm3
pand %xmm2, %xmm3
movdqa %xmm2, %xmm5
por %xmm4, %xmm2
pand %xmm1, %xmm4
pand %xmm4, %xmm13
pandn %xmm4, %xmm5
pandn %xmm6, %xmm4
movdqa %xmm13, %xmm6
por %xmm4, %xmm6
por %xmm3, %xmm5
movdqa 0x20(%rsp), %xmm3
pand %xmm5, %xmm3
pandn 0x60(%rsp), %xmm5
por %xmm3, %xmm5
pand %xmm1, %xmm2
movdqa %xmm0, %xmm1
pand %xmm2, %xmm1
pandn %xmm12, %xmm2
movdqa %xmm2, %xmm12
por %xmm1, %xmm12
movd %xmm15, (%r12,%r9,4)
movq 0x18(%rsp), %rax
movd %xmm10, (%rax,%r9,4)
psubd %xmm7, %xmm0
incq %r9
cmpq %r9, 0xf8(%rsp)
jne 0x3aeebc
movdqa 0x20(%rsp), %xmm0
paddd 0x27a88d(%rip), %xmm0   # 0x629af0
movdqa %xmm0, 0x20(%rsp)
movq 0xf0(%rsp), %rbx
addq $0x4, %rbx
movq 0xe8(%rsp), %rax
addq %rax, 0x88(%rsp)
addq %rax, 0x78(%rsp)
addq %rax, 0x80(%rsp)
addq %rax, 0x70(%rsp)
cmpq %rdx, %rbx
movq 0x1b0(%rsp), %r15
jb 0x3aedda
movdqa %xmm6, 0x100(%rsp)
movdqa %xmm12, 0xd0(%rsp)
movl 0x4(%rsp), %r8d
movq 0x18(%rsp), %rdi
movdqa 0xc0(%rsp), %xmm1
movdqa 0xb0(%rsp), %xmm2
movdqa %xmm5, 0x90(%rsp)
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movl 0x100(%rsp,%rdx,4), %esi
cmpl %r8d, %esi
jle 0x3af305
movl 0x90(%rsp,%rdx,4), %eax
movl 0xd0(%rsp,%rdx,4), %ecx
movl %esi, %r8d
jmp 0x3af32b
jne 0x3af32b
movl 0xd0(%rsp,%rdx,4), %esi
cmpl %ecx, %esi
jge 0x3af31d
movl 0x90(%rsp,%rdx,4), %eax
movl %esi, %ecx
jmp 0x3af32b
jne 0x3af32b
movl 0x90(%rsp,%rdx,4), %esi
cmpl %eax, %esi
cmovll %esi, %eax
incq %rdx
cmpl $0x4, %edx
jne 0x3af2e6
movdqa 0x50(%rsp), %xmm0
pcmpgtd %xmm2, %xmm0
pcmpgtd 0xa0(%rsp), %xmm1
por %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
movq 0x10(%rsp), %rdx
je 0x3af361
orb $0x40, 0xc(%rdx)
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %eax, %eax
movl %r8d, (%rdx)
movl %eax, 0x4(%rdx)
movl %ecx, 0x8(%rdx)
callq 0x20a60d
movq %r12, %rdi
callq 0x20a60d
movq %r14, %rdi
callq 0x20a60d
cmpl $0x0, 0x30(%r15)
jne 0x3af390
movq 0x8(%rsp), %rdi
callq 0x20a60d
movq 0x10(%rsp), %rax
jmp 0x3af3c8
callq 0x1be01b
jmp 0x3af3c6
callq 0x1bdff5
jmp 0x3af3c6
callq 0x1bdfcf
jmp 0x3af3c6
callq 0x1bdfa9
jmp 0x3af3c6
callq 0x1bdf83
jmp 0x3af3c6
callq 0x1bdf5d
jmp 0x3af3c6
callq 0x1bdf37
xorl %eax, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop