#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);
int /*<<< orphan*/ _USBIndexWrite(int, int, int, int, int);
void USBFIFOConfigSet(uint32_t ui32Base, uint32_t ui32Endpoint,
                      uint32_t ui32FIFOAddress, uint32_t ui32FIFOSize,
                      uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Endpoint == 0x00000010) || (ui32Endpoint == 0x00000020) ||
         (ui32Endpoint == 0x00000030) || (ui32Endpoint == 0x00000040) ||
         (ui32Endpoint == 0x00000050) || (ui32Endpoint == 0x00000060) ||
         (ui32Endpoint == 0x00000070));
  if (ui32Flags & (0x00002000 | 0x00002000)) {
    _USBIndexWrite(ui32Base, ui32Endpoint >> 4, 0x00000062, ui32FIFOSize, 1);
    _USBIndexWrite(ui32Base, ui32Endpoint >> 4, 0x00000064,
                   ui32FIFOAddress >> 3, 2);
  } else {
    _USBIndexWrite(ui32Base, ui32Endpoint >> 4, 0x00000063, ui32FIFOSize, 1);
    _USBIndexWrite(ui32Base, ui32Endpoint >> 4, 0x00000066,
                   ui32FIFOAddress >> 3, 2);
  }
}


x86 assembly (clang, -O0):
<USBFIFOConfigSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%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,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     11b0 <USBFIFOConfigSet+0x90>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x14(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     120e <USBFIFOConfigSet+0xee>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    -0x10(%rbp),%ecx
mov    $0x62,%edx
mov    $0x1,%r8d
call   1040 <_USBIndexWrite@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
mov    $0x64,%edx
mov    $0x2,%r8d
call   1040 <_USBIndexWrite@plt>
jmp    1249 <USBFIFOConfigSet+0x129>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    -0x10(%rbp),%ecx
mov    $0x63,%edx
mov    $0x1,%r8d
call   1040 <_USBIndexWrite@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
mov    $0x66,%edx
mov    $0x2,%r8d
call   1040 <_USBIndexWrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBFIFOConfigSet>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
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    %eax,%eax
test   $0x2000,%r12d
sete   %al
sar    $0x4,%ebx
lea    (%rax,%rax,1),%r12d
add    $0x64,%r12d
mov    %eax,%edx
or     $0x62,%edx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%ecx
mov    $0x1,%r8d
call   1040 <_USBIndexWrite@plt>
sar    $0x3,%r14d
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r14d,%ecx
mov    $0x2,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <_USBIndexWrite@plt>

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

LLVM IR (-O2):
define void @USBFIFOConfigSet(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %0, 1074069504
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = add i32 %1, -16
%10 = tail call i32 @llvm.fshl.i32(i32 %9, i32 %9, i32 28)
%11 = icmp ult i32 %10, 6
%12 = icmp eq i32 %1, 112
%13 = or i1 %12, %11
%14 = zext i1 %13 to i32
%15 = tail call i32 @ASSERT(i32 %14)
%16 = and i32 %4, 8192
%17 = icmp eq i32 %16, 0
%18 = ashr i32 %1, 4
%19 = select i1 %17, i32 99, i32 98
%20 = select i1 %17, i32 102, i32 100
%21 = tail call i32 @_USBIndexWrite(i32 %0, i32 %18, i32 %19, i32 %3, i32 1)
%22 = ashr i32 %2, 3
%23 = tail call i32 @_USBIndexWrite(i32 %0, i32 %18, i32 %20, i32 %22, i32 2)
ret void
}