#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 */
unsigned int UARTRegConfigModeEnable(unsigned int, int);
signed char UARTCharGetNonBlocking(unsigned int baseAdd) {
  unsigned int lcrRegValue = 0;
  signed char retVal = -1;
  lcrRegValue = UARTRegConfigModeEnable(baseAdd, (0x007F));
  if ((*((volatile unsigned int *)(baseAdd + (0x14)))) & (0x00000001u)) {
    retVal = (signed char)(*((volatile unsigned int *)(baseAdd + (0x0))));
  }
  (*((volatile unsigned int *)(baseAdd + (0xC)))) = lcrRegValue;
  return retVal;
}


x86 assembly (clang, -O0):
<UARTCharGetNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movb   $0xff,-0x9(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7f,%esi
call   1030 <UARTRegConfigModeEnable@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x14,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1159 <UARTCharGetNonBlocking+0x49>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,%eax
mov    (%rax),%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xc,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharGetNonBlocking>:
push   %rbx
mov    %edi,%ebx
mov    $0x7f,%esi
call   1030 <UARTRegConfigModeEnable@plt>
lea    0x14(%rbx),%edx
mov    $0xff,%cl
testl  $0x1,(%rdx)
je     112e <UARTCharGetNonBlocking+0x1e>
mov    %ebx,%ecx
mov    (%rcx),%ecx
add    $0xc,%ebx
mov    %eax,(%rbx)
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @UARTCharGetNonBlocking(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %2
store i32 0, i32* %3
store i8 -1, i8* %4
%5 = load i32, i32* %2
%6 = call i32 @UARTRegConfigModeEnable(i32 %5, i32 127)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = add i32 %7, 20
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %1
%15 = load i32, i32* %2
%16 = add i32 %15, 0
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %4
br label %21
21: ; preds = %14, %1
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = add i32 %23, 12
%25 = zext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
store volatile i32 %22, i32* %26
%27 = load i8, i8* %4
ret i8 %27
}

LLVM IR (-O2):
define signext i8 @UARTCharGetNonBlocking(i32 %0) {
%2 = tail call i32 @UARTRegConfigModeEnable(i32 %0, i32 127)
%3 = add i32 %0, 20
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = zext i32 %0 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = trunc i32 %12 to i8
br label %14
14: ; preds = %9, %1
%15 = phi i8 [ %13, %9 ], [ -1, %1 ]
%16 = add i32 %0, 12
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
store volatile i32 %2, i32* %18
ret i8 %15
}