#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 /*<<< orphan*/ scanf(char *, int *, char *, int *);
scalar_t__ strcmp(char *, char *);
int main() {
  int a, b, c;
  char ch[3];
  scanf("%d %s %d", &a, ch, &b);
  if (strcmp(ch, "add") == 0) {
    c = a + b;
    printf("%d\n", c);
  } else {
    if (strcmp(ch, "sub") == 0) {
      c = a - b;
      printf("%d\n", c);
    } else {
      if (strcmp(ch, "mul") == 0) {
        c = a * b;
        printf("%d\n", c);
      } else {
        if (b != 0)
          if (strcmp(ch, "div") == 0) {
            c = a / b;
            printf("%d\n", c);
          } else {
            if (strcmp(ch, "mod") == 0) {
              c = a % b;
              printf("%d\n", c);
            } else
              printf("error\n");
          }
        else
          printf("error\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x13(%rbp),%rdx
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
lea    -0x13(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1190 <main+0x60>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b6 <main+0x186>
lea    -0x13(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c9 <main+0x99>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b1 <main+0x181>
lea    -0x13(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1203 <main+0xd3>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x17c>
cmpl   $0x0,-0xc(%rbp)
je     1299 <main+0x169>
lea    -0x13(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1247 <main+0x117>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1294 <main+0x164>
lea    -0x13(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1281 <main+0x151>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128f <main+0x15f>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1294 <main+0x164>
jmp    12a7 <main+0x177>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x17c>
jmp    12b1 <main+0x181>
jmp    12b6 <main+0x186>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x9(%rsp),%rbx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdx
call   1060 <scanf@plt>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e4 <main+0xa4>
lea    0xe93(%rip),%rsi
lea    0x9(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ee <main+0xae>
lea    0xe81(%rip),%rsi
lea    0x9(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11f8 <main+0xb8>
cmpl   $0x0,0x4(%rsp)
je     11d6 <main+0x96>
lea    0xe68(%rip),%rsi
lea    0x9(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1217 <main+0xd7>
lea    0xe56(%rip),%rsi
lea    0x9(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     122b <main+0xeb>
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
jmp    120f <main+0xcf>
mov    0x4(%rsp),%esi
add    0xc(%rsp),%esi
jmp    1201 <main+0xc1>
mov    0xc(%rsp),%esi
sub    0x4(%rsp),%esi
jmp    1201 <main+0xc1>
mov    0x4(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xe05(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0xc(%rsp),%eax
cltd
idivl  0x4(%rsp)
lea    0xde6(%rip),%rdi
mov    %eax,%esi
jmp    1208 <main+0xc8>
mov    0xc(%rsp),%eax
cltd
idivl  0x4(%rsp)
lea    0xdd2(%rip),%rdi
mov    %edx,%esi
jmp    1208 <main+0xc8>

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

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