#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*/ FillGrid(char **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  char grid[10][10 + 1];
  int numcase, caseid, msize;
  scanf("%d", &numcase);
  caseid = 1;
  while (caseid <= numcase) {
    scanf("%d", &msize);
    int row;
    for (row = 0; row < msize; row++)
      scanf("%s", grid[row]);
    FillGrid(grid, msize);
    printf("Case %d:\n", caseid);
    for (row = 0; row < msize; row++)
      printf("%s\n", grid[row]);
    caseid++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x84(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x84(%rbp),%eax
jg     125f <main+0x12f>
lea    0xe86(%rip),%rdi
lea    -0x8c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    11d8 <main+0xa8>
movslq -0x90(%rbp),%rax
lea    -0x80(%rbp),%rsi
imul   $0xb,%rax,%rax
add    %rax,%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1192 <main+0x62>
lea    -0x80(%rbp),%rdi
mov    -0x8c(%rbp),%esi
call   1030 <FillGrid@plt>
mov    -0x88(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    124b <main+0x11b>
movslq -0x90(%rbp),%rax
lea    -0x80(%rbp),%rsi
imul   $0xb,%rax,%rax
add    %rax,%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1205 <main+0xd5>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    123f <main+0xff>
mov    $0x1,%r13d
lea    0x10(%rsp),%r14
lea    0xe82(%rip),%r15
jmp    11a2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r13),%eax
cmp    0xc(%rsp),%r13d
mov    %eax,%r13d
jge    123f <main+0xff>
lea    0xe57(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    11ef <main+0xaf>
mov    %r14,%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rsi
add    $0xb,%r12
cmp    %rsi,%rbp
jl     11d0 <main+0x90>
mov    %r14,%rdi
call   1040 <FillGrid@plt>
lea    0xe08(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1190 <main+0x50>
mov    %r14,%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0xb,%rbp
cmp    %rax,%rbx
jl     1220 <main+0xe0>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Case %d:\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [11 x i8]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %8
8: ; preds = %47, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %50
12: ; preds = %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %6
br label %14
14: ; preds = %24, %12
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %2, i64 0, i64 %20
%22 = getelementptr inbounds [11 x i8], [11 x i8]* %21, i64 0, i64 0
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %14
27: ; preds = %14
%28 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %2, i64 0, i64 0
%29 = bitcast [11 x i8]* %28 to i8**
%30 = load i32, i32* %5
%31 = call i32 @FillGrid(i8** %29, i32 %30)
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %32)
store i32 0, i32* %6
br label %34
34: ; preds = %44, %27
%35 = load i32, i32* %6
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %2, i64 0, i64 %40
%42 = getelementptr inbounds [11 x i8], [11 x i8]* %41, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %34
47: ; preds = %34
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %8
50: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Case %d:\0A\00"
define i32 @main() {
%1 = alloca [10 x [11 x i8]]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %1, i64 0, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %43, label %10
10: ; preds = %0
%11 = bitcast [10 x [11 x i8]]* %1 to i8**
br label %12
12: ; preds = %10, %39
%13 = phi i32 [ 1, %10 ], [ %40, %39 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %12, %17
%18 = phi i64 [ %21, %17 ], [ 0, %12 ]
%19 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %1, i64 0, i64 %18, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %12
%26 = phi i32 [ %15, %12 ], [ %22, %17 ]
%27 = call i32 @FillGrid(i8** %11, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%29 = load i32, i32* %3
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %25, %31
%32 = phi i64 [ %35, %31 ], [ 0, %25 ]
%33 = getelementptr inbounds [10 x [11 x i8]], [10 x [11 x i8]]* %1, i64 0, i64 %32, i64 0
%34 = call i32 @puts(i8* %33)
%35 = add nuw nsw i64 %32, 1
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %35, %37
br i1 %38, label %31, label %39
39: ; preds = %31, %25
%40 = add nuw nsw i32 %13, 1
%41 = load i32, i32* %2
%42 = icmp slt i32 %13, %41
br i1 %42, label %12, label %43
43: ; preds = %39, %0
ret i32 0
}