// File: /workspace/github_c_makefile_star2_O1/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 0x45bf(%rip), %rsi      # 0xb110
movq %rsp, %rdi
movl $0xc, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x2, %edx
jne 0x6b87
movq 0x8(%rax), %rdi
callq 0x7e8c
movq %rax, %rbx
movq %rax, %rdi
callq 0x6d7d
movq %rbx, %rdi
callq 0x6ea7
movq %rbx, %rdi
callq 0x98c9
jmp 0x6b93
leaq 0x4540(%rip), %rdi      # 0xb0ce
callq 0x5060
leaq 0x31c96(%rip), %rbx     # 0x38830
movq %rbx, %rdi
callq 0x6d7d
movq %rbx, %rdi
callq 0x6ea7
leaq 0x445a(%rip), %rdi      # 0xb00b
callq 0x87bc
testq %rax, %rax
je 0x6d55
movq %rax, %rbx
leaq 0x4460(%rip), %rdi      # 0xb029
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x8efb
testq %rax, %rax
je 0x6d5a
movq %rax, %r14
movq %rax, %rdi
callq 0x6d7d
movq %r14, %rdi
callq 0x6ea7
movq %r14, %rdi
callq 0x98c9
leaq 0x442b(%rip), %rdi      # 0xb02e
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x9162
testq %rax, %rax
je 0x6d5f
movq %rax, %r14
movq %rax, %rdi
callq 0x6d7d
movq %r14, %rdi
callq 0x6ea7
movq %r14, %rdi
callq 0x98c9
leaq 0x43f6(%rip), %rdi      # 0xb033
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x9162
testq %rax, %rax
je 0x6d64
movq %rax, %r14
movq %rax, %rdi
callq 0x6d7d
movq %r14, %rdi
callq 0x6ea7
movq %r14, %rdi
callq 0x98c9
movq %rbx, %rdi
callq 0x9472
testq %rax, %rax
je 0x6d69
movq %rax, %r14
movq %rax, %rdi
movl $0xa, %esi
movl $0xa, %edx
movl $0x64, %ecx
callq 0x988e
cmpl $0x64, 0x1c(%r14)
jne 0x6d6e
movq %r14, %rdi
callq 0x98c9
leaq 0x434f(%rip), %rdi      # 0xb004
movq %rsp, %rsi
movl $0x4, %edx
callq 0x916c
testq %rax, %rax
je 0x6d73
movq %rax, %r14
movq %rax, %rdi
callq 0x6d7d
movq %r14, %rdi
callq 0x6ea7
movq %r14, %rdi
callq 0x9472
testq %rax, %rax
je 0x6d78
movq %rax, %r15
movq %r14, %rdi
callq 0x98c9
movq %r15, %rdi
callq 0x6d7d
movq %r15, %rdi
callq 0x6ea7
movq %r15, %rdi
callq 0x98c9
leaq 0x436d(%rip), %rsi      # 0xb086
movq %rbx, %rdi
movl $0x4, %edx
callq 0x9654
movq %rax, %r14
movq %rax, %rdi
callq 0x6d7d
movq %r14, %rdi
callq 0x6ea7
movq %r14, %rdi
callq 0x98c9
movq %rbx, %rdi
callq 0x6d7d
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x52e3
callq 0x52be
callq 0x5299
callq 0x5274
callq 0x524f
callq 0x51e0
callq 0x522a
callq 0x5205