#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 */

/* Variables and functions */
unsigned long USB_EP_TO_INDEX(unsigned long);
void USBEndpointDMAChannel(unsigned long ulBase, unsigned long ulEndpoint,
                           unsigned long ulChannel) {
  unsigned long ulMask;
  ;

  ;
  ;
  ulMask = 0xf << (ulChannel * 4);
  ulMask = (*((volatile unsigned long *)(ulBase + 0x00000450))) & (~ulMask);
  ulMask |= (USB_EP_TO_INDEX(ulEndpoint)) << (ulChannel * 4);
  (*((volatile unsigned long *)(ulBase + 0x00000450))) = ulMask;
}


x86 assembly (clang, -O0):
<USBEndpointDMAChannel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%ecx
mov    $0xf,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x450(%rax),%rax
mov    -0x20(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <USB_EP_TO_INDEX@plt>
mov    -0x18(%rbp),%rcx
shl    $0x2,%rcx
shl    %cl,%rax
or     -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x450(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDMAChannel>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0x0(,%rdx,4),%ebp
mov    $0xf,%eax
mov    %ebp,%ecx
shl    %cl,%eax
not    %eax
movslq %eax,%rbx
and    0x450(%rdi),%rbx
mov    %rsi,%rdi
call   1030 <USB_EP_TO_INDEX@plt>
mov    %ebp,%ecx
shl    %cl,%rax
or     %rbx,%rax
mov    %rax,0x450(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBEndpointDMAChannel(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
%11 = shl i32 15, %10
%12 = sext i32 %11 to i64
store i64 %12, i64* %7
%13 = load i64, i64* %4
%14 = add i64 %13, 1104
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
%17 = load i64, i64* %7
%18 = xor i64 %17, -1
%19 = and i64 %16, %18
store i64 %19, i64* %7
%20 = load i64, i64* %5
%21 = call i64 @USB_EP_TO_INDEX(i64 %20)
%22 = load i64, i64* %6
%23 = mul i64 %22, 4
%24 = shl i64 %21, %23
%25 = load i64, i64* %7
%26 = or i64 %25, %24
store i64 %26, i64* %7
%27 = load i64, i64* %7
%28 = load i64, i64* %4
%29 = add i64 %28, 1104
%30 = inttoptr i64 %29 to i64*
store volatile i64 %27, i64* %30
ret void
}

LLVM IR (-O2):
define void @USBEndpointDMAChannel(i64 %0, i64 %1, i64 %2) {
%4 = shl i64 %2, 2
%5 = trunc i64 %4 to i32
%6 = shl i32 15, %5
%7 = add i64 %0, 1104
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = xor i32 %6, -1
%11 = sext i32 %10 to i64
%12 = and i64 %9, %11
%13 = tail call i64 @USB_EP_TO_INDEX(i64 %1)
%14 = shl i64 %13, %4
%15 = or i64 %14, %12
store volatile i64 %15, i64* %8
ret void
}