#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, double *);
int main(void) {
  int c;
  double f, len;
  while (scanf("%lf", &f) != EOF && f != 0.00) {
    for (c = 1, len = 0; len < f; c += 1)
      len += 1.0 / (c + 1);
    printf("%d card(s)\n", c - 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e9d(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x19(%rbp)
je     116e <main+0x4e>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117e <main+0x5e>
jmp    11e6 <main+0xc6>
movl   $0x1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cf <main+0xaf>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe4d(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118d <main+0x6d>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed9(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2eaa(%rip),%r12
cmp    (%r12),%rax
je     11f1 <main+0xd1>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115d <main+0x3d>
jnp    11f1 <main+0xd1>
movsd  0xe9b(%rip),%xmm4
lea    0xea0(%rip),%r14
lea    0xe95(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%esi
ucomisd %xmm1,%xmm0
jbe    11bc <main+0x9c>
mov    $0x1,%esi
xorpd  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%esi
xorps  %xmm2,%xmm2
cvtsi2sd %esi,%xmm2
movapd %xmm4,%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm3,%xmm1
ucomisd %xmm1,%xmm0
ja     11a0 <main+0x80>
add    $0xffffffff,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movsd  0xe26(%rip),%xmm4
cmp    (%r12),%rax
xorpd  %xmm1,%xmm1
je     11f1 <main+0xd1>
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    1180 <main+0x60>
jp     1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"%d card(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
br label %5
5: ; preds = %29, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load double, double* %3
%11 = fcmp une double %10, 0.000000e+00
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ false, %5 ], [ %11, %9 ]
br i1 %13, label %14, label %33
14: ; preds = %12
store i32 1, i32* %2
store double 0.000000e+00, double* %4
br label %15
15: ; preds = %26, %14
%16 = load double, double* %4
%17 = load double, double* %3
%18 = fcmp olt double %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
%22 = sitofp i32 %21 to double
%23 = fdiv double 1.000000e+00, %22
%24 = load double, double* %4
%25 = fadd double %24, %23
store double %25, double* %4
br label %26
26: ; preds = %19
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %15
29: ; preds = %15
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 1
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %5
33: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"%d card(s)\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load i64, i64* @EOF
%5 = icmp ne i64 %3, %4
%6 = load double, double* %1
%7 = fcmp une double %6, 0.000000e+00
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %9, label %30
9: ; preds = %0, %20
%10 = phi double [ %27, %20 ], [ %6, %0 ]
%11 = fcmp ogt double %10, 0.000000e+00
br i1 %11, label %12, label %20
12: ; preds = %9, %12
%13 = phi double [ %18, %12 ], [ 0.000000e+00, %9 ]
%14 = phi i32 [ %15, %12 ], [ 1, %9 ]
%15 = add nuw nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = fdiv double 1.000000e+00, %16
%18 = fadd double %13, %17
%19 = fcmp olt double %18, %10
br i1 %19, label %12, label %20
20: ; preds = %12, %9
%21 = phi i32 [ 1, %9 ], [ %15, %12 ]
%22 = add nsw i32 %21, -1
%23 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%25 = load i64, i64* @EOF
%26 = icmp ne i64 %24, %25
%27 = load double, double* %1
%28 = fcmp une double %27, 0.000000e+00
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %9, label %30
30: ; preds = %20, %0
ret i32 0
}