// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/src/memory.c
// Function: parasail_matrix_copy
parasail_matrix_t* parasail_matrix_copy(const parasail_matrix_t *matrix)
{
    parasail_matrix_t *retval = NULL;

    PARASAIL_CHECK_NULL(matrix);

    PARASAIL_NEW(retval, parasail_matrix_t);
    retval->name = matrix->name;
    retval->size = matrix->size;
    retval->max = matrix->max;
    retval->min = matrix->min;
    retval->type = matrix->type;
    retval->length = matrix->length;

    {
        size_t matrix_size = 0;
        size_t alphabet_size = (matrix->size+1);
        int *new_mapper = NULL;
        int *new_matrix = NULL;
        char *new_alphabet = NULL;
        char *new_query = NULL;

        if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
            matrix_size = matrix->size*matrix->size;
        }
        else if (matrix->type == PARASAIL_MATRIX_TYPE_PSSM) {
            matrix_size = matrix->size*matrix->length;
        }

        PARASAIL_CALLOC(new_mapper, int, 256);
        (void)memcpy(new_mapper, matrix->mapper, sizeof(int)*256);

        PARASAIL_CALLOC(new_matrix, int, matrix_size);
        (void)memcpy(new_matrix, matrix->matrix, sizeof(int)*matrix_size);

        PARASAIL_CALLOC(new_alphabet, char, alphabet_size);
        (void)memcpy(new_alphabet, matrix->alphabet, sizeof(char)*alphabet_size);

        if (matrix->query) {
            size_t query_size = strlen(matrix->query);
            PARASAIL_CALLOC(new_query, char, query_size+1);
            (void)memcpy(new_query, matrix->query, sizeof(char)*(query_size+1));
            new_query[query_size] = '\0';
        }

        retval->mapper = new_mapper;
        retval->matrix = new_matrix;
        retval->user_matrix = new_matrix;
        retval->alphabet = new_alphabet;
        retval->query = new_query;
    }

    return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1c5441
movq 0xc61bc3(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xb26bcc(%rip), %rsi    # 0xcebfeb
leaq 0xb26bd5(%rip), %rdx    # 0xcebffb
leaq 0xb274f8(%rip), %rcx    # 0xcec925
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c5443
jmp 0x1c5445
movq $0x48, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x19e150
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1c5491
movq 0xc61b70(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
movq -0x20(%rbp), %rcx
leaq 0xb26a47(%rip), %rsi    # 0xcebebd
leaq 0xb26b7e(%rip), %rdx    # 0xcebffb
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c5493
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x1c5540
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x10(%rbp), %rcx
imull 0x18(%rcx), %eax
cltq
movq %rax, -0x28(%rbp)
jmp 0x1c5561
movq -0x10(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0x1c555f
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x10(%rbp), %rcx
imull 0x34(%rcx), %eax
cltq
movq %rax, -0x28(%rbp)
jmp 0x1c5561
jmp 0x1c5563
movq $0x400, -0x58(%rbp)     # imm = 0x400
movq -0x58(%rbp), %rdi
callq 0x19e150
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1c55af
movq 0xc61a52(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
movq -0x58(%rbp), %rcx
leaq 0xb26929(%rip), %rsi    # 0xcebebd
leaq 0xb26a60(%rip), %rdx    # 0xcebffb
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c55b1
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x19e0a0
movq -0x28(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x19e150
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1c5617
movq 0xc619ea(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
movq -0x60(%rbp), %rcx
leaq 0xb268c1(%rip), %rsi    # 0xcebebd
leaq 0xb269f8(%rip), %rdx    # 0xcebffb
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c5619
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x28(%rbp), %rdx
shlq $0x2, %rdx
callq 0x19e0a0
movq -0x30(%rbp), %rax
shlq $0x0, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x19e150
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1c5682
movq 0xc6197f(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
movq -0x68(%rbp), %rcx
leaq 0xb26856(%rip), %rsi    # 0xcebebd
leaq 0xb2698d(%rip), %rdx    # 0xcebffb
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c5684
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x30(%rbp), %rdx
shlq $0x0, %rdx
callq 0x19e0a0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x1c5739
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x19e050
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
addq $0x1, %rax
shlq $0x0, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x19e150
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x1c570e
movq 0xc618f0(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
movq -0x78(%rbp), %rcx
leaq 0xb267c7(%rip), %rsi    # 0xcebebd
leaq 0xb268fe(%rip), %rdx    # 0xcebffb
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x1c577d
jmp 0x1c5710
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x70(%rbp), %rdx
addq $0x1, %rdx
shlq $0x0, %rdx
callq 0x19e0a0
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)