#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 int uint32_t;

/* Variables and functions */
int __byte(int *, int /*<<< orphan*/);
uint32_t UARTIntStatus(uint32_t ui32Base, bool bMasked) {
  uint32_t temp = 0;
  ;
  if (__byte((int *)(ui32Base + 0x4), 0) & 0x80)
    temp |= 0x04;
  if (__byte((int *)(ui32Base + 0x5), 0) & 0x80)
    temp |= 0x01;
  if (__byte((int *)(ui32Base + 0x5), 0) & (0x40 | 0x20))
    temp |= 0x02;
  if (__byte((int *)(ui32Base + 0xA), 0) & 0x80)
    temp |= 0x08;
  if (__byte((int *)(ui32Base + 0xB), 0) & 0x80)
    temp |= 0x10;
  return temp;
}


x86 assembly (clang, -O0):
<UARTIntStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     114c <UARTIntStatus+0x3c>
mov    -0xc(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     1173 <UARTIntStatus+0x63>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x60,%eax
cmp    $0x0,%eax
je     1198 <UARTIntStatus+0x88>
mov    -0xc(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa,%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     11bf <UARTIntStatus+0xaf>
mov    -0xc(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb,%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     11e6 <UARTIntStatus+0xd6>
mov    -0xc(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTIntStatus>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
lea    0x4(%r14),%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
mov    %eax,%r12d
shr    $0x5,%r12d
and    $0x4,%r12d
lea    0x5(%r14),%eax
movslq %eax,%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
mov    %eax,%ebx
shr    $0x7,%ebx
and    $0x1,%ebx
lea    (%rbx,%r12,1),%r13d
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
test   $0x60,%al
lea    0x2(%rbx,%r12,1),%ebp
cmove  %r13d,%ebp
lea    0xa(%r14),%eax
movslq %eax,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
mov    %eax,%ebx
shr    $0x4,%ebx
and    $0x8,%ebx
or     %ebp,%ebx
add    $0xb,%r14d
movslq %r14d,%rdi
xor    %esi,%esi
call   1030 <__byte@plt>
shr    $0x3,%eax
and    $0x10,%eax
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @UARTIntStatus(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = call i32 @__byte(i32* %9, i32 0)
%11 = and i32 %10, 128
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* %5
%15 = or i32 %14, 4
store i32 %15, i32* %5
br label %16
16: ; preds = %13, %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 5
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = call i32 @__byte(i32* %20, i32 0)
%22 = and i32 %21, 128
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i32, i32* %5
%26 = or i32 %25, 1
store i32 %26, i32* %5
br label %27
27: ; preds = %24, %16
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 5
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
%32 = call i32 @__byte(i32* %31, i32 0)
%33 = and i32 %32, 96
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %27
%36 = load i32, i32* %5
%37 = or i32 %36, 2
store i32 %37, i32* %5
br label %38
38: ; preds = %35, %27
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 10
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i32*
%43 = call i32 @__byte(i32* %42, i32 0)
%44 = and i32 %43, 128
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %38
%47 = load i32, i32* %5
%48 = or i32 %47, 8
store i32 %48, i32* %5
br label %49
49: ; preds = %46, %38
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 11
%52 = sext i32 %51 to i64
%53 = inttoptr i64 %52 to i32*
%54 = call i32 @__byte(i32* %53, i32 0)
%55 = and i32 %54, 128
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %49
%58 = load i32, i32* %5
%59 = or i32 %58, 16
store i32 %59, i32* %5
br label %60
60: ; preds = %57, %49
%61 = load i32, i32* %5
ret i32 %61
}

LLVM IR (-O2):
define i32 @UARTIntStatus(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 4
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @__byte(i32* %5, i32 0)
%7 = lshr i32 %6, 5
%8 = and i32 %7, 4
%9 = add nsw i32 %0, 5
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = tail call i32 @__byte(i32* %11, i32 0)
%13 = lshr i32 %12, 7
%14 = and i32 %13, 1
%15 = or i32 %14, %8
%16 = tail call i32 @__byte(i32* %11, i32 0)
%17 = and i32 %16, 96
%18 = icmp eq i32 %17, 0
%19 = or i32 %15, 2
%20 = select i1 %18, i32 %15, i32 %19
%21 = add nsw i32 %0, 10
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = tail call i32 @__byte(i32* %23, i32 0)
%25 = lshr i32 %24, 4
%26 = and i32 %25, 8
%27 = or i32 %20, %26
%28 = add nsw i32 %0, 11
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
%31 = tail call i32 @__byte(i32* %30, i32 0)
%32 = lshr i32 %31, 3
%33 = and i32 %32, 16
%34 = or i32 %27, %33
ret i32 %34
}