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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBIntDisableEndpoint(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  (*((volatile uint16_t *)(ui32Base + 0x00000006))) &=
      ~(ui32Flags & (0x0000FFFE | 0x0000FFFE | 0x00000001));
  (*((volatile uint16_t *)(ui32Base + 0x00000008))) &=
      ~((ui32Flags & (0xFFFE0000 | 0xFFFE0000)) >> 16);
}


x86 assembly (clang, -O0):
<USBIntDisableEndpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edx
and    $0xffff,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x6,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
and    $0xfffe0000,%edx
shr    $0x10,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntDisableEndpoint>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
mov    %esi,%ebp
not    %ebp
xor    %edi,%edi
cmp    $0x40050000,%r14d
sete   %dil
call   1030 <ASSERT@plt>
or     $0xffff0000,%ebp
movslq %r14d,%rax
and    %ebp,0x6(%rax)
shr    $0x10,%ebx
not    %ebx
or     $0xffff0001,%ebx
and    %ebx,0x8(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBIntDisableEndpoint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1074069504
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = and i32 %9, 65535
%11 = xor i32 %10, -1
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 6
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = and i32 %16, %11
store volatile i32 %17, i32* %15
%18 = load i32, i32* %4
%19 = and i32 %18, -131072
%20 = lshr i32 %19, 16
%21 = xor i32 %20, -1
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 8
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, %21
store volatile i32 %27, i32* %25
ret void
}

LLVM IR (-O2):
define void @USBIntDisableEndpoint(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074069504
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, 65535
%7 = xor i32 %6, -1
%8 = add nsw i32 %0, 6
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, %7
store volatile i32 %12, i32* %10
%13 = lshr i32 %1, 16
%14 = and i32 %13, 65534
%15 = xor i32 %14, -1
%16 = add nsw i32 %0, 8
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = and i32 %19, %15
store volatile i32 %20, i32* %18
ret void
}