#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 isLeftAssociative(char);
scalar_t__ precedenceLevel(char);
bool evalBefore(char op1, char op2) {
  if (precedenceLevel(op1) > precedenceLevel(op2)) {
    return true;
  }
  if (precedenceLevel(op1) == precedenceLevel(op2)) {
    if (op1 == op2) {
      return isLeftAssociative(op1);
    }
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<evalBefore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%edi
call   1040 <precedenceLevel@plt>
mov    %rax,-0x10(%rbp)
movsbl -0x6(%rbp),%edi
call   1040 <precedenceLevel@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
jle    1166 <evalBefore+0x46>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <evalBefore+0xa0>
movsbl -0x5(%rbp),%edi
call   1040 <precedenceLevel@plt>
mov    %rax,-0x18(%rbp)
movsbl -0x6(%rbp),%edi
call   1040 <precedenceLevel@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    11b9 <evalBefore+0x99>
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    11ad <evalBefore+0x8d>
movsbl -0x5(%rbp),%edi
call   1030 <isLeftAssociative@plt>
mov    %eax,-0x4(%rbp)
jmp    11c0 <evalBefore+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <evalBefore+0xa0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalBefore>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%ebp
call   1040 <precedenceLevel@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1040 <precedenceLevel@plt>
mov    %rax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rbx
jg     1187 <evalBefore+0x67>
movsbl %bpl,%r14d
mov    %r14d,%edi
call   1040 <precedenceLevel@plt>
mov    %rax,%rbx
movsbl %r15b,%edi
call   1040 <precedenceLevel@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jne    1187 <evalBefore+0x67>
mov    $0x1,%eax
cmp    %r15b,%bpl
jne    1187 <evalBefore+0x67>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <isLeftAssociative@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @evalBefore(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = call i64 @precedenceLevel(i8 signext %6)
%8 = load i8, i8* %5
%9 = call i64 @precedenceLevel(i8 signext %8)
%10 = icmp sgt i64 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %29
12: ; preds = %2
%13 = load i8, i8* %4
%14 = call i64 @precedenceLevel(i8 signext %13)
%15 = load i8, i8* %5
%16 = call i64 @precedenceLevel(i8 signext %15)
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %28
18: ; preds = %12
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = load i8, i8* %4
%26 = call i32 @isLeftAssociative(i8 signext %25)
store i32 %26, i32* %3
br label %29
27: ; preds = %18
store i32 1, i32* %3
br label %29
28: ; preds = %12
store i32 0, i32* %3
br label %29
29: ; preds = %28, %27, %24, %11
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @evalBefore(i8 signext %0, i8 signext %1) {
%3 = tail call i64 @precedenceLevel(i8 signext %0)
%4 = tail call i64 @precedenceLevel(i8 signext %1)
%5 = icmp sgt i64 %3, %4
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = tail call i64 @precedenceLevel(i8 signext %0)
%8 = tail call i64 @precedenceLevel(i8 signext %1)
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = icmp eq i8 %0, %1
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call i32 @isLeftAssociative(i8 signext %0)
br label %14
14: ; preds = %6, %10, %2, %12
%15 = phi i32 [ %13, %12 ], [ 1, %2 ], [ 1, %10 ], [ 0, %6 ]
ret i32 %15
}