#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 '!':
      return 4;
    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    11e8 <get_op_prio+0xc8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffdf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5d,%eax
ja     11c7 <get_op_prio+0xa7>
mov    -0x18(%rbp),%rax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0x6,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0x7,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0x9,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0xb,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0xc,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0xd,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
movl   $0x10,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xfa3(%rip),%rdi
mov    $0x0,%al
call   1040 <die@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xf95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     121c <get_op_prio+0xfc>
mov    -0x10(%rbp),%rdi
lea    0xf7e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1228 <get_op_prio+0x108>
movl   $0x3,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xf5b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     125c <get_op_prio+0x13c>
mov    -0x10(%rbp),%rdi
lea    0xf44(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1268 <get_op_prio+0x148>
movl   $0x8,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xf21(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     129c <get_op_prio+0x17c>
mov    -0x10(%rbp),%rdi
lea    0xf0a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12a8 <get_op_prio+0x188>
movl   $0x9,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xee7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     12dc <get_op_prio+0x1bc>
mov    -0x10(%rbp),%rdi
lea    0xed0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12e8 <get_op_prio+0x1c8>
movl   $0xa,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    130e <get_op_prio+0x1ee>
movl   $0xe,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1334 <get_op_prio+0x214>
movl   $0xf,-0x4(%rbp)
jmp    134d <get_op_prio+0x22d>
mov    -0x10(%rbp),%rsi
lea    0xe67(%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    0x1051(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x3,%ebp
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0x1037(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0x1022(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x8,%ebp
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0x1008(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0xff3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x9,%ebp
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0xfd9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0xfc4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0xa,%ebp
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0xfaa(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12ab <get_op_prio+0x18b>
lea    0xf95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12b4 <get_op_prio+0x194>
lea    0xf80(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12bb <get_op_prio+0x19b>
lea    0xf6b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <die@plt>
jmp    128a <get_op_prio+0x16a>
movsbl (%rbx),%esi
lea    -0x21(%rsi),%eax
cmp    $0x5d,%eax
ja     127c <get_op_prio+0x15c>
mov    $0x4,%ebp
lea    0xda2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x6,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0x7,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0x9,%ebp
jmp    12ab <get_op_prio+0x18b>
lea    0xef5(%rip),%rdi
xor    %eax,%eax
call   1040 <die@plt>
mov    $0xffffffff,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0xb,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0x10,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0xc,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0xd,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0xe,%ebp
jmp    12ab <get_op_prio+0x18b>
mov    $0xf,%ebp
jmp    12ab <get_op_prio+0x18b>

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

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