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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7(%rbp),%rdx
lea    0xeb6(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rcx
call   1050 <scanf@plt>
lea    -0x7(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118f <main+0x5f>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1294 <main+0x164>
lea    -0x7(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c7 <main+0x97>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128f <main+0x15f>
lea    -0x7(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1200 <main+0xd0>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <main+0x15a>
lea    -0x7(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1239 <main+0x109>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1285 <main+0x155>
lea    -0x7(%rbp),%rdi
lea    0xde6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1272 <main+0x142>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x150>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1285 <main+0x155>
jmp    128a <main+0x15a>
jmp    128f <main+0x15f>
jmp    1294 <main+0x164>
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    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11d8 <main+0x98>
lea    0xea1(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11e2 <main+0xa2>
lea    0xe90(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11ec <main+0xac>
lea    0xe7f(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     120b <main+0xcb>
lea    0xe6e(%rip),%rsi
lea    0x5(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     121f <main+0xdf>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
jmp    1203 <main+0xc3>
mov    0x8(%rsp),%esi
add    0xc(%rsp),%esi
jmp    11f5 <main+0xb5>
mov    0xc(%rsp),%esi
sub    0x8(%rsp),%esi
jmp    11f5 <main+0xb5>
mov    0x8(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xe11(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0xc(%rsp),%eax
cltd
idivl  0x8(%rsp)
lea    0xdf2(%rip),%rdi
mov    %eax,%esi
jmp    11fc <main+0xbc>
mov    0xc(%rsp),%eax
cltd
idivl  0x8(%rsp)
lea    0xdde(%rip),%rdi
mov    %edx,%esi
jmp    11fc <main+0xbc>

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