#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);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float serie = 0.0, k, n;
  scanf("%f", &k);
  while (k != -1) {
    if (k >= 1 && k <= 15) {
      for (n = 1.0; serie <= k; ++n)
        serie += (1.0 / n);
      printf("%d\n", (int)(n - 1));
    } else
      printf("%d\n", 1);
    serie = 0.0;
    scanf("%f", &k);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xeda(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xeac(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1168 <main+0x48>
jp     1168 <main+0x48>
jmp    1246 <main+0x126>
movss  -0xc(%rbp),%xmm0
movss  0xe8f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1218 <main+0xf8>
movss  0xe82(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     1218 <main+0xf8>
movss  0xe6c(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11f2 <main+0xd2>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4f(%rip),%xmm1
divsd  %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe21(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    119d <main+0x7d>
movss  -0x10(%rbp),%xmm0
movss  0xe05(%rip),%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%esi
lea    0xe0d(%rip),%rdi
call   1030 <printf@plt>
jmp    1229 <main+0x109>
lea    0xdfc(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xde0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1147 <main+0x27>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xee8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xeb9(%rip),%xmm0
jne    114f <main+0x2f>
jnp    1219 <main+0xf9>
movss  0xead(%rip),%xmm5
movsd  0xeb1(%rip),%xmm6
lea    0xeb5(%rip),%r14
lea    0xeab(%rip),%r15
lea    0xc(%rsp),%rbx
jmp    11c0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addss  0xe78(%rip),%xmm1
cvttss2si %xmm1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movsd  0xe69(%rip),%xmm6
movss  0xe55(%rip),%xmm5
movss  0xc(%rsp),%xmm0
ucomiss 0xe44(%rip),%xmm0
jne    11c0 <main+0xa0>
jnp    1219 <main+0xf9>
ucomiss %xmm5,%xmm0
mov    $0x1,%esi
jb     118c <main+0x6c>
movss  0xe36(%rip),%xmm1
ucomiss %xmm0,%xmm1
jb     118c <main+0x6c>
ucomiss 0xe2e(%rip),%xmm0
movaps %xmm5,%xmm1
jb     1180 <main+0x60>
xorps  %xmm2,%xmm2
movaps %xmm5,%xmm1
nopl   0x0(%rax)
xorps  %xmm3,%xmm3
cvtss2sd %xmm1,%xmm3
movapd %xmm6,%xmm4
divsd  %xmm3,%xmm4
cvtss2sd %xmm2,%xmm2
addsd  %xmm4,%xmm2
cvtsd2ss %xmm2,%xmm2
addss  %xmm5,%xmm1
ucomiss %xmm2,%xmm0
jae    11f0 <main+0xd0>
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
br label %6
6: ; preds = %38, %0
%7 = load float, float* %3
%8 = fcmp une float %7, -1.000000e+00
br i1 %8, label %9, label %40
9: ; preds = %6
%10 = load float, float* %3
%11 = fcmp oge float %10, 1.000000e+00
br i1 %11, label %12, label %36
12: ; preds = %9
%13 = load float, float* %3
%14 = fcmp ole float %13, 1.500000e+01
br i1 %14, label %15, label %36
15: ; preds = %12
store float 1.000000e+00, float* %4
br label %16
16: ; preds = %28, %15
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fcmp ole float %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = fdiv double 1.000000e+00, %22
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = fadd double %25, %23
%27 = fptrunc double %26 to float
store float %27, float* %2
br label %28
28: ; preds = %20
%29 = load float, float* %4
%30 = fadd float %29, 1.000000e+00
store float %30, float* %4
br label %16
31: ; preds = %16
%32 = load float, float* %4
%33 = fsub float %32, 1.000000e+00
%34 = fptosi float %33 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %38
36: ; preds = %12, %9
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %38
38: ; preds = %36, %31
store float 0.000000e+00, float* %2
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
br label %6
40: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c"%d\0A\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
%5 = fcmp une float %4, -1.000000e+00
br i1 %5, label %6, label %33
6: ; preds = %0, %27
%7 = phi float [ %31, %27 ], [ %4, %0 ]
%8 = fcmp oge float %7, 1.000000e+00
%9 = fcmp ole float %7, 1.500000e+01
%10 = and i1 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %6
%12 = fcmp ult float %7, 0.000000e+00
br i1 %12, label %23, label %13
13: ; preds = %11, %13
%14 = phi float [ %21, %13 ], [ 1.000000e+00, %11 ]
%15 = phi float [ %20, %13 ], [ 0.000000e+00, %11 ]
%16 = fpext float %14 to double
%17 = fdiv double 1.000000e+00, %16
%18 = fpext float %15 to double
%19 = fadd double %17, %18
%20 = fptrunc double %19 to float
%21 = fadd float %14, 1.000000e+00
%22 = fcmp ult float %7, %20
br i1 %22, label %23, label %13
23: ; preds = %13, %11
%24 = phi float [ 1.000000e+00, %11 ], [ %21, %13 ]
%25 = fadd float %24, -1.000000e+00
%26 = fptosi float %25 to i32
br label %27
27: ; preds = %6, %23
%28 = phi i32 [ %26, %23 ], [ 1, %6 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%31 = load float, float* %1
%32 = fcmp une float %31, -1.000000e+00
br i1 %32, label %6, label %33
33: ; preds = %27, %0
ret i32 0
}