#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*/ value;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int rate, higher_rate, num_years;
  double value[5];
  printf("Enter interest rate: ");
  scanf("%d", &rate);
  printf("Enter number of years: ");
  scanf("%d", &num_years);
  printf("\nYears");
  higher_rate = rate;
  for (int i = 0; i < ((int)(sizeof(value) / sizeof(value[0]))); i += 1) {
    printf("%6d%%", higher_rate);
    higher_rate += 1;
    value[i] = 100.00;
  }
  printf("\n");
  for (int year = 1; year <= num_years; year += 1) {
    printf("%3d\t", year);
    for (int i = 0; i < ((int)(sizeof(value) / sizeof(value[0]))); i += 1) {
      for (int j = 0; j < 12; j += 1) {
        value[i] += (rate + i) / 100.0 / 12.0 * value[i];
      }
      printf("%7.2f", value[i]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
jge    11ca <main+0xaa>
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0x44(%rbp),%rax
movsd  0xe52(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1186 <main+0x66>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     12b2 <main+0x192>
mov    -0x48(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x5,-0x4c(%rbp)
jge    1296 <main+0x176>
movl   $0x0,-0x50(%rbp)
cmpl   $0xc,-0x50(%rbp)
jge    1270 <main+0x150>
mov    -0x8(%rbp),%eax
add    -0x4c(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xdd8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdc4(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x4c(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm2
movslq -0x4c(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1214 <main+0xf4>
movslq -0x4c(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm0
lea    0xdd4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1203 <main+0xe3>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11df <main+0xbf>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ebx
lea    0xec7(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2(%rbx),%esi
movaps 0xe4c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x3(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%ebx
movapd 0xe25(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movabs $0x4059000000000000,%rax
mov    %rax,0x30(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x8(%rsp)
jle    1329 <main+0x1f9>
mov    $0x1,%r15d
lea    0xe40(%rip),%r14
lea    0xe3e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
nop
mov    0xc(%rsp),%eax
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xdbb(%rip),%xmm0
divsd  0xdbb(%rip),%xmm0
movsd  0x10(%rsp,%rbx,8),%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp,%rbx,8)
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x5,%rbx
jne    1240 <main+0x110>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    0x8(%rsp),%r15d
mov    %eax,%r15d
jl     1230 <main+0x100>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter interest rate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter number of years: \00"
@.str.3 = [7 x i8] c"\0AYears\00"
@.str.4 = [6 x i8] c"%6d%%\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [5 x i8] c"%3d\09\00"
@.str.7 = [6 x i8] c"%7.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x double]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* %2
store i32 %15, i32* %3
store i32 0, i32* %6
br label %16
16: ; preds = %27, %0
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 %25
store double 1.000000e+02, double* %26
br label %27
27: ; preds = %19
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %16
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %7
br label %32
32: ; preds = %76, %30
%33 = load i32, i32* %7
%34 = load i32, i32* %4
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %79
36: ; preds = %32
%37 = load i32, i32* %7
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %37)
store i32 0, i32* %8
br label %39
39: ; preds = %71, %36
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 5
br i1 %41, label %42, label %74
42: ; preds = %39
store i32 0, i32* %9
br label %43
43: ; preds = %62, %42
%44 = load i32, i32* %9
%45 = icmp slt i32 %44, 12
br i1 %45, label %46, label %65
46: ; preds = %43
%47 = load i32, i32* %2
%48 = load i32, i32* %8
%49 = add nsw i32 %47, %48
%50 = sitofp i32 %49 to double
%51 = fdiv double %50, 1.000000e+02
%52 = fdiv double %51, 1.200000e+01
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 %54
%56 = load double, double* %55
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 %58
%60 = load double, double* %59
%61 = call double @llvm.fmuladd.f64(double %52, double %56, double %60)
store double %61, double* %59
br label %62
62: ; preds = %46
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %43
65: ; preds = %43
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 %67
%69 = load double, double* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double %69)
br label %71
71: ; preds = %65
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %39
74: ; preds = %39
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
br label %32
79: ; preds = %32
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter interest rate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter number of years: \00"
@.str.3 = [7 x i8] c"\0AYears\00"
@.str.4 = [6 x i8] c"%6d%%\00"
@.str.6 = [5 x i8] c"%3d\09\00"
@.str.7 = [6 x i8] c"%7.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x double]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [5 x double]* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = add nsw i32 %12, 1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = add nsw i32 %12, 2
%17 = bitcast [5 x double]* %3 to <2 x double>*
store <2 x double> <double 1.000000e+02, double 1.000000e+02>, <2 x double>* %17
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%19 = add nsw i32 %12, 3
%20 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 2
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%22 = add nsw i32 %12, 4
%23 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 1.000000e+02, double 1.000000e+02>, <2 x double>* %23
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%25 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 4
store double 1.000000e+02, double* %25
%26 = call i32 @putchar(i32 10)
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 1
br i1 %28, label %29, label %30
29: ; preds = %58, %0
ret i32 0
30: ; preds = %0, %58
%31 = phi i32 [ %60, %58 ], [ 1, %0 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %33
%34 = phi i64 [ 0, %30 ], [ %56, %33 ]
%35 = load i32, i32* %1
%36 = trunc i64 %34 to i32
%37 = add nsw i32 %35, %36
%38 = sitofp i32 %37 to double
%39 = fdiv double %38, 1.000000e+02
%40 = fdiv double %39, 1.200000e+01
%41 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %34
%42 = load double, double* %41
%43 = call double @llvm.fmuladd.f64(double %40, double %42, double %42)
%44 = call double @llvm.fmuladd.f64(double %40, double %43, double %43)
%45 = call double @llvm.fmuladd.f64(double %40, double %44, double %44)
%46 = call double @llvm.fmuladd.f64(double %40, double %45, double %45)
%47 = call double @llvm.fmuladd.f64(double %40, double %46, double %46)
%48 = call double @llvm.fmuladd.f64(double %40, double %47, double %47)
%49 = call double @llvm.fmuladd.f64(double %40, double %48, double %48)
%50 = call double @llvm.fmuladd.f64(double %40, double %49, double %49)
%51 = call double @llvm.fmuladd.f64(double %40, double %50, double %50)
%52 = call double @llvm.fmuladd.f64(double %40, double %51, double %51)
%53 = call double @llvm.fmuladd.f64(double %40, double %52, double %52)
%54 = call double @llvm.fmuladd.f64(double %40, double %53, double %53)
store double %54, double* %41
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double %54)
%56 = add nuw nsw i64 %34, 1
%57 = icmp eq i64 %56, 5
br i1 %57, label %58, label %33
58: ; preds = %33
%59 = call i32 @putchar(i32 10)
%60 = add nuw nsw i32 %31, 1
%61 = load i32, i32* %2
%62 = icmp slt i32 %31, %61
br i1 %62, label %30, label %29
}