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

/* Variables and functions */
uint32_t USBHostSpeedGet(uint32_t ui32Base) {
  ;
  if ((*((volatile uint8_t *)(ui32Base + 0x00000001))) & 0x00000010) {
    return (0x00000002);
  }
  if ((*((volatile uint8_t *)(ui32Base + 0x00000060))) & 0x00000040) {
    return (0x00000001);
  }
  if ((*((volatile uint8_t *)(ui32Base + 0x00000060))) & 0x00000020) {
    return (0x00000000);
  }
  return (0x80000000);
}


x86 assembly (clang, -O0):
<USBHostSpeedGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    (%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1129 <USBHostSpeedGet+0x29>
movl   $0x2,-0x4(%rbp)
jmp    1174 <USBHostSpeedGet+0x74>
mov    -0x8(%rbp),%eax
add    $0x60,%eax
cltq
mov    (%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     114b <USBHostSpeedGet+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    1174 <USBHostSpeedGet+0x74>
mov    -0x8(%rbp),%eax
add    $0x60,%eax
cltq
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     116d <USBHostSpeedGet+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1174 <USBHostSpeedGet+0x74>
movl   $0x80000000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostSpeedGet>:
movslq %edi,%rcx
mov    $0x2,%eax
testl  $0x10,0x1(%rcx)
jne    112c <USBHostSpeedGet+0x2c>
mov    $0x1,%eax
testl  $0x40,0x60(%rcx)
jne    112c <USBHostSpeedGet+0x2c>
mov    0x60(%rcx),%eax
shl    $0x1a,%eax
not    %eax
and    $0x80000000,%eax
ret

LLVM IR (-O0):
define i32 @USBHostSpeedGet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 16
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 2, i32* %2
br label %31
12: ; preds = %1
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 96
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 64
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %12
store i32 1, i32* %2
br label %31
21: ; preds = %12
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 96
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %21
store i32 0, i32* %2
br label %31
30: ; preds = %21
store i32 -2147483648, i32* %2
br label %31
31: ; preds = %30, %29, %20, %11
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @USBHostSpeedGet(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, 16
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = add nsw i32 %0, 96
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, 64
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = load volatile i32, i32* %11
%17 = shl i32 %16, 26
%18 = and i32 %17, -2147483648
%19 = xor i32 %18, -2147483648
br label %20
20: ; preds = %15, %8, %1
%21 = phi i32 [ 2, %1 ], [ 1, %8 ], [ %19, %15 ]
ret i32 %21
}