#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 count(int);
int /*<<< orphan*/ printf(char *, int, ...);
int scanf(char *, int *);
int main() {
  int n, i = 0, t;
  while (scanf("%d", &n) == 1) {
    if (n < 0)
      break;
    i++;
    if (n == 1)
      printf("Case %d: 0\n", i);
    else {
      t = count(n);
      printf("Case %d: %d\n", i, t);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11bb <main+0x8b>
cmpl   $0x0,-0x8(%rbp)
jge    116e <main+0x3e>
jmp    11bb <main+0x8b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1197 <main+0x67>
mov    -0xc(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b6 <main+0x86>
mov    -0x8(%rbp),%edi
call   1030 <count@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ce <main+0x9e>
mov    0xc(%rsp),%edi
test   %edi,%edi
js     11ce <main+0x9e>
mov    $0x1,%ebx
lea    0xe9c(%rip),%r14
lea    0xe92(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xe95(%rip),%r13
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%edi
jne    11a0 <main+0x70>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <count@plt>
mov    %r13,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ce <main+0x9e>
add    $0x1,%ebx
mov    0xc(%rsp),%edi
test   %edi,%edi
jns    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"Case %d: 0\0A\00"
@.str.2 = [13 x i8] c"Case %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %26, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
br label %27
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %3
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %26
20: ; preds = %12
%21 = load i32, i32* %2
%22 = call i32 @count(i32 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24)
br label %26
26: ; preds = %20, %17
br label %5
27: ; preds = %11, %5
ret i32 0
}

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