#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*/ add_two_string(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strip_leading_zeros(char *);
int /*<<< orphan*/ strip_trailing_zeros(char *);
int main() {
  int num_cases;
  char op1[256], op2[256], out[256];
  scanf("%d\n", &num_cases);
  while (num_cases-- > 0) {
    scanf("%s %s\n", &op1[0], &op2[0]);
    strip_trailing_zeros(op1);
    strip_trailing_zeros(op2);
    add_two_string(op1, op2, out);
    strip_leading_zeros(out);
    printf("%s\n", out);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x310,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11fa <main+0xaa>
lea    -0x110(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <strip_trailing_zeros@plt>
lea    -0x210(%rbp),%rdi
call   1060 <strip_trailing_zeros@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
lea    -0x310(%rbp),%rdx
call   1050 <add_two_string@plt>
lea    -0x310(%rbp),%rdi
call   1030 <strip_leading_zeros@plt>
lea    -0x310(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1040 <printf@plt>
jmp    1174 <main+0x24>
xor    %eax,%eax
add    $0x310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x310,%rsp
lea    0xe99(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    1200 <main+0xb0>
lea    0xe7b(%rip),%r14
lea    0x210(%rsp),%r15
lea    0x110(%rsp),%r12
lea    0x10(%rsp),%rbx
lea    0xe62(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r15,%rdi
call   1060 <strip_trailing_zeros@plt>
mov    %r12,%rdi
call   1060 <strip_trailing_zeros@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <add_two_string@plt>
mov    %rbx,%rdi
call   1030 <strip_leading_zeros@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jg     11b0 <main+0x60>
xor    %eax,%eax
add    $0x310,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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