#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 */
int /*<<< orphan*/ ASSERT(int);
uint32_t USBHostSpeedGet(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x40050000);
  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
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x40050000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    (%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1151 <USBHostSpeedGet+0x41>
movl   $0x2,-0x4(%rbp)
jmp    119c <USBHostSpeedGet+0x8c>
mov    -0x8(%rbp),%eax
add    $0x60,%eax
cltq
mov    (%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1173 <USBHostSpeedGet+0x63>
movl   $0x1,-0x4(%rbp)
jmp    119c <USBHostSpeedGet+0x8c>
mov    -0x8(%rbp),%eax
add    $0x60,%eax
cltq
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1195 <USBHostSpeedGet+0x85>
movl   $0x0,-0x4(%rbp)
jmp    119c <USBHostSpeedGet+0x8c>
movl   $0x80000000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostSpeedGet>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rcx
mov    $0x2,%eax
testl  $0x10,0x1(%rcx)
jne    1150 <USBHostSpeedGet+0x40>
mov    $0x1,%eax
testl  $0x40,0x60(%rcx)
jne    1150 <USBHostSpeedGet+0x40>
mov    0x60(%rcx),%eax
shl    $0x1a,%eax
not    %eax
and    $0x80000000,%eax
pop    %rbx
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 = icmp eq i32 %4, 1074069504
%6 = zext i1 %5 to i32
%7 = call i32 @ASSERT(i32 %6)
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, 16
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %1
store i32 2, i32* %2
br label %35
16: ; preds = %1
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 96
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
%22 = and i32 %21, 64
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %16
store i32 1, i32* %2
br label %35
25: ; preds = %16
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 96
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = and i32 %30, 32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %25
store i32 0, i32* %2
br label %35
34: ; preds = %25
store i32 -2147483648, i32* %2
br label %35
35: ; preds = %34, %33, %24, %15
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @USBHostSpeedGet(i32 %0) {
%2 = icmp eq i32 %0, 1074069504
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 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 eq i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %1
%12 = add nsw i32 %0, 96
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = and i32 %15, 64
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load volatile i32, i32* %14
%20 = shl i32 %19, 26
%21 = and i32 %20, -2147483648
%22 = xor i32 %21, -2147483648
br label %23
23: ; preds = %18, %11, %1
%24 = phi i32 [ 2, %1 ], [ 1, %11 ], [ %22, %18 ]
ret i32 %24
}