// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/tests/test_openmp.c
// Function: ssw_
static parasail_result_t* ssw_(
        const char * const restrict s1, const int s1_len,
        const char * const restrict s2, const int s2_len,
        const int open, const int gap, const parasail_matrix_t * pmatrix,
        int score_size)
{
    parasail_result_t *result = parasail_result_new();
    s_profile *profile = NULL;
    int8_t *s1_num = (int8_t*)malloc(sizeof(int8_t) * s1_len);
    int8_t *s2_num = (int8_t*)malloc(sizeof(int8_t) * s2_len);
    int8_t *matrix = (int8_t*)malloc(sizeof(int8_t) * 24 * 24);
    s_align *ssw_result = NULL;
    int m = 0;

    /* This table is used to transform amino acid letters into numbers. */
    static const int8_t table[128] = {
        23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
        23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
        23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
        23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
        23, 0,  20, 4,  3,  6,  13, 7,  8,  9,  23, 11, 10, 12, 2,  23,
        14, 5,  1,  15, 16, 23, 19, 17, 22, 18, 21, 23, 23, 23, 23, 23,
        23, 0,  20, 4,  3,  6,  13, 7,  8,  9,  23, 11, 10, 12, 2,  23,
        14, 5,  1,  15, 16, 23, 19, 17, 22, 18, 21, 23, 23, 23, 23, 23
    };

    /* initialize score matrix */
    for (m = 0; m < s1_len; ++m) s1_num[m] = table[(int)s1[m]];
    for (m = 0; m < s2_len; ++m) s2_num[m] = table[(int)s2[m]];
    for (m = 0; m < 24*24; ++m) matrix[m] = pmatrix->matrix[m];
    profile = ssw_init(s1_num, s1_len, matrix, 24, score_size);
    ssw_result = ssw_align(profile, s2_num, s2_len, -open, -gap, 2, 0, 0, s1_len/2);
    result->score = ssw_result->score1;
    if (ssw_result->saturated) {
        result->flag |= PARASAIL_FLAG_SATURATED;
    }
    align_destroy(ssw_result);
    init_destroy(profile);
    free(s1_num);
    free(s2_num);
    free(matrix);

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movl %r8d, 0x8(%rsp)
movl %ecx, %r15d
movq %rdx, %rbx
movl %esi, %r14d
movl %esi, 0x4(%rsp)
movq %rdi, %rbp
xorl %eax, %eax
callq 0x2fb4dd
movq %rax, 0x10(%rsp)
movslq %r14d, %r13
movq %r13, %rdi
callq 0x29b190
movq %rax, %r14
movl %r15d, (%rsp)
movslq %r15d, %rdi
callq 0x29b190
movq %rax, %r15
movl $0x240, %edi            # imm = 0x240
callq 0x29b190
movq %rax, %r12
testl %r13d, %r13d
movl 0x4(%rsp), %r13d
jle 0x2f9bf0
movl %r13d, %eax
xorl %ecx, %ecx
leaq 0x3c14a6(%rip), %rdx    # 0x6bb080
movsbq (%rbp,%rcx), %rsi
movb (%rsi,%rdx), %sil
movb %sil, (%r14,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x2f9bda
movq 0x50(%rsp), %rax
cmpl $0x0, (%rsp)
jle 0x2f9c1c
movl (%rsp), %ecx
xorl %edx, %edx
leaq 0x3c1479(%rip), %rsi    # 0x6bb080
movsbq (%rbx,%rdx), %rdi
movb (%rdi,%rsi), %dil
movb %dil, (%r15,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x2f9c07
movl 0x58(%rsp), %ecx
movq 0x8(%rax), %rax
xorl %edx, %edx
movq 0x10(%rsp), %rbp
movb (%rax,%rdx,4), %sil
movb %sil, (%r12,%rdx)
incq %rdx
cmpq $0x240, %rdx            # imm = 0x240
jne 0x2f9c2b
movsbl %cl, %r8d
movq %r14, %rdi
movl %r13d, %esi
movq %r12, %rdx
movl $0x18, %ecx
callq 0x2f9ce8
movq %rax, %rbx
movl 0x8(%rsp), %ecx
negb %cl
movl 0xc(%rsp), %edx
negb %dl
movl %r13d, %eax
shrl $0x1f, %eax
addl %r13d, %eax
sarl %eax
subq $0x8, %rsp
xorl %r13d, %r13d
movzbl %cl, %ecx
movzbl %dl, %r8d
movq %rbx, %rdi
movq %r15, %rsi
movl 0x8(%rsp), %edx
movl $0x2, %r9d
pushq %rax
pushq %r13
pushq %r13
callq 0x2f9dca
addq $0x20, %rsp
movzwl (%rax), %ecx
movl %ecx, (%rbp)
cmpl %r13d, 0x24(%rax)
je 0x2f9cac
orb $0x40, 0xc(%rbp)
movq %rax, %rdi
callq 0x2fa9dc
movq %rbx, %rdi
callq 0x2f9dac
movq %r14, %rdi
callq 0x29b170
movq %r15, %rdi
callq 0x29b170
movq %r12, %rdi
callq 0x29b170
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop