// File: /workspace/github_c_makefile_star2_O1/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 0x7a07
movq %rsi, %r13
movq %r14, %rdi
callq *0xa0(%r14)
testl %eax, %eax
je 0x7a87
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
jmp 0x7a0c
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
xorl %r15d, %r15d
xorl %r12d, %r12d
leaq 0x9857(%rip), %rax      # 0x11270
movl %ebp, (%rax)
testq %r12, %r12
je 0x7a28
movq %r12, %rdi
callq 0x21a0
testq %rbx, %rbx
je 0x7a6b
cmpq $0x0, (%rbx)
je 0x7a6b
testq %r15, %r15
je 0x7a5c
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 0x7a3b
movq (%rbx), %rdi
callq 0x21a0
movq $0x0, (%rbx)
leaq 0x97fe(%rip), %rax      # 0x11270
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 %r13, %rsi
callq *0x30(%r14)
testq %rax, %rax
je 0x7b54
movq %rax, %r15
incq %r15
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x1(%rax), %rdi
callq 0x20e0
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
testq %rax, %rax
je 0x7a0f
movq %rax, %r12
movq %r14, %rdi
callq *0xc8(%r14)
movq %rax, (%rsp)
movq %r14, %rdi
callq *0x18(%r14)
movq %r12, %rdi
movq (%rsp), %rsi
movq %rax, %rdx
callq 0x2460
movq %r14, %rdi
callq *0x18(%r14)
movb $0x0, (%r12,%rax)
leaq (,%r15,8), %rdi
callq 0x20e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x7a12
movq %r12, %rdi
movq %r13, %rsi
callq 0x9d97
testq %rax, %rax
je 0x7b47
xorl %ebp, %ebp
movq %rax, %rdi
callq 0x65a4
movq (%rbx), %rcx
movq %rax, (%rcx,%rbp)
testq %rax, %rax
je 0x7a1b
xorl %edi, %edi
movq %r13, %rsi
callq 0x9d97
addq $0x8, %rbp
testq %rax, %rax
jne 0x7b1c
movq %r12, %rdi
callq 0x21a0
jmp 0x7a75
xorl %r15d, %r15d
jmp 0x7a75