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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x110(%rbp),%rdx
lea    0xea9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119f <main+0x6f>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b6 <main+0x186>
lea    -0x110(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11dc <main+0xac>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b1 <main+0x181>
lea    -0x110(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1218 <main+0xe8>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x17c>
lea    -0x110(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1256 <main+0x126>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <main+0x177>
lea    -0x110(%rbp),%rdi
lea    0xdb9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1294 <main+0x164>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a2 <main+0x172>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <main+0x177>
jmp    12ac <main+0x17c>
jmp    12b1 <main+0x181>
jmp    12b6 <main+0x186>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x118,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeca(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    $0x646f6c,%eax
jle    1182 <main+0x62>
cmp    $0x646f6d,%eax
je     119a <main+0x7a>
cmp    $0x6c756d,%eax
je     11b2 <main+0x92>
cmp    $0x766964,%eax
jne    11e1 <main+0xc1>
mov    0x8(%rsp),%eax
cltd
idivl  0xc(%rsp)
mov    %eax,0x8(%rsp)
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
jmp    11d0 <main+0xb0>
cmp    $0x627573,%eax
je     11bd <main+0x9d>
cmp    $0x646461,%eax
jne    11e1 <main+0xc1>
mov    0x8(%rsp),%esi
add    0xc(%rsp),%esi
jmp    11c5 <main+0xa5>
mov    0x8(%rsp),%eax
cltd
idivl  0xc(%rsp)
mov    %edx,0x8(%rsp)
lea    0xe5b(%rip),%rdi
mov    %edx,%esi
jmp    11d0 <main+0xb0>
mov    0x8(%rsp),%esi
imul   0xc(%rsp),%esi
jmp    11c5 <main+0xa5>
mov    0x8(%rsp),%esi
sub    0xc(%rsp),%esi
mov    %esi,0x8(%rsp)
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x118,%rsp
ret
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>

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

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