#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);
void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint) {
  uint32_t ui32Register;
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  if (ui32Endpoint == 0x00000000) {
    ui32Register = 0x00000102;
  } else {
    ui32Register = 0x00000116 + (ui32Endpoint - 0x10);
  }
  (*((volatile uint8_t *)(ui32Base + ui32Register))) = 0x00000020;
}


x86 assembly (clang, -O0):
<USBHostRequestIN>:
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 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+0x95>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11a5 <USBHostRequestIN+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>
cmpl   $0x0,-0x8(%rbp)
jne    11c8 <USBHostRequestIN+0xb8>
movl   $0x102,-0xc(%rbp)
jmp    11d6 <USBHostRequestIN+0xc6>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
add    $0x116,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
movl   $0x20,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostRequestIN>:
push   %rbp
push   %rbx
push   %rax
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>
lea    0x106(%rbx),%eax
test   %ebx,%ebx
mov    $0x102,%ecx
cmovne %eax,%ecx
movslq %ecx,%rax
movslq %ebp,%rcx
movl   $0x20,(%rax,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @USBHostRequestIN(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* %4
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %33
store i32 258, i32* %5
br label %44
40: ; preds = %33
%41 = load i32, i32* %4
%42 = sub nsw i32 %41, 16
%43 = add nsw i32 278, %42
store i32 %43, i32* %5
br label %44
44: ; preds = %40, %39
%45 = load i32, i32* %3
%46 = load i32, i32* %5
%47 = add nsw i32 %45, %46
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
store volatile i32 32, i32* %49
ret void
}

LLVM IR (-O2):
define void @USBHostRequestIN(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074069504
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = icmp eq i32 %1, 0
%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 = add nsw i32 %1, 262
%14 = select i1 %6, i32 258, i32 %13
%15 = add nsw i32 %14, %0
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
store volatile i32 32, i32* %17
ret void
}