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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0xf(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    0xe46(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0xf(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    11ff <main+0x7f>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <addition@plt>
mov    %eax,%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1343 <main+0x1c3>
lea    -0xf(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1239 <main+0xb9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1090 <subtraction@plt>
mov    %eax,%esi
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    133e <main+0x1be>
lea    -0xf(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1273 <main+0xf3>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <multiplication@plt>
mov    %eax,%esi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1339 <main+0x1b9>
lea    -0xf(%rbp),%rdi
lea    0xd94(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12ca <main+0x14a>
cmpl   $0x0,-0xc(%rbp)
je     12b7 <main+0x137>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <division@plt>
mov    %eax,%esi
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c5 <main+0x145>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1334 <main+0x1b4>
lea    -0xf(%rbp),%rdi
lea    0xd47(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1321 <main+0x1a1>
cmpl   $0x0,-0xc(%rbp)
je     130e <main+0x18e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mod@plt>
mov    %eax,%esi
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    131c <main+0x19c>
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    132f <main+0x1af>
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1334 <main+0x1b4>
jmp    1339 <main+0x1b9>
jmp    133e <main+0x1be>
jmp    1343 <main+0x1c3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe72(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0xe5f(%rip),%rdi
lea    0xd(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1241 <main+0xc1>
lea    0xe2d(%rip),%rsi
lea    0xd(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1250 <main+0xd0>
lea    0xe1b(%rip),%rsi
lea    0xd(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     125f <main+0xdf>
lea    0xe09(%rip),%rsi
lea    0xd(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     126e <main+0xee>
lea    0xdfd(%rip),%rsi
lea    0xd(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1299 <main+0x119>
mov    0x10(%rsp),%esi
test   %esi,%esi
je     1299 <main+0x119>
mov    0x14(%rsp),%edi
call   1030 <mod@plt>
jmp    127f <main+0xff>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
call   1040 <addition@plt>
jmp    127f <main+0xff>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
call   1090 <subtraction@plt>
jmp    127f <main+0xff>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
call   1050 <multiplication@plt>
jmp    127f <main+0xff>
mov    0x10(%rsp),%esi
test   %esi,%esi
je     1299 <main+0x119>
mov    0x14(%rsp),%edi
call   1070 <division@plt>
lea    0xd7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd76(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    128f <main+0x10f>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"add\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 = [6 x i8] c"error\00"
@.str.7 = [4 x i8] c"mod\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 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @addition(i32 %13, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %59
17: ; preds = %0
%18 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = call i32 @subtraction(i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %59
25: ; preds = %17
%26 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = call i32 @multiplication(i32 %29, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %59
33: ; preds = %25
%34 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %33
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %36
%40 = load i32, i32* %1
%41 = call i32 @division(i32 %40, i32 %37)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %59
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %59
45: ; preds = %33
%46 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %45
%49 = load i32, i32* %2
%50 = icmp eq i32 %49, 0
br i1 %50, label %55, label %51
51: ; preds = %48
%52 = load i32, i32* %1
%53 = call i32 @mod(i32 %52, i32 %49)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %53)
br label %59
55: ; preds = %48
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %59
57: ; preds = %45
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %59
59: ; preds = %20, %43, %39, %51, %55, %57, %28, %12
ret i32 0
}