unsigned int usb_receivebyte(unsigned char *receivebyte) {
  unsigned int i = 0;
  *(volatile unsigned int *)0xCC006814 = 0x000000D0;
  *(volatile unsigned int *)0xCC006824 = 0xA0000000;
  *(volatile unsigned int *)0xCC006820 = 0x19;
  while ((*(volatile unsigned int *)0xCC006820) & 1)
    ;
  i = *(volatile unsigned int *)0xCC006824;
  *(volatile unsigned int *)0xCC006814 = 0x0;
  if (i & 0x08000000) {
    *receivebyte = (i >> 16) & 0xff;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<usb_receivebyte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0xcc006814,%eax
movl   $0xd0,(%rax)
mov    $0xcc006824,%eax
movl   $0xa0000000,(%rax)
mov    $0xcc006820,%eax
movl   $0x19,(%rax)
mov    $0xcc006820,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1148 <usb_receivebyte+0x48>
jmp    1130 <usb_receivebyte+0x30>
mov    $0xcc006824,%eax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0xcc006814,%eax
movl   $0x0,(%rax)
mov    -0x14(%rbp),%eax
and    $0x8000000,%eax
cmp    $0x0,%eax
je     118d <usb_receivebyte+0x8d>
mov    -0x14(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1194 <usb_receivebyte+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_receivebyte>:
mov    $0xcc006814,%eax
movl   $0xd0,(%rax)
movl   $0xa0000000,0x10(%rax)
movl   $0x19,0xc(%rax)
nopl   0x0(%rax)
mov    0xc(%rax),%ecx
test   $0x1,%cl
jne    1120 <usb_receivebyte+0x20>
mov    0x10(%rax),%ecx
movl   $0x0,(%rax)
xor    %eax,%eax
test   $0x8000000,%ecx
je     1145 <usb_receivebyte+0x45>
shr    $0x10,%ecx
mov    %cl,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @usb_receivebyte(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store volatile i32 208, i32* inttoptr (i64 3422578708 to i32*)
store volatile i32 -1610612736, i32* inttoptr (i64 3422578724 to i32*)
store volatile i32 25, i32* inttoptr (i64 3422578720 to i32*)
br label %5
5: ; preds = %9, %1
%6 = load volatile i32, i32* inttoptr (i64 3422578720 to i32*)
%7 = and i32 %6, 1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load volatile i32, i32* inttoptr (i64 3422578724 to i32*)
store i32 %11, i32* %4
store volatile i32 0, i32* inttoptr (i64 3422578708 to i32*)
%12 = load i32, i32* %4
%13 = and i32 %12, 134217728
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i32, i32* %4
%17 = lshr i32 %16, 16
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %3
store i8 %19, i8* %20
store i32 1, i32* %2
br label %22
21: ; preds = %10
store i32 0, i32* %2
br label %22
22: ; preds = %21, %15
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @usb_receivebyte(i8* nocapture writeonly %0) {
store volatile i32 208, i32* inttoptr (i64 3422578708 to i32*)
store volatile i32 -1610612736, i32* inttoptr (i64 3422578724 to i32*)
store volatile i32 25, i32* inttoptr (i64 3422578720 to i32*)
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 3422578720 to i32*)
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = load volatile i32, i32* inttoptr (i64 3422578724 to i32*)
store volatile i32 0, i32* inttoptr (i64 3422578708 to i32*)
%8 = and i32 %7, 134217728
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = lshr i32 %7, 16
%12 = trunc i32 %11 to i8
store i8 %12, i8* %0
br label %13
13: ; preds = %6, %10
%14 = phi i32 [ 1, %10 ], [ 0, %6 ]
ret i32 %14
}