// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: reverse
static
int reverse(STRING** self)
{
    int     ch      = 0;

    size_t  pos     = 0;

    char*   p       = NULL,
        *   dest    = NULL;

    if ((*self)->empty(*self)) {
        status = ESTRISEMPTY; goto ERR;
    }
    if ((dest = (char*)
                malloc(sizeof(char) * (*self)->capacity(*self))) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    } else {
        memset(dest, '\0', (*self)->capacity(*self));
    }
    p = (*self)->c_str(*self);
    pos = (*self)->size(*self);
    setlocale(LC_CTYPE, T_STRING_LOCALE_VALUE);
    while (*p != '\0' && pos) {
        if ((ch = mblen(p, MB_CUR_MAX)) < 0) {
#ifdef  LIBRARY_VERBOSE
            print_error();
/* LIBRARY_VERBOSE */
#endif
            status = EINVALIDCHAR; goto ERR;
        } else {
            pos -= ch;
            memcpy(dest + pos, p, ch);
            p += ch;
        }
    }
    free((*self)->string);
    (*self)->string = dest;

    return 0;

ERR:
    if (dest != NULL) {
        free(dest);
        dest = NULL;
    }

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xe4a9
leaq 0x8daa(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
jmp 0xe607
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, %rdi
shlq $0x0, %rdi
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xe4e5
leaq 0x8d6e(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xe607
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x38(%rbp), %rdi
movq %rax, %rdx
xorl %esi, %esi
callq 0x2050
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, -0x20(%rbp)
xorl %edi, %edi
leaq 0x3fd1(%rip), %rsi      # 0x1251c
callq 0x23d0
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0xe56c
cmpq $0x0, -0x20(%rbp)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0xe575
jmp 0xe5df
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x21b0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jge 0xe5a5
leaq 0x8cab(%rip), %rax      # 0x17248
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
jmp 0xe607
movslq -0x14(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
addq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0x2410
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xe550
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
callq 0x2180
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xe62b
cmpq $0x0, -0x30(%rbp)
je 0xe61f
movq -0x30(%rbp), %rdi
callq 0x2180
movq $0x0, -0x30(%rbp)
leaq 0x8c22(%rip), %rax      # 0x17248
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)