// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: mbcenter
static
int mbcenter(STRING** self, size_t s, char c)
{
    size_t  ps  = 0,
            s2  = 0;

    if ((*self)->empty(*self)) {
        status = ESTRISEMPTY; goto ERR;
    }
    if (count_mb_witdh(*self, &s2) < 0)
        return (status = EINVALIDCHAR);
    if (s <= s2)
        return 0;

    ps = s2;
    s2 = (s - s2) >> 1;
    if (c == '\0')
        c = ' ';
    if (reallocate_memory(self, s + (s - s2) + 1) < 0) {
        status = EMEMORYALLOC; goto ERR;
    } else {
        memmove((*self)->c_str(*self) + s2,
                (*self)->c_str(*self),
                (*self)->size(*self));
        memset((*self)->c_str(*self), c, s2);
        memset((*self)->c_str(*self) + (*self)->size(*self) + s2,
                c,
                s2 + (s - ps) % 2);
        (*self)->length = strlen((*self)->c_str(*self));
        *((*self)->c_str(*self) + (*self)->size(*self)) = '\0';
    }

    return 0;

ERR:
    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%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 0xcfe3
leaq 0xa270(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
jmp 0xd1cf
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0xf380
cmpl $0x0, %eax
jge 0xd011
leaq 0xa249(%rip), %rax      # 0x17248
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd1db
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
ja 0xd027
movl $0x0, -0x4(%rbp)
jmp 0xd1db
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
subq -0x30(%rbp), %rax
shrq %rax
movq %rax, -0x30(%rbp)
movsbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0xd04b
movb $0x20, -0x19(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
subq -0x30(%rbp), %rax
addq %rax, %rsi
addq $0x1, %rsi
callq 0xf100
cmpl $0x0, %eax
jge 0xd07e
leaq 0xa1d5(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xd1cf
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
addq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
callq 0x2310
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, %rdi
movsbl -0x19(%rbp), %eax
movq -0x30(%rbp), %rdx
movzbl %al, %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, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq -0x40(%rbp), %rdi
addq %rax, %rdi
addq -0x30(%rbp), %rdi
movsbl -0x19(%rbp), %eax
movq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
subq -0x28(%rbp), %rcx
andq $0x1, %rcx
addq %rcx, %rdx
movzbl %al, %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, %rdi
callq 0x2190
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movq %rax, %rcx
movq -0x38(%rbp), %rax
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
jmp 0xd1db
leaq 0xa072(%rip), %rax      # 0x17248
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)