#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 */
typedef int uint;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int sansaAndXor(void) {
  int numTestCases;
  scanf("%d", &numTestCases);
  while (numTestCases--) {
    int inputLength;
    scanf("%d", &inputLength);
    uint xorSum = 0;
    int isInputLengthOdd = inputLength % 2;
    int isEvenIndex = 1;
    while (inputLength--) {
      uint element;
      scanf("%u", &element);
      if (isInputLengthOdd && isEvenIndex) {
        xorSum ^= element;
      }
      isEvenIndex = !isEvenIndex;
    }
    printf("%u\n", xorSum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<sansaAndXor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     11e3 <sansaAndXor+0xc3>
lea    0xead(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11cf <sansaAndXor+0xaf>
lea    0xe70(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
je     11b9 <sansaAndXor+0x99>
cmpl   $0x0,-0x14(%rbp)
je     11b9 <sansaAndXor+0x99>
mov    -0x18(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <sansaAndXor+0x58>
mov    -0xc(%rbp),%esi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
jmp    1138 <sansaAndXor+0x18>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sansaAndXor>:
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>
subl   $0x1,0x10(%rsp)
jae    1157 <sansaAndXor+0x37>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea5(%rip),%r13
lea    0x14(%rsp),%rbx
xor    %r14d,%r14d
jmp    1185 <sansaAndXor+0x65>
nopl   0x0(%rax,%rax,1)
lea    0xe8f(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
subl   $0x1,0x10(%rsp)
jb     1146 <sansaAndXor+0x26>
lea    0xe74(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r15d
mov    %r15d,%eax
mov    $0x0,%ebp
sub    $0x1,%eax
mov    %eax,0xc(%rsp)
jb     1170 <sansaAndXor+0x50>
xor    %ebp,%ebp
mov    $0x1,%r12d
jmp    11d7 <sansaAndXor+0xb7>
cs nopw 0x0(%rax,%rax,1)
test   $0x1,%r15b
cmove  %r14d,%r12d
xor    %r12d,%ebp
mov    %cl,%al
subl   $0x1,0xc(%rsp)
mov    %eax,%r12d
jb     1170 <sansaAndXor+0x50>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
test   %r12d,%r12d
sete   %cl
je     11c0 <sansaAndXor+0xa0>
mov    0x14(%rsp),%r12d
jmp    11c0 <sansaAndXor+0xa0>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [4 x i8] c"%u\0A\00"
define i32 @sansaAndXor() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %8
8: ; preds = %36, %0
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %39
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
%14 = load i32, i32* %2
%15 = srem i32 %14, 2
store i32 %15, i32* %4
store i32 1, i32* %5
br label %16
16: ; preds = %31, %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, -1
store i32 %18, i32* %2
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %36
20: ; preds = %16
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i32, i32* %3
%30 = xor i32 %29, %28
store i32 %30, i32* %3
br label %31
31: ; preds = %27, %24, %20
%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 %16
36: ; preds = %16
%37 = load i32, i32* %3
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %8
39: ; preds = %8
ret i32 0
}

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