#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 _USBIndexRead(int, int, int, int);
void USBFIFOConfigGet(uint32_t ui32Base, uint32_t ui32Endpoint,
                      uint32_t *pui32FIFOAddress, uint32_t *pui32FIFOSize,
                      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)) {
    *pui32FIFOAddress =
        (_USBIndexRead(ui32Base, ui32Endpoint >> 4, (uint32_t)0x00000064, 2))
        << 3;
    *pui32FIFOSize =
        _USBIndexRead(ui32Base, ui32Endpoint >> 4, (uint32_t)0x00000062, 1);
  } else {
    *pui32FIFOAddress =
        (_USBIndexRead(ui32Base, ui32Endpoint >> 4, (uint32_t)0x00000066, 2))
        << 3;
    *pui32FIFOSize =
        _USBIndexRead(ui32Base, ui32Endpoint >> 4, (uint32_t)0x00000063, 1);
  }
}


x86 assembly (clang, -O0):
<USBFIFOConfigGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     11b2 <USBFIFOConfigGet+0x92>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x1c(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     1218 <USBFIFOConfigGet+0xf8>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    $0x64,%edx
mov    $0x2,%ecx
call   1030 <_USBIndexRead@plt>
mov    %eax,%ecx
shl    $0x3,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    $0x62,%edx
mov    $0x1,%ecx
call   1030 <_USBIndexRead@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    125b <USBFIFOConfigGet+0x13b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    $0x66,%edx
mov    $0x2,%ecx
call   1030 <_USBIndexRead@plt>
mov    %eax,%ecx
shl    $0x3,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
mov    $0x63,%edx
mov    $0x1,%ecx
call   1030 <_USBIndexRead@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBFIFOConfigGet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%r13d
xor    %edi,%edi
cmp    $0x40050000,%r13d
sete   %dil
call   1040 <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   1040 <ASSERT@plt>
xor    %ebp,%ebp
test   $0x2000,%r12d
sete   %bpl
sar    $0x4,%ebx
lea    0x64(%rbp,%rbp,1),%edx
or     $0x62,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
mov    $0x2,%ecx
call   1030 <_USBIndexRead@plt>
shl    $0x3,%eax
mov    %eax,(%r15)
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <_USBIndexRead@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @USBFIFOConfigGet(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 = call i32 @_USBIndexRead(i32 %43, i32 %45, i32 100, i32 2)
%47 = shl i32 %46, 3
%48 = load i32*, i32** %8
store i32 %47, i32* %48
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = ashr i32 %50, 4
%52 = call i32 @_USBIndexRead(i32 %49, i32 %51, i32 98, i32 1)
%53 = load i32*, i32** %9
store i32 %52, i32* %53
br label %66
54: ; preds = %35
%55 = load i32, i32* %6
%56 = load i32, i32* %7
%57 = ashr i32 %56, 4
%58 = call i32 @_USBIndexRead(i32 %55, i32 %57, i32 102, i32 2)
%59 = shl i32 %58, 3
%60 = load i32*, i32** %8
store i32 %59, i32* %60
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = ashr i32 %62, 4
%64 = call i32 @_USBIndexRead(i32 %61, i32 %63, i32 99, i32 1)
%65 = load i32*, i32** %9
store i32 %64, i32* %65
br label %66
66: ; preds = %54, %42
ret void
}

LLVM IR (-O2):
define void @USBFIFOConfigGet(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %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 102, i32 100
%20 = select i1 %17, i32 99, i32 98
%21 = tail call i32 @_USBIndexRead(i32 %0, i32 %18, i32 %19, i32 2)
%22 = shl i32 %21, 3
store i32 %22, i32* %2
%23 = tail call i32 @_USBIndexRead(i32 %0, i32 %18, i32 %20, i32 1)
store i32 %23, i32* %3
ret void
}