#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() {
  int year, rateInt;
  double amount, principal = 1000.0, rate = 0.05;
  for (rateInt = 5; rateInt <= 10; rateInt++) {
    rate = (float)rateInt / 100;
    printf("\n--- Interest at %d percent ---\n", rateInt);
    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,-0x20(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x5,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1219 <main+0xf9>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  0xeb1(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0xeb3(%rip),%rsi
lea    0xeb1(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     1206 <main+0xe6>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe4c(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a8 <main+0x88>
jmp    120b <main+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x5,%ebx
lea    0xee1(%rip),%r14
lea    0xefb(%rip),%r15
lea    0xefd(%rip),%r12
lea    0xefb(%rip),%r13
lea    0xf06(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
divss  0xe91(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe67(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1040 <pow@plt>
movsd  0xe58(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe2e(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
mulsd  0xe08(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
mulsd  0xde2(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x5,%edi
call   1040 <pow@plt>
mulsd  0xdbc(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x6,%edi
call   1040 <pow@plt>
mulsd  0xd96(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x7,%edi
call   1040 <pow@plt>
mulsd  0xd70(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x8,%edi
call   1040 <pow@plt>
mulsd  0xd4a(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0x9,%edi
call   1040 <pow@plt>
mulsd  0xd24(%rip),%xmm0
mov    %rbp,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
mov    $0xa,%edi
call   1040 <pow@plt>
mulsd  0xcfe(%rip),%xmm0
mov    %rbp,%rdi
mov    $0xa,%esi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0xb,%ebx
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0A--- Interest at %d percent ---\0A\00"
@.str.1 = [9 x i8] c"%4s%21s\0A\00"
@.str.2 = [5 x i8] c"Year\00"
@.str.3 = [18 x i8] c"Amount on deposit\00"
@.str.4 = [11 x i8] c"%4d%21.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store double 1.000000e+03, double* %5
store double 5.000000e-02, double* %6
store i32 5, i32* %3
br label %7
7: ; preds = %35, %0
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %38
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = fdiv float %12, 1.000000e+02
%14 = fpext float %13 to double
store double %14, double* %6
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %18
18: ; preds = %31, %10
%19 = load i32, i32* %2
%20 = icmp sle i32 %19, 10
br i1 %20, label %21, label %34
21: ; preds = %18
%22 = load double, double* %5
%23 = load double, double* %6
%24 = fadd double 1.000000e+00, %23
%25 = load i32, i32* %2
%26 = call double @pow(double %24, i32 %25)
%27 = fmul double %22, %26
store double %27, double* %4
%28 = load i32, i32* %2
%29 = load double, double* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %28, double %29)
br label %31
31: ; preds = %21
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %18
34: ; preds = %18
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %7
38: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A--- Interest at %d percent ---\0A\00"
@.str.1 = [9 x i8] c"%4s%21s\0A\00"
@.str.2 = [5 x i8] c"Year\00"
@.str.3 = [18 x i8] c"Amount on deposit\00"
@.str.4 = [11 x i8] c"%4d%21.2f\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 5, %0 ], [ %39, %1 ]
%3 = sitofp i32 %2 to float
%4 = fdiv float %3, 1.000000e+02
%5 = fpext float %4 to double
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%8 = fadd double %5, 1.000000e+00
%9 = tail call double @pow(double %8, i32 1)
%10 = fmul double %9, 1.000000e+03
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 1, double %10)
%12 = tail call double @pow(double %8, i32 2)
%13 = fmul double %12, 1.000000e+03
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 2, double %13)
%15 = tail call double @pow(double %8, i32 3)
%16 = fmul double %15, 1.000000e+03
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 3, double %16)
%18 = tail call double @pow(double %8, i32 4)
%19 = fmul double %18, 1.000000e+03
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 4, double %19)
%21 = tail call double @pow(double %8, i32 5)
%22 = fmul double %21, 1.000000e+03
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 5, double %22)
%24 = tail call double @pow(double %8, i32 6)
%25 = fmul double %24, 1.000000e+03
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 6, double %25)
%27 = tail call double @pow(double %8, i32 7)
%28 = fmul double %27, 1.000000e+03
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 7, double %28)
%30 = tail call double @pow(double %8, i32 8)
%31 = fmul double %30, 1.000000e+03
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 8, double %31)
%33 = tail call double @pow(double %8, i32 9)
%34 = fmul double %33, 1.000000e+03
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 9, double %34)
%36 = tail call double @pow(double %8, i32 10)
%37 = fmul double %36, 1.000000e+03
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 10, double %37)
%39 = add nuw nsw i32 %2, 1
%40 = icmp eq i32 %39, 11
br i1 %40, label %41, label %1
41: ; preds = %1
ret i32 0
}