#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 */
double pow(double, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double amount;
  double principal = 1000.0;
  double rate = .05;
  int year;
  printf("%4s%21s\n", "Year", "Amount on deposit");
  for (year = 1; year <= 10; year++) {
    amount = principal * pow(1.0 + rate, year);
    printf("%4d%21.2f\n", year, amount);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
lea    0xec8(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jg     11ca <main+0xaa>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe88(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x24(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116c <main+0x4c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xeea(%rip),%rsi
lea    0xee8(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0xebb(%rip),%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
mulsd  0xeb1(%rip),%xmm0
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe8b(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe81(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe62(%rip),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
mulsd  0xe58(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe39(%rip),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
mulsd  0xe2f(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe10(%rip),%xmm0
mov    $0x5,%edi
call   1040 <pow@plt>
mulsd  0xe06(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xde7(%rip),%xmm0
mov    $0x6,%edi
call   1040 <pow@plt>
mulsd  0xddd(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdbe(%rip),%xmm0
mov    $0x7,%edi
call   1040 <pow@plt>
mulsd  0xdb4(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xd95(%rip),%xmm0
mov    $0x8,%edi
call   1040 <pow@plt>
mulsd  0xd8b(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xd6c(%rip),%xmm0
mov    $0x9,%edi
call   1040 <pow@plt>
mulsd  0xd62(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xd43(%rip),%xmm0
mov    $0xa,%edi
call   1040 <pow@plt>
mulsd  0xd39(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%4s%21s\0A\00"
@.str.1 = [5 x i8] c"Year\00"
@.str.2 = [18 x i8] c"Amount on deposit\00"
@.str.3 = [11 x i8] c"%4d%21.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store double 1.000000e+03, double* %3
store double 5.000000e-02, double* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fadd double 1.000000e+00, %12
%14 = load i32, i32* %5
%15 = call double @pow(double %13, i32 %14)
%16 = fmul double %11, %15
store double %16, double* %2
%17 = load i32, i32* %5
%18 = load double, double* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %17, double %18)
br label %20
20: ; preds = %10
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
23: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%4s%21s\0A\00"
@.str.1 = [5 x i8] c"Year\00"
@.str.2 = [18 x i8] c"Amount on deposit\00"
@.str.3 = [11 x i8] c"%4d%21.2f\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call double @pow(double 1.050000e+00, i32 1)
%3 = fmul double %2, 1.000000e+03
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 1, double %3)
%5 = tail call double @pow(double 1.050000e+00, i32 2)
%6 = fmul double %5, 1.000000e+03
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 2, double %6)
%8 = tail call double @pow(double 1.050000e+00, i32 3)
%9 = fmul double %8, 1.000000e+03
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 3, double %9)
%11 = tail call double @pow(double 1.050000e+00, i32 4)
%12 = fmul double %11, 1.000000e+03
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 4, double %12)
%14 = tail call double @pow(double 1.050000e+00, i32 5)
%15 = fmul double %14, 1.000000e+03
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 5, double %15)
%17 = tail call double @pow(double 1.050000e+00, i32 6)
%18 = fmul double %17, 1.000000e+03
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 6, double %18)
%20 = tail call double @pow(double 1.050000e+00, i32 7)
%21 = fmul double %20, 1.000000e+03
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 7, double %21)
%23 = tail call double @pow(double 1.050000e+00, i32 8)
%24 = fmul double %23, 1.000000e+03
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 8, double %24)
%26 = tail call double @pow(double 1.050000e+00, i32 9)
%27 = fmul double %26, 1.000000e+03
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 9, double %27)
%29 = tail call double @pow(double 1.050000e+00, i32 10)
%30 = fmul double %29, 1.000000e+03
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 10, double %30)
ret i32 0
}