#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 */
typedef scalar_t__ uint32_t;
typedef int uint16_t;

/* Variables and functions */
int __byte(int *, int /*<<< orphan*/);
bool UARTCharsAvail(uint32_t ui32Base) {
  ;
  if ((*((volatile uint16_t *)(ui32Base + 0xA))) & 0x4000) {
    return ((((*((volatile uint16_t *)(ui32Base + 0xB))) & 0x1F00) >> 8)
                ? true
                : false);
  } else {
    return ((__byte((int *)(ui32Base + 0x5), 0) & 0x40) ? true : false);
  }
}


x86 assembly (clang, -O0):
<UARTCharsAvail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0xa(%rax),%eax
and    $0x4000,%eax
cmp    $0x0,%eax
je     1156 <UARTCharsAvail+0x46>
mov    -0x10(%rbp),%rax
mov    0xb(%rax),%edx
and    $0x1f00,%edx
sar    $0x8,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <UARTCharsAvail+0x6a>
mov    -0x10(%rbp),%rdi
add    $0x5,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
mov    %eax,%edx
and    $0x40,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharsAvail>:
push   %rax
testl  $0x4000,0xa(%rdi)
jne    112d <UARTCharsAvail+0x1d>
add    $0x5,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
shr    $0x6,%eax
and    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
testl  $0x1f00,0xb(%rdi)
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @UARTCharsAvail(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = add nsw i64 %4, 10
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, 16384
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = load i64, i64* %3
%12 = add nsw i64 %11, 11
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, 7936
%16 = ashr i32 %15, 8
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 1, i32 0
store i32 %19, i32* %2
br label %29
20: ; preds = %1
%21 = load i64, i64* %3
%22 = add nsw i64 %21, 5
%23 = inttoptr i64 %22 to i32*
%24 = call i32 @__byte(i32* %23, i32 0)
%25 = and i32 %24, 64
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 1, i32 0
store i32 %28, i32* %2
br label %29
29: ; preds = %20, %10
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @UARTCharsAvail(i64 %0) {
%2 = add nsw i64 %0, 10
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = and i32 %4, 16384
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = add nsw i64 %0, 11
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = and i32 %10, 7936
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
br label %20
14: ; preds = %1
%15 = add nsw i64 %0, 5
%16 = inttoptr i64 %15 to i32*
%17 = tail call i32 @__byte(i32* %16, i32 0)
%18 = lshr i32 %17, 6
%19 = and i32 %18, 1
br label %20
20: ; preds = %14, %7
%21 = phi i32 [ %13, %7 ], [ %19, %14 ]
ret i32 %21
}