#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*/ fgets(char *, int, int /*<<< orphan*/);
int findLongestCommonSubseq(char *, char *, int, int, int **);
int /*<<< orphan*/ memset(int **, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ stdin;
scalar_t__ strlen(char *);
int main(void) {
  int caseId, lenOne, lenTwo;
  char seqOne[101 + 1], seqTwo[101 + 1];
  int memoTable[101][101];
  caseId = 1;
  while (1) {
    fgets(seqOne, 101 + 1, stdin);
    if (seqOne[0] == '#')
      break;
    fgets(seqTwo, 101 + 1, stdin);
    lenOne = (int)strlen(seqOne);
    if (seqOne[lenOne - 1] == '\n') {
      seqOne[lenOne - 1] = '\0';
      lenOne--;
    }
    lenTwo = (int)strlen(seqTwo);
    if (seqTwo[lenTwo - 1] == '\n') {
      seqTwo[lenTwo - 1] = '\0';
      lenTwo--;
    }
    memset(memoTable, -1, 101 * 101 * sizeof(int));
    printf("Case #%d: you can visit at most %d cities.\n", caseId,
           findLongestCommonSubseq(seqOne, seqTwo, lenOne - 1, lenTwo - 1,
                                   memoTable));
    caseId++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa070,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2e74(%rip),%rax
mov    (%rax),%edx
mov    $0x66,%esi
call   1060 <fgets@plt>
movsbl -0x80(%rbp),%eax
cmp    $0x23,%eax
jne    1192 <main+0x42>
jmp    1289 <main+0x139>
lea    -0xf0(%rbp),%rdi
mov    0x2e48(%rip),%rax
mov    (%rax),%edx
mov    $0x66,%esi
call   1060 <fgets@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11e4 <main+0x94>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x80(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
lea    -0xf0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0xf0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1225 <main+0xd5>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0xf0(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
lea    -0xa060(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x9f64,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xa064(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
lea    -0xa060(%rbp),%r8
call   1070 <findLongestCommonSubseq@plt>
mov    -0xa064(%rbp),%esi
mov    %eax,%edx
lea    0xd8a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x19>
xor    %eax,%eax
add    $0xa070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa048,%rsp
mov    0x2e80(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rsp,%rdi
mov    $0x66,%esi
call   1060 <fgets@plt>
cmpb   $0x23,(%rsp)
jne    1192 <main+0x42>
xor    %eax,%eax
add    $0xa048,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebx
lea    0x70(%rsp),%r14
mov    %rsp,%r15
lea    0xe0(%rsp),%r12
jmp    1210 <main+0xc0>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0xffffffff,%esi
mov    $0x9f64,%edx
call   1050 <memset@plt>
add    $0xffffffff,%ebp
add    $0xffffffff,%r13d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %r12,%r8
call   1070 <findLongestCommonSubseq@plt>
lea    0xe1d(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x2df2(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r15,%rdi
mov    $0x66,%esi
call   1060 <fgets@plt>
cmpb   $0x23,(%rsp)
je     117e <main+0x2e>
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0x66,%esi
call   1060 <fgets@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
shl    $0x20,%rax
movabs $0xffffffff00000000,%rcx
ff ff ff
add    %rcx,%rax
sar    $0x20,%rax
cmpb   $0xa,(%rsp,%rax,1)
jne    124d <main+0xfd>
movb   $0x0,(%rsp,%rax,1)
add    $0xffffffff,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%r13
shl    $0x20,%rax
movabs $0xffffffff00000000,%rcx
ff ff ff
add    %rcx,%rax
sar    $0x20,%rax
cmpb   $0xa,0x70(%rsp,%rax,1)
jne    11b0 <main+0x60>
movb   $0x0,0x70(%rsp,%rax,1)
add    $0xffffffff,%r13d
jmp    11b0 <main+0x60>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [44 x i8] c"Case #%d: you can visit at most %d cities.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [102 x i8]
%6 = alloca [102 x i8]
%7 = alloca [101 x [101 x i32]]
store i32 0, i32* %1
store i32 1, i32* %2
br label %8
8: ; preds = %0, %56
%9 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 102, i32 %10)
%12 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 35
br i1 %15, label %16, label %17
16: ; preds = %8
br label %73
17: ; preds = %8
%18 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 0
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %18, i32 102, i32 %19)
%21 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 0
%22 = call i64 @strlen(i8* %21)
%23 = trunc i64 %22 to i32
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 10
br i1 %30, label %31, label %38
31: ; preds = %17
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 %34
store i8 0, i8* %35
%36 = load i32, i32* %3
%37 = add nsw i32 %36, -1
store i32 %37, i32* %3
br label %38
38: ; preds = %31, %17
%39 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 0
%40 = call i64 @strlen(i8* %39)
%41 = trunc i64 %40 to i32
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 10
br i1 %48, label %49, label %56
49: ; preds = %38
%50 = load i32, i32* %4
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 %52
store i8 0, i8* %53
%54 = load i32, i32* %4
%55 = add nsw i32 %54, -1
store i32 %55, i32* %4
br label %56
56: ; preds = %49, %38
%57 = getelementptr inbounds [101 x [101 x i32]], [101 x [101 x i32]]* %7, i64 0, i64 0
%58 = bitcast [101 x i32]* %57 to i32**
%59 = call i32 @memset(i32** %58, i32 -1, i32 40804)
%60 = load i32, i32* %2
%61 = getelementptr inbounds [102 x i8], [102 x i8]* %5, i64 0, i64 0
%62 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 0
%63 = load i32, i32* %3
%64 = sub nsw i32 %63, 1
%65 = load i32, i32* %4
%66 = sub nsw i32 %65, 1
%67 = getelementptr inbounds [101 x [101 x i32]], [101 x [101 x i32]]* %7, i64 0, i64 0
%68 = bitcast [101 x i32]* %67 to i32**
%69 = call i32 @findLongestCommonSubseq(i8* %61, i8* %62, i32 %64, i32 %66, i32** %68)
%70 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %60, i32 %69)
%71 = load i32, i32* %2
%72 = add nsw i32 %71, 1
store i32 %72, i32* %2
br label %8
73: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [44 x i8] c"Case #%d: you can visit at most %d cities.\0A\00"
define i32 @main() {
%1 = alloca [102 x i8]
%2 = alloca [102 x i8]
%3 = alloca [101 x [101 x i32]]
%4 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 0
%6 = bitcast [101 x [101 x i32]]* %3 to i8*
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 102, i32 %7)
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 35
br i1 %10, label %51, label %11
11: ; preds = %0
%12 = bitcast [101 x [101 x i32]]* %3 to i32**
br label %13
13: ; preds = %11, %39
%14 = phi i32 [ 1, %11 ], [ %46, %39 ]
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %5, i32 102, i32 %15)
%17 = call i64 @strlen(i8* %4)
%18 = trunc i64 %17 to i32
%19 = shl i64 %17, 32
%20 = add i64 %19, -4294967296
%21 = ashr exact i64 %20, 32
%22 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 10
br i1 %24, label %25, label %27
25: ; preds = %13
store i8 0, i8* %22
%26 = add nsw i32 %18, -1
br label %27
27: ; preds = %25, %13
%28 = phi i32 [ %26, %25 ], [ %18, %13 ]
%29 = call i64 @strlen(i8* %5)
%30 = trunc i64 %29 to i32
%31 = shl i64 %29, 32
%32 = add i64 %31, -4294967296
%33 = ashr exact i64 %32, 32
%34 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 10
br i1 %36, label %37, label %39
37: ; preds = %27
store i8 0, i8* %34
%38 = add nsw i32 %30, -1
br label %39
39: ; preds = %37, %27
%40 = phi i32 [ %38, %37 ], [ %30, %27 ]
%41 = call i32 @memset(i32** %12, i32 -1, i32 40804)
%42 = add nsw i32 %28, -1
%43 = add nsw i32 %40, -1
%44 = call i32 @findLongestCommonSubseq(i8* %4, i8* %5, i32 %42, i32 %43, i32** %12)
%45 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %44)
%46 = add nuw nsw i32 %14, 1
%47 = load i32, i32* @stdin
%48 = call i32 @fgets(i8* %4, i32 102, i32 %47)
%49 = load i8, i8* %4
%50 = icmp eq i8 %49, 35
br i1 %50, label %51, label %13
51: ; preds = %39, %0
ret i32 0
}