// File: /workspace/github_c_makefile_star2_O1/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 0x7b87
movq %rsi, %r15
movq %rdi, %r13
callq *0xa0(%rdi)
testl %eax, %eax
je 0x7bd4
movl $0xfffffffc, %r12d      # imm = 0xFFFFFFFC
jmp 0x7b8d
movl $0xfffffffb, %r12d      # imm = 0xFFFFFFFB
xorl %ebx, %ebx
xorl %ebp, %ebp
leaq 0x96d8(%rip), %r15      # 0x11270
movl %r12d, (%r15)
testq %rbp, %rbp
je 0x7ba8
movq %rbp, %rdi
callq 0x21a0
testq %r14, %r14
je 0x7bbf
movq (%r14), %rdx
testq %rdx, %rdx
je 0x7bbf
xorl %edi, %edi
movq %rbx, %rsi
callq 0x9ca5
movslq (%r15), %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 0x7cd2
movq %rax, %rbx
incq %rbx
movq %r13, %rdi
callq *0x18(%r13)
leaq 0x1(%rax), %rdi
callq 0x20e0
movl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
testq %rax, %rax
je 0x7b8f
movq %rax, %rbp
movq %r13, %rdi
callq *0xc8(%r13)
movq %rbp, (%rsp)
movq %rax, %rbp
movq %r13, %rdi
callq *0x18(%r13)
movq (%rsp), %rdi
movq %rbp, %rsi
movq (%rsp), %rbp
movq %rax, %rdx
callq 0x2460
movq %r13, %rdi
callq *0x18(%r13)
movb $0x0, (%rbp,%rax)
leaq (,%rbx,8), %rdi
callq 0x20e0
movq %rax, (%r14)
testq %rax, %rax
je 0x7b91
movq %rbp, %rdi
movq %r15, %rsi
callq 0x9d97
testq %rax, %rax
je 0x7cc4
movq %rax, %r13
xorl %r12d, %r12d
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 0x7cd9
movq (%r14), %rax
movq (%rax,%r12), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2460
movq (%r14), %rax
movq (%rax,%r12), %rax
movb $0x0, (%rax,%rbp)
xorl %edi, %edi
movq %r15, %rsi
callq 0x9d97
movq %rax, %r13
addq $0x8, %r12
testq %rax, %rax
jne 0x7c71
movq (%rsp), %rdi
callq 0x21a0
jmp 0x7bc2
xorl %ebx, %ebx
jmp 0x7bc2
movl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
movq (%rsp), %rbp
jmp 0x7b91