#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int max, i;
  scanf("%d", &max);
  for (i = 0; i < max; i++) {
    int a, b;
    char znak;
    scanf("%d %c %d", &a, &znak, &b);
    if (znak == '+')
      printf("%d\n", a + b);
    if (znak == '-')
      printf("%d\n", a - b);
    if (znak == '*')
      printf("%d\n", a * b);
    if (znak == '/')
      printf("%d\n", a / b);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1201 <main+0xe1>
lea    0xea5(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x15(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x2b,%eax
jne    118d <main+0x6d>
mov    -0x10(%rbp),%esi
add    -0x14(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x2d,%eax
jne    11ac <main+0x8c>
mov    -0x10(%rbp),%esi
sub    -0x14(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x2a,%eax
jne    11cc <main+0xac>
mov    -0x10(%rbp),%esi
imul   -0x14(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x2f,%eax
jne    11ee <main+0xce>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%esi
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
jmp    11f3 <main+0xd3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x28>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed1(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    1218 <main+0xf8>
lea    0xead(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xb(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0xea0(%rip),%rbx
xor    %ebp,%ebp
jmp    117d <main+0x5d>
nopl   (%rax)
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
jge    1218 <main+0xf8>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0xb(%rsp),%eax
cmp    $0x2b,%al
je     11b0 <main+0x90>
cmp    $0x2d,%al
je     11c9 <main+0xa9>
cmp    $0x2a,%al
je     11e2 <main+0xc2>
cmp    $0x2f,%al
jne    1170 <main+0x50>
jmp    1200 <main+0xe0>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
add    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movzbl 0xb(%rsp),%eax
cmp    $0x2d,%al
jne    119d <main+0x7d>
mov    0x10(%rsp),%esi
sub    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movzbl 0xb(%rsp),%eax
cmp    $0x2a,%al
jne    11a1 <main+0x81>
mov    0xc(%rsp),%esi
imul   0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movzbl 0xb(%rsp),%eax
cmp    $0x2f,%al
jne    1170 <main+0x50>
mov    0x10(%rsp),%eax
cltd
idivl  0xc(%rsp)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%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"%d %c %d\00"
@.str.2 = [4 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
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %53
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i8* %6, i32* %5)
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %18, %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %17, %12
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = sub nsw i32 %27, %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %26, %22
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 42
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = mul nsw i32 %36, %37
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %35, %31
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 47
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i32, i32* %4
%46 = load i32, i32* %5
%47 = sdiv i32 %45, %46
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %44, %40
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %8
53: ; preds = %8
%54 = load i32, i32* %1
ret i32 %54
}

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