#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 *, unsigned int);
int /*<<< orphan*/ scanf(char *, unsigned int *, ...);
int main(void) {
  unsigned int m, n, j, k, g;
  scanf("%d\n", &m);
  for (j = 0; j < m; j++) {
    scanf("%u %u\n", &n, &k);
    g = (k >> 1) ^ k;
    printf("%d\n", g);
  }
  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
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1193 <main+0x73>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
shr    $0x1,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     118b <main+0x6b>
lea    0xeb7(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xea2(%rip),%rbx
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%esi
shr    %esi
xor    %eax,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jb     1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [7 x i8] c"%u %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %8
8: ; preds = %20, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %5)
%14 = load i32, i32* %5
%15 = lshr i32 %14, 1
%16 = load i32, i32* %5
%17 = xor i32 %15, %16
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %4
%22 = add i32 %21, 1
store i32 %22, i32* %4
br label %8
23: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [7 x i8] c"%u %u\0A\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 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %0, %10
%11 = phi i32 [ %17, %10 ], [ 0, %0 ]
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = lshr i32 %13, 1
%15 = xor i32 %14, %13
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = add nuw i32 %11, 1
%18 = load i32, i32* %1
%19 = icmp ult i32 %17, %18
br i1 %19, label %10, label %20
20: ; preds = %10, %0
ret i32 0
}