unsigned char uart_poll_rx_byte(unsigned int uart) {
  if (!uart) {
    while (!(*((volatile unsigned int *)(0xF1000000 + 0x60)) & 4))
      ;
    *((volatile unsigned int *)(0xF1000000 + 0x70)) |= 4;
    return (*((volatile unsigned int *)(0xF1000000 + 0x24)) & 0xFF);
  } else {
    while (!(*((volatile unsigned int *)(0xF1800000 + 0x60)) & 4))
      ;
    *((volatile unsigned int *)(0xF1800000 + 0x70)) |= 4;
    return (*((volatile unsigned int *)(0xF1800000 + 0x24)) & 0xFF);
  }
}


x86 assembly (clang, -O0):
<uart_poll_rx_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115f <uart_poll_rx_byte+0x5f>
jmp    1116 <uart_poll_rx_byte+0x16>
mov    $0xf1000060,%eax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1135 <uart_poll_rx_byte+0x35>
jmp    113a <uart_poll_rx_byte+0x3a>
jmp    1116 <uart_poll_rx_byte+0x16>
mov    $0xf1000070,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0xf1000070,%eax
mov    %ecx,(%rax)
mov    $0xf1000024,%eax
mov    (%rax),%eax
and    $0xff,%eax
mov    %al,-0x1(%rbp)
jmp    11a8 <uart_poll_rx_byte+0xa8>
jmp    1164 <uart_poll_rx_byte+0x64>
mov    $0xf1800060,%eax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1183 <uart_poll_rx_byte+0x83>
jmp    1188 <uart_poll_rx_byte+0x88>
jmp    1164 <uart_poll_rx_byte+0x64>
mov    $0xf1800070,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0xf1800070,%eax
mov    %ecx,(%rax)
mov    $0xf1800024,%eax
mov    (%rax),%eax
and    $0xff,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_poll_rx_byte>:
mov    $0xf1000070,%eax
test   %edi,%edi
je     1130 <uart_poll_rx_byte+0x30>
nopl   0x0(%rax)
testl  $0x4,0x7ffff0(%rax)
je     1110 <uart_poll_rx_byte+0x10>
orl    $0x4,0x800000(%rax)
mov    0x7fffb4(%rax),%eax
movzbl %al,%eax
ret
nopl   (%rax)
testl  $0x4,-0x10(%rax)
je     1130 <uart_poll_rx_byte+0x30>
orl    $0x4,(%rax)
mov    -0x4c(%rax),%eax
ret

LLVM IR (-O0):
define zeroext i8 @uart_poll_rx_byte(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %1
br label %7
7: ; preds = %12, %6
%8 = load volatile i32, i32* inttoptr (i64 4043309152 to i32*)
%9 = and i32 %8, 4
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load volatile i32, i32* inttoptr (i64 4043309168 to i32*)
%15 = or i32 %14, 4
store volatile i32 %15, i32* inttoptr (i64 4043309168 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 4043309092 to i32*)
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i8
store i8 %18, i8* %2
br label %32
19: ; preds = %1
br label %20
20: ; preds = %25, %19
%21 = load volatile i32, i32* inttoptr (i64 4051697760 to i32*)
%22 = and i32 %21, 4
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br i1 %24, label %25, label %26
25: ; preds = %20
br label %20
26: ; preds = %20
%27 = load volatile i32, i32* inttoptr (i64 4051697776 to i32*)
%28 = or i32 %27, 4
store volatile i32 %28, i32* inttoptr (i64 4051697776 to i32*)
%29 = load volatile i32, i32* inttoptr (i64 4051697700 to i32*)
%30 = and i32 %29, 255
%31 = trunc i32 %30 to i8
store i8 %31, i8* %2
br label %32
32: ; preds = %26, %13
%33 = load i8, i8* %2
ret i8 %33
}

LLVM IR (-O2):
define zeroext i8 @uart_poll_rx_byte(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = load volatile i32, i32* inttoptr (i64 4043309152 to i32*)
%5 = and i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
%8 = load volatile i32, i32* inttoptr (i64 4043309168 to i32*)
%9 = or i32 %8, 4
store volatile i32 %9, i32* inttoptr (i64 4043309168 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 4043309092 to i32*)
br label %20
11: ; preds = %1, %11
%12 = load volatile i32, i32* inttoptr (i64 4051697760 to i32*)
%13 = and i32 %12, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %11, label %15
15: ; preds = %11
%16 = load volatile i32, i32* inttoptr (i64 4051697776 to i32*)
%17 = or i32 %16, 4
store volatile i32 %17, i32* inttoptr (i64 4051697776 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 4051697700 to i32*)
%19 = and i32 %18, 255
br label %20
20: ; preds = %15, %7
%21 = phi i32 [ %19, %15 ], [ %10, %7 ]
%22 = trunc i32 %21 to i8
ret i8 %22
}