// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/tests/test_matrix.c
// Function: main
int main(int argc, char **argv)
{
    parasail_matrix_t *matrix = NULL;
    const parasail_matrix_t *internal_matrix = NULL;
    parasail_matrix_t *user_matrix = NULL;
    parasail_matrix_t *user_matrix_copy = NULL;
    const char *pssm_alphabet = "abcdef";
    const int pssm_values[] = {
        0,  1,  2,  3,   4,  5,
        6,  7,  8,  9,  10, 11,
        12, 13, 14, 15, 16, 17,
        18, 19, 20, 21, 22, 23
    };
    const int pssm_length = 4;

    if (argc == 2) {
        matrix = parasail_matrix_from_file(argv[1]);
        print_matrix(matrix);
        print_mapper(matrix);
        parasail_matrix_free(matrix);
    }
    else {
        printf("missing matrix file argument, skipping that part of the test\n");
    }

    print_matrix(&parasail_blosum62);
    print_mapper(&parasail_blosum62);

    internal_matrix = parasail_matrix_lookup("blosum62");
    if (NULL == internal_matrix) {
        fprintf(stderr, "matrix lookup failed");
        exit(EXIT_FAILURE);
    }

    user_matrix = parasail_matrix_create("ACGT", 2, -1);
    if (NULL == user_matrix) {
        fprintf(stderr, "matrix create failed");
        exit(EXIT_FAILURE);
    }
    print_matrix(user_matrix);
    print_mapper(user_matrix);
    parasail_matrix_free(user_matrix);

    user_matrix = parasail_matrix_create_case_sensitive("AcgT", 2, -1);
    if (NULL == user_matrix) {
        fprintf(stderr, "matrix create failed");
        exit(EXIT_FAILURE);
    }
    print_matrix(user_matrix);
    print_mapper(user_matrix);
    parasail_matrix_free(user_matrix);

    user_matrix = parasail_matrix_create_case_sensitive("ACGTacgt", 2, -1);
    if (NULL == user_matrix) {
        fprintf(stderr, "matrix create failed");
        exit(EXIT_FAILURE);
    }
    print_matrix(user_matrix);
    print_mapper(user_matrix);
    parasail_matrix_free(user_matrix);

    user_matrix = parasail_matrix_copy(internal_matrix);
    if (NULL == user_matrix) {
        fprintf(stderr, "matrix copy failed");
        exit(EXIT_FAILURE);
    }

    parasail_matrix_set_value(user_matrix, 10, 10, 100);
    if (100 != user_matrix->max) {
        fprintf(stderr, "matrix set value failed");
        exit(EXIT_FAILURE);
    }

    parasail_matrix_free(user_matrix);

    user_matrix = parasail_matrix_pssm_create(
            pssm_alphabet,
            pssm_values,
            pssm_length);
    if (NULL == user_matrix) {
        fprintf(stderr, "pssm matrix create failed");
        exit(EXIT_FAILURE);
    }
    print_matrix(user_matrix);
    print_mapper(user_matrix);

    user_matrix_copy = parasail_matrix_copy(user_matrix);
    if (NULL == user_matrix_copy) {
        fprintf(stderr, "pssm matrix copy failed");
        exit(EXIT_FAILURE);
    }
    parasail_matrix_free(user_matrix);

    print_matrix(user_matrix_copy);
    print_mapper(user_matrix_copy);
    parasail_matrix_free(user_matrix_copy);

    user_matrix = parasail_matrix_convert_square_to_pssm(internal_matrix, "asdf", 4);
    print_matrix(user_matrix);
    print_mapper(user_matrix);
    parasail_matrix_free(user_matrix);

    print_matrix(internal_matrix);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rax
movl %edi, %edx
leaq 0x455f(%rip), %rsi      # 0xb110
movq %rsp, %rdi
movl $0xc, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x2, %edx
jne 0x6be8
movq 0x8(%rax), %rdi
callq 0x7f1e
movq %rax, %rbx
movq %rax, %rdi
callq 0x6de5
movq 0x10(%rbx), %rdi
callq 0x6f0f
movq %rbx, %rdi
callq 0x9d16
jmp 0x6bf4
leaq 0x44df(%rip), %rdi      # 0xb0ce
callq 0x5060
leaq 0x31c35(%rip), %rdi     # 0x38830
callq 0x6de5
leaq 0x4e69(%rip), %rdi      # 0xba70
callq 0x6f0f
leaq 0x43f8(%rip), %rdi      # 0xb00b
callq 0x8718
testq %rax, %rax
je 0x6dbd
movq %rax, %rbx
leaq 0x43fe(%rip), %rdi      # 0xb029
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x934a
testq %rax, %rax
je 0x6dc2
movq %rax, %r14
movq %rax, %rdi
callq 0x6de5
movq 0x10(%r14), %rdi
callq 0x6f0f
movq %r14, %rdi
callq 0x9d16
leaq 0x43c8(%rip), %rdi      # 0xb02e
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x95c1
testq %rax, %rax
je 0x6dc7
movq %rax, %r14
movq %rax, %rdi
callq 0x6de5
movq 0x10(%r14), %rdi
callq 0x6f0f
movq %r14, %rdi
callq 0x9d16
leaq 0x4392(%rip), %rdi      # 0xb033
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x95c1
testq %rax, %rax
je 0x6dcc
movq %rax, %r14
movq %rax, %rdi
callq 0x6de5
movq 0x10(%r14), %rdi
callq 0x6f0f
movq %r14, %rdi
callq 0x9d16
movq %rbx, %rdi
callq 0x98d5
testq %rax, %rax
je 0x6dd1
movq %rax, %r14
movq %rax, %rdi
movl $0xa, %esi
movl $0xa, %edx
movl $0x64, %ecx
callq 0x9cdb
cmpl $0x64, 0x1c(%r14)
jne 0x6dd6
movq %r14, %rdi
callq 0x9d16
leaq 0x42ea(%rip), %rdi      # 0xb004
movq %rsp, %rsi
movl $0x4, %edx
callq 0x95cb
testq %rax, %rax
je 0x6ddb
movq %rax, %r14
movq %rax, %rdi
callq 0x6de5
movq 0x10(%r14), %rdi
callq 0x6f0f
movq %r14, %rdi
callq 0x98d5
testq %rax, %rax
je 0x6de0
movq %rax, %r15
movq %r14, %rdi
callq 0x9d16
movq %r15, %rdi
callq 0x6de5
movq 0x10(%r15), %rdi
callq 0x6f0f
movq %r15, %rdi
callq 0x9d16
leaq 0x4306(%rip), %rsi      # 0xb086
movq %rbx, %rdi
movl $0x4, %edx
callq 0x9ab5
movq %rax, %r14
movq %rax, %rdi
callq 0x6de5
movq 0x10(%r14), %rdi
callq 0x6f0f
movq %r14, %rdi
callq 0x9d16
movq %rbx, %rdi
callq 0x6de5
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x52f3
callq 0x52ce
callq 0x52a9
callq 0x5284
callq 0x525f
callq 0x51f0
callq 0x523a
callq 0x5215