#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, char *, int *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int a, b;
  char c, d;
  for (;;) {
    system("clear");
    scanf("%d%c%d%c", &a, &c, &b, &d);
    if (c == '+')
      c = '-';
    else if (c == '-')
      c = '+';
    else
      printf("error\n");
    if (c == '+' || c == '-')
      printf("%d%c%d%c\n", a, c, b, d);
    getchar();
    getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <system@plt>
lea    0xe9d(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x19(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1a(%rbp),%r8
call   1060 <scanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x2b,%eax
jne    1194 <main+0x54>
movb   $0x2d,-0x19(%rbp)
jmp    11bd <main+0x7d>
movsbl -0x19(%rbp),%eax
cmp    $0x2d,%eax
jne    11aa <main+0x6a>
movb   $0x2b,-0x19(%rbp)
jmp    11b8 <main+0x78>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bd <main+0x7d>
movsbl -0x19(%rbp),%eax
cmp    $0x2b,%eax
je     11d7 <main+0x97>
movsbl -0x19(%rbp),%eax
cmp    $0x2d,%eax
jne    11f4 <main+0xb4>
mov    -0x14(%rbp),%esi
movsbl -0x19(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsbl -0x1a(%rbp),%r8d
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    1156 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9b(%rip),%r14
lea    0xe9a(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xe(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xf(%rsp),%rbp
jmp    11c4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2b,0xe(%rsp)
mov    $0x2b,%al
movzbl %al,%edx
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ecx
movsbl 0xf(%rsp),%r8d
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1070 <scanf@plt>
movzbl 0xe(%rsp),%eax
cmp    $0x2d,%al
je     1190 <main+0x40>
cmp    $0x2b,%al
jne    1200 <main+0xb0>
movb   $0x2d,0xe(%rsp)
mov    $0x2d,%al
jmp    1197 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
movzbl 0xe(%rsp),%eax
cmp    $0x2d,%al
je     1197 <main+0x47>
cmp    $0x2b,%al
je     1197 <main+0x47>
jmp    11b6 <main+0x66>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [9 x i8] c"%d%c%d%c\00"
@.str.2 = [7 x i8] c"error\0A\00"
@.str.3 = [10 x i8] c"%d%c%d%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %41, %2
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %6, i8* %8, i32* %7, i8* %9)
%13 = load i8, i8* %8
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 43
br i1 %15, label %16, label %17
16: ; preds = %10
store i8 45, i8* %8
br label %25
17: ; preds = %10
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %22
21: ; preds = %17
store i8 43, i8* %8
br label %24
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %21
br label %25
25: ; preds = %24, %16
%26 = load i8, i8* %8
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 43
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load i8, i8* %8
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 45
br i1 %32, label %33, label %41
33: ; preds = %29, %25
%34 = load i32, i32* %6
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = load i32, i32* %7
%38 = load i8, i8* %9
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %34, i32 %36, i32 %37, i32 %39)
br label %41
41: ; preds = %33, %29
%42 = call i32 (...) @getchar()
%43 = call i32 (...) @getchar()
br label %10
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [9 x i8] c"%d%c%d%c\00"
@.str.3 = [10 x i8] c"%d%c%d%c\0A\00"
@str = [6 x i8] c"error\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
br label %9
9: ; preds = %26, %2
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3, i8* %5, i32* %4, i8* %6)
%12 = load i8, i8* %5
switch i8 %12, label %15 [
i8 43, label %13
i8 45, label %14
]
13: ; preds = %9
store i8 45, i8* %5
br label %18
14: ; preds = %9
store i8 43, i8* %5
br label %18
15: ; preds = %9
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%17 = load i8, i8* %5
switch i8 %17, label %26 [
i8 45, label %18
i8 43, label %18
]
18: ; preds = %13, %14, %15, %15
%19 = phi i8 [ %17, %15 ], [ %17, %15 ], [ 45, %13 ], [ 43, %14 ]
%20 = zext i8 %19 to i32
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %20, i32 %22, i32 %24)
br label %26
26: ; preds = %15, %18
%27 = call i32 (...) @getchar()
%28 = call i32 (...) @getchar()
br label %9
}