#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 *, long long);
long long reverse_number(long long);
int /*<<< orphan*/ scanf(char *, long long *, ...);
int main() {
  long long int t;
  scanf("%lld", &t);
  while (t--) {
    long long int m = 0, n = 0, revm = 0, revn = 0, answer;
    scanf("%lld%lld", &m, &n);
    revm = reverse_number(m);
    revn = reverse_number(n);
    answer = revn + revm;
    printf("%lld\n", reverse_number(answer));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     11e3 <main+0xb3>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xe6f(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <reverse_number@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <reverse_number@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <reverse_number@plt>
mov    %rax,%rsi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xec0(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subq   $0x1,0x18(%rsp)
jb     11c7 <main+0x97>
lea    0xea1(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xe99(%rip),%r13
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%rdi
call   1030 <reverse_number@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1030 <reverse_number@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1030 <reverse_number@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
subq   $0x1,0x18(%rsp)
jae    1170 <main+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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