#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 USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint,
                           uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  if (ui32Flags & 0x00002000) {
    return (
        (*((volatile uint8_t *)(ui32Base + 0x00000082 + (ui32Endpoint >> 1)))));
  } else {
    return ((*((volatile uint8_t *)(ui32Base + 0x00000082 + 4 +
                                    (ui32Endpoint >> 1)))));
  }
}


x86 assembly (clang, -O0):
<USBHostHubAddrGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x40050000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x20,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x30,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x40,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x50,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
mov    $0x1,%al
cmpl   $0x60,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     11a8 <USBHostHubAddrGet+0x98>
cmpl   $0x70,-0xc(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x10(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     11e2 <USBHostHubAddrGet+0xd2>
mov    -0x8(%rbp),%eax
add    $0x82,%eax
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11fc <USBHostHubAddrGet+0xec>
mov    -0x8(%rbp),%eax
add    $0x82,%eax
add    $0x4,%eax
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostHubAddrGet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
mov    %ebx,%eax
rol    $0x1c,%eax
cmp    $0x7,%eax
setb   %al
cmp    $0x70,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <ASSERT@plt>
xor    %eax,%eax
test   $0x2000,%r14d
sete   %al
lea    0x82(%rbp,%rax,4),%eax
sar    %ebx
cltq
movslq %ebx,%rcx
mov    (%rax,%rcx,1),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @USBHostHubAddrGet(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = tail call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 28)
%8 = icmp ult i32 %7, 7
%9 = icmp eq i32 %1, 112
%10 = or i1 %9, %8
%11 = zext i1 %10 to i32
%12 = tail call i32 @ASSERT(i32 %11)
%13 = and i32 %2, 8192
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 134, i32 130
%16 = add nsw i32 %15, %0
%17 = ashr i32 %1, 1
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
ret i32 %21
}