#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 ch16(char *);
int /*<<< orphan*/ ch2(int, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int x, y, i, n;
  char c, c1[14], c2[14];
  scanf("%d", &n);
  while (n-- > 0) {
    scanf("%s %c %s", c1, &c, c2);
    x = ch16(c1);
    y = ch16(c2);
    ch2(x, c1);
    printf(" %c ", c);
    ch2(y, c2);
    if (c == '+')
      printf(" = %d\n", x + y);
    else
      printf(" = %d\n", x - y);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%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
jle    120a <main+0xca>
lea    -0x23(%rbp),%rsi
lea    -0x31(%rbp),%rcx
lea    0xe7f(%rip),%rdi
lea    -0x15(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x23(%rbp),%rdi
call   1030 <ch16@plt>
mov    %eax,-0x8(%rbp)
lea    -0x31(%rbp),%rdi
call   1030 <ch16@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x23(%rbp),%rsi
call   1050 <ch2@plt>
movsbl -0x15(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x31(%rbp),%rsi
call   1050 <ch2@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x2b,%eax
jne    11f3 <main+0xb3>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
jmp    1205 <main+0xc5>
mov    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
jmp    1161 <main+0x21>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jle    120a <main+0xca>
lea    0x1a(%rsp),%r12
lea    0xc(%rsp),%rbx
lea    0xe87(%rip),%r13
lea    0xe85(%rip),%rbp
nopl   0x0(%rax)
lea    0xe6c(%rip),%rdi
mov    %r12,%rsi
lea    0x7(%rsp),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r12,%rdi
call   1030 <ch16@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <ch16@plt>
mov    %eax,%r15d
mov    %r14d,%edi
mov    %r12,%rsi
call   1050 <ch2@plt>
movsbl 0x7(%rsp),%esi
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1050 <ch2@plt>
mov    %r15d,%esi
neg    %esi
cmpb   $0x2b,0x7(%rsp)
cmove  %r15d,%esi
add    %r14d,%esi
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jg     1190 <main+0x50>
xor    %eax,%eax
add    $0x28,%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 = [9 x i8] c"%s %c %s\00"
@.str.2 = [5 x i8] c" %c \00"
@.str.3 = [7 x i8] c" = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca [14 x i8]
%8 = alloca [14 x i8]
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 = %44, %0
%11 = load i32, i32* %5
%12 = add nsw i32 %11, -1
store i32 %12, i32* %5
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %45
14: ; preds = %10
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %8, i64 0, i64 0
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %6, i8* %16)
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %7, i64 0, i64 0
%19 = call i32 @ch16(i8* %18)
store i32 %19, i32* %2
%20 = getelementptr inbounds [14 x i8], [14 x i8]* %8, i64 0, i64 0
%21 = call i32 @ch16(i8* %20)
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = getelementptr inbounds [14 x i8], [14 x i8]* %7, i64 0, i64 0
%24 = call i32 @ch2(i32 %22, i8* %23)
%25 = load i8, i8* %6
%26 = sext i8 %25 to i32
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %3
%29 = getelementptr inbounds [14 x i8], [14 x i8]* %8, i64 0, i64 0
%30 = call i32 @ch2(i32 %28, i8* %29)
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 43
br i1 %33, label %34, label %39
34: ; preds = %14
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = add nsw i32 %35, %36
%38 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %44
39: ; preds = %14
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = sub nsw i32 %40, %41
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %39, %34
br label %10
45: ; preds = %10
ret i32 0
}

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