// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory_sse.c
// Function: parasail_profile_create_stats_sse_128_16
parasail_profile_t * parasail_profile_create_stats_sse_128_16(
        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 = 8; /* 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_16_t p;
            __m128i_16_t m;
            __m128i_16_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->profile16.score = vProfile;
    profile->profile16.matches = vProfileM;
    profile->profile16.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 0x298b11
movq %rdi, %r14
testq %rdi, %rdi
je 0x298b32
movq %rdx, %rbx
movl %esi, %r12d
cmpl $0x0, 0x30(%rdx)
je 0x2988e0
movl 0x34(%rbx), %r12d
movslq 0x18(%rbx), %rsi
leal 0x7(%r12), %eax
pushq $0x8
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 0x298acd
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x298acd
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x298acd
movq %r14, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x1acaf8
xorl %r8d, %r8d
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x298acd
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 0x298ae4
movq %r8, %rax
imulq (%rsp), %rax
movslq %edi, %rdi
shlq $0x2, %rax
xorl %r9d, %r9d
xorl %r12d, %r12d
cmpq 0x38(%rsp), %r12
je 0x298ac5
movq %rdi, 0x48(%rsp)
movl 0x30(%rbx), %r11d
movq %r9, 0x40(%rsp)
xorl %r15d, %r15d
movq %r12, %r10
cmpq $0x8, %r15
je 0x298a7a
testl %r11d, %r11d
je 0x298a10
cmpq %rdx, %r10
jge 0x298a32
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 0x298a2d
cmpq %rdx, %r10
jge 0x298a32
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
movzwl (%rsi), %esi
jmp 0x298a34
xorl %esi, %esi
movw %si, 0x70(%rsp,%r15,2)
cmpq %rdx, %r10
jge 0x298a56
movq 0x10(%rbx), %rdi
movzbl (%r14,%r10), %ecx
movl (%rdi,%rcx,4), %ecx
xorl %edi, %edi
cmpq %rcx, %r8
sete %dil
jmp 0x298a58
xorl %edi, %edi
movw %di, 0x60(%rsp,%r15,2)
xorl %ecx, %ecx
testw %si, %si
setg %cl
movw %cx, 0x50(%rsp,%r15,2)
addq %rbp, %r10
incq %r15
addq %r13, %r9
jmp 0x2989de
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 0x2989bf
incq %r8
jmp 0x29899f
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, 0x30(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x40(%rbx)
leaq -0xc07(%rip), %rax      # 0x297f04
movq %rax, 0x78(%rbx)
jmp 0x298acf
movq 0x4a24c0(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32e4c9(%rip), %rsi    # 0x5c6feb
leaq 0x32fa90(%rip), %rdx    # 0x5c85b9
leaq 0x32ee12(%rip), %rcx    # 0x5c7942
jmp 0x298b51
movq 0x4a249f(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32e4a8(%rip), %rsi    # 0x5c6feb
leaq 0x32fa6f(%rip), %rdx    # 0x5c85b9
leaq 0x32ebe9(%rip), %rcx    # 0x5c773a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
jmp 0x298acf