#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 get, total;
  int a[10];
  int i, j = 0, k;
  scanf("%f", &get);
  while (get != 0.0) {
    for (i = 1, total = 0.0; total < get; i++) {
      total += (float)1 / (i + 1);
      if (total > get) {
        break;
      }
    }
    a[j] = i;
    ++j;
    scanf("%f", &get);
  }
  for (k = 0; k < j; k++) {
    printf("%d card(s)\n", a[k]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x48(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1167 <main+0x47>
jp     1167 <main+0x47>
jmp    11f9 <main+0xd9>
movl   $0x1,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11d0 <main+0xb0>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
movss  0xe65(%rip),%xmm0
divss  %xmm1,%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11bd <main+0x9d>
jmp    11d0 <main+0xb0>
jmp    11c2 <main+0xa2>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1176 <main+0x56>
mov    -0x44(%rbp),%ecx
movslq -0x48(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
lea    0xe19(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1146 <main+0x26>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    122e <main+0x10e>
movslq -0x4c(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1200 <main+0xe0>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xed6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1150 <main+0x30>
jnp    1205 <main+0xe5>
mov    $0x1,%eax
xor    %ebx,%ebx
movss  0xea1(%rip),%xmm4
lea    0xea2(%rip),%r14
lea    0xc(%rsp),%r15
jmp    11a1 <main+0x81>
nopl   (%rax)
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  0xe75(%rip),%xmm4
movss  0xc(%rsp),%xmm0
lea    0x1(%r12),%eax
ucomiss 0xe67(%rip),%xmm0
jne    11a1 <main+0x81>
jnp    11d3 <main+0xb3>
mov    %eax,%r12d
xorps  %xmm1,%xmm1
mov    $0x1,%ecx
nopl   0x0(%rax)
mov    %ecx,%eax
ucomiss %xmm1,%xmm0
jbe    1170 <main+0x50>
lea    0x1(%rax),%ecx
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
movaps %xmm4,%xmm3
divss  %xmm2,%xmm3
addss  %xmm3,%xmm1
ucomiss %xmm0,%xmm1
jbe    11b0 <main+0x90>
jmp    1170 <main+0x50>
test   %ebx,%ebx
je     1205 <main+0xe5>
mov    %r12d,%r15d
xor    %ebx,%ebx
lea    0xe28(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11f0 <main+0xd0>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [12 x i8] c"%d card(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
br label %9
9: ; preds = %33, %0
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = fcmp une double %11, 0.000000e+00
br i1 %12, label %13, label %41
13: ; preds = %9
store i32 1, i32* %5
store float 0.000000e+00, float* %3
br label %14
14: ; preds = %30, %13
%15 = load float, float* %3
%16 = load float, float* %2
%17 = fcmp olt float %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sitofp i32 %20 to float
%22 = fdiv float 1.000000e+00, %21
%23 = load float, float* %3
%24 = fadd float %23, %22
store float %24, float* %3
%25 = load float, float* %3
%26 = load float, float* %2
%27 = fcmp ogt float %25, %26
br i1 %27, label %28, label %29
28: ; preds = %18
br label %33
29: ; preds = %18
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %14
33: ; preds = %28, %14
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %36
store i32 %34, i32* %37
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
br label %9
41: ; preds = %9
store i32 0, i32* %7
br label %42
42: ; preds = %52, %41
%43 = load i32, i32* %7
%44 = load i32, i32* %6
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %42
55: ; preds = %42
ret i32 0
}

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