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

    if (self->empty(self))
        return (status = ESTRISEMPTY);
    if (str == NULL)
        return (status = EARGISNULPTR);
    if ((len = strlen(str)) > self->size(self))
        return (status = EOUTOFRANGE);
    if (self->index(self, str, 0, &idx) < 0)
        return (status = ESTRNOTFOUND);

    if ((*dest = (char**)
                malloc(sizeof(char*) * 2)) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        return (status = EMEMORYALLOC);
    }

    if ((*(*dest) = (char*)
                malloc(sizeof(char) * (idx + 1))) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    } else {
        memcpy(*(*dest), self->c_str(self), idx);
        *(*((*dest)) + idx) = '\0';
    }

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

    return 0;
    
ERR:
    switch (status) {
        case    EMEMORYALLOC:
            if (*(*dest) != NULL) {
                free(*(*dest));
                *(*dest) = NULL;
            }
            if (*(*dest + 1) != NULL) {
                free(*(*dest + 1));
                *(*dest + 1) = NULL;
            }
            break;
    }
    
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq $0x0, (%rsp)
callq *0xa0(%rdi)
testl %eax, %eax
je 0x76b3
leaq 0x9be1(%rip), %rax      # 0x11278
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x76e3
movq %r12, %rdi
callq 0x21b0
movq %rax, %r15
movq %r14, %rdi
callq *0x18(%r14)
cmpq %rax, %r15
jbe 0x76f7
leaq 0x9ba2(%rip), %rax      # 0x11278
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x76a2
leaq 0x9b8e(%rip), %rax      # 0x11278
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
jmp 0x76a2
movq %rsp, %rcx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq *0x1b8(%r14)
testl %eax, %eax
js 0x77f8
movl $0x10, %edi
callq 0x20e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x780f
movq %rax, %r12
movq (%rsp), %rdi
incq %rdi
callq 0x20e0
movq %rax, (%r12)
testq %rax, %rax
je 0x7826
movq %rax, %r13
movq %r14, %rdi
callq *0xc8(%r14)
movq (%rsp), %r12
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x2470
movq (%rbx), %rax
movq (%rax), %rax
movb $0x0, (%rax,%r12)
movq %r14, %rdi
callq *0x18(%r14)
movq (%rsp), %rcx
subq %r15, %rax
leaq (%rax,%rcx), %rdi
incq %rdi
callq 0x20e0
movq (%rbx), %rcx
movq %rax, 0x8(%rcx)
movq (%rbx), %r12
testq %rax, %rax
je 0x7835
movq %r15, %rbp
negq %rbp
movq 0x8(%r12), %r12
movq %r14, %rdi
callq *0xc8(%r14)
addq (%rsp), %rax
movq %r15, %r13
addq %rax, %r13
movq %r14, %rdi
callq *0x18(%r14)
movq (%rsp), %rcx
addq %r15, %rcx
subq %rcx, %rax
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2470
movq (%rbx), %rax
movq 0x8(%rax), %rbx
movq %r14, %rdi
callq *0x18(%r14)
addq %rbx, %rax
subq (%rsp), %rax
movb $0x0, (%rax,%rbp)
xorl %ebp, %ebp
jmp 0x76a2
leaq 0x9a79(%rip), %rax      # 0x11278
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
movl $0xfffffffa, %ebp       # imm = 0xFFFFFFFA
jmp 0x76a2
leaq 0x9a62(%rip), %rax      # 0x11278
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jmp 0x76a2
leaq 0x9a4b(%rip), %rax      # 0x11278
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0x785d
movq (%r12), %rdi
leaq 0x9a38(%rip), %rax      # 0x11278
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
testq %rdi, %rdi
je 0x785d
callq 0x21a0
movq (%rbx), %rax
movq $0x0, (%rax)
movq (%rbx), %r12
movq 0x8(%r12), %rdi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x76a2
callq 0x21a0
movq (%rbx), %rax
movq $0x0, 0x8(%rax)
jmp 0x76a2