#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 halfLife(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  printf("Year      Atoms left\n");
  printf("-----     -----------\n");
  for (int i = 0; i < 13 + 1; i++) {
    printf("%4d       %8d\n", i, halfLife(i, 10000));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xe,-0x14(%rbp)
jge    1197 <main+0x77>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x2710,%esi
call   1040 <halfLife@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x6,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x9,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xb,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xc,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xd,%edi
mov    $0x2710,%esi
call   1050 <halfLife@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Year Atoms left\0A\00"
@.str.1 = [23 x i8] c"----- -----------\0A\00"
@.str.2 = [15 x i8] c"%4d %8d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %9
9: ; preds = %17, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 14
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %6
%14 = load i32, i32* %6
%15 = call i32 @halfLife(i32 %14, i32 10000)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %9
20: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [15 x i8] c"%4d %8d\0A\00"
@str = [21 x i8] c"Year Atoms left\00"
@str.3 = [22 x i8] c"----- -----------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @halfLife(i32 0, i32 10000)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %5)
%7 = tail call i32 @halfLife(i32 1, i32 10000)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %7)
%9 = tail call i32 @halfLife(i32 2, i32 10000)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %9)
%11 = tail call i32 @halfLife(i32 3, i32 10000)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %11)
%13 = tail call i32 @halfLife(i32 4, i32 10000)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %13)
%15 = tail call i32 @halfLife(i32 5, i32 10000)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %15)
%17 = tail call i32 @halfLife(i32 6, i32 10000)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %17)
%19 = tail call i32 @halfLife(i32 7, i32 10000)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %19)
%21 = tail call i32 @halfLife(i32 8, i32 10000)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 %21)
%23 = tail call i32 @halfLife(i32 9, i32 10000)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 9, i32 %23)
%25 = tail call i32 @halfLife(i32 10, i32 10000)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 %25)
%27 = tail call i32 @halfLife(i32 11, i32 10000)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 11, i32 %27)
%29 = tail call i32 @halfLife(i32 12, i32 10000)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 12, i32 %29)
%31 = tail call i32 @halfLife(i32 13, i32 10000)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 13, i32 %31)
ret i32 0
}