#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, double, double, size_t);
int main(void) {
  double initial = 100.0;
  double minimum = 1.0;
  double damping = 1.005;
  size_t count = 1;
  double l;
  for (l = initial; l >= minimum; l /= damping, ++count)
    ;
  printf("count from %.1f to %.1f with damping %.3f: %u\n", initial, minimum,
         damping, count);
  exit(EXIT_SUCCESS);
}


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  0xec4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11a1 <main+0x81>
jmp    117d <main+0x5d>
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1168 <main+0x48>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    -0x28(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%esi
movsd  0xed2(%rip),%xmm0
movsd  0xed2(%rip),%xmm1
movsd  0xed2(%rip),%xmm2
xchg   %ax,%ax
divsd  %xmm1,%xmm0
add    $0x1,%rsi
ucomisd %xmm2,%xmm0
jae    1140 <main+0x20>
lea    0xec3(%rip),%rdi
movsd  0xea3(%rip),%xmm0
movsd  0xeab(%rip),%xmm1
movsd  0xe9b(%rip),%xmm2
call   1030 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"count from %.1f to %.1f with damping %.3f: %u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i64
%6 = alloca double
store i32 0, i32* %1
store double 1.000000e+02, double* %2
store double 1.000000e+00, double* %3
store double 1.005000e+00, double* %4
store i64 1, i64* %5
%7 = load double, double* %2
store double %7, double* %6
br label %8
8: ; preds = %13, %0
%9 = load double, double* %6
%10 = load double, double* %3
%11 = fcmp oge double %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
br label %13
13: ; preds = %12
%14 = load double, double* %4
%15 = load double, double* %6
%16 = fdiv double %15, %14
store double %16, double* %6
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %5
br label %8
19: ; preds = %8
%20 = load double, double* %2
%21 = load double, double* %3
%22 = load double, double* %4
%23 = load i64, i64* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double %20, double %21, double %22, i64 %23)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
}

LLVM IR (-O2):
@.str = [47 x i8] c"count from %.1f to %.1f with damping %.3f: %u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 1.000000e+02, %0 ], [ %4, %1 ]
%3 = phi i64 [ 1, %0 ], [ %5, %1 ]
%4 = fdiv double %2, 1.005000e+00
%5 = add i64 %3, 1
%6 = fcmp ult double %4, 1.000000e+00
br i1 %6, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double 1.000000e+02, double 1.000000e+00, double 1.005000e+00, i64 %5)
%9 = load i32, i32* @EXIT_SUCCESS
%10 = tail call i32 @exit(i32 %9)
unreachable
}