// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory_sse.c
// Function: parasail_profile_create_stats_sse_128_64
parasail_profile_t * parasail_profile_create_stats_sse_128_64(
        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 = 2; /* 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_64_t p;
            __m128i_64_t m;
            __m128i_64_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->profile64.score = vProfile;
    profile->profile64.matches = vProfileM;
    profile->profile64.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 0x299071
movq %rdi, %r14
testq %rdi, %rdi
je 0x299092
movq %rdx, %rbx
movl %esi, %r12d
cmpl $0x0, 0x30(%rdx)
je 0x298e43
movl 0x34(%rbx), %r12d
movslq 0x18(%rbx), %rsi
leal 0x1(%r12), %eax
pushq $0x2
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 0x29902d
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x29902d
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x29902d
movq %r14, %rdi
movl %r12d, %esi
movq %rbx, %rdx
callq 0x1acaf8
xorl %r8d, %r8d
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x29902d
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 0x299044
movq %r8, %rax
imulq (%rsp), %rax
movslq %edi, %rdi
shlq $0x2, %rax
xorl %r9d, %r9d
xorl %r12d, %r12d
cmpq 0x38(%rsp), %r12
je 0x299025
movq %rdi, 0x48(%rsp)
movl 0x30(%rbx), %r11d
movq %r9, 0x40(%rsp)
xorl %r15d, %r15d
movq %r12, %r10
cmpq $0x2, %r15
je 0x298fda
testl %r11d, %r11d
je 0x298f73
cmpq %rdx, %r10
jge 0x298f95
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 0x298f90
cmpq %rdx, %r10
jge 0x298f95
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
movslq (%rsi), %rsi
jmp 0x298f97
xorl %esi, %esi
movq %rsi, 0x70(%rsp,%r15,8)
cmpq %rdx, %r10
jge 0x298fb8
movq 0x10(%rbx), %rdi
movzbl (%r14,%r10), %ecx
movl (%rdi,%rcx,4), %ecx
xorl %edi, %edi
cmpq %rcx, %r8
sete %dil
jmp 0x298fba
xorl %edi, %edi
movq %rdi, 0x60(%rsp,%r15,8)
xorl %ecx, %ecx
testq %rsi, %rsi
setg %cl
movq %rcx, 0x50(%rsp,%r15,8)
addq %rbp, %r10
incq %r15
addq %r13, %r9
jmp 0x298f41
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 0x298f22
incq %r8
jmp 0x298f02
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, 0x60(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x68(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x70(%rbx)
leaq -0x1167(%rip), %rax     # 0x297f04
movq %rax, 0x78(%rbx)
jmp 0x29902f
movq 0x4a1f60(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32df69(%rip), %rsi    # 0x5c6feb
leaq 0x32f582(%rip), %rdx    # 0x5c860b
leaq 0x32e8b2(%rip), %rcx    # 0x5c7942
jmp 0x2990b1
movq 0x4a1f3f(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32df48(%rip), %rsi    # 0x5c6feb
leaq 0x32f561(%rip), %rdx    # 0x5c860b
leaq 0x32e689(%rip), %rcx    # 0x5c773a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
jmp 0x29902f