// File: /workspace/github_c_makefile_star2_O2/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 0x7026
leaq 0xa26e(%rip), %rax      # 0x11278
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
pushq $-0x4
popq %r12
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 0x7003
movq %rbx, %rdi
callq *0x20(%rbx)
leaq (,%rax,8), %rdi
callq 0x20e0
movq %rax, (%r14)
pushq $-0x3
popq %rcx
testq %rax, %rax
je 0x70ee
xorl %r12d, %r12d
movq %rbx, %rdi
callq *0x20(%rbx)
cmpq %rax, %r12
jae 0x706e
movq (%r14), %rax
andq $0x0, (%rax,%r12,8)
incq %r12
jmp 0x7056
leaq 0x431d(%rip), %rsi      # 0xb392
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2430
xorl %ebp, %ebp
cmpb $0x0, (%r15)
je 0x7014
movq %rbx, %rdi
callq *0x20(%rbx)
cmpq %rax, %rbp
jae 0x7014
callq 0x21d0
movq %r15, %rdi
movq %rax, %rsi
callq 0x2310
testl %eax, %eax
js 0x70e7
movl %eax, %r13d
leal 0x1(%r13), %edi
callq 0x20e0
movq (%r14), %rcx
movq %rax, (%rcx,%rbp,8)
testq %rax, %rax
je 0x70eb
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)
addq %r13, %r15
incq %rbp
jmp 0x7081
pushq $-0x2
jmp 0x70ed
pushq $-0x3
popq %rcx
leaq 0xa183(%rip), %r15      # 0x11278
movl %ecx, (%r15)
movq (%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8d62
movl (%r15), %r12d
jmp 0x7014