// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/src/memory.c
// Function: parasail_matrix_create_internal
static parasail_matrix_t* parasail_matrix_create_internal(
        const char *alphabet, const int match, const int mismatch, int case_sensitive)
{
    parasail_matrix_t *retval = NULL;
    int *matrix = NULL;
    int *mapper = NULL;
    char *alphabet_copy = NULL;
    size_t size = 0;
    size_t size1 = 0;
    size_t i = 0;
    size_t j = 0;
    size_t c = 0;

    PARASAIL_CHECK_NULL(alphabet);

    size = strlen(alphabet);
    if (size >= INT_MAX) {
        fprintf(stderr, "%s: alphabet is too large\n", __func__);
        return NULL;
    }
    size1 = size + 1;

    PARASAIL_CALLOC(matrix, int, size1*size1);

    for (i=0; i<size; ++i) {
        for (j=0; j<size; ++j) {
            if (i == j) {
                matrix[c++] = match;
            }
            else {
                matrix[c++] = mismatch;
            }
        }
        matrix[c++] = 0;
    }
    for (j=0; j<size1; ++j) {
        matrix[c++] = 0;
    }

    PARASAIL_CALLOC(mapper, int, 256);
    parasail_memset_int(mapper, (int)size, 256);
    if (case_sensitive) {
        for (i=0; i<size; ++i) {
            mapper[(unsigned char)alphabet[i]] = (int)i;
        }
    }
    else {
        for (i=0; i<size; ++i) {
            mapper[toupper((unsigned char)alphabet[i])] = (int)i;
            mapper[tolower((unsigned char)alphabet[i])] = (int)i;
        }
    }

    PARASAIL_CALLOC(alphabet_copy, char, size1+1);
    (void)memcpy(alphabet_copy, alphabet, sizeof(char) * size);
    alphabet_copy[size] = '*';
    alphabet_copy[size1] = '\0';

    PARASAIL_NEW(retval, parasail_matrix_t);
    retval->name = "";
    retval->matrix = matrix;
    retval->mapper = mapper;
    retval->size = (int)size1;
    retval->max = match > mismatch ? match : mismatch;
    retval->min = match > mismatch ? mismatch : match;
    retval->user_matrix = matrix;
    retval->type = PARASAIL_MATRIX_TYPE_SQUARE;
    retval->length = retval->size;
    retval->alphabet = alphabet_copy;
    retval->query = NULL;
    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
je 0x1ac169
movl %ecx, %r14d
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r13
callq 0x19e070
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jae 0x1ac190
movq %rax, %r12
movl %r14d, 0x4(%rsp)
leaq 0x1(%rax), %r14
movq %r14, %r15
imulq %r14, %r15
shlq $0x2, %r15
movq %r15, %rdi
callq 0x19e150
testq %rax, %rax
je 0x1ac1b7
movq %r12, 0x8(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
leaq (%rax,%rcx,4), %r8
cmpq %r12, %rdx
je 0x1ac01e
xorl %esi, %esi
cmpq %rsi, %r12
je 0x1ac00e
cmpq %rsi, %rdx
movl %ebx, %edi
cmovel %ebp, %edi
movl %edi, (%r8,%rsi,4)
incq %rsi
jmp 0x1abff8
addq %rsi, %rcx
incq %rcx
andl $0x0, (%r8,%rsi,4)
incq %rdx
jmp 0x1abfed
pushq $-0x1
popq %rcx
cmpq %rcx, %r12
je 0x1ac031
andl $0x0, 0x4(%r8,%rcx,4)
incq %rcx
jmp 0x1ac021
movq %rax, 0x20(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x19e150
testq %rax, %rax
je 0x1ac1d7
movq %rax, %r15
xorl %eax, %eax
movq 0x8(%rsp), %rcx
cmpq $0x100, %rax            # imm = 0x100
je 0x1ac064
movl %ecx, (%r15,%rax,4)
incq %rax
jmp 0x1ac053
movq %r14, 0x18(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x1ac086
xorl %eax, %eax
cmpq %rax, %r12
je 0x1ac0d2
movzbl (%r13,%rax), %ecx
movl %eax, (%r15,%rcx,4)
incq %rax
jmp 0x1ac072
xorl %r14d, %r14d
movq %r15, 0x10(%rsp)
cmpq %r14, %r12
je 0x1ac0d2
callq 0x19e030
movq (%rax), %rax
movq %r13, %r15
movzbl (%r13,%r14), %r13d
shll $0x2, %r13d
movslq (%rax,%r13), %rax
movq 0x10(%rsp), %rcx
movl %r14d, (%rcx,%rax,4)
callq 0x19e040
movq (%rax), %rax
movslq (%rax,%r13), %rax
movq %r15, %r13
movq 0x10(%rsp), %r15
movl %r14d, (%r15,%rax,4)
incq %r14
jmp 0x1ac08e
addq $0x2, %r12
movq %r12, %rdi
callq 0x19e150
testq %rax, %rax
je 0x1ac1f9
movq %rax, %rdi
movq %r13, %rsi
movq %rax, %r12
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x19e0c0
movw $0x2a, (%r12,%r14)
movq %r12, %r14
pushq $0x48
popq %rdi
callq 0x19e150
testq %rax, %rax
je 0x1ac219
movq %rax, %r13
leaq 0x3bc390(%rip), %rax    # 0x5684b2
movq %rax, (%r13)
movq 0x20(%rsp), %rdx
movq %rdx, 0x8(%r13)
movq %r15, 0x10(%r13)
movq 0x18(%rsp), %rcx
movl %ecx, 0x18(%r13)
cmpl %ebx, %ebp
movl %ebx, %eax
cmovgl %ebp, %eax
movl %eax, 0x1c(%r13)
cmovll %ebp, %ebx
movl %ebx, 0x20(%r13)
movq %rdx, 0x28(%r13)
andl $0x0, 0x30(%r13)
movl %ecx, 0x34(%r13)
movq %r14, 0x38(%r13)
andq $0x0, 0x40(%r13)
jmp 0x1ac23e
movq 0x58ee68(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41ae71(%rip), %rsi    # 0x5c6feb
leaq 0x41b4f4(%rip), %rdx    # 0x5c7675
leaq 0x41b50d(%rip), %rcx    # 0x5c7695
xorl %r13d, %r13d
jmp 0x1ac237
movq 0x58ee41(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41b4fd(%rip), %rsi    # 0x5c769e
leaq 0x41b4cd(%rip), %rdx    # 0x5c7675
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x19e180
jmp 0x1ac23e
movq 0x58ee1a(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41acf5(%rip), %rsi    # 0x5c6ebd
leaq 0x41b4a6(%rip), %rdx    # 0x5c7675
xorl %r13d, %r13d
movq %r15, %rcx
jmp 0x1ac237
movq 0x58edfa(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41acd5(%rip), %rsi    # 0x5c6ebd
leaq 0x41b486(%rip), %rdx    # 0x5c7675
xorl %r13d, %r13d
movl $0x400, %ecx            # imm = 0x400
jmp 0x1ac237
movq 0x58edd8(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41acb3(%rip), %rsi    # 0x5c6ebd
leaq 0x41b464(%rip), %rdx    # 0x5c7675
xorl %r13d, %r13d
movq %r12, %rcx
jmp 0x1ac237
movq 0x58edb8(%rip), %rax    # 0x73afd8
movq (%rax), %rdi
leaq 0x41ac93(%rip), %rsi    # 0x5c6ebd
leaq 0x41b444(%rip), %rdx    # 0x5c7675
xorl %r13d, %r13d
pushq $0x48
popq %rcx
xorl %eax, %eax
callq 0x19e180
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq