// File: /workspace/github_c_makefile_star2_O2/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: c_split
static
size_t c_split(STRING* self, char* const delim, char*** dest)
{
    size_t  y       = 0,
            len     = 0,
            idx     = 0;

    char*   tok     = NULL,
        *   tmp     = NULL;

    if (delim == NULL) {
        status = EARGISNULPTR; goto ERR;
    }
    if (self->empty(self)) {
        status = ESTRISEMPTY; goto ERR;
    }
    if ((idx = self->count(self, delim)) == 0)
        return 0;
    else
        idx++;

    if ((tmp = (char*)
                malloc(sizeof(char) * (self->size(self) + 1))) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    } else {
        memcpy(tmp, self->c_str(self), self->size(self));
        *(tmp + self->size(self)) = '\0';
    }
    if ((*dest = (char**)
                malloc(sizeof(char*) * idx)) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    }
    tok = mbstrtok(tmp, delim);
    while (tok != NULL) {
        len = strlen(tok);
        if ((*((*dest) + y) = (char*)
                    malloc(sizeof(char) * (len + 1))) == NULL) {
#ifdef  LIBRARY_VERBOSE
            print_error();
/* LIBRARY_VERBOSE */
#endif
            status = EMEMORYALLOC; goto ERR;
        } else {
            memcpy(*((*dest) + y), tok, len);
            *(*((*dest) + y) + len) = '\0';
        }
        tok = mbstrtok(NULL, delim);
        y++;
    }
    if (tmp != NULL) {
        free(tmp);
        tmp = NULL;
    }

    return idx;

ERR:
    if (tmp != NULL) {
        free(tmp);
        tmp = NULL;
    }
    if (dest != NULL &&
            *dest != NULL)
        release_char_arr(NULL, idx, *dest);

    return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
testq %rsi, %rsi
je 0x6e8c
movq %rsi, %r15
movq %rdi, %r13
callq *0xa0(%rdi)
testl %eax, %eax
je 0x6ed2
pushq $-0x4
jmp 0x6e8e
pushq $-0x5
popq %r12
xorl %ebx, %ebx
xorl %edi, %edi
leaq 0xa3dd(%rip), %r15      # 0x11278
movl %r12d, (%r15)
callq 0x21a0
testq %r14, %r14
je 0x6ebd
movq (%r14), %rdx
testq %rdx, %rdx
je 0x6ebd
xorl %edi, %edi
movq %rbx, %rsi
callq 0x8d62
movl (%r15), %r12d
movslq %r12d, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
movq %r15, %rsi
callq *0x30(%r13)
testq %rax, %rax
je 0x6fba
movq %rax, %rbx
incq %rbx
movq %r13, %rdi
callq *0x18(%r13)
leaq 0x1(%rax), %rdi
callq 0x20e0
pushq $-0x3
popq %r12
testq %rax, %rax
je 0x6e92
movq %rax, %rbp
movq %r13, %rdi
callq *0xc8(%r13)
movq %rax, (%rsp)
movq %r13, %rdi
callq *0x18(%r13)
movq %rbp, %rdi
movq (%rsp), %rsi
movq %rax, %rdx
callq 0x2470
movq %r13, %rdi
callq *0x18(%r13)
movb $0x0, (%rbp,%rax)
leaq (,%rbx,8), %rdi
callq 0x20e0
movq %rax, (%r14)
testq %rax, %rax
movq %rbp, %rdi
je 0x6e94
movq %rdi, (%rsp)
movq %r15, %rsi
callq 0x8e2d
movq %rax, %r13
xorl %r12d, %r12d
testq %r13, %r13
je 0x6fc1
movq %r13, %rdi
callq 0x21b0
movq %rax, %rbp
leaq 0x1(%rax), %rdi
callq 0x20e0
movq (%r14), %rcx
movq %rax, (%rcx,%r12)
testq %rax, %rax
je 0x6fcf
movq (%r14), %rax
movq (%rax,%r12), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2470
movq (%r14), %rax
movq (%rax,%r12), %rax
movb $0x0, (%rax,%rbp)
xorl %edi, %edi
movq %r15, %rsi
callq 0x8e2d
movq %rax, %r13
addq $0x8, %r12
jmp 0x6f65
xorl %ebx, %ebx
jmp 0x6ec0
movq (%rsp), %rdi
callq 0x21a0
jmp 0x6ec0
pushq $-0x3
popq %r12
movq (%rsp), %rdi
jmp 0x6e94