// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
testq %rdx, %rdx
je 0x2ead34
movq %rdi, %r14
testq %rdi, %rdi
je 0x2ead3b
movq %rdx, %rbx
movl %esi, %r15d
cmpl $0x0, 0x30(%rdx)
je 0x2eab66
movl 0x34(%rbx), %r15d
movl 0x18(%rbx), %r12d
leal 0xf(%r15), %eax
leal 0x1e(%r15), %r13d
testl %eax, %eax
cmovnsl %eax, %r13d
sarl $0x4, %r13d
movl %r13d, %eax
imull %r12d, %eax
movslq %eax, %rbp
shlq $0x4, %rbp
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20947c
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x2ead40
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20947c
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x2ead40
movl $0x10, %edi
movq %rbp, %rsi
callq 0x20947c
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x2ead40
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
callq 0x20a588
testq %rax, %rax
je 0x2ead40
movq %rax, 0x20(%rsp)
testl %r12d, %r12d
jle 0x2ead07
movl %r13d, %ecx
cmpl $0x2, %r13d
movl $0x1, %eax
cmovgel %r13d, %eax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
xorl %edi, %edi
testl %r15d, %r15d
jle 0x2eacfb
movslq %edi, %rdi
xorl %r8d, %r8d
movl 0x30(%rbx), %r9d
movq %r8, %r10
xorl %r11d, %r11d
testl %r9d, %r9d
je 0x2eac48
cmpl %r10d, %r15d
jle 0x2eac75
movq 0x38(%rbx), %r13
addq %rbp, %r13
movq %r10, %rsi
jmp 0x2eac54
cmpl %r10d, %r15d
jle 0x2eac75
leaq (%r14,%r10), %r13
movq %rbp, %rsi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rax
movzbl (%r13), %r13d
movslq (%rax,%r13,4), %rax
imull %r12d, %esi
movslq %esi, %rsi
addq %rax, %rsi
movb (%rdx,%rsi,4), %sil
jmp 0x2eac77
xorl %esi, %esi
movb %sil, 0x30(%rsp,%r11)
cmpl %r10d, %r15d
jle 0x2eac96
movq 0x10(%rbx), %rax
movzbl (%r14,%r10), %edx
movl (%rax,%rdx,4), %eax
cmpq %rax, %rbp
sete %sil
jmp 0x2eac98
xorl %esi, %esi
cmpb $0x0, 0x30(%rsp,%r11)
setg 0x40(%rsp,%r11)
movb %sil, 0x50(%rsp,%r11)
addq %rcx, %r10
incq %r11
cmpq $0x10, %r11
jne 0x2eac32
movq %rdi, %rax
shlq $0x4, %rax
movaps 0x30(%rsp), %xmm0
movq 0x18(%rsp), %rdx
movaps %xmm0, (%rdx,%rax)
movaps 0x50(%rsp), %xmm0
movq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx,%rax)
movaps 0x40(%rsp), %xmm0
movq 0x8(%rsp), %rdx
movaps %xmm0, (%rdx,%rax)
incq %rdi
incq %r8
cmpq 0x28(%rsp), %r8
jne 0x2eac28
incq %rbp
cmpq %r12, %rbp
jne 0x2eac19
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x20(%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x28(%rax)
leaq -0x714(%rip), %rcx      # 0x2ea61a
movq %rcx, 0x78(%rax)
jmp 0x2ead42
callq 0x1aadf7
jmp 0x2ead40
callq 0x1aadd1
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq