// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/src/memory_avx2.c
// Function: parasail_profile_create_avx_256_16
parasail_profile_t * parasail_profile_create_avx_256_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; /* number of amino acids in table */
    const int32_t segWidth = 16; /* number of values in vector unit */
    int32_t segLen = 0;
    __m256i* 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___m256i(32, 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) {
            __m256i_16_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;
            }
            _mm256_store_si256(&vProfile[index], t.m);
            ++index;
        }
    }

    profile->profile16.score = vProfile;
    profile->free = &parasail_free___m256i;
    return profile;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0xe0, %rsp
movq %rdi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movq %rdx, 0x80(%rsp)
movl $0x0, 0x7c(%rsp)
movl $0x0, 0x78(%rsp)
movl $0x0, 0x74(%rsp)
movl $0x0, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movl $0x0, 0x68(%rsp)
movl $0x10, 0x64(%rsp)
movl $0x0, 0x60(%rsp)
movq $0x0, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movq $0x0, 0x48(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x9934c2
movq 0x493b46(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0x358b4f(%rip), %rsi    # 0xcebfeb
leaq 0x35d28b(%rip), %rdx    # 0xcf072e
leaq 0x35947b(%rip), %rcx    # 0xcec925
movb $0x0, %al
callq 0x19e180
movq $0x0, 0x98(%rsp)
jmp 0x9937ac
jmp 0x9934c4
movq 0x80(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x99351a
jmp 0x9934d4
cmpq $0x0, 0x90(%rsp)
jne 0x993516
movq 0x493af2(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0x358afb(%rip), %rsi    # 0xcebfeb
leaq 0x35d237(%rip), %rdx    # 0xcf072e
leaq 0x35923c(%rip), %rcx    # 0xcec73a
movb $0x0, %al
callq 0x19e180
movq $0x0, 0x98(%rsp)
jmp 0x9937ac
jmp 0x993518
jmp 0x99351a
movq 0x80(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x993535
movl 0x8c(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x993544
movq 0x80(%rsp), %rax
movl 0x34(%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x7c(%rsp)
movq 0x80(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x68(%rsp)
movl 0x7c(%rsp), %eax
addl $0x10, %eax
subl $0x1, %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, 0x60(%rsp)
movl 0x68(%rsp), %eax
imull 0x60(%rsp), %eax
movslq %eax, %rsi
movl $0x20, %edi
callq 0x992f60
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x9935a5
movq $0x0, 0x98(%rsp)
jmp 0x9937ac
movq 0x90(%rsp), %rdi
movl 0x7c(%rsp), %esi
movq 0x80(%rsp), %rdx
callq 0x1c5d00
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x9935dc
movq $0x0, 0x98(%rsp)
jmp 0x9937ac
movl $0x0, 0x70(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x68(%rsp), %eax
jge 0x993781
movl $0x0, 0x78(%rsp)
movl 0x78(%rsp), %eax
cmpl 0x60(%rsp), %eax
jge 0x99376f
movl 0x78(%rsp), %eax
movl %eax, 0x74(%rsp)
movl $0x0, 0x6c(%rsp)
cmpl $0x10, 0x6c(%rsp)
jge 0x993717
movq 0x80(%rsp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x993695
movl 0x74(%rsp), %eax
cmpl 0x7c(%rsp), %eax
jl 0x993643
xorl %eax, %eax
movl %eax, 0x18(%rsp)
jmp 0x993682
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x68(%rsp), %ecx
imull 0x70(%rsp), %ecx
movq 0x80(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x90(%rsp), %rsi
movslq 0x74(%rsp), %rdi
movzbl (%rsi,%rdi), %esi
addl (%rdx,%rsi,4), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movw %ax, %cx
movslq 0x6c(%rsp), %rax
movw %cx, 0x20(%rsp,%rax,2)
jmp 0x9936fb
movl 0x74(%rsp), %eax
cmpl 0x7c(%rsp), %eax
jl 0x9936a7
xorl %eax, %eax
movl %eax, 0x14(%rsp)
jmp 0x9936ea
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x68(%rsp), %ecx
imull 0x74(%rsp), %ecx
movq 0x80(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x80(%rsp), %rsi
movq 0x38(%rsi), %rsi
movslq 0x70(%rsp), %rdi
movzbl (%rsi,%rdi), %esi
addl (%rdx,%rsi,4), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movw %ax, %cx
movslq 0x6c(%rsp), %rax
movw %cx, 0x20(%rsp,%rax,2)
movl 0x60(%rsp), %eax
addl 0x74(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x993618
movq 0x58(%rsp), %rax
movslq 0x54(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
vmovdqa 0x20(%rsp), %ymm0
movq %rax, 0xc8(%rsp)
vmovdqa %ymm0, 0xa0(%rsp)
vmovdqa 0xa0(%rsp), %ymm0
movq 0xc8(%rsp), %rax
vmovdqa %ymm0, (%rax)
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x9935fa
jmp 0x993771
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x9935e4
movq 0x58(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x48(%rsp), %rax
leaq -0x3bb(%rip), %rcx      # 0x9933e0
movq %rcx, 0x78(%rax)
movq 0x48(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
nopl (%rax)