#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*/ gf_div(long, long);
int /*<<< orphan*/ gf_mult(long, long);
int /*<<< orphan*/ gf_xor(long, long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *, char *, long *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  usage();
  long a, b;
  char op;
  scanf("%ld %c %ld", &a, &op, &b);
  while ((a < 0) || (a > 255) || (b < 0) || (b > 255)) {
    usage();
    scanf("%ld %c %ld", &a, &op, &b);
  }
  if ((op == '+') || (op == '-')) {
    printf("%ld\n", gf_xor(a, b));
  } else if (op == '*') {
    printf("%ld\n", gf_mult(a, b));
  } else if (op == '/') {
    printf("%ld\n", gf_div(a, b));
  } else
    printf("Unknown Operation\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <usage@plt>
lea    0xe7c(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x21(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1070 <scanf@plt>
mov    $0x1,%al
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x22(%rbp)
jl     11d6 <main+0x76>
mov    $0x1,%al
cmpq   $0xff,-0x18(%rbp)
mov    %al,-0x22(%rbp)
jg     11d6 <main+0x76>
mov    $0x1,%al
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x22(%rbp)
jl     11d6 <main+0x76>
cmpq   $0xff,-0x20(%rbp)
setg   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    11e6 <main+0x86>
jmp    120a <main+0xaa>
mov    $0x0,%al
call   1060 <usage@plt>
lea    0xe0c(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x21(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1070 <scanf@plt>
jmp    1195 <main+0x35>
movsbl -0x21(%rbp),%eax
cmp    $0x2b,%eax
je     1224 <main+0xc4>
movsbl -0x21(%rbp),%eax
cmp    $0x2d,%eax
jne    1246 <main+0xe6>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <gf_xor@plt>
mov    %eax,%esi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bc <main+0x15c>
movsbl -0x21(%rbp),%eax
cmp    $0x2a,%eax
jne    1275 <main+0x115>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <gf_mult@plt>
mov    %eax,%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b7 <main+0x157>
movsbl -0x21(%rbp),%eax
cmp    $0x2f,%eax
jne    12a4 <main+0x144>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <gf_div@plt>
mov    %eax,%esi
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b2 <main+0x152>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b7 <main+0x157>
jmp    12bc <main+0x15c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1070 <usage@plt>
lea    0xe8f(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x7(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1080 <scanf@plt>
mov    0x10(%rsp),%rdi
cmp    $0xff,%rdi
ja     11be <main+0x4e>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
js     11be <main+0x4e>
cmp    $0x100,%rsi
jl     1219 <main+0xa9>
lea    0xe53(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x7(%rsp),%r12
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <usage@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1080 <scanf@plt>
mov    0x10(%rsp),%rdi
cmp    $0xff,%rdi
ja     11e0 <main+0x70>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
js     11e0 <main+0x70>
cmp    $0xff,%rsi
jg     11e0 <main+0x70>
mov    0x7(%rsp),%al
add    $0xd6,%al
cmp    $0x5,%al
ja     1267 <main+0xf7>
movzbl %al,%eax
lea    0xdd3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
call   1060 <gf_xor@plt>
jmp    1249 <main+0xd9>
call   1090 <gf_mult@plt>
jmp    1249 <main+0xd9>
call   1050 <gf_div@plt>
lea    0xdd3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xdba(%rip),%rdi
call   1030 <puts@plt>
jmp    1259 <main+0xe9>

LLVM IR (-O0):
@.str = [11 x i8] c"%ld %c %ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
@.str.2 = [19 x i8] c"Unknown Operation\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @usage()
%10 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64* %6, i8* %8, i64* %7)
br label %11
11: ; preds = %25, %2
%12 = load i64, i64* %6
%13 = icmp slt i64 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %11
%15 = load i64, i64* %6
%16 = icmp sgt i64 %15, 255
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = load i64, i64* %7
%19 = icmp slt i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i64, i64* %7
%22 = icmp sgt i64 %21, 255
br label %23
23: ; preds = %20, %17, %14, %11
%24 = phi i1 [ true, %17 ], [ true, %14 ], [ true, %11 ], [ %22, %20 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = call i32 (...) @usage()
%27 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64* %6, i8* %8, i64* %7)
br label %11
28: ; preds = %23
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 43
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i8, i8* %8
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 45
br i1 %35, label %36, label %41
36: ; preds = %32, %28
%37 = load i64, i64* %6
%38 = load i64, i64* %7
%39 = call i32 @gf_xor(i64 %37, i64 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %39)
br label %63
41: ; preds = %32
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 42
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i64, i64* %6
%47 = load i64, i64* %7
%48 = call i32 @gf_mult(i64 %46, i64 %47)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %48)
br label %62
50: ; preds = %41
%51 = load i8, i8* %8
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 47
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = load i64, i64* %6
%56 = load i64, i64* %7
%57 = call i32 @gf_div(i64 %55, i64 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %57)
br label %61
59: ; preds = %50
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %61
61: ; preds = %59, %54
br label %62
62: ; preds = %61, %45
br label %63
63: ; preds = %62, %36
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%ld %c %ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
@str = [18 x i8] c"Unknown Operation\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8
%6 = tail call i32 (...) @usage()
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64* %3, i8* %5, i64* %4)
%10 = load i64, i64* %3
%11 = icmp ugt i64 %10, 255
%12 = load i64, i64* %4
%13 = icmp slt i64 %12, 0
%14 = select i1 %11, i1 true, i1 %13
%15 = icmp sgt i64 %12, 255
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %17, label %27
17: ; preds = %2, %17
%18 = call i32 (...) @usage()
%19 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64* %3, i8* %5, i64* %4)
%20 = load i64, i64* %3
%21 = icmp ugt i64 %20, 255
%22 = load i64, i64* %4
%23 = icmp slt i64 %22, 0
%24 = select i1 %21, i1 true, i1 %23
%25 = icmp sgt i64 %22, 255
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %17, label %27
27: ; preds = %17, %2
%28 = phi i64 [ %10, %2 ], [ %20, %17 ]
%29 = phi i64 [ %12, %2 ], [ %22, %17 ]
%30 = load i8, i8* %5
switch i8 %30, label %40 [
i8 45, label %31
i8 43, label %31
i8 42, label %34
i8 47, label %37
]
31: ; preds = %27, %27
%32 = call i32 @gf_xor(i64 %28, i64 %29)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %42
34: ; preds = %27
%35 = call i32 @gf_mult(i64 %28, i64 %29)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %42
37: ; preds = %27
%38 = call i32 @gf_div(i64 %28, i64 %29)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %38)
br label %42
40: ; preds = %27
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %34, %40, %37, %31
ret i32 0
}