#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 *make_message(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char *myMessage = NULL;
  char *name;
  if (argc > 1)
    name = argv[1];
  else
    name = "Geoffrey Scheller";
  char *formatStr = "Hello there %s, %s and %s,\nhow are you all today?\n";
  myMessage = make_message(formatStr, "Joe Blow", "Jane Doe", name);
  if (myMessage != NULL)
    printf("%s", myMessage);
  else {
    printf("Something went wrong.\n");
    return 1;
  }
  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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1159 <main+0x39>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1164 <main+0x44>
lea    0xea0(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rcx
lea    0xec7(%rip),%rsi
lea    0xec9(%rip),%rdx
call   1040 <make_message@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11b0 <main+0x90>
mov    -0x18(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <main+0xb1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     113c <main+0xc>
mov    0x8(%rsi),%rcx
jmp    1143 <main+0x13>
lea    0xebd(%rip),%rcx
lea    0xec8(%rip),%rdi
lea    0xef4(%rip),%rsi
lea    0xef6(%rip),%rdx
call   1050 <make_message@plt>
test   %rax,%rax
je     1177 <main+0x47>
lea    0xeee(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1188 <main+0x58>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Geoffrey Scheller\00"
@.str.1 = [51 x i8] c"Hello there %s, %s and %s,\0Ahow are you all today?\0A\00"
@.str.2 = [9 x i8] c"Joe Blow\00"
@.str.3 = [9 x i8] c"Jane Doe\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [23 x i8] c"Something went wrong.\0A\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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %7
br label %16
15: ; preds = %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %7
br label %16
16: ; preds = %15, %11
store i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8** %8
%17 = load i8*, i8** %8
%18 = load i8*, i8** %7
%19 = call i8* @make_message(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %18)
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i8*, i8** %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %23)
br label %27
25: ; preds = %16
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %28
27: ; preds = %22
store i32 0, i32* %3
br label %28
28: ; preds = %27, %25
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [18 x i8] c"Geoffrey Scheller\00"
@.str.1 = [51 x i8] c"Hello there %s, %s and %s,\0Ahow are you all today?\0A\00"
@.str.2 = [9 x i8] c"Joe Blow\00"
@.str.3 = [9 x i8] c"Jane Doe\00"
@.str.4 = [3 x i8] c"%s\00"
@str = [22 x i8] c"Something went wrong.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = tail call i8* @make_message(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %15
13: ; preds = %7
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %11, %13
%16 = phi i32 [ 0, %11 ], [ 1, %13 ]
ret i32 %16
}