#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char const *argv[]) {
  int t, a, b, r;
  char A[100], B[100];
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d", &a, &b);
    sprintf(A, "%d", a);
    sprintf(B, "%d", b);
    reverse(A, strlen(A));
    reverse(B, strlen(B));
    a = atoi(A);
    b = atoi(B);
    r = a + b;
    sprintf(A, "%d", r);
    reverse(A, strlen(A));
    printf("%s\n", A);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     12ae <main+0x14e>
lea    0xe5a(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe3d(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe27(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x118(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x110(%rbp)
lea    -0x100(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x110(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x90(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    -0x100(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xd9a(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x108(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x90(%rbp),%rsi
lea    0xd62(%rip),%rdi
call   1050 <printf@plt>
jmp    118b <main+0x2b>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xe8b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     125c <main+0xfc>
lea    0x4(%rsp),%r12
lea    0xe68(%rip),%r13
lea    0x80(%rsp),%rbx
lea    0x10(%rsp),%rbp
lea    0xe57(%rip),%r14
nop
lea    0xe49(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <sprintf@plt>
mov    0x4(%rsp),%edx
mov    %rbp,%rdi
mov    %r13,%rsi
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    %eax,0x8(%rsp)
mov    %rbp,%rdi
call   1070 <atoi@plt>
mov    %eax,0x4(%rsp)
add    %eax,%r15d
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15d,%edx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    11b0 <main+0x50>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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