#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 /*<<< orphan*/ printf(char *, int, ...);
int main(void) {
  const double BONUS = 1000000.00;
  const double WITHDRAW = 100000.00;
  int years = 0;
  double balance;
  balance = BONUS;
  while (balance > 0) {
    balance = 1.08 * balance;
    balance -= WITHDRAW;
    years++;
    printf("Year %2d, your balance is $%.2f\n", years, balance);
  }
  printf("Insufficient funds! It takes %d years!\n", years);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ab <main+0x9b>
movsd  0xea9(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    114d <main+0x3d>
mov    -0x1c(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf90(%rip),%rbx
movsd  0xee0(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xed1(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xec2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xeb3(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xea4(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe95(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe86(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe77(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe68(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe59(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe4a(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xb,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe3b(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe2c(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe1d(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xe,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe0e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xf,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdff(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdf0(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x11,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xde1(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x12,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdd2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x13,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdc3(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xdb4(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x15,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdc7(%rip),%rdi
mov    $0x15,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Year %2d, your balance is $%.2f\0A\00"
@.str.1 = [40 x i8] c"Insufficient funds! It takes %d years!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
store double 1.000000e+06, double* %2
store double 1.000000e+05, double* %3
store i32 0, i32* %4
store double 1.000000e+06, double* %5
br label %6
6: ; preds = %9, %0
%7 = load double, double* %5
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load double, double* %5
%11 = fmul double 1.080000e+00, %10
store double %11, double* %5
%12 = load double, double* %5
%13 = fsub double %12, 1.000000e+05
store double %13, double* %5
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = load double, double* %5
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %16, double %17)
br label %6
19: ; preds = %6
%20 = load i32, i32* %4
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Year %2d, your balance is $%.2f\0A\00"
@.str.1 = [40 x i8] c"Insufficient funds! It takes %d years!\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 1, double 9.800000e+05)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 2, double 9.584000e+05)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 3, double 0x412C894000000001)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 4, double 0x412BC46B851EB854)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 5, double 0x412AEFD7F62B6AEB)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 6, double 0x412A0A42D6A9C565)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 7, double 0x4129124FDD98A1FD)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 8, double 0x41280686E5157BC0)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 9, double 0x4126E551AFBB0AC6)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 10, double 0x4125ACF980595D8F)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 11, double 0x41245BA4806083C4)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 12, double 0x4122EF52F10C136E)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 13, double 0x412165DC230D0ABF)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 14, double 0x411F79D66030A694)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 15, double 0x411BE3F6E2C3E71C)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 16, double 0x411804A95B4E747B)
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 17, double 0x4113D60DF1F89248)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 18, double 0x410EA399006AD592)
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 19, double 0x4104E215E1BB0F9E)
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 20, double 0x40F4B18B6CB2C594)
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 21, double 0xC0C08536E434DA08)
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 21)
ret i32 0
}