#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int pr(char elem) {
  switch (elem) {
  case '(':
    return 1;
    break;
  case '+':
    return 2;
    break;
  case '-':
    return 2;
    break;
  case '*':
    return 3;
    break;
  case '/':
    return 3;
    break;
  default:
    printf("INVALID ENTRY...FORCE CLOSE\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1194 <pr+0x74>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    11a7 <pr+0x87>
movl   $0x2,-0x4(%rbp)
jmp    11a7 <pr+0x87>
movl   $0x2,-0x4(%rbp)
jmp    11a7 <pr+0x87>
movl   $0x3,-0x4(%rbp)
jmp    11a7 <pr+0x87>
movl   $0x3,-0x4(%rbp)
jmp    11a7 <pr+0x87>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr>:
push   %rax
add    $0xffffffd8,%edi
cmp    $0x8,%edi
jae    1142 <pr+0x22>
mov    $0xad,%eax
bt     %edi,%eax
jae    1142 <pr+0x22>
movslq %edi,%rax
lea    0xedf(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"INVALID ENTRY...FORCE CLOSE\0A\00"
define i32 @pr(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 40, label %6
i32 43, label %7
i32 45, label %8
i32 42, label %9
i32 47, label %10
]
6: ; preds = %1
store i32 1, i32* %2
br label %14
7: ; preds = %1
store i32 2, i32* %2
br label %14
8: ; preds = %1
store i32 2, i32* %2
br label %14
9: ; preds = %1
store i32 3, i32* %2
br label %14
10: ; preds = %1
store i32 3, i32* %2
br label %14
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %10, %9, %8, %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@str = [28 x i8] c"INVALID ENTRY...FORCE CLOSE\00"
@switch.table.pr = [8 x i32] [i32 1, i32 1, i32 3, i32 2, i32 1, i32 2, i32 1, i32 3]
define i32 @pr(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -40
%4 = icmp ult i32 %3, 8
br i1 %4, label %8, label %5
5: ; preds = %8, %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %1
%9 = trunc i32 %3 to i8
%10 = lshr i8 -83, %9
%11 = and i8 %10, 1
%12 = icmp eq i8 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %8
%14 = sext i32 %3 to i64
%15 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.pr, i64 0, i64 %14
%16 = load i32, i32* %15
ret i32 %16
}