#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 /*<<< orphan*/ putchar(char);
int strlen(char const *);
int print_center(const char *output) {
  int len = strlen(output);
  int i;
  putchar('|');
  i = 0;
  while (i < (81 - 3 - len) / 2) {
    putchar(' ');
    i++;
  }
  printf("%s", output);
  i = 0;
  while (i < (81 - 3 - len) / 2) {
    putchar(' ');
    i++;
  }
  if ((81 - 2 - len) % 2 == 0)
    putchar(' ');
  printf("|\n");
  return 0;
}


x86 assembly (clang, -O0):
<print_center>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    $0x7c,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x4e,%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    1194 <print_center+0x64>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <print_center+0x29>
mov    -0x8(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x4e,%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11e8 <print_center+0xb8>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <print_center+0x7d>
mov    $0x4f,%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    120b <print_center+0xdb>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_center>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmp    $0x4d,%r14d
jge    11d1 <print_center+0x91>
mov    $0x4e,%eax
sub    %r14d,%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovge %ebp,%ebx
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1180 <print_center+0x40>
lea    0xe6a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x4c,%r14d
jg     11e2 <print_center+0xa2>
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovge %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11c0 <print_center+0x80>
jmp    11e2 <print_center+0xa2>
lea    0xe28(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
test   $0x1,%r14b
je     11f2 <print_center+0xb2>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe0a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"|\0A\00"
define i32 @print_center(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* %3
%7 = call i32 @putchar(i8 signext 124)
store i32 0, i32* %4
br label %8
8: ; preds = %14, %1
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 78, %10
%12 = sdiv i32 %11, 2
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = call i32 @putchar(i8 signext 32)
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %8
18: ; preds = %8
%19 = load i8*, i8** %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 0, i32* %4
br label %21
21: ; preds = %27, %18
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = sub nsw i32 78, %23
%25 = sdiv i32 %24, 2
%26 = icmp slt i32 %22, %25
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = call i32 @putchar(i8 signext 32)
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %21
31: ; preds = %21
%32 = load i32, i32* %3
%33 = sub nsw i32 79, %32
%34 = srem i32 %33, 2
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @putchar(i8 signext 32)
br label %38
38: ; preds = %36, %31
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [2 x i8] c"|\00"
define i32 @print_center(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @putchar(i8 signext 124)
%4 = sub nsw i32 78, %2
%5 = sdiv i32 %4, 2
%6 = icmp slt i32 %2, 77
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %25
9: ; preds = %1
%10 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %11
11: ; preds = %9, %11
%12 = phi i32 [ %14, %11 ], [ 0, %9 ]
%13 = tail call i32 @putchar(i8 signext 32)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %10
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br i1 %6, label %18, label %25
18: ; preds = %16
%19 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %20
20: ; preds = %18, %20
%21 = phi i32 [ %23, %20 ], [ 0, %18 ]
%22 = tail call i32 @putchar(i8 signext 32)
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %23, %19
br i1 %24, label %25, label %20
25: ; preds = %20, %7, %16
%26 = sub i32 1, %2
%27 = and i32 %26, 1
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = tail call i32 @putchar(i8 signext 32)
br label %31
31: ; preds = %29, %25
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}