#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*/ findCases(int, int, int **);
int goodSudoku(int, int, int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, i, j;
  int grid[9][9];
  scanf("%d", &t);
  while (t--) {
    for (i = 0; i < 9; i++)
      for (j = 0; j < 9; j++)
        scanf("%d", &grid[i][j]);
    printf("\n");
    if (goodSudoku(9, 9, grid) == 1)
      printf("Serendipity\n");
    else
      findCases(9, 9, grid);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1233 <main+0xf3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11e2 <main+0xa2>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11cf <main+0x8f>
movslq -0xc(%rbp),%rax
lea    -0x160(%rbp),%rsi
imul   $0x24,%rax,%rax
add    %rax,%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe44(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118e <main+0x4e>
jmp    11d4 <main+0x94>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x3d>
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdx
mov    $0x9,%esi
mov    %esi,%edi
call   1040 <goodSudoku@plt>
cmp    $0x1,%eax
jne    121b <main+0xdb>
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0xee>
lea    -0x160(%rbp),%rdx
mov    $0x9,%esi
mov    %esi,%edi
call   1060 <findCases@plt>
jmp    1162 <main+0x22>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x160,%rsp
lea    0xe99(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    118b <main+0x3b>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %r13d,%r13d
lea    0xe6b(%rip),%r12
lea    0x10(%rsp),%r14
lea    0xe62(%rip),%r15
jmp    11cf <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x9,%edi
mov    $0x9,%esi
mov    %r14,%rdx
call   1070 <findCases@plt>
subl   $0x1,0xc(%rsp)
mov    $0x0,%r13d
jb     1178 <main+0x28>
lea    0x0(,%r13,8),%rbx
add    %r13,%rbx
lea    (%rsp,%rbx,4),%rsi
add    $0x10,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x14,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x18,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x1c,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x20,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x24,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x28,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x2c,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,4),%rsi
add    $0x30,%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
add    $0x1,%r13
cmp    $0x9,%r13
jne    11cf <main+0x7f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
mov    $0x9,%esi
mov    %r14,%rdx
call   1050 <goodSudoku@plt>
cmp    $0x1,%eax
jne    11b0 <main+0x60>
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    11c2 <main+0x72>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [12 x i8] c"Serendipity\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x [9 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [9 x [9 x i32]]* %2 to i8*
%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 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %47, label %9
9: ; preds = %0
%10 = bitcast [9 x [9 x i32]]* %2 to i32**
br label %11
11: ; preds = %33, %9
%12 = phi i64 [ 0, %9 ], [ %34, %33 ]
%13 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 1
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 2
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 3
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 4
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 5
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 6
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 7
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %27)
%29 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %2, i64 0, i64 %12, i64 8
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
%31 = add nuw nsw i64 %12, 1
%32 = icmp eq i64 %31, 9
br i1 %32, label %35, label %33
33: ; preds = %11, %43
%34 = phi i64 [ %31, %11 ], [ 0, %43 ]
br label %11
35: ; preds = %11
%36 = call i32 @putchar(i32 10)
%37 = call i32 @goodSudoku(i32 9, i32 9, i32** %10)
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %43
41: ; preds = %35
%42 = call i32 @findCases(i32 9, i32 9, i32** %10)
br label %43
43: ; preds = %41, %39
%44 = load i32, i32* %1
%45 = add nsw i32 %44, -1
store i32 %45, i32* %1
%46 = icmp eq i32 %44, 0
br i1 %46, label %47, label %33
47: ; preds = %43, %0
ret i32 0
}