#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*/ die(char *, ...);
scalar_t__ strcmp(char *, char *);
int get_op_prio(char *op) {
  if (!op[1]) {
    switch (op[0]) {
    case '*':
    case '/':
    case '%':
      return 6;
    case '+':
    case '-':
      return 7;
    case '<':
    case '>':
      return 9;
    case '&':
      return 11;
    case '^':
      return 12;
    case '|':
      return 13;
    case '?':
      return 16;
    default:
      die("unknown op '%c'", op[0]);
      return -1;
    }
  } else {
    if (strcmp(op, "++") == 0 || strcmp(op, "--") == 0) {
      return 3;
    } else if (strcmp(op, ">>") == 0 || strcmp(op, "<<") == 0) {
      return 8;
    } else if (strcmp(op, ">=") == 0 || strcmp(op, "<=") == 0) {
      return 9;
    } else if (strcmp(op, "==") == 0 || strcmp(op, "!=") == 0) {
      return 10;
    } else if (strcmp(op, "&&") == 0) {
      return 14;
    } else if (strcmp(op, "||") == 0) {
      return 15;
    } else {
      die("unknown op '%s'", op);
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<get_op_prio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,0x1(%rax)
jne    11dc <get_op_prio+0xbc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x57,%eax
ja     11bb <get_op_prio+0x9b>
mov    -0x18(%rbp),%rax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x6,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0x7,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0x9,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0xb,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0xc,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0xd,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
movl   $0x10,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xf97(%rip),%rdi
mov    $0x0,%al
call   1040 <die@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xf89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1210 <get_op_prio+0xf0>
mov    -0x10(%rbp),%rdi
lea    0xf72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    121c <get_op_prio+0xfc>
movl   $0x3,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xf4f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1250 <get_op_prio+0x130>
mov    -0x10(%rbp),%rdi
lea    0xf38(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    125c <get_op_prio+0x13c>
movl   $0x8,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xf15(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1290 <get_op_prio+0x170>
mov    -0x10(%rbp),%rdi
lea    0xefe(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    129c <get_op_prio+0x17c>
movl   $0x9,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xedb(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     12d0 <get_op_prio+0x1b0>
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12dc <get_op_prio+0x1bc>
movl   $0xa,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1302 <get_op_prio+0x1e2>
movl   $0xe,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1328 <get_op_prio+0x208>
movl   $0xf,-0x4(%rbp)
jmp    1341 <get_op_prio+0x221>
mov    -0x10(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <die@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_op_prio>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x0,0x1(%rdi)
je     1247 <get_op_prio+0x127>
lea    0x1039(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x3,%ebp
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0x101f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0x100a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x8,%ebp
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xff0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xfdb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x9,%ebp
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xfc1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xfac(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0xa,%ebp
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xf92(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12a4 <get_op_prio+0x184>
lea    0xf7d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ad <get_op_prio+0x18d>
lea    0xf68(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12b4 <get_op_prio+0x194>
lea    0xf53(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <die@plt>
jmp    128a <get_op_prio+0x16a>
movsbl (%rbx),%esi
lea    -0x25(%rsi),%eax
cmp    $0x57,%eax
ja     127c <get_op_prio+0x15c>
mov    $0x6,%ebp
lea    0xda2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x7,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0x9,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0xb,%ebp
jmp    12a4 <get_op_prio+0x184>
lea    0xedd(%rip),%rdi
xor    %eax,%eax
call   1040 <die@plt>
mov    $0xffffffff,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0x10,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0xc,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0xd,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0xe,%ebp
jmp    12a4 <get_op_prio+0x184>
mov    $0xf,%ebp
jmp    12a4 <get_op_prio+0x184>

LLVM IR (-O0):
@.str = [16 x i8] c"unknown op '%c'\00"
@.str.1 = [3 x i8] c"++\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [3 x i8] c">>\00"
@.str.4 = [3 x i8] c"<<\00"
@.str.5 = [3 x i8] c">=\00"
@.str.6 = [3 x i8] c"<=\00"
@.str.7 = [3 x i8] c"==\00"
@.str.8 = [3 x i8] c"!=\00"
@.str.9 = [3 x i8] c"&&\00"
@.str.10 = [3 x i8] c"||\00"
@.str.11 = [16 x i8] c"unknown op '%s'\00"
define i32 @get_op_prio(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %26, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %20 [
i32 42, label %13
i32 47, label %13
i32 37, label %13
i32 43, label %14
i32 45, label %14
i32 60, label %15
i32 62, label %15
i32 38, label %16
i32 94, label %17
i32 124, label %18
i32 63, label %19
]
13: ; preds = %8, %8, %8
store i32 6, i32* %2
br label %75
14: ; preds = %8, %8
store i32 7, i32* %2
br label %75
15: ; preds = %8, %8
store i32 9, i32* %2
br label %75
16: ; preds = %8
store i32 11, i32* %2
br label %75
17: ; preds = %8
store i32 12, i32* %2
br label %75
18: ; preds = %8
store i32 13, i32* %2
br label %75
19: ; preds = %8
store i32 16, i32* %2
br label %75
20: ; preds = %8
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %24)
store i32 -1, i32* %2
br label %75
26: ; preds = %1
%27 = load i8*, i8** %3
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8*, i8** %3
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30, %26
store i32 3, i32* %2
br label %75
35: ; preds = %30
%36 = load i8*, i8** %3
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i8*, i8** %3
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %39, %35
store i32 8, i32* %2
br label %75
44: ; preds = %39
%45 = load i8*, i8** %3
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i8*, i8** %3
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %48, %44
store i32 9, i32* %2
br label %75
53: ; preds = %48
%54 = load i8*, i8** %3
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %53
%58 = load i8*, i8** %3
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %57, %53
store i32 10, i32* %2
br label %75
62: ; preds = %57
%63 = load i8*, i8** %3
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %62
store i32 14, i32* %2
br label %75
67: ; preds = %62
%68 = load i8*, i8** %3
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %67
store i32 15, i32* %2
br label %75
72: ; preds = %67
%73 = load i8*, i8** %3
%74 = call i32 (i8*, ...) @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* %73)
store i32 -1, i32* %2
br label %75
75: ; preds = %72, %71, %66, %61, %52, %43, %34, %20, %19, %18, %17, %16, %15, %14, %13
%76 = load i32, i32* %2
ret i32 %76
}

LLVM IR (-O2):
@.str = [16 x i8] c"unknown op '%c'\00"
@.str.1 = [3 x i8] c"++\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [3 x i8] c">>\00"
@.str.4 = [3 x i8] c"<<\00"
@.str.5 = [3 x i8] c">=\00"
@.str.6 = [3 x i8] c"<=\00"
@.str.7 = [3 x i8] c"==\00"
@.str.8 = [3 x i8] c"!=\00"
@.str.9 = [3 x i8] c"&&\00"
@.str.10 = [3 x i8] c"||\00"
@.str.11 = [16 x i8] c"unknown op '%s'\00"
define i32 @get_op_prio(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = load i8, i8* %0
%7 = sext i8 %6 to i32
switch i32 %7, label %14 [
i32 42, label %48
i32 47, label %48
i32 37, label %48
i32 43, label %8
i32 45, label %8
i32 60, label %9
i32 62, label %9
i32 38, label %10
i32 94, label %11
i32 124, label %12
i32 63, label %13
]
8: ; preds = %5, %5
br label %48
9: ; preds = %5, %5
br label %48
10: ; preds = %5
br label %48
11: ; preds = %5
br label %48
12: ; preds = %5
br label %48
13: ; preds = %5
br label %48
14: ; preds = %5
%15 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %48
16: ; preds = %1
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %48, label %19
19: ; preds = %16
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %48, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %48, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %48, label %28
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %48, label %31
31: ; preds = %28
%32 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %48, label %34
34: ; preds = %31
%35 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %48, label %37
37: ; preds = %34
%38 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %48, label %40
40: ; preds = %37
%41 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %40
%44 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %43
%47 = tail call i32 (i8*, ...) @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* %0)
br label %48
48: ; preds = %43, %40, %34, %37, %28, %31, %22, %25, %16, %19, %5, %5, %5, %46, %14, %13, %12, %11, %10, %9, %8
%49 = phi i32 [ -1, %46 ], [ -1, %14 ], [ 16, %13 ], [ 13, %12 ], [ 12, %11 ], [ 11, %10 ], [ 9, %9 ], [ 7, %8 ], [ 6, %5 ], [ 6, %5 ], [ 6, %5 ], [ 3, %19 ], [ 3, %16 ], [ 8, %25 ], [ 8, %22 ], [ 9, %31 ], [ 9, %28 ], [ 10, %37 ], [ 10, %34 ], [ 14, %40 ], [ 15, %43 ]
ret i32 %49
}