// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory_sse.c
// Function: parasail_profile_create_sse_128_8
parasail_profile_t * parasail_profile_create_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; /* number of amino acids in table */
    const int32_t segWidth = 16; /* number of values in vector unit */
    int32_t segLen = 0;
    __m128i* restrict vProfile = NULL;
    int32_t index = 0;
    parasail_profile_t *profile = NULL;

    PARASAIL_CHECK_NULL(matrix);
    /* s1 is ignored for pssm, required for square */
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        PARASAIL_CHECK_NULL(s1);
    }

    s1Len = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ? _s1Len : matrix->length;
    n = matrix->size;
    segLen = (s1Len + segWidth - 1) / segWidth;
    vProfile = parasail_memalign___m128i(16, n * segLen);
    if (!vProfile) 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 t;
            j = i;
            for (segNum=0; segNum<segWidth; ++segNum) {
                if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
                    t.v[segNum] = j >= s1Len ? 0 : matrix->matrix[n*k+matrix->mapper[(unsigned char)s1[j]]];
                }
                else {
                    t.v[segNum] = j >= s1Len ? 0 : matrix->matrix[n*j+matrix->mapper[(unsigned char)matrix->alphabet[k]]];
                }
                j += segLen;
            }
            _mm_store_si128(&vProfile[index], t.m);
            ++index;
        }
    }

    profile->profile8.score = vProfile;
    profile->free = &parasail_free___m128i;
    return profile;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
testq %rdx, %rdx
je 0x297ea9
movq %rdx, %rbx
movq %rdi, %r14
movl 0x30(%rdx), %eax
testl %eax, %eax
setne %cl
testq %rdi, %rdi
setne %dl
orb %cl, %dl
je 0x297eca
movl %esi, %ebp
testl %eax, %eax
je 0x297d2d
movl 0x34(%rbx), %ebp
movslq 0x18(%rbx), %rsi
leal 0xf(%rbp), %eax
pushq $0x10
popq %rcx
cltd
idivl %ecx
movq %rax, %r12
movslq %eax, %r15
movq %r15, %r13
movq %rsi, 0x8(%rsp)
imulq %rsi, %r13
pushq $0x10
popq %rdi
movq %r13, %rsi
callq 0x297cd8
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x297e8a
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1acaf8
xorl %r8d, %r8d
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x297e8a
testl %r12d, %r12d
cmovlel %r8d, %r12d
movq %r12, 0x30(%rsp)
movq 0x8(%rsp), %rax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq %rcx, 0x20(%rsp)
movslq %ebp, %rdx
leaq (,%rax,4), %rax
movq %rax, 0x28(%rsp)
shlq $0x2, %r13
xorl %r9d, %r9d
cmpq 0x20(%rsp), %r8
je 0x297e8e
movq %r8, %rax
imulq 0x8(%rsp), %rax
movslq %r9d, %r9
shlq $0x2, %rax
xorl %ecx, %ecx
xorl %ebp, %ebp
cmpq 0x30(%rsp), %rbp
je 0x297e82
movq %r9, 0x38(%rsp)
movl 0x30(%rbx), %r11d
movq %rcx, %r9
xorl %r12d, %r12d
movq %rbp, %r10
cmpq $0x10, %r12
je 0x297e58
testl %r11d, %r11d
je 0x297e24
cmpq %rdx, %r10
jge 0x297e46
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 0x297e41
cmpq %rdx, %r10
jge 0x297e46
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 0x297e48
xorl %esi, %esi
movb %sil, 0x40(%rsp,%r12)
addq %r15, %r10
incq %r12
addq %r13, %r9
jmp 0x297df6
movq 0x38(%rsp), %r9
movq %r9, %rsi
shlq $0x4, %rsi
movaps 0x40(%rsp), %xmm0
movq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi,%rsi)
incq %r9
incq %rbp
addq 0x28(%rsp), %rcx
jmp 0x297dd9
incq %r8
jmp 0x297dba
xorl %ebx, %ebx
jmp 0x297ef2
movq 0x18(%rsp), %rbx
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rbx)
leaq 0x61(%rip), %rax        # 0x297f04
movq %rax, 0x78(%rbx)
jmp 0x297ef2
movq 0x4a3128(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32f131(%rip), %rsi    # 0x5c6feb
leaq 0x330645(%rip), %rdx    # 0x5c8506
leaq 0x32fa7a(%rip), %rcx    # 0x5c7942
jmp 0x297ee9
movq 0x4a3107(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x32f110(%rip), %rsi    # 0x5c6feb
leaq 0x330624(%rip), %rdx    # 0x5c8506
leaq 0x32f851(%rip), %rcx    # 0x5c773a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq