#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 */
typedef int /*<<< orphan*/ memoTable;

/* Variables and functions */
int countNumPreimageHash(int, int, int, int ***);
int /*<<< orphan*/ memset(int ***, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int memoTable[26 + 1][26][26 * 26 + 1];
  memset(memoTable, -1, sizeof(memoTable));
  int length, weightSum, caseId;
  caseId = 1;
  while (1) {
    scanf("%d %d", &length, &weightSum);
    if (length == 0 && weightSum == 0)
      break;
    printf("Case %d: %d\n", caseId,
           countNumPreimageHash(length, 26 - 1, weightSum, memoTable));
    caseId++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d01f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1d01e0(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x1d01d8,%edx
call   1040 <memset@plt>
movl   $0x1,-0x1d01ec(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x1d01e4(%rbp),%rsi
lea    -0x1d01e8(%rbp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,-0x1d01e4(%rbp)
jne    11ab <main+0x6b>
cmpl   $0x0,-0x1d01e8(%rbp)
jne    11ab <main+0x6b>
jmp    11fc <main+0xbc>
mov    -0x1d01ec(%rbp),%eax
mov    %eax,-0x1d01f0(%rbp)
mov    -0x1d01e4(%rbp),%edi
mov    -0x1d01e8(%rbp),%edx
lea    -0x1d01e0(%rbp),%rcx
mov    $0x19,%esi
call   1060 <countNumPreimageHash@plt>
mov    -0x1d01f0(%rbp),%esi
mov    %eax,%edx
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1d01ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d01ec(%rbp)
jmp    1172 <main+0x32>
xor    %eax,%eax
add    $0x1d01f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1d01e8,%rsp
lea    0x10(%rsp),%rdi
mov    $0xffffffff,%esi
mov    $0x1d01d8,%edx
call   1040 <memset@plt>
lea    0xe94(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%edx
mov    %edi,%eax
or     %edx,%eax
je     11e8 <main+0xa8>
mov    $0x1,%ebx
lea    0x10(%rsp),%r14
lea    0xe6c(%rip),%r15
lea    0xe5f(%rip),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    $0x19,%esi
mov    %r14,%rcx
call   1060 <countNumPreimageHash@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%edx
mov    %edi,%eax
or     %edx,%eax
jne    11b0 <main+0x70>
xor    %eax,%eax
add    $0x1d01e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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