#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 *, int);
int /*<<< orphan*/ reverse(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int main() {
  int intCmd;
  scanf("%d", &intCmd);
  while (intCmd--) {
    char chNumA[16];
    char chNumB[16];
    char chResult[16];
    int intNumA, intNumB, result;
    scanf("%s %s", chNumA, chNumB);
    intNumA = atoi(chNumA);
    intNumB = atoi(chNumB);
    sprintf(chNumA, "%d", intNumA);
    sprintf(chNumB, "%d", intNumB);
    reverse(chNumA, strlen(chNumA));
    reverse(chNumB, strlen(chNumB));
    intNumA = atoi(chNumA);
    intNumB = atoi(chNumB);
    result = intNumA + intNumB;
    sprintf(chResult, "%d", result);
    reverse(chResult, strlen(chResult));
    printf("%d\n", atoi(chResult));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     128d <main+0x12d>
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x44(%rbp)
lea    -0x30(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x44(%rbp),%edx
lea    0xe2f(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%edx
lea    0xe1c(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x44(%rbp)
lea    -0x30(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x4c(%rbp),%edx
lea    0xdb0(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
lea    -0x40(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%esi
lea    0xd86(%rip),%rdi
call   1050 <printf@plt>
jmp    1181 <main+0x21>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe8b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     126c <main+0x10c>
lea    0x30(%rsp),%r15
lea    0x20(%rsp),%rbx
lea    0xe63(%rip),%r12
lea    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe4c(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1080 <sprintf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <atoi@plt>
add    %eax,%ebp
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1080 <sprintf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %r13,%rdi
call   1070 <atoi@plt>
lea    0xdaf(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    11b0 <main+0x50>
xor    %eax,%eax
add    $0x48,%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"%s %s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %53
14: ; preds = %10
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16)
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %7
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%23 = load i32, i32* %6
%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 [16 x i8], [16 x i8]* %4, i64 0, i64 0
%26 = load i32, i32* %7
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = call i32 @reverse(i8* %28, i32 %30)
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%33 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%34 = call i32 @strlen(i8* %33)
%35 = call i32 @reverse(i8* %32, i32 %34)
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %6
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %7
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = add nsw i32 %40, %41
store i32 %42, i32* %8
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%44 = load i32, i32* %8
%45 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%47 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
%49 = call i32 @reverse(i8* %46, i32 %48)
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%51 = call i32 @atoi(i8* %50)
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %51)
br label %10
53: ; preds = %10
ret i32 0
}

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