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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint) {
  uint32_t ui32Status;
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  ui32Status =
      (*((volatile uint16_t *)(ui32Base + (ui32Endpoint - 0x10) + 0x00000112)));
  ui32Status |= (((*((volatile uint16_t *)(ui32Base + (ui32Endpoint - 0x10) +
                                           0x00000116))))
                 << 16);
  return (ui32Status);
}


x86 assembly (clang, -O0):
<USBEndpointStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBEndpointStatus+0x95>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x112,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x116,%eax
cltq
mov    (%rax),%eax
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointStatus>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
xor    %edi,%edi
cmp    $0x40050000,%r14d
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>
lea    (%r14,%rbx,1),%eax
add    $0xfffffff0,%eax
cltq
mov    0x112(%rax),%ecx
mov    0x116(%rax),%eax
shl    $0x10,%eax
or     %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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