#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*/ *gets(char *);
int /*<<< orphan*/ memset(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ printBoard(int **);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ reconstructInitBoard(int **, char *);
int main(void) {
  int gameBoard[3][3], caseId;
  char line[300 + 2];
  caseId = 1;
  while (gets(line) != NULL) {
    memset(gameBoard, 0, 3 * 3 * sizeof(int));
    reconstructInitBoard(gameBoard, line);
    printf("Case #%d:\n", caseId);
    printBoard(gameBoard);
    caseId++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
lea    -0x170(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     11c5 <main+0x75>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rdi
lea    -0x170(%rbp),%rsi
call   1070 <reconstructInitBoard@plt>
mov    -0x34(%rbp),%esi
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <printBoard@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1169 <main+0x19>
xor    %eax,%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x168,%rsp
lea    0x30(%rsp),%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     11cc <main+0x7c>
mov    $0x1,%ebx
mov    %rsp,%r14
lea    0x30(%rsp),%r15
lea    0xe7f(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <reconstructInitBoard@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <printBoard@plt>
add    $0x1,%ebx
mov    %r15,%rdi
call   1060 <gets@plt>
test   %rax,%rax
jne    1190 <main+0x40>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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