#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 */
typedef int /*<<< orphan*/ message;

/* Variables and functions */
float get_pi();
int /*<<< orphan*/ populate_message(char *, int);
int /*<<< orphan*/ printf(char *, ...);
char *some_complex_operation(int);
int /*<<< orphan*/ something();
char *strlen(char *);
int /*<<< orphan*/ the_for();
int /*<<< orphan*/ the_while();
int main() {
  printf("Hello World!\n");
  something();
  float my_pi = get_pi();
  printf("OK here's pi: %f\n", my_pi);
  the_while();
  the_for();
  printf("This constant should be a zero: %d\n", 0);
  for (int j = 0; j < 3; j = j + 1) {
    printf("Counting up to a symbolic constant: %d\n", j);
  }
  char *my_message;
  my_message = some_complex_operation(5);
  printf("The message: %s\n", my_message);
  my_message = some_complex_operation(-1);
  printf("The message: %s\n", my_message);
  my_message = some_complex_operation(101);
  printf("The message: %s\n", my_message);
  char message[15];
  printf("Initial message: %s\n", message);
  printf("Initial message length: %ld\n", strlen(message));
  populate_message(message, sizeof(message));
  printf("Updated message: %s\n", message);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   1060 <something@plt>
mov    $0x0,%al
call   1090 <get_pi@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10a0 <the_while@plt>
mov    $0x0,%al
call   1040 <the_for@plt>
lea    0xe44(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1215 <main+0x95>
mov    -0xc(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ec <main+0x6c>
mov    $0x5,%edi
call   1050 <some_complex_operation@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <some_complex_operation@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x65,%edi
call   1050 <some_complex_operation@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x27(%rbp),%rsi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x27(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x27(%rbp),%rdi
mov    $0xf,%esi
call   1030 <populate_message@plt>
lea    -0x27(%rbp),%rsi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf1a(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1070 <something@plt>
xor    %eax,%eax
call   10a0 <get_pi@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
xor    %eax,%eax
call   10b0 <the_while@plt>
xor    %eax,%eax
call   1040 <the_for@plt>
lea    0xe3c(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xe50(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x5,%edi
call   1060 <some_complex_operation@plt>
lea    0xe3d(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <some_complex_operation@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x65,%edi
call   1060 <some_complex_operation@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xe0c(%rip),%rdi
lea    0x1(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1080 <strlen@plt>
lea    0xe03(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <populate_message@plt>
lea    0xe02(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
@.str.1 = [18 x i8] c"OK here's pi: %f\0A\00"
@.str.2 = [36 x i8] c"This constant should be a zero: %d\0A\00"
@.str.3 = [40 x i8] c"Counting up to a symbolic constant: %d\0A\00"
@.str.4 = [17 x i8] c"The message: %s\0A\00"
@.str.5 = [21 x i8] c"Initial message: %s\0A\00"
@.str.6 = [29 x i8] c"Initial message length: %ld\0A\00"
@.str.7 = [21 x i8] c"Updated message: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [15 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @something()
%8 = call float (...) @get_pi()
store float %8, float* %2
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = call i32 (...) @the_while()
%13 = call i32 (...) @the_for()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 0)
store i32 0, i32* %3
br label %15
15: ; preds = %21, %0
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %15
24: ; preds = %15
%25 = call i8* @some_complex_operation(i32 5)
store i8* %25, i8** %4
%26 = load i8*, i8** %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = call i8* @some_complex_operation(i32 -1)
store i8* %28, i8** %4
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = call i8* @some_complex_operation(i32 101)
store i8* %31, i8** %4
%32 = load i8*, i8** %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%37 = call i8* @strlen(i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%40 = call i32 @populate_message(i8* %39, i32 15)
%41 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %41)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"OK here's pi: %f\0A\00"
@.str.2 = [36 x i8] c"This constant should be a zero: %d\0A\00"
@.str.3 = [40 x i8] c"Counting up to a symbolic constant: %d\0A\00"
@.str.4 = [17 x i8] c"The message: %s\0A\00"
@.str.5 = [21 x i8] c"Initial message: %s\0A\00"
@.str.6 = [29 x i8] c"Initial message length: %ld\0A\00"
@.str.7 = [21 x i8] c"Updated message: %s\0A\00"
@str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @something()
%4 = tail call float (...) @get_pi()
%5 = fpext float %4 to double
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = tail call i32 (...) @the_while()
%8 = tail call i32 (...) @the_for()
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 1)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 2)
%13 = tail call i8* @some_complex_operation(i32 5)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = tail call i8* @some_complex_operation(i32 -1)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = tail call i8* @some_complex_operation(i32 101)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = call i8* @strlen(i8* %19)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %21)
%23 = call i32 @populate_message(i8* %19, i32 15)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %19)
ret i32 0
}