#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*/ printf(char *, ...);
int strlen(char *);
void MSG_BoxedText(char *string) {
  int i, l;
  l = strlen(string);
  for (i = 0; i <= l + 3; i++) {
    printf("*");
  }
  printf("\n* %s *\n", string);
  for (i = 0; i <= l + 3; i++) {
    printf("*");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<MSG_BoxedText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jg     116c <MSG_BoxedText+0x4c>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <MSG_BoxedText+0x1f>
mov    -0x8(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jg     11b2 <MSG_BoxedText+0x92>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1185 <MSG_BoxedText+0x65>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSG_BoxedText>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
cmp    $0xfffffffc,%eax
jg     1157 <MSG_BoxedText+0x27>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11bf <MSG_BoxedText+0x8f>
mov    %eax,%ebx
lea    0x3(%rbx),%r15d
xor    %ebp,%ebp
test   %r15d,%r15d
cmovg  %r15d,%ebp
add    $0x1,%ebp
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <MSG_BoxedText+0x40>
lea    0xe7a(%rip),%rdi
xor    %ebp,%ebp
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xfffffffd,%ebx
jl     11bf <MSG_BoxedText+0x8f>
test   %r15d,%r15d
cmovg  %r15d,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <MSG_BoxedText+0x80>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [9 x i8] c"\0A* %s *\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @MSG_BoxedText(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
store i32 0, i32* %3
br label %7
7: ; preds = %14, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 3
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
%18 = load i8*, i8** %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %18)
store i32 0, i32* %3
br label %20
20: ; preds = %27, %17
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 3
%24 = icmp sle i32 %21, %23
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %20
30: ; preds = %20
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"\0A* %s *\0A\00"
define void @MSG_BoxedText(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add i32 %2, 3
%4 = icmp slt i32 %2, -3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %23
7: ; preds = %1
%8 = call i32 @llvm.smax.i32(i32 %3, i32 0)
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ %12, %9 ], [ 0, %7 ]
%11 = tail call i32 @putchar(i32 42)
%12 = add nuw i32 %10, 1
%13 = icmp eq i32 %10, %8
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br i1 %4, label %23, label %16
16: ; preds = %14
%17 = call i32 @llvm.smax.i32(i32 %3, i32 0)
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ %21, %18 ], [ 0, %16 ]
%20 = tail call i32 @putchar(i32 42)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %19, %17
br i1 %22, label %23, label %18
23: ; preds = %18, %5, %14
%24 = tail call i32 @putchar(i32 10)
ret void
}