#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 */
float fabsf(float);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float a1 = 2, a2, e, m;
  int k = 1;
  scanf("%f", &e);
  do {
    a2 = 2 + 1 / a1;
    m = fabsf(a2 - a1);
    a1 = a2;
    k++;
  } while (m > e);
  printf("%d", k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xea9(%rip),%xmm1
divss  -0x8(%rbp),%xmm1
movss  0xe98(%rip),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movaps 0xe8e(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
ja     1153 <main+0x33>
mov    -0x18(%rbp),%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%esi
movss  0xec1(%rip),%xmm0
movss  0x4(%rsp),%xmm1
movss  0xeb7(%rip),%xmm2
movaps 0xebc(%rip),%xmm3
movaps %xmm0,%xmm4
nopw   0x0(%rax,%rax,1)
movaps %xmm2,%xmm5
divss  %xmm4,%xmm5
addss  %xmm0,%xmm5
movaps %xmm5,%xmm6
subss  %xmm4,%xmm6
andps  %xmm3,%xmm6
add    $0x1,%esi
ucomiss %xmm1,%xmm6
movaps %xmm5,%xmm4
ja     1160 <main+0x40>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store float 2.000000e+00, float* %2
store i32 1, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
br label %8
8: ; preds = %19, %0
%9 = load float, float* %2
%10 = fdiv float 1.000000e+00, %9
%11 = fadd float 2.000000e+00, %10
store float %11, float* %3
%12 = load float, float* %3
%13 = load float, float* %2
%14 = fsub float %12, %13
%15 = call float @llvm.fabs.f32(float %14)
store float %15, float* %5
%16 = load float, float* %3
store float %16, float* %2
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %19
19: ; preds = %8
%20 = load float, float* %5
%21 = load float, float* %4
%22 = fcmp ogt float %20, %21
br i1 %22, label %8, label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
br label %5
5: ; preds = %5, %0
%6 = phi float [ 2.000000e+00, %0 ], [ %9, %5 ]
%7 = phi i32 [ 1, %0 ], [ %12, %5 ]
%8 = fdiv float 1.000000e+00, %6
%9 = fadd float %8, 2.000000e+00
%10 = fsub float %9, %6
%11 = call float @llvm.fabs.f32(float %10)
%12 = add nuw nsw i32 %7, 1
%13 = fcmp ogt float %11, %4
br i1 %13, label %5, label %14
14: ; preds = %5
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}