#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;
typedef int volatile int32_t;

/* Variables and functions */
int __byte(int *, int /*<<< orphan*/);
int32_t UARTCharGetNonBlocking(uint32_t ui32Base) {
  ;
  if ((*((volatile uint16_t *)(ui32Base + 0xA))) & 0x4000) {
    if (((*((volatile uint16_t *)(ui32Base + 0xB))) & 0x1F00) >> 8) {
      return ((*((volatile uint16_t *)(ui32Base + 0x7))) & 0xFF);
    } else {
      return (-1);
    }
  } else {
    if ((__byte((int *)(ui32Base + 0x5), 0) & 0x40)) {
      return ((*((volatile uint16_t *)(ui32Base + 0x7))) & 0xFF);
    } else {
      return (-1);
    }
  }
}


x86 assembly (clang, -O0):
<UARTCharGetNonBlocking>:
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     1169 <UARTCharGetNonBlocking+0x59>
mov    -0x10(%rbp),%rax
mov    0xb(%rax),%eax
and    $0x1f00,%eax
sar    $0x8,%eax
cmp    $0x0,%eax
je     115d <UARTCharGetNonBlocking+0x4d>
mov    -0x10(%rbp),%rax
mov    0x7(%rax),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    119f <UARTCharGetNonBlocking+0x8f>
movl   $0xffffffff,-0x4(%rbp)
jmp    119f <UARTCharGetNonBlocking+0x8f>
mov    -0x10(%rbp),%rdi
add    $0x5,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x40,%eax
cmp    $0x0,%eax
je     1198 <UARTCharGetNonBlocking+0x88>
mov    -0x10(%rbp),%rax
mov    0x7(%rax),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    119f <UARTCharGetNonBlocking+0x8f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharGetNonBlocking>:
push   %rbx
mov    %rdi,%rbx
testl  $0x4000,0xa(%rdi)
jne    1136 <UARTCharGetNonBlocking+0x26>
lea    0x5(%rbx),%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   $0x40,%cl
jne    113f <UARTCharGetNonBlocking+0x2f>
pop    %rbx
ret
testl  $0x1f00,0xb(%rbx)
je     1147 <UARTCharGetNonBlocking+0x37>
mov    0x7(%rbx),%eax
movzbl %al,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @UARTCharGetNonBlocking(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 %25
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
br i1 %17, label %18, label %24
18: ; preds = %10
%19 = load i64, i64* %3
%20 = add nsw i64 %19, 7
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, 255
store i32 %23, i32* %2
br label %39
24: ; preds = %10
store i32 -1, i32* %2
br label %39
25: ; preds = %1
%26 = load i64, i64* %3
%27 = add nsw i64 %26, 5
%28 = inttoptr i64 %27 to i32*
%29 = call i32 @__byte(i32* %28, i32 0)
%30 = and i32 %29, 64
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load i64, i64* %3
%34 = add nsw i64 %33, 7
%35 = inttoptr i64 %34 to i32*
%36 = load volatile i32, i32* %35
%37 = and i32 %36, 255
store i32 %37, i32* %2
br label %39
38: ; preds = %25
store i32 -1, i32* %2
br label %39
39: ; preds = %38, %32, %24, %18
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @UARTCharGetNonBlocking(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 %13, 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 eq i32 %11, 0
br i1 %12, label %24, label %19
13: ; preds = %1
%14 = add nsw i64 %0, 5
%15 = inttoptr i64 %14 to i32*
%16 = tail call i32 @__byte(i32* %15, i32 0)
%17 = and i32 %16, 64
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %13, %7
%20 = add nsw i64 %0, 7
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, 255
br label %24
24: ; preds = %19, %13, %7
%25 = phi i32 [ -1, %7 ], [ -1, %13 ], [ %23, %19 ]
ret i32 %25
}