#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*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  int N, i = 1, p, n;
  char s[1010];
  scanf("%d", &N);
  n = N;
  while (N > 0) {
    if (N == n) {
      getchar();
      gets(s);
      p = strlen(s);
      printf("case %d:length=%d.\n", i++, p);
      N--;
    } else {
      gets(s);
      p = strlen(s);
      printf("case %d:length=%d.\n", i++, p);
      N--;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1222 <main+0xd2>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11df <main+0x8f>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    -0x410(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edx
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    121d <main+0xcd>
lea    -0x410(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edx
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    117f <main+0x2f>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xe9c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    11cc <main+0x7c>
mov    $0x1,%ebx
lea    0x10(%rsp),%r14
lea    0xe7c(%rip),%r15
mov    %ebp,%eax
jmp    11bf <main+0x6f>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x1,%ecx
jle    11cc <main+0x7c>
cmp    %ebp,%eax
jne    1190 <main+0x40>
xor    %eax,%eax
call   1050 <getchar@plt>
jmp    1190 <main+0x40>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"case %d:length=%d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1010 x i8]
store i32 0, i32* %1
store i32 1, i32* %3
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
store i32 %8, i32* %5
br label %9
9: ; preds = %39, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %40
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %5
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = call i32 (...) @getchar()
%18 = getelementptr inbounds [1010 x i8], [1010 x i8]* %6, i64 0, i64 0
%19 = call i32 @gets(i8* %18)
%20 = getelementptr inbounds [1010 x i8], [1010 x i8]* %6, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
store i32 %21, i32* %4
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %24)
%26 = load i32, i32* %2
%27 = add nsw i32 %26, -1
store i32 %27, i32* %2
br label %39
28: ; preds = %12
%29 = getelementptr inbounds [1010 x i8], [1010 x i8]* %6, i64 0, i64 0
%30 = call i32 @gets(i8* %29)
%31 = getelementptr inbounds [1010 x i8], [1010 x i8]* %6, i64 0, i64 0
%32 = call i32 @strlen(i8* %31)
store i32 %32, i32* %4
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
%35 = load i32, i32* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %33, i32 %35)
%37 = load i32, i32* %2
%38 = add nsw i32 %37, -1
store i32 %38, i32* %2
br label %39
39: ; preds = %28, %16
br label %9
40: ; preds = %9
ret i32 0
}

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