#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(int argc, char *argv[]) {
  printf("Enter a number to increment by: ");
  double increment = 0;
  scanf("%lf", &increment);
  printf("increment by each time %lf, until i reach %lf (%d)\n", increment,
         increment * 100, 100);
  int i = 0;
  double num = 0;
  while (num < 100 * increment) {
    printf("%d: %lf\n", i, num);
    num += increment;
    i++;
  }
  printf("finished at %d: %lf\n", i, num);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xed6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe97(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
lea    0xeb8(%rip),%rdi
mov    $0x64,%esi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xe63(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11df <main+0xbf>
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1190 <main+0x70>
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
movq   $0x0,0x8(%rsp)
lea    0xee2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  0xe9d(%rip),%xmm1
lea    0xec3(%rip),%rdi
mov    $0x64,%esi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm2
mulsd  0xe7c(%rip),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    11e3 <main+0xc3>
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
lea    0xed2(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe46(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%ebx
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm2
ja     11a0 <main+0x80>
lea    0xe77(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter a number to increment by: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [52 x i8] c"increment by each time %lf, until i reach %lf (%d)\0A\00"
@.str.3 = [9 x i8] c"%d: %lf\0A\00"
@.str.4 = [21 x i8] c"finished at %d: %lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %6)
%11 = load double, double* %6
%12 = load double, double* %6
%13 = fmul double %12, 1.000000e+02
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), double %11, double %13, i32 100)
store i32 0, i32* %7
store double 0.000000e+00, double* %8
br label %15
15: ; preds = %20, %2
%16 = load double, double* %8
%17 = load double, double* %6
%18 = fmul double 1.000000e+02, %17
%19 = fcmp olt double %16, %18
br i1 %19, label %20, label %29
20: ; preds = %15
%21 = load i32, i32* %7
%22 = load double, double* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %21, double %22)
%24 = load double, double* %6
%25 = load double, double* %8
%26 = fadd double %25, %24
store double %26, double* %8
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %15
29: ; preds = %15
%30 = load i32, i32* %7
%31 = load double, double* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %30, double %31)
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter a number to increment by: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [52 x i8] c"increment by each time %lf, until i reach %lf (%d)\0A\00"
@.str.3 = [9 x i8] c"%d: %lf\0A\00"
@.str.4 = [21 x i8] c"finished at %d: %lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%7 = load double, double* %3
%8 = fmul double %7, 1.000000e+02
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), double %7, double %8, i32 100)
%10 = load double, double* %3
%11 = fmul double %10, 1.000000e+02
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %13, label %22
13: ; preds = %2, %13
%14 = phi double [ %18, %13 ], [ 0.000000e+00, %2 ]
%15 = phi i32 [ %19, %13 ], [ 0, %2 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %15, double %14)
%17 = load double, double* %3
%18 = fadd double %14, %17
%19 = add nuw nsw i32 %15, 1
%20 = fmul double %17, 1.000000e+02
%21 = fcmp olt double %18, %20
br i1 %21, label %13, label %22
22: ; preds = %13, %2
%23 = phi i32 [ 0, %2 ], [ %19, %13 ]
%24 = phi double [ 0.000000e+00, %2 ], [ %18, %13 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %23, double %24)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}