#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(int argc, char *argv[]) {
  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)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x1e,%esi
mov    $0x2e,%edx
call   1040 <center@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0x1f,%esi
mov    $0x2d,%edx
call   1040 <center@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x20,%esi
mov    $0x2a,%edx
call   1040 <center@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x21,%esi
mov    $0x5e,%edx
call   1040 <center@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe30(%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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i8* @center(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 30, i8 signext 46)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = 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* %13, i8** %7
%14 = load i8*, i8** %7
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = 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* %16, i8** %8
%17 = load i8*, i8** %8
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = 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* %19, i8** %9
%20 = load i8*, i8** %9
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
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(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @center(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 30, i8 signext 46)
%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 ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 31, i8 signext 45)
%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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 32, i8 signext 42)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i8* @center(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 33, i8 signext 94)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret i32 0
}