// File: /workspace/github_c_makefile_star2_O3/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: split
static
size_t split(STRING* self, char* const delim, STRING*** dest)
{
    size_t  y       = 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 = (STRING**)
                malloc(sizeof(STRING*) * idx)) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    }
    tok = mbstrtok(tmp, delim);
    while (tok != NULL) {
        if ((*((*dest) + y) = new_string(tok))
                == NULL)
            goto ERR;
        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) {
        y = 0;
        while (y < idx) {
            self->release(*((*dest) + y));
            *((*dest) + y) = NULL;
            y++;
        }
        free(*dest);
        *dest = NULL;
    }

    return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x78b3
movq %rsi, %r12
movq %r14, %rdi
callq *0xa0(%r14)
testl %eax, %eax
je 0x7925
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x78b8
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
xorl %r15d, %r15d
leaq 0x99b6(%rip), %rcx      # 0x11278
movl %eax, (%rcx)
testq %rbx, %rbx
je 0x7909
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x7909
testq %r15, %r15
je 0x78fd
xorl %r12d, %r12d
movq (%rbx), %rax
movq (%rax,%r12,8), %rdi
callq *0x268(%r14)
movq (%rbx), %rax
movq $0x0, (%rax,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x78d9
movq (%rbx), %rdi
callq 0x21a0
movq $0x0, (%rbx)
leaq 0x9968(%rip), %rax      # 0x11278
movslq (%rax), %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r12, %rsi
callq *0x30(%r14)
testq %rax, %rax
je 0x79e4
movq %rax, %r15
incq %r15
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x1(%rax), %rdi
callq 0x20e0
testq %rax, %rax
je 0x79ec
movq %rax, %r13
movq %r14, %rdi
callq *0xc8(%r14)
movq %rax, %rbp
movq %r14, %rdi
callq *0x18(%r14)
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x2470
movq %r14, %rdi
callq *0x18(%r14)
movb $0x0, (%r13,%rax)
leaq (,%r15,8), %rdi
callq 0x20e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x79f6
movq %r13, %rdi
movq %r12, %rsi
callq 0x9c30
testq %rax, %rax
je 0x79d7
xorl %ebp, %ebp
movq %rax, %rdi
callq 0x6460
movq (%rbx), %rcx
movq %rax, (%rcx,%rbp)
testq %rax, %rax
je 0x7a03
xorl %edi, %edi
movq %r12, %rsi
callq 0x9c30
addq $0x8, %rbp
testq %rax, %rax
jne 0x79b0
movq %r13, %rdi
callq 0x21a0
jmp 0x7913
xorl %r15d, %r15d
jmp 0x7913
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jmp 0x78bb
leaq 0x987b(%rip), %rax      # 0x11278
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
movq %r13, %rdi
callq 0x21a0
jmp 0x78c9