#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 *, int);
int revnum(int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int rev = 0, a, b, c, rev1, rev2, rev3, N, j;
  int arr[10000];
  scanf("%d", &N);
  for (j = 0; j < N; j++) {
    scanf("%d%d", &a, &b);
    rev1 = revnum(a);
    rev2 = revnum(b);
    c = rev1 + rev2;
    rev3 = revnum(c);
    arr[j] = rev3;
  }
  for (j = 0; j < N; j++)
    printf("\n%d", arr[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11ca <main+0x9a>
lea    0xe8b(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1040 <revnum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <revnum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <revnum@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x9c70(%rbp,%rax,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1162 <main+0x32>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1202 <main+0xd2>
movslq -0x28(%rbp),%rax
mov    -0x9c70(%rbp,%rax,4),%esi
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d1 <main+0xa1>
xor    %eax,%eax
add    $0x9c70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x9c50,%rsp
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11da <main+0xaa>
lea    0xe9c(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <revnum@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%edi
call   1040 <revnum@plt>
add    %eax,%ebp
mov    %ebp,%edi
call   1040 <revnum@plt>
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1170 <main+0x40>
test   %eax,%eax
jle    11da <main+0xaa>
xor    %ebp,%ebp
lea    0xe49(%rip),%rbx
nopl   0x0(%rax)
mov    0x10(%rsp,%rbp,4),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jl     11c0 <main+0x90>
xor    %eax,%eax
add    $0x9c50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10000 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [10000 x i32]* %4 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 %14, label %37
12: ; preds = %14
%13 = icmp sgt i32 %25, 0
br i1 %13, label %28, label %37
14: ; preds = %0, %14
%15 = phi i64 [ %24, %14 ], [ 0, %0 ]
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%17 = load i32, i32* %1
%18 = call i32 @revnum(i32 %17)
%19 = load i32, i32* %2
%20 = call i32 @revnum(i32 %19)
%21 = add nsw i32 %20, %18
%22 = call i32 @revnum(i32 %21)
%23 = getelementptr inbounds [10000 x i32], [10000 x i32]* %4, i64 0, i64 %15
store i32 %22, i32* %23
%24 = add nuw nsw i64 %15, 1
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %14, label %12
28: ; preds = %12, %28
%29 = phi i64 [ %33, %28 ], [ 0, %12 ]
%30 = getelementptr inbounds [10000 x i32], [10000 x i32]* %4, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i64 %29, 1
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = icmp slt i64 %33, %35
br i1 %36, label %28, label %37
37: ; preds = %28, %0, %12
ret i32 0
}