#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 */
int /*<<< orphan*/ usb_configure_endpoint(unsigned int, int);
void usb_enable_endpoint(unsigned ep, unsigned options) {
  unsigned int *p =
      (unsigned int *)(&*(volatile unsigned *)(0xBF800000 +
                                               (0x85300 + (0 << 4))) +
                       (4 * ep));
  *p = options;
  if (options & 0x08) {
    usb_configure_endpoint(ep, 0);
  }
  if (options & 0x04) {
    usb_configure_endpoint(ep, 1);
  }
}


x86 assembly (clang, -O0):
<usb_enable_endpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0xbf885300,%eax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     115a <usb_enable_endpoint+0x4a>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <usb_configure_endpoint@plt>
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1176 <usb_enable_endpoint+0x66>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <usb_configure_endpoint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_enable_endpoint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x0(,%rbx,4),%eax
mov    $0xbf885300,%ecx
mov    %esi,(%rcx,%rax,4)
test   $0x8,%bpl
je     1135 <usb_enable_endpoint+0x25>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <usb_configure_endpoint@plt>
test   $0x4,%bpl
jne    1142 <usb_enable_endpoint+0x32>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebx,%edi
mov    $0x1,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <usb_configure_endpoint@plt>

LLVM IR (-O0):
define void @usb_enable_endpoint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = mul i32 4, %6
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* inttoptr (i64 3213382400 to i32*), i64 %8
store i32* %9, i32** %5
%10 = load i32, i32* %4
%11 = load i32*, i32** %5
store i32 %10, i32* %11
%12 = load i32, i32* %4
%13 = and i32 %12, 8
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* %3
%17 = call i32 @usb_configure_endpoint(i32 %16, i32 0)
br label %18
18: ; preds = %15, %2
%19 = load i32, i32* %4
%20 = and i32 %19, 4
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %3
%24 = call i32 @usb_configure_endpoint(i32 %23, i32 1)
br label %25
25: ; preds = %22, %18
ret void
}

LLVM IR (-O2):
define void @usb_enable_endpoint(i32 %0, i32 %1) {
%3 = shl i32 %0, 2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* inttoptr (i64 3213382400 to i32*), i64 %4
store i32 %1, i32* %5
%6 = and i32 %1, 8
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @usb_configure_endpoint(i32 %0, i32 0)
br label %10
10: ; preds = %8, %2
%11 = and i32 %1, 4
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @usb_configure_endpoint(i32 %0, i32 1)
br label %15
15: ; preds = %13, %10
ret void
}