// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory_sse.c
// Function: parasail_profile_create_stats_sse_128_8
parasail_profile_t * parasail_profile_create_stats_sse_128_8(
        const char * const restrict s1, const int _s1Len,
        const parasail_matrix_t *matrix)
{
    int s1Len = 0;
    int32_t i = 0;
    int32_t j = 0;
    int32_t k = 0;
    int32_t segNum = 0;
    int32_t n = 0;
    const int32_t segWidth = 16; /* number of values in vector unit */
    int32_t segLen = 0;
    __m128i* restrict vProfile = NULL;
    __m128i* restrict vProfileM = NULL;
    __m128i* restrict vProfileS = NULL;
    int32_t index = 0;
    parasail_profile_t *profile = NULL;

    PARASAIL_CHECK_NULL(matrix);
    /* s1 is required for both pssm and square */
    PARASAIL_CHECK_NULL(s1);

    s1Len = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ? _s1Len : matrix->length;
    n = matrix->size; /* number of amino acids in table */
    segLen = (s1Len + segWidth - 1) / segWidth;
    vProfile = parasail_memalign___m128i(16, n * segLen);
    if (!vProfile) return NULL;
    vProfileM = parasail_memalign___m128i(16, n * segLen);
    if (!vProfileM) return NULL;
    vProfileS = parasail_memalign___m128i(16, n * segLen);
    if (!vProfileS) return NULL;
    profile = parasail_profile_new(s1, s1Len, matrix);
    if (!profile) return NULL;

    for (k=0; k<n; ++k) {
        for (i=0; i<segLen; ++i) {
            __m128i_8_t p;
            __m128i_8_t m;
            __m128i_8_t s;
            j = i;
            for (segNum=0; segNum<segWidth; ++segNum) {
                if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
                    p.v[segNum] = j >= s1Len ? 0 : matrix->matrix[n*k+matrix->mapper[(unsigned char)s1[j]]];
                }
                else {
                    p.v[segNum] = j >= s1Len ? 0 : matrix->matrix[n*j+matrix->mapper[(unsigned char)matrix->alphabet[k]]];
                }
                m.v[segNum] = j >= s1Len ? 0 : (k == matrix->mapper[(unsigned char)s1[j]]);
                s.v[segNum] = p.v[segNum] > 0;
                j += segLen;
            }
            _mm_store_si128(&vProfile[index], p.m);
            _mm_store_si128(&vProfileM[index], m.m);
            _mm_store_si128(&vProfileS[index], s.m);
            ++index;
        }
    }

    profile->profile8.score = vProfile;
    profile->profile8.matches = vProfileM;
    profile->profile8.similar = vProfileS;
    profile->free = &parasail_free___m128i;
    return profile;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
testq %rdx, %rdx
je 0x29885c
movq %rdi, %r14
testq %rdi, %rdi
je 0x29887d
movq %rdx, %rbx
movl %esi, %r12d
cmpl $0x0, 0x30(%rdx)
je 0x298634
movl 0x34(%rbx), %r12d
movslq 0x18(%rbx), %rsi
leal 0xf(%r12), %eax
pushq $0x10
popq %rcx
cltd
idivl %ecx
movq %rax, %r15
movslq %eax, %rbp
movq %rbp, %r13
movq %rsi, (%rsp)
imulq %rsi, %r13
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x298818
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x298818
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x298818
movq %r14, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x1acaf8
xorl %r8d, %r8d
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x298818
testl %r15d, %r15d
cmovlel %r8d, %r15d
movq %r15, 0x38(%rsp)
movq (%rsp), %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
movq %rax, 0x28(%rsp)
movslq %r12d, %rdx
leaq (,%rcx,4), %rax
movq %rax, 0x30(%rsp)
shlq $0x2, %r13
xorl %edi, %edi
cmpq 0x28(%rsp), %r8
je 0x29882f
movq %r8, %rax
imulq (%rsp), %rax
movslq %edi, %rdi
shlq $0x2, %rax
xorl %r9d, %r9d
xorl %r12d, %r12d
cmpq 0x38(%rsp), %r12
je 0x298810
movq %rdi, 0x48(%rsp)
movl 0x30(%rbx), %r11d
movq %r9, 0x40(%rsp)
xorl %r15d, %r15d
movq %r12, %r10
cmpq $0x10, %r15
je 0x2987c5
testl %r11d, %r11d
je 0x298764
cmpq %rdx, %r10
jge 0x298786
movq 0x10(%rbx), %rsi
movq 0x38(%rbx), %rdi
movzbl (%rdi,%r8), %edi
movslq (%rsi,%rdi,4), %rsi
shlq $0x2, %rsi
addq 0x8(%rbx), %rsi
addq %r9, %rsi
jmp 0x298781
cmpq %rdx, %r10
jge 0x298786
movq 0x10(%rbx), %rsi
movzbl (%r14,%r10), %edi
movslq (%rsi,%rdi,4), %rsi
movq 0x8(%rbx), %rdi
addq %rax, %rdi
leaq (%rdi,%rsi,4), %rsi
movb (%rsi), %sil
jmp 0x298788
xorl %esi, %esi
movb %sil, 0x70(%rsp,%r15)
cmpq %rdx, %r10
jge 0x2987a7
movq 0x10(%rbx), %rdi
movzbl (%r14,%r10), %ecx
movl (%rdi,%rcx,4), %ecx
cmpq %rcx, %r8
sete %dil
jmp 0x2987a9
xorl %edi, %edi
testb %sil, %sil
setg 0x50(%rsp,%r15)
movb %dil, 0x60(%rsp,%r15)
addq %rbp, %r10
incq %r15
addq %r13, %r9
jmp 0x298732
movq 0x48(%rsp), %rdi
movq %rdi, %rcx
shlq $0x4, %rcx
movaps 0x70(%rsp), %xmm0
movq 0x18(%rsp), %rsi
movaps %xmm0, (%rsi,%rcx)
movaps 0x60(%rsp), %xmm0
movq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi,%rcx)
movaps 0x50(%rsp), %xmm0
movq 0x8(%rsp), %rsi
movaps %xmm0, (%rsi,%rcx)
incq %rdi
incq %r12
movq 0x40(%rsp), %r9
addq 0x30(%rsp), %r9
jmp 0x298713
incq %r8
jmp 0x2986f3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rbx)
leaq -0x952(%rip), %rax      # 0x297f04
movq %rax, 0x78(%rbx)
jmp 0x29881a
movq 0x4a2775(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32e77e(%rip), %rsi    # 0x5c6feb
leaq 0x32fd1d(%rip), %rdx    # 0x5c8591
leaq 0x32f0c7(%rip), %rcx    # 0x5c7942
jmp 0x29889c
movq 0x4a2754(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32e75d(%rip), %rsi    # 0x5c6feb
leaq 0x32fcfc(%rip), %rdx    # 0x5c8591
leaq 0x32ee9e(%rip), %rcx    # 0x5c773a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
jmp 0x29881a