#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 *, ...);
scalar_t__ strcmp(char *, char *);
int main() {
  int chislo1, chislo2, izhod;
  char znak[4];
  scanf("%d", &chislo1);
  scanf("%s", znak);
  scanf("%d", &chislo2);
  if (strcmp(znak, "add") == 0) {
    izhod = chislo1 + chislo2;
    printf("%d", izhod);
  } else {
    if (strcmp(znak, "sub") == 0) {
      izhod = chislo1 - chislo2;
      printf("%d", izhod);
    }
    if (strcmp(znak, "mul") == 0) {
      izhod = chislo1 * chislo2;
      printf("%d", izhod);
    }
    if (strcmp(znak, "div") == 0) {
      if (chislo2 != 0) {
        izhod = chislo1 / chislo2;
        printf("%d", izhod);
      } else {
        printf("error");
      }
    }
    if (strcmp(znak, "mod") == 0) {
      if (chislo2 != 0) {
        izhod = chislo1 % chislo2;
        printf("%d", izhod);
      } else {
        printf("error");
      }
    }
  }
  if (strcmp(znak, "add") != 0 && strcmp(znak, "sub") != 0 &&
      strcmp(znak, "mul") != 0 && strcmp(znak, "div") != 0 &&
      strcmp(znak, "mod") != 0) {
    printf("error");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x14(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe96(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x14(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ae <main+0x7e>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ca <main+0x19a>
lea    -0x14(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e2 <main+0xb2>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1217 <main+0xe7>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    126e <main+0x13e>
cmpl   $0x0,-0xc(%rbp)
je     125b <main+0x12b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1269 <main+0x139>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126e <main+0x13e>
lea    -0x14(%rbp),%rdi
lea    0xda3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12c5 <main+0x195>
cmpl   $0x0,-0xc(%rbp)
je     12b2 <main+0x182>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c0 <main+0x190>
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c5 <main+0x195>
jmp    12ca <main+0x19a>
lea    -0x14(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     135a <main+0x22a>
lea    -0x14(%rbp),%rdi
lea    0xd1b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     135a <main+0x22a>
lea    -0x14(%rbp),%rdi
lea    0xd05(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     135a <main+0x22a>
lea    -0x14(%rbp),%rdi
lea    0xcef(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     135a <main+0x22a>
lea    -0x14(%rbp),%rdi
lea    0xcdf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     135a <main+0x22a>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121a <main+0xea>
lea    0xe79(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11b6 <main+0x86>
mov    0x14(%rsp),%esi
sub    0x10(%rsp),%esi
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe51(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11e3 <main+0xb3>
mov    0x10(%rsp),%esi
imul   0x14(%rsp),%esi
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe28(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1239 <main+0x109>
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
je     122b <main+0xfb>
mov    0x14(%rsp),%eax
cltd
idiv   %ecx
lea    0xdf1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1239 <main+0x109>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
lea    0xdd7(%rip),%rdi
jmp    126b <main+0x13b>
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xddc(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1272 <main+0x142>
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
je     12f8 <main+0x1c8>
mov    0x14(%rsp),%eax
cltd
idiv   %ecx
lea    0xd97(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd8d(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ee <main+0x1be>
lea    0xd7b(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ee <main+0x1be>
lea    0xd69(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ee <main+0x1be>
lea    0xd57(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ee <main+0x1be>
lea    0xd4b(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ee <main+0x1be>
lea    0xd2f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd17(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1272 <main+0x142>

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