#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*/ printf(char *, int, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int T, ncase, k, nim, x, allones;
  scanf("%d", &T);
  for (ncase = 1; ncase <= T; ncase++) {
    scanf("%d", &k);
    nim = 0;
    allones = 1;
    while (k--) {
      scanf("%d", &x);
      if (x != 1)
        allones = 0;
      nim ^= x;
    }
    if (allones)
      nim = !nim;
    printf("Case %d: %s\n", ncase, nim == 0 ? "Bob" : "Alice");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1203 <main+0xe3>
lea    0xea7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     11b3 <main+0x93>
lea    0xe75(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
je     11a5 <main+0x85>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1170 <main+0x50>
cmpl   $0x0,-0x1c(%rbp)
je     11ce <main+0xae>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%ecx
lea    0xe39(%rip),%rdx
lea    0xe2e(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdx
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11ff <main+0xdf>
mov    $0x1,%r14d
lea    0xea9(%rip),%rbx
lea    0xc(%rsp),%rbp
lea    0xeb1(%rip),%r12
lea    0x14(%rsp),%r13
xor    %r15d,%r15d
jmp    118d <main+0x6d>
nopl   (%rax)
lea    0xe8c(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0x1(%r14),%eax
cmp    0x10(%rsp),%r14d
mov    %eax,%r14d
jge    11ff <main+0xdf>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
mov    %r12,%rdx
jb     1170 <main+0x50>
xor    %r12d,%r12d
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x1,%eax
cmovne %r15d,%ebp
xor    %eax,%r12d
subl   $0x1,0xc(%rsp)
jae    11b0 <main+0x90>
xor    %eax,%eax
test   %r12d,%r12d
sete   %al
test   %ebp,%ebp
cmove  %r12d,%eax
test   %eax,%eax
lea    0xe2d(%rip),%r12
mov    %r12,%rdx
lea    0xe1f(%rip),%rax
cmove  %rax,%rdx
lea    0xc(%rsp),%rbp
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%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 = [13 x i8] c"Case %d: %s\0A\00"
@.str.2 = [4 x i8] c"Bob\00"
@.str.3 = [6 x i8] c"Alice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %9
9: ; preds = %43, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %46
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
store i32 1, i32* %7
br label %15
15: ; preds = %24, %13
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
%18 = icmp ne i32 %16, 0
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 0, i32* %7
br label %24
24: ; preds = %23, %19
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = xor i32 %26, %25
store i32 %27, i32* %5
br label %15
28: ; preds = %15
%29 = load i32, i32* %7
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
%35 = zext i1 %34 to i32
store i32 %35, i32* %5
br label %36
36: ; preds = %31, %28
%37 = load i32, i32* %3
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%42 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %37, i8* %41)
br label %43
43: ; preds = %36
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %9
46: ; preds = %9
ret i32 0
}

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