// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/memory_sse.c
// Function: parasail_profile_create_sse_128_32
parasail_profile_t * parasail_profile_create_sse_128_32(
        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 = 4; /* 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_32_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->profile32.score = vProfile;
    profile->free = &parasail_free___m128i;
    return profile;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdx, %rdx
je 0x2ea914
movq %rdx, %rbx
movq %rdi, %r14
movl 0x30(%rdx), %eax
testl %eax, %eax
setne %cl
testq %rdi, %rdi
setne %dl
orb %cl, %dl
je 0x2ea91b
movl %esi, %r15d
testl %eax, %eax
je 0x2ea7e9
movl 0x34(%rbx), %r15d
movl 0x18(%rbx), %r13d
leal 0x3(%r15), %eax
leal 0x6(%r15), %ebp
testl %eax, %eax
cmovnsl %eax, %ebp
sarl $0x2, %ebp
movl %ebp, %eax
imull %r13d, %eax
movslq %eax, %rsi
shlq $0x4, %rsi
movl $0x10, %edi
callq 0x20947c
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x2ea920
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
callq 0x20a588
testq %rax, %rax
je 0x2ea920
movq %rax, 0x10(%rsp)
testl %r13d, %r13d
jle 0x2ea8f9
movl %ebp, %ecx
cmpl $0x2, %ebp
movl $0x1, %eax
cmovgel %ebp, %eax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
xorl %edi, %edi
testl %r15d, %r15d
jle 0x2ea8ed
movslq %edi, %rdi
xorl %r8d, %r8d
movl 0x30(%rbx), %r9d
movq %r8, %r10
xorl %r11d, %r11d
testl %r9d, %r9d
je 0x2ea88d
cmpl %r10d, %r15d
jle 0x2ea8b8
movq 0x38(%rbx), %rbp
addq %r12, %rbp
movq %r10, %rsi
jmp 0x2ea899
cmpl %r10d, %r15d
jle 0x2ea8b8
leaq (%r14,%r10), %rbp
movq %r12, %rsi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rax
movzbl (%rbp), %ebp
movslq (%rax,%rbp,4), %rax
imull %r13d, %esi
movslq %esi, %rsi
addq %rax, %rsi
movl (%rdx,%rsi,4), %esi
jmp 0x2ea8ba
xorl %esi, %esi
movl %esi, 0x20(%rsp,%r11,4)
addq %rcx, %r10
incq %r11
cmpq $0x4, %r11
jne 0x2ea877
movq %rdi, %rax
shlq $0x4, %rax
movaps 0x20(%rsp), %xmm0
movq 0x8(%rsp), %rdx
movaps %xmm0, (%rdx,%rax)
incq %rdi
incq %r8
cmpq 0x18(%rsp), %r8
jne 0x2ea86d
incq %r12
cmpq %r13, %r12
jne 0x2ea85e
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x48(%rax)
leaq -0x2f4(%rip), %rcx      # 0x2ea61a
movq %rcx, 0x78(%rax)
jmp 0x2ea922
callq 0x1aad5f
jmp 0x2ea920
callq 0x1aad39
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq