#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 const, ...);
int main() {
  const int REPS = 1000000;
  int i;
  double balance = 0.0;
  printf("\nYour starting bank account balance is %0.2f\n", balance);
  for (i = 0; i < REPS; i++) {
    balance += 1.0;
  }
  printf("\nAfter %d $1 deposits, your balance is $%0.2f\n\n", REPS, balance);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf4240,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xf4240,-0xc(%rbp)
jge    1175 <main+0x65>
movsd  0xea3(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x38>
movsd  -0x18(%rbp),%xmm0
lea    0xeb5(%rip),%rdi
mov    $0xf4240,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xorpd  %xmm0,%xmm0
mov    $0xf4240,%eax
movsd  0xece(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
add    $0xfffffff6,%eax
jne    1140 <main+0x30>
lea    0xec2(%rip),%rdi
mov    $0xf4240,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"\0AYour starting bank account balance is %0.2f\0A\00"
@.str.1 = [48 x i8] c"\0AAfter %d $1 deposits, your balance is $%0.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store i32 1000000, i32* %2
store double 0.000000e+00, double* %4
%5 = load double, double* %4
%6 = fptosi double %5 to i32
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 1000000
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load double, double* %4
%13 = fadd double %12, 1.000000e+00
store double %13, double* %4
br label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %8
17: ; preds = %8
%18 = load double, double* %4
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 1000000, double %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"\0AYour starting bank account balance is %0.2f\0A\00"
@.str.1 = [48 x i8] c"\0AAfter %d $1 deposits, your balance is $%0.2f\0A\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 0)
br label %2
2: ; preds = %2, %0
%3 = phi double [ 0.000000e+00, %0 ], [ %14, %2 ]
%4 = phi i32 [ 0, %0 ], [ %15, %2 ]
%5 = fadd double %3, 1.000000e+00
%6 = fadd double %5, 1.000000e+00
%7 = fadd double %6, 1.000000e+00
%8 = fadd double %7, 1.000000e+00
%9 = fadd double %8, 1.000000e+00
%10 = fadd double %9, 1.000000e+00
%11 = fadd double %10, 1.000000e+00
%12 = fadd double %11, 1.000000e+00
%13 = fadd double %12, 1.000000e+00
%14 = fadd double %13, 1.000000e+00
%15 = add nuw nsw i32 %4, 10
%16 = icmp eq i32 %15, 1000000
br i1 %16, label %17, label %2
17: ; preds = %2
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 1000000, double %14)
ret i32 0
}