// File: /workspace/github_c_makefile_star2_O0/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
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 -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xaf23
leaq 0xc337(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xb1b4
cmpq $0x0, -0x18(%rbp)
jne 0xaf43
leaq 0xc317(%rip), %rax      # 0x17248
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xb1b4
movq -0x18(%rbp), %rdi
callq 0x2190
movq %rax, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jbe 0xaf87
leaq 0xc2d3(%rip), %rax      # 0x17248
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb1b4
movq -0x10(%rbp), %rax
movq 0x1b8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
leaq -0x28(%rbp), %rcx
callq *%rax
cmpl $0x0, %eax
jge 0xafc2
leaq 0xc298(%rip), %rax      # 0x17248
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xb1b4
movl $0x10, %edi
callq 0x20e0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0xaff2
leaq 0xc268(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xb1b4
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x20e0
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0xb025
leaq 0xc22e(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xb144
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x40(%rbp), %rdi
movq %rax, %rsi
movq -0x28(%rbp), %rdx
callq 0x2410
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, %rdi
subq -0x30(%rbp), %rdi
addq -0x28(%rbp), %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x20e0
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0xb0af
leaq 0xc1a4(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xb144
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
addq -0x28(%rbp), %rax
addq -0x30(%rbp), %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
subq -0x28(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0x2410
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %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
addq %rcx, %rax
xorl %ecx, %ecx
subq -0x28(%rbp), %rcx
addq %rcx, %rax
xorl %ecx, %ecx
subq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
jmp 0xb1b4
leaq 0xc0fd(%rip), %rax      # 0x17248
movl (%rax), %eax
subl $-0x3, %eax
jne 0xb1ad
jmp 0xb154
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0xb17e
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x2180
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0xb1ab
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x2180
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq $0x0, 0x8(%rax)
jmp 0xb1ad
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)