#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 */
double ceil(double);
int /*<<< orphan*/ printf(char *, int, double);
int scanf(char *, double *);
int sqrt(int);
int main() {
  int i = 1;
  double n, temp;
  while (scanf("%lf", &n) == 1) {
    if (n == 0)
      break;
    temp = (sqrt(9 + (8 * n)) + 3) / 2;
    temp = ceil(temp);
    printf("Case %d: %.0lf\n", i, temp);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11f7 <main+0xb7>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118c <main+0x4c>
jp     118c <main+0x4c>
jmp    11f7 <main+0xb7>
movsd  -0x10(%rbp),%xmm0
movsd  0xe67(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe63(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
add    $0x3,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
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>
cmp    $0x1,%eax
jne    11dd <main+0xad>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1165 <main+0x35>
jnp    11dd <main+0xad>
mov    $0x1,%ebx
lea    0xeab(%rip),%r14
lea    0xea0(%rip),%r15
mov    %rsp,%r12
nopl   0x0(%rax,%rax,1)
mulsd  0xe78(%rip),%xmm0
addsd  0xe78(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
add    $0x3,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0x3,%eax
sar    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11dd <main+0xad>
add    $0x1,%ebx
movsd  (%rsp),%xmm0
ucomisd 0xe37(%rip),%xmm0
jne    1180 <main+0x50>
jp     1180 <main+0x50>
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"
@.str.1 = [16 x i8] c"Case %d: %.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store i32 1, i32* %2
br label %5
5: ; preds = %12, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = load double, double* %3
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
br label %27
12: ; preds = %8
%13 = load double, double* %3
%14 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %13, double 9.000000e+00)
%15 = fptosi double %14 to i32
%16 = call i32 @sqrt(i32 %15)
%17 = add nsw i32 %16, 3
%18 = sdiv i32 %17, 2
%19 = sitofp i32 %18 to double
store double %19, double* %4
%20 = load double, double* %4
%21 = call double @llvm.ceil.f64(double %20)
store double %21, double* %4
%22 = load i32, i32* %2
%23 = load double, double* %4
%24 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %22, double %23)
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %5
27: ; preds = %11, %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [16 x i8] c"Case %d: %.0lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = icmp ne i32 %3, 1
%5 = load double, double* %1
%6 = fcmp oeq double %5, 0.000000e+00
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %24, label %8
8: ; preds = %0, %8
%9 = phi double [ %21, %8 ], [ %5, %0 ]
%10 = phi i32 [ %18, %8 ], [ 1, %0 ]
%11 = call double @llvm.fmuladd.f64(double %9, double 8.000000e+00, double 9.000000e+00)
%12 = fptosi double %11 to i32
%13 = call i32 @sqrt(i32 %12)
%14 = add nsw i32 %13, 3
%15 = sdiv i32 %14, 2
%16 = sitofp i32 %15 to double
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %10, double %16)
%18 = add nuw nsw i32 %10, 1
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%20 = icmp ne i32 %19, 1
%21 = load double, double* %1
%22 = fcmp oeq double %21, 0.000000e+00
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %24, label %8
24: ; preds = %8, %0
ret i32 0
}