// File: /workspace/github_c_makefile_star2_O3/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 0x20b397
movl %ecx, %r14d
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
callq 0x19e070
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jae 0x20b39e
movq %rax, %r12
movl %r14d, 0x14(%rsp)
leaq 0x1(%rax), %r15
movq %r15, %r13
imulq %r15, %r13
shlq $0x2, %r13
movq %r13, %rdi
callq 0x19e150
testq %rax, %rax
je 0x20b3a5
movq %rax, %r14
testq %r12, %r12
je 0x20b244
xorl %eax, %eax
xorl %edx, %edx
leaq 0x4(,%rdx,4), %rcx
xorl %esi, %esi
movq %rax, %rdi
addq %rsi, %rdi
movl %ebx, %edi
cmovel %ebp, %edi
movl %edi, -0x4(%r14,%rcx)
addq $0x4, %rcx
decq %rsi
movq %r12, %rdi
addq %rsi, %rdi
jne 0x20b20c
subq %rsi, %rdx
incq %rdx
movl $0x0, -0x4(%r14,%rcx)
incq %rax
cmpq %r12, %rax
jne 0x20b202
jmp 0x20b246
xorl %ecx, %ecx
movq %r14, %rdi
addq %rcx, %rdi
leaq 0x4(,%r12,4), %rdx
xorl %esi, %esi
callq 0x19e090
movl $0x400, %edi            # imm = 0x400
callq 0x19e150
testq %rax, %rax
je 0x20b3c5
movq %rax, %r13
movq %r12, %rax
movq %r12, 0x20(%rsp)
movd %eax, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorl %eax, %eax
movdqu %xmm0, (%r13,%rax,4)
addq $0x4, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x20b284
movq %r15, 0x18(%rsp)
cmpl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %rdx
je 0x20b2c2
testq %r12, %r12
je 0x20b2ff
xorl %eax, %eax
movzbl (%rdx,%rax), %ecx
movl %eax, (%r13,%rcx,4)
incq %rax
cmpq %rax, %r12
jne 0x20b2af
jmp 0x20b2ff
testq %r12, %r12
je 0x20b2ff
callq 0x19e030
movq (%rax), %r15
callq 0x19e040
movq 0x8(%rsp), %rdi
movq (%rax), %rax
xorl %ecx, %ecx
movzbl (%rdi,%rcx), %edx
shll $0x2, %edx
movslq (%r15,%rdx), %rsi
movl %ecx, (%r13,%rsi,4)
movslq (%rax,%rdx), %rdx
movl %ecx, (%r13,%rdx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x20b2de
addq $0x2, %r12
movq %r12, %rdi
callq 0x19e150
testq %rax, %rax
je 0x20b3cc
movq %rax, %rcx
movq %rax, %r12
movq %rcx, %rdi
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0x19e0c0
movw $0x2a, (%r12,%r15)
movl $0x48, %edi
callq 0x19e150
testq %rax, %rax
je 0x20b3f3
movq %rax, %r15
leaq 0x3bf15f(%rip), %rax    # 0x5ca4b2
movq %rax, (%r15)
movq %r14, 0x8(%r15)
movq %r13, 0x10(%r15)
movq 0x18(%rsp), %rcx
movl %ecx, 0x18(%r15)
cmpl %ebx, %ebp
movl %ebx, %eax
cmovgl %ebp, %eax
movl %eax, 0x1c(%r15)
cmovll %ebp, %ebx
movl %ebx, 0x20(%r15)
movq %r14, 0x28(%r15)
movl $0x0, 0x30(%r15)
movl %ecx, 0x34(%r15)
movq %r12, 0x38(%r15)
movq $0x0, 0x40(%r15)
jmp 0x20b3fb
callq 0x19eba7
jmp 0x20b3f8
callq 0x19eb88
jmp 0x20b3f8
movq 0x5ccc2c(%rip), %rax    # 0x7d7fd8
movq (%rax), %rdi
leaq 0x41db87(%rip), %rsi    # 0x628f3d
leaq 0x41e338(%rip), %rdx    # 0x6296f5
xorl %r15d, %r15d
movq %r13, %rcx
jmp 0x20b3ea
callq 0x19eb64
jmp 0x20b3f8
movq 0x5ccc05(%rip), %rax    # 0x7d7fd8
movq (%rax), %rdi
leaq 0x41db60(%rip), %rsi    # 0x628f3d
leaq 0x41e311(%rip), %rdx    # 0x6296f5
xorl %r15d, %r15d
movq %r12, %rcx
xorl %eax, %eax
callq 0x19e180
jmp 0x20b3fb
callq 0x19eb42
xorl %r15d, %r15d
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq