// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/tests/test_verify_rowcols.c
// Function: check_functions
static void check_functions(
        parasail_function_group_t f,
        parasail_sequences_t *sequences,
        unsigned long pair_limit_,
        const parasail_matrix_t *matrix_,
        gap_score_t gap)
{
    const parasail_function_info_t *functions = f.fs;
    unsigned long matrix_index = 0;
    unsigned long gap_index = 0;
    unsigned long function_index = 0;
    long long pair_index = 0;
    long long pair_limit = (long long)pair_limit_;
    parasail_function_t *reference_function = NULL;
    const parasail_matrix_t ** matrices = parasail_matrices;
    const parasail_matrix_t * single_matrix[] = {
        matrix_,
        NULL
    };

    if (NULL != matrix_) {
        matrices = single_matrix;
    }

    printf("checking %s functions\n", f.name);
    for (matrix_index=0; NULL!=matrices[matrix_index]; ++matrix_index) {
        const parasail_matrix_t *matrix = matrices[matrix_index];
        const char *matrixname = matrix->name;
        if (verbose) printf("\t%s\n", matrixname);
        for (gap_index=0; INT_MIN!=gap_scores[gap_index].open; ++gap_index) {
            int open = gap_scores[gap_index].open;
            int extend = gap_scores[gap_index].extend;
            if (gap.open != INT_MIN && gap.extend != INT_MIN) {
                open = gap.open;
                extend = gap.extend;
            }
            if (verbose) printf("\t\topen=%d extend=%d\n", open, extend);
            reference_function = functions[0].pointer;
            for (function_index=1;
                    NULL!=functions[function_index].pointer;
                    ++function_index) {
                unsigned long saturated = 0;
                if (verbose) printf("\t\t\t%s\n", functions[function_index].name);
#pragma omp parallel for
                for (pair_index=0; pair_index<pair_limit; ++pair_index) {
                    parasail_result_t *reference_result = NULL;
                    parasail_result_t *result = NULL;
                    unsigned long a = 0;
                    unsigned long b = 1;
                    int *ref_score_row = NULL;
                    int *ref_score_col = NULL;
                    int *score_row = NULL;
                    int *score_col = NULL;
                    size_t size_a = 0;
                    size_t size_b = 0;
                    k_combination2(pair_index, &a, &b);
                    size_a = sequences->seqs[a].seq.l;
                    size_b = sequences->seqs[b].seq.l;
                    /*printf("\t\t\t\tpair=%lld (%lu,%lu)\n", pair_index, a, b);*/
                    reference_result = reference_function(
                            sequences->seqs[a].seq.s, size_a,
                            sequences->seqs[b].seq.s, size_b,
                            open, extend,
                            matrix);
                    result = functions[function_index].pointer(
                            sequences->seqs[a].seq.s, size_a,
                            sequences->seqs[b].seq.s, size_b,
                            open, extend,
                            matrix);
                    if (parasail_result_is_saturated(result)) {
                        /* no point in comparing a result that saturated */
                        parasail_result_free(reference_result);
                        parasail_result_free(result);
#pragma omp atomic
                        saturated += 1;
                        continue;
                    }
                    ref_score_row = parasail_result_get_score_row(reference_result);
                    ref_score_col = parasail_result_get_score_col(reference_result);
                    score_row = parasail_result_get_score_row(result);
                    score_col = parasail_result_get_score_col(result);
                    if (reference_result->score != result->score) {
#pragma omp critical(printer)
                        {
                            printf("%s(%lu,%lu,%d,%d,%s) wrong score (%d!=%d)\n",
                                    functions[function_index].name,
                                    a, b, open, extend,
                                    matrixname,
                                    reference_result->score, result->score);
                        }
                    }
                    if (diff_array(size_b, ref_score_row, score_row)) {
#pragma omp critical(printer)
                        {
                            printf("%s(%lu,%lu,%d,%d,%s) bad score row\n",
                                    functions[function_index].name,
                                    a, b, open, extend,
                                    matrixname);
                        }
                    }
                    if (diff_array(size_a, ref_score_col, score_col)) {
#pragma omp critical(printer)
                        {
                            printf("%s(%lu,%lu,%d,%d,%s) bad score col\n",
                                    functions[function_index].name,
                                    a, b, open, extend,
                                    matrixname);
                        }
                    }
                    if (parasail_result_is_stats(result)) {
                        int *ref_matches_row = parasail_result_get_matches_row(reference_result);
                        int *ref_matches_col = parasail_result_get_matches_col(reference_result);
                        int *ref_similar_row = parasail_result_get_similar_row(reference_result);
                        int *ref_similar_col = parasail_result_get_similar_col(reference_result);
                        int *ref_length_row = parasail_result_get_length_row(reference_result);
                        int *ref_length_col = parasail_result_get_length_col(reference_result);
                        int *matches_row = parasail_result_get_matches_row(result);
                        int *matches_col = parasail_result_get_matches_col(result);
                        int *similar_row = parasail_result_get_similar_row(result);
                        int *similar_col = parasail_result_get_similar_col(result);
                        int *length_row = parasail_result_get_length_row(result);
                        int *length_col = parasail_result_get_length_col(result);
                        if (diff_array(size_b, ref_matches_row, matches_row)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad matches row\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                        if (diff_array(size_a, ref_matches_col, matches_col)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad matches col\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                        if (diff_array(size_b, ref_similar_row, similar_row)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad similar row\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                        if (diff_array(size_a, ref_similar_col, similar_col)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad similar col\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                        if (diff_array(size_b, ref_length_row, length_row)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad length row\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                        if (diff_array(size_a, ref_length_col, length_col)) {
#pragma omp critical(printer)
                            {
                                printf("%s(%lu,%lu,%d,%d,%s) bad length col\n",
                                        functions[function_index].name,
                                        a, b, open, extend,
                                        matrixname);
                            }
                        }
                    }
                    parasail_result_free(reference_result);
                    parasail_result_free(result);
                }
                if (verbose && saturated) {
                    printf("%s %d %d %s saturated %lu times\n",
                            functions[function_index].name,
                            open, extend,
                            matrixname,
                            saturated);
                }
            }
            if (gap.open != INT_MIN && gap.extend != INT_MIN) {
                /* user-specified gap, don't loop */
                break;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %r9, %r14
movq %rcx, %r15
movq %rdx, 0x78(%rsp)
movq %rsi, %r12
movq %rdi, %rsi
movq %r9, %r13
shrq $0x20, %r13
leaq 0x110(%rsp), %rax
movq %r8, (%rax)
andq $0x0, 0x8(%rax)
testq %r8, %r8
leaq 0x4d8f7f(%rip), %rcx    # 0x624320
cmovneq %rax, %rcx
movq %rcx, 0x88(%rsp)
leaq 0x3d67c4(%rip), %rdi    # 0x521b78
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x14a040
movq %r14, 0xa0(%rsp)
movl %r14d, %eax
negl %eax
setno %al
movl $0x80000000, %ecx       # imm = 0x80000000
movq %r13, 0x98(%rsp)
cmpq %rcx, %r13
setne %cl
andb %al, %cl
movb %cl, 0x27(%rsp)
testq %r15, %r15
cmovleq %rbx, %r15
movq %r15, 0x100(%rsp)
xorl %ecx, %ecx
movq %r12, 0xe8(%rsp)
movq 0x88(%rsp), %rax
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x14bac8
movq %rcx, 0x90(%rsp)
movq %rax, 0x80(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
cmpb $0x1, 0x4fc529(%rip)    # 0x64795c
jne 0x14b448
leaq 0x3d676a(%rip), %rdi    # 0x521ba6
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x14a040
xorl %ebx, %ebx
leaq 0x4dbcbf(%rip), %rax    # 0x627110
movl (%rax,%rbx,8), %eax
movl %eax, %ecx
negl %ecx
jo 0x14bab8
movq 0x98(%rsp), %rcx
movl %ecx, 0x1c(%rsp)
movq 0xa0(%rsp), %rcx
movl %ecx, 0x20(%rsp)
cmpb $0x0, 0x27(%rsp)
jne 0x14b490
leaq 0x4dbc8c(%rip), %rcx    # 0x627110
movl 0x4(%rcx,%rbx,8), %ecx
movl %ecx, 0x1c(%rsp)
movl %eax, 0x20(%rsp)
cmpb $0x1, 0x4fc4c5(%rip)    # 0x64795c
jne 0x14b4af
leaq 0x3d66ef(%rip), %rdi    # 0x521b8f
movl 0x20(%rsp), %esi
movl 0x1c(%rsp), %edx
xorl %eax, %eax
callq 0x14a040
movq (%r12), %rax
movq %rax, 0xf0(%rsp)
pushq $0x1
popq %rax
movq %rax, 0x68(%rsp)
movq %rbx, 0xf8(%rsp)
imulq $0x48, 0x68(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, (%r12,%rax)
je 0x14baaa
addq %r12, 0x28(%rsp)
cmpb $0x1, 0x4fc46f(%rip)    # 0x64795c
jne 0x14b506
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x3d66a5(%rip), %rdi    # 0x521ba4
xorl %eax, %eax
callq 0x14a040
xorl %r9d, %r9d
xorl %eax, %eax
cmpq 0x100(%rsp), %rax
je 0x14ba6c
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x38(%rsp)
addsd %xmm0, %xmm0
ucomisd 0x3d6540(%rip), %xmm0   # 0x521a70
movq %r9, 0x70(%rsp)
movq %rax, 0x108(%rsp)
jb 0x14b545
sqrtsd %xmm0, %xmm0
jmp 0x14b54a
callq 0x14a0e0
callq 0x14a1d0
movsd 0x3d64f9(%rip), %xmm2   # 0x521a50
addsd %xmm2, %xmm0
movsd 0x3d64f5(%rip), %xmm3   # 0x521a58
movapd %xmm3, %xmm1
maxsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x3d64e1(%rip), %xmm0   # 0x521a60
movsd 0x38(%rsp), %xmm4
movapd %xmm4, %xmm2
subsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jb 0x14b59d
addsd %xmm1, %xmm0
addsd %xmm3, %xmm1
jmp 0x14b585
cvttsd2si %xmm2, %rax
movsd 0x3d64be(%rip), %xmm0   # 0x521a68
subsd %xmm0, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %r12
sarq $0x3f, %r12
andq %rcx, %r12
orq %rax, %r12
cvttsd2si %xmm1, %rax
subsd %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rax, %rbp
sarq $0x3f, %rbp
andq %rcx, %rbp
orq %rax, %rbp
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq %r12, %rbx
shlq $0x6, %rbx
movq 0x20(%rax,%rbx), %rsi
movq %rsi, 0x38(%rsp)
movq 0x28(%rax,%rbx), %rdi
movq %rbp, %r15
shlq $0x6, %r15
movq 0x20(%rax,%r15), %r14
movq 0x28(%rax,%r15), %rdx
movq 0x80(%rsp), %rax
movq %rax, (%rsp)
movl %r14d, %ecx
movl 0x20(%rsp), %r13d
movl %r13d, %r8d
movl 0x1c(%rsp), %r9d
callq *0xf0(%rsp)
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rax,%rbx), %rdi
movq 0x38(%rsp), %rsi
movq 0x28(%rax,%r15), %rdx
movq 0x80(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %r15
movl %r14d, %ecx
movl %r13d, %r8d
movl 0x1c(%rsp), %r9d
movq 0x28(%rsp), %rax
callq *(%rax)
movq %rax, %r13
movq %rax, %rdi
callq 0x14d42e
testl %eax, %eax
je 0x14b698
movq 0x48(%rsp), %rdi
callq 0x14c399
movq %r13, %rdi
callq 0x14c399
movq 0x70(%rsp), %r9
incq %r9
jmp 0x14ba4c
movq %r15, 0x40(%rsp)
movq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x14da97
movq %rax, 0x50(%rsp)
movq %r14, %rdi
callq 0x14dc5d
movq %rax, 0x60(%rsp)
movq %r13, %rdi
callq 0x14da97
movq %rax, %rbx
movq %r13, %rdi
callq 0x14dc5d
movq %rax, 0x58(%rsp)
movl (%r14), %eax
movl (%r13), %ecx
cmpl %ecx, %eax
je 0x14b717
movq 0x28(%rsp), %rdx
movq 0x8(%rdx), %rsi
movl %ecx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d64ab(%rip), %rdi    # 0x521bab
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rbx, %rdx
callq 0x14bada
testl %eax, %eax
je 0x14b75d
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d6490(%rip), %rdi    # 0x521bd6
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x38(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
movq 0x48(%rsp), %rbx
je 0x14b7aa
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d6467(%rip), %rdi    # 0x521bfa
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq %r13, %rdi
callq 0x14d594
testl %eax, %eax
je 0x14ba37
movq %rbx, %rdi
callq 0x14db13
movq %rax, 0xb0(%rsp)
movq %rbx, %rdi
callq 0x14dcde
movq %rax, 0xc0(%rsp)
movq %rbx, %rdi
callq 0x14db81
movq %rax, 0xd0(%rsp)
movq %rbx, %rdi
callq 0x14dd4c
movq %rax, 0xe0(%rsp)
movq %rbx, %rdi
callq 0x14dbef
movq %rax, 0x58(%rsp)
movq %rbx, %rdi
callq 0x14ddba
movq %rax, 0x60(%rsp)
movq %r13, %rdi
callq 0x14db13
movq %rax, %rbx
movq %r13, %rdi
callq 0x14dcde
movq %rax, 0xa8(%rsp)
movq %r13, %rdi
callq 0x14db81
movq %rax, 0xb8(%rsp)
movq %r13, %rdi
callq 0x14dd4c
movq %rax, 0xc8(%rsp)
movq %r13, %rdi
callq 0x14dbef
movq %rax, 0xd8(%rsp)
movq %r13, %rdi
callq 0x14ddba
movq %rax, 0x50(%rsp)
movq 0x40(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq %rbx, %rdx
callq 0x14bada
testl %eax, %eax
je 0x14b8b5
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d6380(%rip), %rdi    # 0x521c1e
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x38(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
je 0x14b903
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d6358(%rip), %rdi    # 0x521c44
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x40(%rsp), %rdi
movq 0xd0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
movq 0x48(%rsp), %rbx
je 0x14b956
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d632b(%rip), %rdi    # 0x521c6a
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x38(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
je 0x14b9a4
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d6303(%rip), %rdi    # 0x521c90
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0xd8(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
je 0x14b9ef
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d62de(%rip), %rdi    # 0x521cb6
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq 0x38(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x14bada
testl %eax, %eax
je 0x14ba37
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
leaq 0x3d62bb(%rip), %rdi    # 0x521cdb
movq %r12, %rdx
movq %rbp, %rcx
movl 0x20(%rsp), %r8d
movl 0x1c(%rsp), %r9d
xorl %eax, %eax
callq 0x14a040
movq %rbx, %rdi
callq 0x14c399
movq %r13, %rdi
callq 0x14c399
movq 0x70(%rsp), %r9
movq 0x108(%rsp), %rax
incq %rax
movq 0xe8(%rsp), %r12
movq 0xf8(%rsp), %rbx
jmp 0x14b50b
testq %r9, %r9
setne %al
andb 0x4fbee4(%rip), %al     # 0x64795c
cmpb $0x1, %al
jne 0x14baa0
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x3d6274(%rip), %rdi    # 0x521d00
movl 0x20(%rsp), %edx
movl 0x1c(%rsp), %ecx
movq 0x30(%rsp), %r8
xorl %eax, %eax
callq 0x14a040
incq 0x68(%rsp)
jmp 0x14b4cb
incq %rbx
cmpb $0x0, 0x27(%rsp)
je 0x14b44a
movq 0x90(%rsp), %rcx
incq %rcx
jmp 0x14b3ff
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq