// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movl %r9d, 0x10(%rsp)
movl %r8d, 0xc(%rsp)
movl %ecx, %r15d
movq %rdx, %rbx
movl %esi, %r14d
movl %esi, 0x8(%rsp)
movq %rdi, %rbp
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x29dafd
movq %rax, 0x20(%rsp)
movslq %r14d, %rdi
movq %rdi, 0x18(%rsp)
callq 0x29b190
movq %rax, %r14
movl %r15d, 0x14(%rsp)
movslq %r15d, %rdi
callq 0x29b190
movq %rax, %r15
movl $0x240, %edi            # imm = 0x240
callq 0x29b190
movq %rax, %r12
cmpl $0x0, 0x18(%rsp)
movl $0x0, %ecx
movl 0x8(%rsp), %eax
movl %eax, %r9d
cmovgl %eax, %ecx
leaq 0x3bf269(%rip), %rax    # 0x65b0a0
cmpq %r13, %rcx
je 0x29be4e
movsbq (%rbp,%r13), %rdx
movb (%rdx,%rax), %dl
movb %dl, (%r14,%r13)
incq %r13
jmp 0x29be37
xorl %ecx, %ecx
movl 0x14(%rsp), %ebp
testl %ebp, %ebp
movl $0x0, %edx
cmovgl %ebp, %edx
movq 0x20(%rsp), %r10
cmpq %rcx, %rdx
je 0x29be7a
movsbq (%rbx,%rcx), %rsi
movb (%rsi,%rax), %sil
movb %sil, (%r15,%rcx)
incq %rcx
jmp 0x29be63
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
xorl %ecx, %ecx
cmpq $0x240, %rcx            # imm = 0x240
je 0x29be9a
movb (%rax,%rcx,4), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x29be85
movl 0x68(%rsp), %eax
movsbl %al, %r8d
pushq $0x18
popq %rcx
movq %r14, %rdi
movq %r10, %rbx
movl %r9d, %r13d
movl %r9d, %esi
movq %r12, %rdx
callq 0x29bf48
movq %rax, %rdx
movl 0xc(%rsp), %ecx
negb %cl
movl 0x10(%rsp), %esi
negb %sil
pushq $0x2
popq %r9
movl %r13d, %eax
movq %rbx, %r13
movq %rdx, %rbx
cltd
idivl %r9d
subq $0x8, %rsp
movzbl %cl, %ecx
movzbl %sil, %r8d
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
pushq %rax
pushq $0x0
pushq $0x0
callq 0x29c189
addq $0x20, %rsp
movzwl (%rax), %ecx
movl %ecx, (%r13)
xorl %ecx, %ecx
cmpl %ecx, 0x24(%rax)
je 0x29bf0e
orb $0x40, 0xc(%r13)
movq %rax, %rdi
callq 0x29d4e1
movq %rbx, %rdi
callq 0x29c16b
movq %r14, %rdi
callq 0x29b170
movq %r15, %rdi
callq 0x29b170
movq %r12, %rdi
callq 0x29b170
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq