#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 main(void) {
  double money, daphne, deirdre;
  int years = 1;
  money = 100.0;
  daphne = money;
  deirdre = money;
  printf("          Daphne   Deirdre\n");
  while (deirdre <= daphne) {
    daphne += money * 0.10;
    deirdre *= 1.05;
    printf("Year%2d : $%-8.2f $%-8.2f\n", years, daphne, deirdre);
    years++;
  }
  printf("Deirdre's investment beyond Daphne's investment takes %d years!\n",
         years - 1);
  printf("Daphne will have $%.2f, and Deirdre will have $%.2f since then!\n",
         daphne, deirdre);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x24(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11c3 <main+0xb3>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe95(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe78(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe86(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1155 <main+0x45>
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xea8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf87(%rip),%rdi
call   1030 <puts@plt>
movsd  0xec5(%rip),%xmm0
xor    %ebx,%ebx
lea    0xed4(%rip),%r14
movsd  %xmm0,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebx
movsd  0x8(%rsp),%xmm0
addsd  0xea7(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  0xe9b(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0x10(%rsp),%xmm0
jae    1150 <main+0x30>
lea    0xe97(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c" Daphne Deirdre\0A\00"
@.str.1 = [27 x i8] c"Year%2d : $%-8.2f $%-8.2f\0A\00"
@.str.2 = [65 x i8] c"Deirdre's investment beyond Daphne's investment takes %d years!\0A\00"
@.str.3 = [65 x i8] c"Daphne will have $%.2f, and Deirdre will have $%.2f since then!\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 i32 1, i32* %5
store double 1.000000e+02, double* %2
%6 = load double, double* %2
store double %6, double* %3
%7 = load double, double* %2
store double %7, double* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %13, %0
%10 = load double, double* %4
%11 = load double, double* %3
%12 = fcmp ole double %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load double, double* %2
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double %14, double 1.000000e-01, double %15)
store double %16, double* %3
%17 = load double, double* %4
%18 = fmul double %17, 1.050000e+00
store double %18, double* %4
%19 = load i32, i32* %5
%20 = load double, double* %3
%21 = load double, double* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %19, double %20, double %21)
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %9
25: ; preds = %9
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load double, double* %3
%30 = load double, double* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), double %29, double %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"Year%2d : $%-8.2f $%-8.2f\0A\00"
@.str.2 = [65 x i8] c"Deirdre's investment beyond Daphne's investment takes %d years!\0A\00"
@.str.3 = [65 x i8] c"Daphne will have $%.2f, and Deirdre will have $%.2f since then!\0A\00"
@str = [27 x i8] c" Daphne Deirdre\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 1, %0 ], [ %9, %2 ]
%4 = phi double [ 1.000000e+02, %0 ], [ %7, %2 ]
%5 = phi double [ 1.000000e+02, %0 ], [ %6, %2 ]
%6 = fadd double %5, 1.000000e+01
%7 = fmul double %4, 1.050000e+00
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %3, double %6, double %7)
%9 = add nuw nsw i32 %3, 1
%10 = fcmp ugt double %7, %6
br i1 %10, label %11, label %2
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), double %6, double %7)
ret i32 0
}