#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 */
scalar_t__ EOF;
scalar_t__ Reverse(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, ...);
int main() {
  int a, b, n, i;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d%d", &a, &b);
      if (Reverse(a) + Reverse(b) == Reverse(a + b))
        printf("%d\n", a + b);
      else
        printf("NO\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
je     1206 <main+0xd6>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1201 <main+0xd1>
lea    0xe85(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <Reverse@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <Reverse@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
call   1050 <Reverse@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    11e0 <main+0xb0>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <main+0xbe>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <main+0xc3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <main+0x38>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x30,%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    0xead(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <main+0x3e>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7b(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
jmp    11bf <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe5b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e2e(%rip),%rcx
cmp    (%rcx),%rax
je     116d <main+0x2d>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <main+0x60>
xor    %r13d,%r13d
jmp    11e7 <main+0xa7>
nopl   0x0(%rax,%rax,1)
lea    0xe32(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jge    11a0 <main+0x60>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%edi
call   1060 <Reverse@plt>
mov    %rax,%rbp
mov    0x10(%rsp),%edi
call   1060 <Reverse@plt>
mov    %rax,%r12
add    %rbp,%r12
mov    0x10(%rsp),%edi
add    0x14(%rsp),%edi
call   1060 <Reverse@plt>
cmp    %rax,%r12
jne    11d0 <main+0x90>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
lea    0xdd2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11dc <main+0x9c>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [3 x i8] c"NO\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 i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %41, label %14
10: ; preds = %37, %14
%11 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %41, label %14
14: ; preds = %0, %10
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %10
17: ; preds = %14, %37
%18 = phi i32 [ %38, %37 ], [ 0, %14 ]
%19 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%20 = load i32, i32* %1
%21 = call i64 @Reverse(i32 %20)
%22 = load i32, i32* %2
%23 = call i64 @Reverse(i32 %22)
%24 = add nsw i64 %23, %21
%25 = load i32, i32* %1
%26 = load i32, i32* %2
%27 = add nsw i32 %26, %25
%28 = call i64 @Reverse(i32 %27)
%29 = icmp eq i64 %24, %28
br i1 %29, label %30, label %35
30: ; preds = %17
%31 = load i32, i32* %1
%32 = load i32, i32* %2
%33 = add nsw i32 %32, %31
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %37
35: ; preds = %17
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %37
37: ; preds = %30, %35
%38 = add nuw nsw i32 %18, 1
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %17, label %10
41: ; preds = %10, %0
ret i32 0
}