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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7(%rbp),%rdx
lea    0xe66(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rcx
call   1080 <scanf@plt>
lea    -0x7(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <main+0x61>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <add@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1325 <main+0x1a5>
lea    -0x7(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    121b <main+0x9b>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10a0 <sub@plt>
mov    %eax,%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1320 <main+0x1a0>
lea    -0x7(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1255 <main+0xd5>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1090 <mul@plt>
mov    %eax,%esi
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    131b <main+0x19b>
lea    -0x7(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12ac <main+0x12c>
cmpl   $0x0,-0x10(%rbp)
je     1299 <main+0x119>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1070 <div@plt>
mov    %eax,%esi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12a7 <main+0x127>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1316 <main+0x196>
lea    -0x7(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1303 <main+0x183>
cmpl   $0x0,-0x10(%rbp)
je     12f0 <main+0x170>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <mod@plt>
mov    %eax,%esi
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12fe <main+0x17e>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1311 <main+0x191>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1316 <main+0x196>
jmp    131b <main+0x19b>
jmp    1320 <main+0x1a0>
jmp    1325 <main+0x1a5>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe64(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x5(%rsp),%rbx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdx
call   1090 <scanf@plt>
lea    0xe4f(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1232 <main+0xa2>
lea    0xe44(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1241 <main+0xb1>
lea    0xe32(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1250 <main+0xc0>
lea    0xe20(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     125f <main+0xcf>
lea    0xe0e(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1288 <main+0xf8>
mov    0x8(%rsp),%esi
test   %esi,%esi
je     1288 <main+0xf8>
mov    0xc(%rsp),%edi
call   1030 <mod@plt>
jmp    1270 <main+0xe0>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <add@plt>
jmp    1270 <main+0xe0>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   10b0 <sub@plt>
jmp    1270 <main+0xe0>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   10a0 <mul@plt>
jmp    1270 <main+0xe0>
mov    0x8(%rsp),%esi
test   %esi,%esi
je     1288 <main+0xf8>
mov    0xc(%rsp),%edi
call   1080 <div@plt>
lea    0xd96(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xd93(%rip),%rdi
call   1050 <puts@plt>
jmp    1280 <main+0xf0>

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