#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*/ prepareMapSumFactorToNum(int *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, mapSumFactorToNum[1000 + 1], caseId;
  prepareMapSumFactorToNum(mapSumFactorToNum);
  caseId = 1;
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    printf("Case %d: %d\n", caseId, mapSumFactorToNum[n]);
    caseId++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xfb0(%rbp),%rdi
call   1040 <prepareMapSumFactorToNum@plt>
movl   $0x1,-0xfb4(%rbp)
lea    0xea1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1177 <main+0x47>
jmp    11a8 <main+0x78>
mov    -0xfb4(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%edx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1158 <main+0x28>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfb8,%rsp
lea    0x10(%rsp),%rdi
call   1040 <prepareMapSumFactorToNum@plt>
lea    0xeb1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a6 <main+0x76>
mov    $0x1,%ebx
lea    0xe96(%rip),%r14
lea    0xe8c(%rip),%r15
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
cltq
mov    0x10(%rsp,%rax,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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