#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 (i < 100) {
    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)
cmpl   $0x64,-0x1c(%rbp)
jge    11cd <main+0xad>
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xec4(%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    0xe85(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2df6(%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
movsd  0xea1(%rip),%xmm1
mulsd  %xmm0,%xmm1
lea    0xec3(%rip),%rdi
mov    $0x64,%esi
mov    $0x2,%al
call   1030 <printf@plt>
xorpd  %xmm0,%xmm0
lea    0xeec(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1190 <main+0x70>
lea    0xe9e(%rip),%rdi
mov    $0x64,%esi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e0a(%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 = %18, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 100
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load double, double* %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %19, double %20)
%22 = load double, double* %6
%23 = load double, double* %8
%24 = fadd double %23, %22
store double %24, double* %8
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %15
27: ; preds = %15
%28 = load i32, i32* %7
%29 = load double, double* %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %28, double %29)
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}

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)
br label %10
10: ; preds = %2, %10
%11 = phi double [ 0.000000e+00, %2 ], [ %15, %10 ]
%12 = phi i32 [ 0, %2 ], [ %16, %10 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %12, double %11)
%14 = load double, double* %3
%15 = fadd double %11, %14
%16 = add nuw nsw i32 %12, 1
%17 = icmp eq i32 %16, 100
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 100, double %15)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}