#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))
    return (op1 == op2) ? isLeftAssociative(op1) : 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    11cc <evalBefore+0xac>
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    11c5 <evalBefore+0xa5>
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,-0x1c(%rbp)
jmp    11ba <evalBefore+0x9a>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ba <evalBefore+0x9a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11cc <evalBefore+0xac>
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 %31
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 %30
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)
br label %28
27: ; preds = %18
br label %28
28: ; preds = %27, %24
%29 = phi i32 [ %26, %24 ], [ 1, %27 ]
store i32 %29, i32* %3
br label %31
30: ; preds = %12
store i32 0, i32* %3
br label %31
31: ; preds = %30, %28, %11
%32 = load i32, i32* %3
ret i32 %32
}

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, %12, %10, %2
%15 = phi i32 [ 1, %2 ], [ %13, %12 ], [ 1, %10 ], [ 0, %6 ]
ret i32 %15
}