// File: /workspace/github_c_makefile_star2_O3/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: to_char_arr
static
int to_char_arr(STRING* self, char*** dest)
{
    int     ch      = 0;

    size_t  y       = 0;

    char*   p       = self->c_str(self);

    if (self->empty(self) ||
            self->mblen(self) == 0) {
        status = ESTRISEMPTY; goto ERR;
    }
    if ((*dest = (char**)
                malloc(sizeof(char*) * self->mblen(self))) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    } else {
        y = 0;
        while (y < self->mblen(self)) {
            *((*dest) + y) = NULL;
            y++;
        }
    }

    setlocale(LC_CTYPE, T_STRING_LOCALE_VALUE);
    y = 0;
    while (*p != '\0' && y < self->mblen(self)) {
        if ((ch = mblen(p, MB_CUR_MAX)) < 0) {
#ifdef  LIBRARY_VERBOSE
            print_error();
/* LIBRARY_VERBOSE */
#endif
            status = EINVALIDCHAR; goto ERR;
        }
        if ((*((*dest) + y) = (char*)
                    malloc(sizeof(char) * (ch + 1))) == NULL) {
#ifdef  LIBRARY_VERBOSE
            print_error();
/* LIBRARY_VERBOSE */
#endif
            status = EMEMORYALLOC; goto ERR;
        } else {
            memcpy(*((*dest) + y), p, ch);
            *(*((*dest) + y) + ch) = '\0';
        }
        p += ch;
        y++;
    }

    return 0;

ERR:
    switch (status) {
        case    ESTRISEMPTY:
            break;
        case    EINVALIDCHAR:
        case    EMEMORYALLOC:
            if (dest != NULL ||
                    *dest != NULL)
                release_char_arr(self, 0, *dest);
            break;
    }

    return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq *0xc8(%rdi)
movq %rax, %r15
movq %rbx, %rdi
callq *0xa0(%rbx)
testl %eax, %eax
je 0x7bf4
leaq 0x96a2(%rip), %rax      # 0x11278
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movl $0xfffffffc, %r12d      # imm = 0xFFFFFFFC
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq *0x20(%rbx)
testq %rax, %rax
je 0x7bcf
movq %rbx, %rdi
callq *0x20(%rbx)
leaq (,%rax,8), %rdi
callq 0x20e0
movq %rax, (%r14)
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
testq %rax, %rax
je 0x7ce1
movq %rbx, %rdi
callq *0x20(%rbx)
testq %rax, %rax
je 0x7c4a
xorl %r12d, %r12d
movq (%r14), %rax
movq $0x0, (%rax,%r12,8)
incq %r12
movq %rbx, %rdi
callq *0x20(%rbx)
cmpq %rax, %r12
jb 0x7c31
leaq 0x477d(%rip), %rsi      # 0xc3ce
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2430
cmpb $0x0, (%r15)
je 0x7be2
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rbx, %rdi
callq *0x20(%rbx)
cmpq %rax, %rbp
jae 0x7be2
callq 0x21d0
movq %r15, %rdi
movq %rax, %rsi
callq 0x2310
testl %eax, %eax
js 0x7cd5
movl %eax, %r13d
leal 0x1(%r13), %edi
callq 0x20e0
movq (%r14), %rcx
movq %rax, (%rcx,%rbp,8)
testq %rax, %rax
je 0x7cdc
movq (%r14), %rax
movq (%rax,%rbp,8), %rdi
movl %r13d, %r13d
movq %r15, %rsi
movq %r13, %rdx
callq 0x2470
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movb $0x0, (%rax,%r13)
incq %rbp
cmpb $0x0, (%r15,%r13)
leaq (%r15,%r13), %r15
jne 0x7c66
jmp 0x7be2
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
jmp 0x7ce1
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
leaq 0x9590(%rip), %r15      # 0x11278
movl %ecx, (%r15)
movq (%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9b40
movl (%r15), %r12d
jmp 0x7be2