#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 chislo1, chislo2, res, f = 0;
  char act[4];
  scanf("%d %s %d", &chislo1, act, &chislo2);
  if (chislo2 == 0) {
    f = 1;
  }
  if (strcmp(act, "add") == 0) {
    res = chislo1 + chislo2;
    printf("%d", res);
  } else if (strcmp(act, "sub") == 0) {
    res = chislo1 - chislo2;
    printf("%d", res);
  } else if (strcmp(act, "mul") == 0) {
    res = chislo1 * chislo2;
    printf("%d", res);
  } else if (strcmp(act, "div") == 0) {
    if (f == 1) {
      printf("error");
    } else {
      res = chislo1 / chislo2;
      printf("%d", res);
    }
  } else if (strcmp(act, "mod") == 0) {
    if (f == 1) {
      printf("error");
    } else {
      res = chislo1 % chislo2;
      printf("%d", res);
    }
  } else {
    printf("error");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x18(%rbp),%rdx
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    116f <main+0x3f>
movl   $0x1,-0x14(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a8 <main+0x78>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12eb <main+0x1bb>
lea    -0x18(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e1 <main+0xb1>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e6 <main+0x1b6>
lea    -0x18(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    121b <main+0xeb>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <main+0x1b1>
lea    -0x18(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1272 <main+0x142>
cmpl   $0x1,-0x14(%rbp)
jne    1252 <main+0x122>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126d <main+0x13d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <main+0x1ac>
lea    -0x18(%rbp),%rdi
lea    0xda2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12c9 <main+0x199>
cmpl   $0x1,-0x14(%rbp)
jne    12a9 <main+0x179>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c4 <main+0x194>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1a7>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <main+0x1ac>
jmp    12e1 <main+0x1b1>
jmp    12e6 <main+0x1b6>
jmp    12eb <main+0x1bb>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xec3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rbx
lea    0xc(%rsp),%rcx
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebp
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11dc <main+0xac>
lea    0xe9a(%rip),%rsi
lea    0x14(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e6 <main+0xb6>
lea    0xe88(%rip),%rsi
lea    0x14(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f0 <main+0xc0>
lea    0xe76(%rip),%rsi
lea    0x14(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1210 <main+0xe0>
lea    0xe6a(%rip),%rsi
lea    0x14(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1228 <main+0xf8>
test   %ebp,%ebp
je     1228 <main+0xf8>
mov    0x10(%rsp),%eax
cltd
idivl  0xc(%rsp)
lea    0xe2e(%rip),%rdi
mov    %edx,%esi
jmp    1200 <main+0xd0>
mov    0xc(%rsp),%esi
add    0x10(%rsp),%esi
jmp    11f9 <main+0xc9>
mov    0x10(%rsp),%esi
sub    0xc(%rsp),%esi
jmp    11f9 <main+0xc9>
mov    0xc(%rsp),%esi
imul   0x10(%rsp),%esi
lea    0xe06(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
test   %ebp,%ebp
je     1228 <main+0xf8>
mov    0x10(%rsp),%eax
cltd
idivl  0xc(%rsp)
lea    0xde2(%rip),%rdi
mov    %eax,%esi
jmp    1200 <main+0xd0>
lea    0xdea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1207 <main+0xd7>

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