#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, int, double);
double rate_function(double *, double, int, int, double, double);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  double book;
  int life_years;
  int year;
  double declining_rate;
  double freeze_rate = 0.0;
  double rate;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s life_years\n", argv[0]);
    exit(1);
  }
  life_years = atoi(argv[1]);
  if (life_years <= 10)
    declining_rate = 2.0;
  else
    declining_rate = 1.5;
  for (book = 100.0, year = 1; year <= life_years + 1; year++) {
    if (life_years == 3 && year == 3) {
      freeze_rate = 0.1481;
    } else if (life_years == 5 && year == 4) {
      freeze_rate = 0.1152;
    } else if (life_years == 7 && year == 5) {
      freeze_rate = 0.08925;
    } else if (life_years == 10 && year == 7) {
      freeze_rate = 0.06555;
    } else if (life_years == 15 && year == 7) {
      freeze_rate = 0.05905;
    } else if (life_years == 20 && year == 9) {
      freeze_rate = 0.044615;
    }
    rate = rate_function(&book, 100.0, life_years, year, declining_rate,
                         freeze_rate);
    printf("%d|%.6lf\n", year, rate);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119e <main+0x4e>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jg     11ca <main+0x7a>
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11d7 <main+0x87>
movsd  0xe2e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe31(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     133c <main+0x1ec>
cmpl   $0x3,-0x1c(%rbp)
jne    1222 <main+0xd2>
cmpl   $0x3,-0x20(%rbp)
jne    1222 <main+0xd2>
movsd  0xe28(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12f4 <main+0x1a4>
cmpl   $0x5,-0x1c(%rbp)
jne    1248 <main+0xf8>
cmpl   $0x4,-0x20(%rbp)
jne    1248 <main+0xf8>
movsd  0xdfa(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12ef <main+0x19f>
cmpl   $0x7,-0x1c(%rbp)
jne    126e <main+0x11e>
cmpl   $0x5,-0x20(%rbp)
jne    126e <main+0x11e>
movsd  0xdcc(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12ea <main+0x19a>
cmpl   $0xa,-0x1c(%rbp)
jne    1294 <main+0x144>
cmpl   $0x7,-0x20(%rbp)
jne    1294 <main+0x144>
movsd  0xd9e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12e5 <main+0x195>
cmpl   $0xf,-0x1c(%rbp)
jne    12ba <main+0x16a>
cmpl   $0x7,-0x20(%rbp)
jne    12ba <main+0x16a>
movsd  0xd70(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12e0 <main+0x190>
cmpl   $0x14,-0x1c(%rbp)
jne    12db <main+0x18b>
cmpl   $0x9,-0x20(%rbp)
jne    12db <main+0x18b>
movsd  0xd42(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12e0 <main+0x190>
jmp    12e5 <main+0x195>
jmp    12ea <main+0x19a>
jmp    12ef <main+0x19f>
jmp    12f4 <main+0x1a4>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    -0x18(%rbp),%rdi
movsd  0xd00(%rip),%xmm0
call   1050 <rate_function@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
lea    0xd35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11eb <main+0x9b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
cmp    $0x2,%edi
jne    1291 <main+0x141>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
cmp    $0xb,%ebx
setl   %cl
movabs $0x4059000000000000,%rdx
mov    %rdx,0x18(%rsp)
test   %ebx,%ebx
js     1282 <main+0x132>
mov    %cl,%al
lea    0xe68(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%r12d
not    %r12d
xorps  %xmm0,%xmm0
xor    %ebp,%ebp
lea    0x18(%rsp),%r14
lea    0xea4(%rip),%r15
jmp    11fb <main+0xab>
nopl   0x0(%rax)
mov    %r14,%rdi
movsd  0xe75(%rip),%xmm0
mov    %ebx,%esi
mov    %ebp,%edx
movsd  0x8(%rsp),%xmm1
movsd  %xmm2,0x10(%rsp)
call   1050 <rate_function@plt>
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r12d,%eax
movsd  0x10(%rsp),%xmm0
add    %ebp,%eax
je     1282 <main+0x132>
mov    %ebp,%eax
lea    0x1(%rax),%ebp
cmp    $0x3,%ebx
jne    1212 <main+0xc2>
movsd  0xe03(%rip),%xmm2
cmp    $0x2,%eax
je     11c0 <main+0x70>
cmp    $0x5,%ebx
jne    1224 <main+0xd4>
movsd  0xdf9(%rip),%xmm2
cmp    $0x3,%eax
je     11c0 <main+0x70>
cmp    $0x7,%ebx
jne    1236 <main+0xe6>
movsd  0xdef(%rip),%xmm2
cmp    $0x4,%eax
je     11c0 <main+0x70>
cmp    $0xa,%ebx
jne    124c <main+0xfc>
movsd  0xde5(%rip),%xmm2
cmp    $0x6,%eax
je     11c0 <main+0x70>
cmp    $0xf,%ebx
jne    1262 <main+0x112>
movsd  0xdd7(%rip),%xmm2
cmp    $0x6,%eax
je     11c0 <main+0x70>
mov    %ebx,%ecx
xor    $0x14,%ecx
xor    $0x8,%eax
or     %ecx,%eax
movsd  0xdc4(%rip),%xmm2
je     11c0 <main+0x70>
movaps %xmm0,%xmm2
jmp    11c0 <main+0x70>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xda4(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s life_years\0A\00"
@.str.1 = [10 x i8] c"%d|%.6lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %10
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp sle i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %21
store double 2.000000e+00, double* %9
br label %30
29: ; preds = %21
store double 1.500000e+00, double* %9
br label %30
30: ; preds = %29, %28
store double 1.000000e+02, double* %6
store i32 1, i32* %8
br label %31
31: ; preds = %92, %30
%32 = load i32, i32* %8
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
%35 = icmp sle i32 %32, %34
br i1 %35, label %36, label %95
36: ; preds = %31
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, 3
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %43
42: ; preds = %39
store double 1.481000e-01, double* %10
br label %83
43: ; preds = %39, %36
%44 = load i32, i32* %7
%45 = icmp eq i32 %44, 5
br i1 %45, label %46, label %50
46: ; preds = %43
%47 = load i32, i32* %8
%48 = icmp eq i32 %47, 4
br i1 %48, label %49, label %50
49: ; preds = %46
store double 1.152000e-01, double* %10
br label %82
50: ; preds = %46, %43
%51 = load i32, i32* %7
%52 = icmp eq i32 %51, 7
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, 5
br i1 %55, label %56, label %57
56: ; preds = %53
store double 8.925000e-02, double* %10
br label %81
57: ; preds = %53, %50
%58 = load i32, i32* %7
%59 = icmp eq i32 %58, 10
br i1 %59, label %60, label %64
60: ; preds = %57
%61 = load i32, i32* %8
%62 = icmp eq i32 %61, 7
br i1 %62, label %63, label %64
63: ; preds = %60
store double 6.555000e-02, double* %10
br label %80
64: ; preds = %60, %57
%65 = load i32, i32* %7
%66 = icmp eq i32 %65, 15
br i1 %66, label %67, label %71
67: ; preds = %64
%68 = load i32, i32* %8
%69 = icmp eq i32 %68, 7
br i1 %69, label %70, label %71
70: ; preds = %67
store double 5.905000e-02, double* %10
br label %79
71: ; preds = %67, %64
%72 = load i32, i32* %7
%73 = icmp eq i32 %72, 20
br i1 %73, label %74, label %78
74: ; preds = %71
%75 = load i32, i32* %8
%76 = icmp eq i32 %75, 9
br i1 %76, label %77, label %78
77: ; preds = %74
store double 4.461500e-02, double* %10
br label %78
78: ; preds = %77, %74, %71
br label %79
79: ; preds = %78, %70
br label %80
80: ; preds = %79, %63
br label %81
81: ; preds = %80, %56
br label %82
82: ; preds = %81, %49
br label %83
83: ; preds = %82, %42
%84 = load i32, i32* %7
%85 = load i32, i32* %8
%86 = load double, double* %9
%87 = load double, double* %10
%88 = call double @rate_function(double* %6, double 1.000000e+02, i32 %84, i32 %85, double %86, double %87)
store double %88, double* %11
%89 = load i32, i32* %8
%90 = load double, double* %11
%91 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %89, double %90)
br label %92
92: ; preds = %83
%93 = load i32, i32* %8
%94 = add nsw i32 %93, 1
store i32 %94, i32* %8
br label %31
95: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s life_years\0A\00"
@.str.1 = [10 x i8] c"%d|%.6lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp slt i32 %14, 11
%16 = select i1 %15, double 2.000000e+00, double 1.500000e+00
store double 1.000000e+02, double* %3
%17 = icmp slt i32 %14, 0
br i1 %17, label %52, label %18
18: ; preds = %11
%19 = icmp eq i32 %14, 3
%20 = icmp eq i32 %14, 5
%21 = icmp eq i32 %14, 7
%22 = icmp eq i32 %14, 10
%23 = icmp eq i32 %14, 15
%24 = icmp eq i32 %14, 20
%25 = add i32 %14, 1
br label %26
26: ; preds = %18, %46
%27 = phi i32 [ 1, %18 ], [ %50, %46 ]
%28 = phi double [ 0.000000e+00, %18 ], [ %47, %46 ]
%29 = icmp eq i32 %27, 3
%30 = select i1 %19, i1 %29, i1 false
br i1 %30, label %46, label %31
31: ; preds = %26
%32 = icmp eq i32 %27, 4
%33 = select i1 %20, i1 %32, i1 false
br i1 %33, label %46, label %34
34: ; preds = %31
%35 = icmp eq i32 %27, 5
%36 = select i1 %21, i1 %35, i1 false
br i1 %36, label %46, label %37
37: ; preds = %34
%38 = icmp eq i32 %27, 7
%39 = select i1 %22, i1 %38, i1 false
br i1 %39, label %46, label %40
40: ; preds = %37
%41 = select i1 %23, i1 %38, i1 false
br i1 %41, label %46, label %42
42: ; preds = %40
%43 = icmp eq i32 %27, 9
%44 = select i1 %24, i1 %43, i1 false
%45 = select i1 %44, double 4.461500e-02, double %28
br label %46
46: ; preds = %42, %40, %37, %34, %31, %26
%47 = phi double [ 1.481000e-01, %26 ], [ 1.152000e-01, %31 ], [ 8.925000e-02, %34 ], [ 6.555000e-02, %37 ], [ 5.905000e-02, %40 ], [ %45, %42 ]
%48 = call double @rate_function(double* %3, double 1.000000e+02, i32 %14, i32 %27, double %16, double %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %27, double %48)
%50 = add nuw i32 %27, 1
%51 = icmp eq i32 %27, %25
br i1 %51, label %52, label %26
52: ; preds = %46, %11
ret i32 0
}