#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 */
void USBEndpointDMADisable(uint32_t ui32Base, uint32_t ui32Endpoint,
                           uint32_t ui32Flags) {
  if (ui32Flags & 0x00002000) {
    (*((volatile unsigned char *)(ui32Base + (ui32Endpoint - 0x10) +
                                  0x00000113))) &= ~0x00000010;
  } else {
    (*((volatile unsigned char *)(ui32Base + (ui32Endpoint - 0x10) +
                                  0x00000117))) &= ~0x00000020;
  }
}


x86 assembly (clang, -O0):
<USBEndpointDMADisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     113f <USBEndpointDMADisable+0x3f>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x113,%eax
cltq
mov    (%rax),%cl
movzbl %cl,%ecx
and    $0xffffffef,%ecx
mov    %cl,(%rax)
jmp    115b <USBEndpointDMADisable+0x5b>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x117,%eax
cltq
mov    (%rax),%cl
movzbl %cl,%ecx
and    $0xffffffdf,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDMADisable>:
and    $0x2000,%edx
mov    %edx,%eax
shr    $0xd,%eax
xor    %ecx,%ecx
test   %edx,%edx
sete   %cl
add    %esi,%edi
shl    $0x4,%al
add    $0xdf,%al
lea    (%rdi,%rcx,4),%ecx
add    $0x103,%ecx
movslq %ecx,%rcx
and    %al,(%rcx)
ret

LLVM IR (-O0):
define void @USBEndpointDMADisable(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* %6
%8 = and i32 %7, 8192
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 16
%14 = add nsw i32 %11, %13
%15 = add nsw i32 %14, 275
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
%18 = load volatile i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 %19, -17
%21 = trunc i32 %20 to i8
store volatile i8 %21, i8* %17
br label %34
22: ; preds = %3
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 16
%26 = add nsw i32 %23, %25
%27 = add nsw i32 %26, 279
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i8*
%30 = load volatile i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, -33
%33 = trunc i32 %32 to i8
store volatile i8 %33, i8* %29
br label %34
34: ; preds = %22, %10
ret void
}

LLVM IR (-O2):
define void @USBEndpointDMADisable(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 8192
%5 = icmp eq i32 %4, 0
%6 = add i32 %1, %0
%7 = select i1 %5, i32 263, i32 259
%8 = select i1 %5, i8 -33, i8 -17
%9 = add i32 %6, %7
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = load volatile i8, i8* %11
%13 = and i8 %12, %8
store volatile i8 %13, i8* %11
ret void
}