#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 */
int32_t UARTCharGet(uint32_t ui32Base) {
  ;
  if ((*((volatile uint16_t *)(ui32Base + 0xA))) & 0x4000) {
    while (!(((*((volatile uint16_t *)(ui32Base + 0xB))) & 0x1F00) >> 8)) {
    }
  } else {
    while (!((*((volatile uint16_t *)(ui32Base + 0x5))) & 0x40)) {
    }
  }
  return ((*((volatile uint16_t *)(ui32Base + 0x7))) & 0xFF);
}


x86 assembly (clang, -O0):
<UARTCharGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xa(%rax),%eax
and    $0x4000,%eax
cmp    $0x0,%eax
je     1150 <UARTCharGet+0x50>
jmp    1122 <UARTCharGet+0x22>
mov    -0x8(%rbp),%rax
mov    0xb(%rax),%eax
and    $0x1f00,%eax
sar    $0x8,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1146 <UARTCharGet+0x46>
jmp    114b <UARTCharGet+0x4b>
jmp    1122 <UARTCharGet+0x22>
jmp    117e <UARTCharGet+0x7e>
jmp    1155 <UARTCharGet+0x55>
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1174 <UARTCharGet+0x74>
jmp    1179 <UARTCharGet+0x79>
jmp    1155 <UARTCharGet+0x55>
jmp    117e <UARTCharGet+0x7e>
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharGet>:
testl  $0x4000,0xa(%rdi)
jne    1120 <UARTCharGet+0x20>
nopl   0x0(%rax)
testl  $0x40,0x5(%rdi)
je     1110 <UARTCharGet+0x10>
jmp    1129 <UARTCharGet+0x29>
nopl   0x0(%rax,%rax,1)
testl  $0x1f00,0xb(%rdi)
je     1120 <UARTCharGet+0x20>
mov    0x7(%rdi),%eax
movzbl %al,%eax
ret

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

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