// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory_avx2.c
// Function: parasail_profile_create_stats_avx_256_64
parasail_profile_t * parasail_profile_create_stats_avx_256_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 = 4; /* number of values in vector unit */
    int32_t segLen = 0;
    __m256i* restrict vProfile = NULL;
    __m256i* restrict vProfileM = NULL;
    __m256i* 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___m256i(32, n * segLen);
    if (!vProfile) return NULL;
    vProfileM = parasail_memalign___m256i(32, n * segLen);
    if (!vProfileM) return NULL;
    vProfileS = parasail_memalign___m256i(32, 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) {
            __m256i_64_t p;
            __m256i_64_t m;
            __m256i_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;
            }
            _mm256_store_si256(&vProfile[index], p.m);
            _mm256_store_si256(&vProfileM[index], m.m);
            _mm256_store_si256(&vProfileS[index], s.m);
            ++index;
        }
    }

    profile->profile64.score = vProfile;
    profile->profile64.matches = vProfileM;
    profile->profile64.similar = vProfileS;
    profile->free = &parasail_free___m256i;
    return profile;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
andq $-0x20, %rsp
subq $0xe0, %rsp
testq %rdx, %rdx
je 0x497f62
movq %rdi, %r14
testq %rdi, %rdi
je 0x497f83
movq %rdx, %rbx
movl %esi, %r13d
cmpl $0x0, 0x30(%rdx)
je 0x497d07
movl 0x34(%rbx), %r13d
movslq 0x18(%rbx), %rsi
leal 0x3(%r13), %eax
pushq $0x4
popq %rcx
cltd
idivl %ecx
movl %eax, 0x8(%rsp)
movslq %eax, %r15
movq %r15, %r12
movq %rsi, 0x10(%rsp)
imulq %rsi, %r12
pushq $0x20
popq %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x497f1e
pushq $0x20
popq %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x497f1e
pushq $0x20
popq %rdi
movq %r12, %rsi
callq 0x496aa4
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x497f1e
movq %r14, %rdi
movl %r13d, %esi
movq %rbx, %rdx
callq 0x1acaf8
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x497f1e
movslq %r13d, %rax
movl 0x8(%rsp), %edx
movl %edx, %ecx
sarl $0x1f, %ecx
andnl %edx, %ecx, %ecx
movq %rcx, 0x48(%rsp)
movq 0x10(%rsp), %rdx
movl %edx, %ecx
sarl $0x1f, %ecx
andnl %edx, %ecx, %ecx
movq %rcx, 0x38(%rsp)
leaq (,%rdx,4), %rcx
movq %rcx, 0x40(%rsp)
shlq $0x2, %r12
xorl %edi, %edi
xorl %esi, %esi
cmpq 0x38(%rsp), %rdi
je 0x497f35
movq %rdi, %r9
imulq 0x10(%rsp), %r9
movslq %esi, %rsi
shlq $0x2, %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq 0x48(%rsp), %r11
je 0x497f16
movq %rsi, 0x8(%rsp)
movl 0x30(%rbx), %edx
movq %r10, 0x58(%rsp)
xorl %ecx, %ecx
movq %r11, 0x50(%rsp)
cmpq $0x4, %rcx
je 0x497eba
testl %edx, %edx
je 0x497e40
cmpq %rax, %r11
jge 0x497e69
movq 0x10(%rbx), %r8
movq 0x38(%rbx), %r13
movzbl (%r13,%rdi), %r13d
movslq (%r8,%r13,4), %r8
shlq $0x2, %r8
addq 0x8(%rbx), %r8
addq %r10, %r8
jmp 0x497e64
cmpq %rax, %r11
jge 0x497e69
movq 0x10(%rbx), %r8
movzbl (%r14,%r11), %r13d
movslq (%r8,%r13,4), %r8
movq 0x8(%rbx), %r13
addq %r9, %r13
leaq (,%r8,4), %r8
addq %r13, %r8
movslq (%r8), %r8
jmp 0x497e6c
xorl %r8d, %r8d
movq %r8, 0xa0(%rsp,%rcx,8)
cmpq %rax, %r11
jge 0x497e93
movq 0x10(%rbx), %r13
movzbl (%r14,%r11), %esi
movl (%r13,%rsi,4), %esi
xorl %r13d, %r13d
cmpq %rsi, %rdi
sete %r13b
jmp 0x497e96
xorl %r13d, %r13d
movq %r13, 0x80(%rsp,%rcx,8)
xorl %esi, %esi
testq %r8, %r8
setg %sil
movq %rsi, 0x60(%rsp,%rcx,8)
addq %r15, %r11
incq %rcx
addq %r12, %r10
jmp 0x497e0e
movq 0x8(%rsp), %rsi
movq %rsi, %rcx
shlq $0x5, %rcx
vmovaps 0xa0(%rsp), %ymm0
movq 0x28(%rsp), %rdx
vmovaps %ymm0, (%rdx,%rcx)
vmovaps 0x80(%rsp), %ymm0
movq 0x20(%rsp), %rdx
vmovaps %ymm0, (%rdx,%rcx)
vmovaps 0x60(%rsp), %ymm0
movq 0x18(%rsp), %rdx
vmovaps %ymm0, (%rdx,%rcx)
incq %rsi
movq 0x50(%rsp), %r11
incq %r11
movq 0x58(%rsp), %r10
addq 0x40(%rsp), %r10
jmp 0x497def
incq %rdi
jmp 0x497dce
xorl %ebx, %ebx
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
movq 0x30(%rsp), %rbx
movq 0x28(%rsp), %rax
movq %rax, 0x60(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x68(%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x70(%rbx)
leaq -0x1264(%rip), %rax     # 0x496cf8
movq %rax, 0x78(%rbx)
jmp 0x497f20
movq 0x2a306f(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12f078(%rip), %rsi    # 0x5c6feb
leaq 0x13474d(%rip), %rdx    # 0x5cc6c7
leaq 0x12f9c1(%rip), %rcx    # 0x5c7942
jmp 0x497fa2
movq 0x2a304e(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x12f057(%rip), %rsi    # 0x5c6feb
leaq 0x13472c(%rip), %rdx    # 0x5cc6c7
leaq 0x12f798(%rip), %rcx    # 0x5c773a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19e180
jmp 0x497f20