#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ r_cons_printf(char *, char *, char *, char const *, char *,
                                 char *);
int /*<<< orphan*/ r_str_pad(char, int);
char *strdup(int /*<<< orphan*/);
int strlen(char const *);
void clippy(const char *msg) {
  int msglen = strlen(msg);
  char *l = strdup(r_str_pad('-', msglen));
  char *s = strdup(r_str_pad(' ', msglen));
  r_cons_printf(" .--.     .-%s-.\n"
                " | _|     | %s |\n"
                " | O O   <  %s |\n"
                " |  |  |  | %s |\n"
                " || | /   `-%s-'\n"
                " |`-'|\n"
                " `---'\n",
                l, s, msg, s, l);
  free(l);
  free(s);
}


x86 assembly (clang, -O0):
<clippy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x2d,%edi
call   1060 <r_str_pad@plt>
mov    %eax,%edi
call   1070 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x20,%edi
call   1060 <r_str_pad@plt>
mov    %eax,%edi
call   1070 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe4d(%rip),%rdi
call   1040 <r_cons_printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clippy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    $0x2d,%edi
mov    %eax,%esi
call   1060 <r_str_pad@plt>
mov    %eax,%edi
call   1070 <strdup@plt>
mov    %rax,%rbx
mov    $0x20,%edi
mov    %ebp,%esi
call   1060 <r_str_pad@plt>
mov    %eax,%edi
call   1070 <strdup@plt>
mov    %rax,%rbp
lea    0xe6f(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
mov    %r14,%rcx
mov    %rax,%r8
mov    %rbx,%r9
call   1040 <r_cons_printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [100 x i8] c" .--. .-%s-.\0A | _| | %s |\0A | O O < %s |\0A | | | | %s |\0A || | / `-%s-'\0A |`-'|\0A `---'\0A\00"
define void @clippy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @r_str_pad(i8 signext 45, i32 %8)
%10 = call i8* @strdup(i32 %9)
store i8* %10, i8** %4
%11 = load i32, i32* %3
%12 = call i32 @r_str_pad(i8 signext 32, i32 %11)
%13 = call i8* @strdup(i32 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = load i8*, i8** %2
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @r_cons_printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i8* %16, i8* %17, i8* %18)
%20 = load i8*, i8** %4
%21 = call i32 @free(i8* %20)
%22 = load i8*, i8** %5
%23 = call i32 @free(i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [100 x i8] c" .--. .-%s-.\0A | _| | %s |\0A | O O < %s |\0A | | | | %s |\0A || | / `-%s-'\0A |`-'|\0A `---'\0A\00"
define void @clippy(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @r_str_pad(i8 signext 45, i32 %2)
%4 = tail call i8* @strdup(i32 %3)
%5 = tail call i32 @r_str_pad(i8 signext 32, i32 %2)
%6 = tail call i8* @strdup(i32 %5)
%7 = tail call i32 @r_cons_printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i8* %0, i8* %6, i8* %4)
%8 = tail call i32 @free(i8* %4)
%9 = tail call i32 @free(i8* %6)
ret void
}