// File: /workspace/github_c_makefile_star2_O2/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 0x4e1f(%rip), %rsi      # 0xa110
pushq $0xc
popq %rcx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x2, %edx
jne 0x5325
movq 0x8(%rax), %rdi
callq 0x6759
movq %rax, %rbx
movq %rax, %rdi
callq 0x5565
movq %rbx, %rdi
callq 0x567b
movq %rbx, %rdi
callq 0x83df
jmp 0x5331
leaq 0x4da2(%rip), %rdi      # 0xa0ce
callq 0x5060
leaq 0x304f8(%rip), %rbx     # 0x35830
movq %rbx, %rdi
callq 0x5565
movq %rbx, %rdi
callq 0x567b
leaq 0x4cbc(%rip), %rdi      # 0xa00b
callq 0x6ff4
testq %rax, %rax
je 0x54ef
movq %rax, %rbx
leaq 0x4cc2(%rip), %rdi      # 0xa029
pushq $0x2
popq %rsi
pushq $-0x1
popq %rdx
callq 0x78ee
testq %rax, %rax
je 0x54dc
movq %rax, %r14
movq %rax, %rdi
callq 0x5565
movq %r14, %rdi
callq 0x567b
movq %r14, %rdi
callq 0x83df
leaq 0x4c91(%rip), %rdi      # 0xa02e
pushq $0x2
popq %rsi
pushq $-0x1
popq %rdx
callq 0x7bb8
testq %rax, %rax
je 0x54dc
movq %rax, %r14
movq %rax, %rdi
callq 0x5565
movq %r14, %rdi
callq 0x567b
movq %r14, %rdi
callq 0x83df
leaq 0x4c60(%rip), %rdi      # 0xa033
pushq $0x2
popq %rsi
pushq $-0x1
popq %rdx
callq 0x7bb8
testq %rax, %rax
je 0x54dc
movq %rax, %r14
movq %rax, %rdi
callq 0x5565
movq %r14, %rdi
callq 0x567b
movq %r14, %rdi
callq 0x83df
movq %rbx, %rdi
callq 0x7f03
testq %rax, %rax
je 0x5504
movq %rax, %r14
pushq $0xa
popq %rdx
pushq $0x64
popq %rcx
movq %rax, %rdi
movl %edx, %esi
callq 0x836e
cmpl $0x64, 0x1c(%r14)
jne 0x5519
movq %r14, %rdi
callq 0x83df
leaq 0x4bc4(%rip), %rdi      # 0xa004
movq %rsp, %rsi
pushq $0x4
popq %rdx
callq 0x7bc0
testq %rax, %rax
je 0x552c
movq %rax, %r14
movq %rax, %rdi
callq 0x5565
movq %r14, %rdi
callq 0x567b
movq %r14, %rdi
callq 0x7f03
testq %rax, %rax
je 0x5541
movq %rax, %r15
movq %r14, %rdi
callq 0x83df
movq %r15, %rdi
callq 0x5565
movq %r15, %rdi
callq 0x567b
movq %r15, %rdi
callq 0x83df
leaq 0x4be4(%rip), %rsi      # 0xa086
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x8130
movq %rax, %r14
movq %rax, %rdi
callq 0x5565
movq %r14, %rdi
callq 0x567b
movq %r14, %rdi
callq 0x83df
movq %rbx, %rdi
callq 0x5565
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x31b0d(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b6c(%rip), %rdi      # 0xa059
jmp 0x5500
movq 0x31afa(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b14(%rip), %rdi      # 0xa014
pushq $0x14
jmp 0x5554
movq 0x31ae5(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b5e(%rip), %rdi      # 0xa073
pushq $0x12
jmp 0x5554
movq 0x31ad0(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b12(%rip), %rdi      # 0xa03c
jmp 0x5552
movq 0x31abd(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b17(%rip), %rdi      # 0xa054
pushq $0x19
jmp 0x5554
movq 0x31aa8(%rip), %rax     # 0x36ff0
movq (%rax), %rcx
leaq 0x4b1c(%rip), %rdi      # 0xa06e
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x5170
pushq $0x1
popq %rdi
callq 0x5160