#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBEndpointDataToggleClear(uint32_t ui32Base, uint32_t ui32Endpoint,
                                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)) {
    (*((volatile uint8_t *)(ui32Base + 0x00000112 + (ui32Endpoint - 0x10)))) |=
        0x00000040;
  } else {
    (*((volatile uint8_t *)(ui32Base + 0x00000116 + (ui32Endpoint - 0x10)))) |=
        0x00000080;
  }
}


x86 assembly (clang, -O0):
<USBEndpointDataToggleClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%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,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1199 <USBEndpointDataToggleClear+0x89>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     11d5 <USBEndpointDataToggleClear+0xc5>
mov    -0x4(%rbp),%eax
add    $0x112,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
or     $0x40,%ecx
mov    %ecx,(%rax)
jmp    11f1 <USBEndpointDataToggleClear+0xe1>
mov    -0x4(%rbp),%eax
add    $0x116,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
or     $0x80,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDataToggleClear>:
push   %rbp
push   %r14
push   %rbx
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,%r14d
sete   %al
add    %ebp,%ebx
lea    (%rbx,%rax,4),%ecx
add    $0x102,%ecx
shl    $0x6,%eax
add    $0x40,%eax
movslq %ecx,%rcx
or     %eax,(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBEndpointDataToggleClear(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1074069504
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 16
br i1 %12, label %31, label %13
13: ; preds = %3
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 32
br i1 %15, label %31, label %16
16: ; preds = %13
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 48
br i1 %18, label %31, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 64
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 80
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 96
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 112
br label %31
31: ; preds = %28, %25, %22, %19, %16, %13, %3
%32 = phi i1 [ true, %25 ], [ true, %22 ], [ true, %19 ], [ true, %16 ], [ true, %13 ], [ true, %3 ], [ %30, %28 ]
%33 = zext i1 %32 to i32
%34 = call i32 @ASSERT(i32 %33)
%35 = load i32, i32* %6
%36 = and i32 %35, 8192
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %48
38: ; preds = %31
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 274
%41 = load i32, i32* %5
%42 = sub nsw i32 %41, 16
%43 = add nsw i32 %40, %42
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
%46 = load volatile i32, i32* %45
%47 = or i32 %46, 64
store volatile i32 %47, i32* %45
br label %58
48: ; preds = %31
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 278
%51 = load i32, i32* %5
%52 = sub nsw i32 %51, 16
%53 = add nsw i32 %50, %52
%54 = sext i32 %53 to i64
%55 = inttoptr i64 %54 to i32*
%56 = load volatile i32, i32* %55
%57 = or i32 %56, 128
store volatile i32 %57, i32* %55
br label %58
58: ; preds = %48, %38
ret void
}

LLVM IR (-O2):
define void @USBEndpointDataToggleClear(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = add i32 %1, -16
%8 = tail call i32 @llvm.fshl.i32(i32 %7, i32 %7, i32 28)
%9 = icmp ult i32 %8, 6
%10 = icmp eq i32 %1, 112
%11 = or i1 %10, %9
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = and i32 %2, 8192
%15 = icmp eq i32 %14, 0
%16 = add i32 %1, %0
%17 = select i1 %15, i32 262, i32 258
%18 = select i1 %15, i32 128, i32 64
%19 = add i32 %16, %17
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = or i32 %22, %18
store volatile i32 %23, i32* %21
ret void
}