#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 *);
scalar_t__ len(int);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strlen(char *);
int main() {
  char sa[18], sb[18], sc[18];
  int T, a, b, c;
  scanf("%d", &T);
  while (T--) {
    scanf("%s %*c %s %*c %s", sa, sb, sc);
    a = strlen(sa) == len(atoi(sa)) ? atoi(sa) : 0;
    b = strlen(sb) == len(atoi(sb)) ? atoi(sb) : 0;
    c = atoi(sc);
    if (!a) {
      printf("%d + %d = %d\n", c - b, b, c);
    } else if (!b) {
      printf("%d + %d = %d\n", a, c - a, c);
    } else {
      printf("%d + %d = %d\n", a, b, a + b);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0x64(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x64(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x64(%rbp)
cmp    $0x0,%eax
je     12c9 <main+0x179>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x78(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1030 <len@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
cmp    %rcx,%rax
jne    11e0 <main+0x90>
lea    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x7c(%rbp)
jmp    11ea <main+0x9a>
xor    %eax,%eax
mov    %eax,-0x7c(%rbp)
jmp    11ea <main+0x9a>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x88(%rbp)
lea    -0x40(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1030 <len@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
cmp    %rcx,%rax
jne    1237 <main+0xe7>
lea    -0x40(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x8c(%rbp)
jmp    1244 <main+0xf4>
xor    %eax,%eax
mov    %eax,-0x8c(%rbp)
jmp    1244 <main+0xf4>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x60(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x68(%rbp)
jne    1280 <main+0x130>
mov    -0x70(%rbp),%esi
sub    -0x6c(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x70(%rbp),%ecx
lea    0xd9e(%rip),%rdi
call   1050 <printf@plt>
jmp    12c4 <main+0x174>
cmpl   $0x0,-0x6c(%rbp)
jne    12a7 <main+0x157>
mov    -0x68(%rbp),%esi
mov    -0x70(%rbp),%edx
sub    -0x68(%rbp),%edx
mov    -0x70(%rbp),%ecx
lea    0xd77(%rip),%rdi
call   1050 <printf@plt>
jmp    12bf <main+0x16f>
mov    -0x68(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%ecx
add    -0x6c(%rbp),%ecx
lea    0xd5a(%rip),%rdi
call   1050 <printf@plt>
jmp    12c4 <main+0x174>
jmp    1174 <main+0x24>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe9b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1189 <main+0x39>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x50(%rsp),%r15
lea    0x30(%rsp),%r13
lea    0x10(%rsp),%r12
jmp    11cb <main+0x7b>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1070 <atoi@plt>
test   %ebp,%ebp
je     1266 <main+0x116>
mov    %eax,%edx
sub    %ebp,%edx
lea    0xe59(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%ecx
call   1050 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     1178 <main+0x28>
xor    %ebp,%ebp
lea    0xe2f(%rip),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1030 <len@plt>
cmp    %rax,%rbx
jne    120d <main+0xbd>
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1030 <len@plt>
cmp    %rax,%rbx
jne    11a0 <main+0x50>
mov    %r13,%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    %r12,%rdi
call   1070 <atoi@plt>
test   %ebp,%ebp
je     1269 <main+0x119>
test   %r14d,%r14d
je     11b0 <main+0x60>
mov    %r14d,%ecx
add    %ebp,%ecx
lea    0xdb8(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
jmp    11bf <main+0x6f>
xor    %r14d,%r14d
mov    %eax,%esi
sub    %r14d,%esi
lea    0xd9f(%rip),%rdi
mov    %r14d,%edx
jmp    11bd <main+0x6d>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [17 x i8] c"%s %*c %s %*c %s\00"
@.str.2 = [14 x i8] c"%d + %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca [18 x i8]
%4 = alloca [18 x i8]
%5 = alloca i32
%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* %5)
br label %10
10: ; preds = %72, %0
%11 = load i32, i32* %5
%12 = add nsw i32 %11, -1
store i32 %12, i32* %5
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %73
14: ; preds = %10
%15 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 0
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16, i8* %17)
%19 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%20 = call i64 @strlen(i8* %19)
%21 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%22 = call i32 @atoi(i8* %21)
%23 = call i64 @len(i32 %22)
%24 = icmp eq i64 %20, %23
br i1 %24, label %25, label %28
25: ; preds = %14
%26 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%27 = call i32 @atoi(i8* %26)
br label %29
28: ; preds = %14
br label %29
29: ; preds = %28, %25
%30 = phi i32 [ %27, %25 ], [ 0, %28 ]
store i32 %30, i32* %6
%31 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%32 = call i64 @strlen(i8* %31)
%33 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%34 = call i32 @atoi(i8* %33)
%35 = call i64 @len(i32 %34)
%36 = icmp eq i64 %32, %35
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%39 = call i32 @atoi(i8* %38)
br label %41
40: ; preds = %29
br label %41
41: ; preds = %40, %37
%42 = phi i32 [ %39, %37 ], [ 0, %40 ]
store i32 %42, i32* %7
%43 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 0
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %8
%45 = load i32, i32* %6
%46 = icmp ne i32 %45, 0
br i1 %46, label %54, label %47
47: ; preds = %41
%48 = load i32, i32* %8
%49 = load i32, i32* %7
%50 = sub nsw i32 %48, %49
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %50, i32 %51, i32 %52)
br label %72
54: ; preds = %41
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 0
br i1 %56, label %64, label %57
57: ; preds = %54
%58 = load i32, i32* %6
%59 = load i32, i32* %8
%60 = load i32, i32* %6
%61 = sub nsw i32 %59, %60
%62 = load i32, i32* %8
%63 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %58, i32 %61, i32 %62)
br label %71
64: ; preds = %54
%65 = load i32, i32* %6
%66 = load i32, i32* %7
%67 = load i32, i32* %6
%68 = load i32, i32* %7
%69 = add nsw i32 %67, %68
%70 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %65, i32 %66, i32 %69)
br label %71
71: ; preds = %64, %57
br label %72
72: ; preds = %71, %47
br label %10
73: ; preds = %10
ret i32 0
}

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