#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 num1, num2, rez;
  int boolean;
  char oper[3];
  scanf("%d%s%d", &num1, oper, &num2);
  boolean = 0;
  if (strcmp(oper, "add") == 0) {
    rez = num1 + num2;
    boolean = 1;
    printf("%d\n", rez);
  } else if (strcmp(oper, "sub") == 0) {
    rez = num1 - num2;
    boolean = 1;
    printf("%d\n", rez);
  } else if (strcmp(oper, "mul") == 0) {
    rez = num1 * num2;
    boolean = 1;
    printf("%d\n", rez);
  } else if (strcmp(oper, "div") == 0) {
    if (num2 != 0) {
      rez = num1 / num2;
      boolean = 1;
      printf("%d\n", rez);
    } else
      printf("Error - delenie na 0!\n");
  }
  if (strcmp(oper, "mod") == 0) {
    if (num2 != 0) {
      rez = num1 % num2;
      boolean = 1;
      printf("%d\n", rez);
    } else
      printf("Error - delenie na 0!\n");
  } else if (boolean == 0)
    printf("Error!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x17(%rbp),%rdx
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
lea    -0x17(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119e <main+0x6e>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128c <main+0x15c>
lea    -0x17(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11de <main+0xae>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <main+0x157>
lea    -0x17(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <main+0xef>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1282 <main+0x152>
lea    -0x17(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    127d <main+0x14d>
cmpl   $0x0,-0xc(%rbp)
je     126a <main+0x13a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1278 <main+0x148>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127d <main+0x14d>
jmp    1282 <main+0x152>
jmp    1287 <main+0x157>
jmp    128c <main+0x15c>
lea    -0x17(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12ea <main+0x1ba>
cmpl   $0x0,-0xc(%rbp)
je     12d7 <main+0x1a7>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e5 <main+0x1b5>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1307 <main+0x1d7>
cmpl   $0x0,-0x14(%rbp)
jne    1302 <main+0x1d2>
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1307 <main+0x1d7>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x5(%rsp),%rbx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdx
call   1060 <scanf@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11db <main+0x9b>
lea    0xe91(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e5 <main+0xa5>
lea    0xe7f(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ef <main+0xaf>
lea    0xe6d(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
mov    $0x1,%bl
test   %rax,%rax
jne    1208 <main+0xc8>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
je     1260 <main+0x120>
mov    0xc(%rsp),%eax
cltd
idiv   %ecx
lea    0xe36(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
jmp    1201 <main+0xc1>
mov    0x8(%rsp),%esi
add    0xc(%rsp),%esi
jmp    11f8 <main+0xb8>
mov    0xc(%rsp),%esi
sub    0x8(%rsp),%esi
jmp    11f8 <main+0xb8>
mov    0x8(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xe0c(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe0c(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     122b <main+0xeb>
test   %bl,%bl
je     1258 <main+0x118>
lea    0xdf6(%rip),%rdi
jmp    1253 <main+0x113>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
je     124c <main+0x10c>
mov    0xc(%rsp),%eax
cltd
idiv   %ecx
lea    0xdca(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1258 <main+0x118>
lea    0xdd3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xdbf(%rip),%rdi
call   1030 <puts@plt>
jmp    1208 <main+0xc8>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d%s%d\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 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 = [7 x i8] c"Error!\00"
@str.10 = [22 x i8] c"Error - delenie na 0!\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 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i8* %6, i32* %2)
%8 = call i64 @strcmp(i8* %6, 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* %1
%12 = load i32, i32* %2
%13 = add nsw i32 %12, %11
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %43
15: ; preds = %0
%16 = call i64 @strcmp(i8* %6, 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* %1
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %43
23: ; preds = %15
%24 = call i64 @strcmp(i8* %6, 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* %1
%28 = load i32, i32* %2
%29 = mul nsw i32 %28, %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %43
31: ; preds = %23
%32 = call i64 @strcmp(i8* %6, 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* %2
%36 = icmp eq i32 %35, 0
br i1 %36, label %41, label %37
37: ; preds = %34
%38 = load i32, i32* %1
%39 = sdiv i32 %38, %35
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %43
41: ; preds = %34
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.10, i64 0, i64 0))
br label %43
43: ; preds = %18, %31, %41, %37, %26, %10
%44 = phi i1 [ false, %18 ], [ true, %31 ], [ true, %41 ], [ false, %37 ], [ false, %26 ], [ false, %10 ]
%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 %56
47: ; preds = %43
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %47
%51 = load i32, i32* %1
%52 = srem i32 %51, %48
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %52)
br label %59
54: ; preds = %47
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.10, i64 0, i64 0))
br label %59
56: ; preds = %43
br i1 %44, label %57, label %59
57: ; preds = %56
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %59
59: ; preds = %56, %57, %50, %54
ret i32 0
}