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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
je     1213 <main+0xd3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    120e <main+0xce>
lea    0xe75(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
call   1030 <reverse@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <reverse@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <reverse@plt>
mov    -0x28(%rbp),%rcx
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
add    %rdx,%rcx
cmp    %rcx,%rax
jne    11ed <main+0xad>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fb <main+0xbb>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <main+0xc0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <main+0x38>
jmp    114f <main+0xf>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
jne    1184 <main+0x34>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe75(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
jmp    11bf <main+0x6f>
nopw   0x0(%rax,%rax,1)
lea    0xe5b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e2e(%rip),%rcx
cmp    (%rcx),%rax
je     117d <main+0x2d>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <main+0x50>
xor    %r13d,%r13d
jmp    11e7 <main+0x97>
nopl   0x0(%rax,%rax,1)
lea    0xe32(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jge    11a0 <main+0x50>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%edi
add    0x14(%rsp),%edi
call   1030 <reverse@plt>
mov    %rax,%rbp
mov    0x14(%rsp),%edi
call   1030 <reverse@plt>
mov    %rax,%r12
mov    0x10(%rsp),%edi
call   1030 <reverse@plt>
add    %r12,%rax
cmp    %rax,%rbp
jne    11d0 <main+0x80>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
lea    0xdd2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11dc <main+0x8c>

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 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = call i64 @reverse(i32 %19)
%21 = load i32, i32* %2
%22 = call i64 @reverse(i32 %21)
%23 = load i32, i32* %3
%24 = call i64 @reverse(i32 %23)
%25 = add nsw i64 %22, %24
%26 = icmp eq i64 %20, %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
%40 = call i32 @exit(i32 0)
unreachable
}

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 = load i32, i32* %2
%22 = add nsw i32 %21, %20
%23 = call i64 @reverse(i32 %22)
%24 = load i32, i32* %1
%25 = call i64 @reverse(i32 %24)
%26 = load i32, i32* %2
%27 = call i64 @reverse(i32 %26)
%28 = add nsw i64 %27, %25
%29 = icmp eq i64 %23, %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
%42 = call i32 @exit(i32 0)
unreachable
}