// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: partition
static
int partition(STRING* self, char* const str, STRING*** 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 = (STRING**)
                malloc(sizeof(STRING*) * 2)) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        return (status = EMEMORYALLOC);
    }

    if ((*(*dest) = new_string(NULL)) == NULL ||
            (*(*dest + 1) = new_string(NULL)) == NULL) {
        status = EMEMORYALLOC; goto ERR;
    }

    if ((*(*dest))->reserve(*dest, self->capacity(self)) < 0) {
        status = EMEMORYALLOC; goto ERR;
    } else {
        memcpy((*(*dest))->c_str(*(*dest)),
                self->c_str(self), idx);
        *((*(*dest))->c_str(*(*dest)) + idx) = '\0';
        (*(*dest))->reconf(*dest, 0);
    }

    if ((*(*dest + 1))->reserve(*dest + 1, self->capacity(self)) < 0) {
        status = EMEMORYALLOC; goto ERR;
    } else {
        memcpy((*(*dest + 1))->c_str(*(*dest + 1)),
                self->c_str(self) + idx + len,
                self->size(self) - idx - len);
        *((*(*dest + 1))->c_str(*(*dest + 1)) +
                self->size(self) - idx - len) = '\0';
        (*(*dest + 1))->reconf(*dest + 1, 0);
    }

    return 0;

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

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %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 0xab06
leaq 0xc754(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xaebd
cmpq $0x0, -0x18(%rbp)
jne 0xab26
leaq 0xc734(%rip), %rax      # 0x17248
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xaebd
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 0xab6a
leaq 0xc6f0(%rip), %rax      # 0x17248
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xaebd
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 0xaba5
leaq 0xc6b5(%rip), %rax      # 0x17248
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xaebd
movl $0x10, %edi
callq 0x20e0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0xabd5
leaq 0xc685(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xaebd
xorl %eax, %eax
movl %eax, %edi
callq 0x8fd0
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
je 0xac08
xorl %eax, %eax
movl %eax, %edi
callq 0x8fd0
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0xac1a
leaq 0xc639(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xae1f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movq -0x40(%rbp), %rax
callq *%rax
cmpl $0x0, %eax
jge 0xac69
leaq 0xc5ea(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xae1f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x50(%rbp), %rdi
movq %rax, %rsi
movq -0x28(%rbp), %rdx
callq 0x2410
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x28(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x38(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x60(%rbp), %rdi
movq %rax, %rsi
movq -0x58(%rbp), %rax
callq *%rax
cmpl $0x0, %eax
jge 0xad3f
leaq 0xc514(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xae1f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0xc8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
movq %rax, -0x78(%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, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x78(%rbp), %rdi
movq -0x70(%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 0xc8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, %rcx
movq -0x68(%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)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x38(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdi
addq $0x8, %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl $0x0, -0x4(%rbp)
jmp 0xaebd
leaq 0xc422(%rip), %rax      # 0x17248
movl (%rax), %eax
subl $-0x3, %eax
jne 0xaeb1
jmp 0xae33
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0xae5d
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x268(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0xae89
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x268(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdi
callq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
leaq 0xc390(%rip), %rax      # 0x17248
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)