#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 USBDMAChannelConfigSet(uint32_t ui32Base, uint32_t ui32Channel,
                            uint32_t ui32Endpoint, uint32_t ui32Config) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT(ui32Channel < 8);
  ASSERT((ui32Endpoint & ~0x00000070) == 0);
  (*((volatile uint32_t *)(ui32Base + 0x00000204 + (0x10 * ui32Channel)))) = 0;
  (*((volatile uint32_t *)(ui32Base + 0x00000204 + (0x10 * ui32Channel)))) =
      ui32Config | ui32Endpoint;
}


x86 assembly (clang, -O0):
<USBDMAChannelConfigSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x8,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%eax
and    $0xffffff8f,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x204,%eax
mov    -0x8(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
cltq
movl   $0x0,(%rax)
mov    -0x10(%rbp),%ecx
or     -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x204,%eax
mov    -0x8(%rbp),%edx
shl    $0x4,%edx
add    %edx,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDMAChannelConfigSet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x8,%r15d
setl   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xffffff8f,%r14d
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
movslq %r15d,%rcx
shl    $0x4,%rcx
movl   $0x0,0x204(%rax,%rcx,1)
or     %r14d,%ebx
mov    %ebx,0x204(%rax,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @USBDMAChannelConfigSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1074069504
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 8
%15 = zext i1 %14 to i32
%16 = call i32 @ASSERT(i32 %15)
%17 = load i32, i32* %7
%18 = and i32 %17, -113
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @ASSERT(i32 %20)
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 516
%24 = load i32, i32* %6
%25 = mul nsw i32 16, %24
%26 = add nsw i32 %23, %25
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i32*
store volatile i32 0, i32* %28
%29 = load i32, i32* %8
%30 = load i32, i32* %7
%31 = or i32 %29, %30
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 516
%34 = load i32, i32* %6
%35 = mul nsw i32 16, %34
%36 = add nsw i32 %33, %35
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store volatile i32 %31, i32* %38
ret void
}

LLVM IR (-O2):
define void @USBDMAChannelConfigSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, 1074069504
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = icmp slt i32 %1, 8
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = and i32 %2, -113
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @ASSERT(i32 %13)
%15 = add nsw i32 %0, 516
%16 = shl nsw i32 %1, 4
%17 = add nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 0, i32* %19
%20 = or i32 %3, %2
store volatile i32 %20, i32* %19
ret void
}