// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xb20d
leaq 0xc046(%rip), %rax      # 0x17248
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
jmp 0xb3a5
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xb235
leaq 0xc01e(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
jmp 0xb3a5
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xb25e
movq $0x0, -0x8(%rbp)
jmp 0xb442
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x20e0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0xb2a4
leaq 0xbfaf(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xb3a5
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rax, %rdx
callq 0x2410
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, %rcx
movq -0x48(%rbp), %rax
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rdi
shlq $0x3, %rdi
callq 0x20e0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0xb329
leaq 0xbf27(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xb3a5
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xf2e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xb380
movq -0x38(%rbp), %rdi
callq 0x8fd0
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq -0x28(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
jne 0xb361
jmp 0xb3a5
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0xf2e0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb33a
cmpq $0x0, -0x40(%rbp)
je 0xb398
movq -0x40(%rbp), %rdi
callq 0x2180
movq $0x0, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb442
cmpq $0x0, -0x40(%rbp)
je 0xb3bd
movq -0x40(%rbp), %rdi
callq 0x2180
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xb434
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xb434
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0xb41d
movq -0x10(%rbp), %rax
movq 0x268(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
callq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb3d6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x2180
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
leaq 0xbe0d(%rip), %rax      # 0x17248
movslq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)