#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 main() {
  printf("Hello world!\n");
  int numDaysInYear = 365;
  printf("days per year: %d\n", numDaysInYear);
  if (numDaysInYear == 366) {
    printf("Seems reasonable\n");
  } else {
    int long someReallyLongNumber = 100000000000000L;
    printf("Some long number: %ld\n", someReallyLongNumber);
  }
  int i;
  for (i = 0; i < 5; i++) {
    printf("i=%d\n", i);
  }
  float pi = 3.14F;
  double doublePi = 314.159265E-2;
  long double lDoublePi = 3.14159265358979L;
  printf("float Pi = %7.5e\n", pi);
  printf("double Pi = %lf\n", doublePi);
  printf("(not actually?) long double Pi = %Lf\n", lDoublePi);
  int x = 5;
  int *intPtr;
  printf("Variable x is located at memory address %lu\n", (int long)&x);
  intPtr = &x;
  printf("The int at memory location %lu is %d\n", (int long)intPtr, *intPtr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x16d,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x16e,-0x8(%rbp)
jne    1165 <main+0x55>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1185 <main+0x75>
movabs $0x5af3107a4000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    11b5 <main+0xa5>
mov    -0x14(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118c <main+0x7c>
movl   $0x4048f5c3,-0x18(%rbp)
movabs $0x400921fb53c8d4f1,%rax
21 09 40
mov    %rax,-0x20(%rbp)
fldt   0xe30(%rip)
fstpt  -0x30(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
mov    %al,-0x41(%rbp)
call   1030 <printf@plt>
mov    -0x41(%rbp),%al
movsd  -0x20(%rbp),%xmm0
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x5,-0x34(%rbp)
lea    -0x34(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x34(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xfc0(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
mov    $0x16d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
movabs $0x5af3107a4000,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
movsd  0xe46(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
movsd  0xe38(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
fldt   0xe33(%rip)
fstpt  (%rsp)
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x5,0x1c(%rsp)
lea    0xe9c(%rip),%rdi
lea    0x1c(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [19 x i8] c"days per year: %d\0A\00"
@.str.2 = [18 x i8] c"Seems reasonable\0A\00"
@.str.3 = [23 x i8] c"Some long number: %ld\0A\00"
@.str.4 = [6 x i8] c"i=%d\0A\00"
@.str.5 = [18 x i8] c"float Pi = %7.5e\0A\00"
@.str.6 = [17 x i8] c"double Pi = %lf\0A\00"
@.str.7 = [38 x i8] c"(not actually?) long double Pi = %Lf\0A\00"
@.str.8 = [45 x i8] c"Variable x is located at memory address %lu\0A\00"
@.str.9 = [38 x i8] c"The int at memory location %lu is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
%5 = alloca float
%6 = alloca double
%7 = alloca x86_fp80
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 365, i32* %2
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 366
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %20
17: ; preds = %0
store i64 100000000000000, i64* %3
%18 = load i64, i64* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %18)
br label %20
20: ; preds = %17, %15
store i32 0, i32* %4
br label %21
21: ; preds = %27, %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 5
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %21
30: ; preds = %21
store float 0x40091EB860000000, float* %5
store double 0x400921FB53C8D4F1, double* %6
store x86_fp80 0xK4000C90FDAA2216887DE, x86_fp80* %7
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %32)
%34 = load double, double* %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double %34)
%36 = load x86_fp80, x86_fp80* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), x86_fp80 %36)
store i32 5, i32* %8
%38 = ptrtoint i32* %8 to i64
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i64 %38)
store i32* %8, i32** %9
%40 = load i32*, i32** %9
%41 = ptrtoint i32* %40 to i64
%42 = load i32*, i32** %9
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i64 %41, i32 %43)
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"days per year: %d\0A\00"
@.str.3 = [23 x i8] c"Some long number: %ld\0A\00"
@.str.4 = [6 x i8] c"i=%d\0A\00"
@.str.5 = [18 x i8] c"float Pi = %7.5e\0A\00"
@.str.6 = [17 x i8] c"double Pi = %lf\0A\00"
@.str.7 = [38 x i8] c"(not actually?) long double Pi = %Lf\0A\00"
@.str.8 = [45 x i8] c"Variable x is located at memory address %lu\0A\00"
@.str.9 = [38 x i8] c"The int at memory location %lu is %d\0A\00"
@str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = alloca i32
%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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 365)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 100000000000000)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 2)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 4)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double 0x40091EB860000000)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double 0x400921FB53C8D4F1)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), x86_fp80 0xK4000C90FDAA2216887DE)
%13 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%14 = ptrtoint i32* %1 to i64
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i64 %14)
%16 = load i32, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i64 %14, i32 %16)
ret i32 0
}