#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;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint,
                           uint32_t ui32Channel) {
  uint32_t ui32Mask;
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000010) || (ui32Endpoint == 0x00000020) ||
         (ui32Endpoint == 0x00000030) || (ui32Endpoint == 0x00000040) ||
         (ui32Endpoint == 0x00000050) || (ui32Endpoint == 0x00000060) ||
         (ui32Endpoint == 0x00000070));
  ASSERT(ui32Channel <= 5);
  ui32Mask = 0xf << (ui32Channel * 4);
  ui32Mask = (*((volatile uint32_t *)(ui32Base + 0x00000450))) & (~ui32Mask);
  ui32Mask |= (((ui32Endpoint) >> 4)) << (ui32Channel * 4);
  (*((volatile uint32_t *)(ui32Base + 0x00000450))) = ui32Mask;
}


x86 assembly (clang, -O0):
<USBEndpointDMAChannel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1199 <USBEndpointDMAChannel+0x89>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x5,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
mov    $0xf,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%eax
cltq
mov    (%rax),%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x4,%eax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
shl    %cl,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x450,%eax
cltq
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDMAChannel>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r14d
xor    %edi,%edi
cmp    $0x40050000,%r14d
sete   %dil
call   1030 <ASSERT@plt>
lea    -0x10(%rbx),%eax
rol    $0x1c,%eax
cmp    $0x6,%eax
setb   %al
cmp    $0x70,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x6,%ebp
setl   %dil
call   1030 <ASSERT@plt>
shl    $0x2,%ebp
mov    $0xf,%eax
mov    %ebp,%ecx
shl    %cl,%eax
movslq %r14d,%rdx
not    %eax
sar    $0x4,%ebx
shl    %cl,%ebx
and    0x450(%rdx),%eax
or     %eax,%ebx
mov    %ebx,0x450(%rdx)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @USBEndpointDMAChannel(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 = add i32 %1, -16
%8 = tail call i32 @llvm.fshl.i32(i32 %7, i32 %7, i32 28)
%9 = icmp ult i32 %8, 6
%10 = icmp eq i32 %1, 112
%11 = or i1 %10, %9
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = icmp slt i32 %2, 6
%15 = zext i1 %14 to i32
%16 = tail call i32 @ASSERT(i32 %15)
%17 = shl nsw i32 %2, 2
%18 = shl i32 15, %17
%19 = add nsw i32 %0, 1104
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = xor i32 %18, -1
%24 = and i32 %22, %23
%25 = ashr i32 %1, 4
%26 = shl i32 %25, %17
%27 = or i32 %24, %26
store volatile i32 %27, i32* %21
ret void
}