#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 */
scalar_t__ getPrecedence(char);
scalar_t__ isRightPrecedence(char);
int isHighPrecedence(char top, char exp) {
  if (getPrecedence(top) == getPrecedence(exp)) {
    if (isRightPrecedence(exp)) {
      return 0;
    }
    return 1;
  }
  if (getPrecedence(top) > getPrecedence(exp))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isHighPrecedence>:
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   1030 <getPrecedence@plt>
mov    %rax,-0x10(%rbp)
movsbl -0x6(%rbp),%edi
call   1030 <getPrecedence@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
jne    1185 <isHighPrecedence+0x65>
movsbl -0x6(%rbp),%edi
call   1040 <isRightPrecedence@plt>
cmp    $0x0,%rax
je     1179 <isHighPrecedence+0x59>
movl   $0x0,-0x4(%rbp)
jmp    11be <isHighPrecedence+0x9e>
movl   $0x1,-0x4(%rbp)
jmp    11be <isHighPrecedence+0x9e>
movsbl -0x5(%rbp),%edi
call   1030 <getPrecedence@plt>
mov    %rax,-0x18(%rbp)
movsbl -0x6(%rbp),%edi
call   1030 <getPrecedence@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jle    11b7 <isHighPrecedence+0x97>
movl   $0x1,-0x4(%rbp)
jmp    11be <isHighPrecedence+0x9e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isHighPrecedence>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   1030 <getPrecedence@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1030 <getPrecedence@plt>
cmp    %rax,%rbx
jne    114f <isHighPrecedence+0x2f>
movsbl %r14b,%edi
call   1040 <isRightPrecedence@plt>
test   %rax,%rax
sete   %al
jmp    116a <isHighPrecedence+0x4a>
movsbl %bpl,%edi
call   1030 <getPrecedence@plt>
mov    %rax,%rbx
movsbl %r14b,%edi
call   1030 <getPrecedence@plt>
cmp    %rax,%rbx
setg   %al
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isHighPrecedence(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 @getPrecedence(i8 signext %6)
%8 = load i8, i8* %5
%9 = call i64 @getPrecedence(i8 signext %8)
%10 = icmp eq i64 %7, %9
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8, i8* %5
%13 = call i64 @isRightPrecedence(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %3
br label %25
16: ; preds = %11
store i32 1, i32* %3
br label %25
17: ; preds = %2
%18 = load i8, i8* %4
%19 = call i64 @getPrecedence(i8 signext %18)
%20 = load i8, i8* %5
%21 = call i64 @getPrecedence(i8 signext %20)
%22 = icmp sgt i64 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %3
br label %25
24: ; preds = %17
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23, %16, %15
%26 = load i32, i32* %3
ret i32 %26
}

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