#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 divisor_sum(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(int argc, const char *argv[]) {
  int m, a, b;
  for (scanf("%d", &m); m > 0; m--) {
    scanf("%d%d", &a, &b);
    if (divisor_sum(a) == b && divisor_sum(b) == a)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    11ca <main+0x9a>
lea    0xe97(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%edi
call   1040 <divisor_sum@plt>
cmp    -0x1c(%rbp),%eax
jne    11ab <main+0x7b>
mov    -0x1c(%rbp),%edi
call   1040 <divisor_sum@plt>
cmp    -0x18(%rbp),%eax
jne    11ab <main+0x7b>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    11b7 <main+0x87>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    11bc <main+0x8c>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11c9 <main+0x99>
lea    0xea2(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0xe99(%rip),%r12
lea    0xe8f(%rip),%r13
jmp    1198 <main+0x68>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jle    11c9 <main+0x99>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%edi
call   1040 <divisor_sum@plt>
cmp    0xc(%rsp),%eax
jne    1180 <main+0x50>
mov    %eax,%edi
call   1040 <divisor_sum@plt>
mov    %r12,%rdi
cmp    0x8(%rsp),%eax
jne    1180 <main+0x50>
jmp    1183 <main+0x53>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %2, %23
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%14 = load i32, i32* %4
%15 = call i32 @divisor_sum(i32 %14)
%16 = load i32, i32* %5
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %12
%19 = call i32 @divisor_sum(i32 %15)
%20 = load i32, i32* %4
%21 = icmp eq i32 %19, %20
br i1 %21, label %23, label %22
22: ; preds = %18, %12
br label %23
23: ; preds = %18, %22
%24 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %22 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %18 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = load i32, i32* %3
%27 = add nsw i32 %26, -1
store i32 %27, i32* %3
%28 = icmp sgt i32 %26, 1
br i1 %28, label %12, label %29
29: ; preds = %23, %2
ret i32 0
}