#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 */
char *center(char *, int, char);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *s = center("Software", 30, '.');
  printf("%s\n", s);
  char *s2 = center("Systems", 31, '-');
  printf("%s\n", s2);
  char *s3 = center("Spring 2014", 32, '*');
  printf("%s\n", s3);
  char *s4 = center("Exam 1", 33, '^');
  printf("%s\n", s4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x1e,%esi
mov    $0x2e,%edx
call   1040 <center@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x1f,%esi
mov    $0x2d,%edx
call   1040 <center@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x20,%esi
mov    $0x2a,%edx
call   1040 <center@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x21,%esi
mov    $0x5e,%edx
call   1040 <center@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x1e,%esi
mov    $0x2e,%edx
call   1040 <center@plt>
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x1f,%esi
mov    $0x2d,%edx
call   1040 <center@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x20,%esi
mov    $0x2a,%edx
call   1040 <center@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x21,%esi
mov    $0x5e,%edx
call   1040 <center@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Software\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [8 x i8] c"Systems\00"
@.str.3 = [12 x i8] c"Spring 2014\00"
@.str.4 = [7 x i8] c"Exam 1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i8* @center(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 30, i8 signext 46)
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i8* @center(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 31, i8 signext 45)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i8* @center(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 32, i8 signext 42)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i8* @center(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 33, i8 signext 94)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Software\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [8 x i8] c"Systems\00"
@.str.3 = [12 x i8] c"Spring 2014\00"
@.str.4 = [7 x i8] c"Exam 1\00"
define i32 @main() {
%1 = tail call i8* @center(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 30, i8 signext 46)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%3 = tail call i8* @center(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 31, i8 signext 45)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i8* @center(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 32, i8 signext 42)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = tail call i8* @center(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 33, i8 signext 94)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}