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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe82(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11a6 <main+0x76>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1397 <main+0x267>
lea    -0x110(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0xc(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11f1 <main+0xc1>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1392 <main+0x262>
lea    -0x110(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0xc(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     123c <main+0x10c>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    138d <main+0x25d>
lea    -0x110(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1277 <main+0x147>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1388 <main+0x258>
lea    -0x110(%rbp),%rdi
lea    0xd98(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12b2 <main+0x182>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1383 <main+0x253>
lea    -0x110(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12ee <main+0x1be>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137e <main+0x24e>
lea    -0x110(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    132a <main+0x1fa>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1379 <main+0x249>
lea    -0x110(%rbp),%rdi
lea    0xcd9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1366 <main+0x236>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xcbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <main+0x244>
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1379 <main+0x249>
jmp    137e <main+0x24e>
jmp    1383 <main+0x253>
jmp    1388 <main+0x258>
jmp    138d <main+0x25d>
jmp    1392 <main+0x262>
jmp    1397 <main+0x267>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb1(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe9e(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a8 <main+0x78>
mov    0x10(%rsp),%ecx
mov    0x8(%rsp),%esi
cmp    $0x766964,%ecx
jne    119c <main+0x6c>
test   %esi,%esi
je     11a8 <main+0x78>
cmp    $0x646f6d,%ecx
jne    11bf <main+0x8f>
test   %esi,%esi
jne    11bf <main+0x8f>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
ret
cmp    $0x627573,%ecx
je     11db <main+0xab>
cmp    $0x6c756d,%ecx
je     11df <main+0xaf>
cmp    $0x646461,%ecx
jne    11eb <main+0xbb>
add    %eax,%esi
jmp    11e2 <main+0xb2>
sub    %esi,%eax
jmp    11f6 <main+0xc6>
imul   %eax,%esi
lea    0xe1d(%rip),%rdi
jmp    11ff <main+0xcf>
cmp    $0x766964,%ecx
jne    1208 <main+0xd8>
cltd
idiv   %esi
lea    0xe09(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b4 <main+0x84>
cmp    $0x646f6d,%ecx
jne    11a8 <main+0x78>
cltd
idiv   %esi
lea    0xdec(%rip),%rdi
mov    %edx,%esi
jmp    11ff <main+0xcf>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"error\0A\00"
@.str.3 = [4 x i8] c"div\00"
@.str.4 = [4 x i8] c"mod\00"
@.str.5 = [4 x i8] c"add\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [4 x i8] c"sub\00"
@.str.8 = [4 x i8] c"mul\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [255 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %99
14: ; preds = %0
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = and i32 %19, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %14
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %98
27: ; preds = %14
%28 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = and i32 %32, %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %27
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %97
40: ; preds = %27
%41 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %50, label %44
44: ; preds = %40
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = add nsw 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.6, i64 0, i64 0), i32 %48)
br label %96
50: ; preds = %40
%51 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %60, label %54
54: ; preds = %50
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = sub nsw 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.6, i64 0, i64 0), i32 %58)
br label %95
60: ; preds = %50
%61 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%62 = call i32 @strcmp(i8* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %70, label %64
64: ; preds = %60
%65 = load i32, i32* %2
%66 = load i32, i32* %3
%67 = mul nsw i32 %65, %66
store i32 %67, i32* %4
%68 = load i32, i32* %4
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %68)
br label %94
70: ; preds = %60
%71 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%72 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%73 = icmp ne i32 %72, 0
br i1 %73, label %80, label %74
74: ; preds = %70
%75 = load i32, i32* %2
%76 = load i32, i32* %3
%77 = sdiv i32 %75, %76
store i32 %77, i32* %4
%78 = load i32, i32* %4
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %78)
br label %93
80: ; preds = %70
%81 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%82 = call i32 @strcmp(i8* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%83 = icmp ne i32 %82, 0
br i1 %83, label %90, label %84
84: ; preds = %80
%85 = load i32, i32* %2
%86 = load i32, i32* %3
%87 = srem i32 %85, %86
store i32 %87, i32* %4
%88 = load i32, i32* %4
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %88)
br label %92
90: ; preds = %80
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %92
92: ; preds = %90, %84
br label %93
93: ; preds = %92, %74
br label %94
94: ; preds = %93, %64
br label %95
95: ; preds = %94, %54
br label %96
96: ; preds = %95, %44
br label %97
97: ; preds = %96, %38
br label %98
98: ; preds = %97, %25
br label %99
99: ; preds = %98, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@str.11 = [6 x i8] c"error\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [255 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = getelementptr inbounds [255 x i8], [255 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 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
br label %48
14: ; preds = %0
%15 = bitcast [255 x i8]* %3 to i32*
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 7760228
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 0
%20 = and i1 %17, %19
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
br label %48
23: ; preds = %14
%24 = icmp eq i32 %16, 6582125
%25 = and i1 %24, %19
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
br label %48
28: ; preds = %23
switch i32 %16, label %38 [
i32 6579297, label %29
i32 6452595, label %32
i32 7107949, label %35
]
29: ; preds = %28
%30 = add nsw i32 %18, %10
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %30)
br label %48
32: ; preds = %28
%33 = sub nsw i32 %10, %18
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %33)
br label %48
35: ; preds = %28
%36 = mul nsw i32 %18, %10
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %36)
br label %48
38: ; preds = %28
br i1 %17, label %39, label %42
39: ; preds = %38
%40 = sdiv i32 %10, %18
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %40)
br label %48
42: ; preds = %38
br i1 %24, label %43, label %46
43: ; preds = %42
%44 = srem i32 %10, %18
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %44)
br label %48
46: ; preds = %42
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
br label %48
48: ; preds = %21, %29, %35, %43, %46, %39, %32, %26, %12
ret i32 0
}