#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);
void EMACPowerManagementControlSet(uint32_t ui32Base, uint32_t ui32Flags) {
  uint32_t ui32Value;
  ASSERT(ui32Base == 0x400EC000);
  ASSERT(~(ui32Flags & ~(0x00000200 | 0x00000004 | 0x00000002 | 0x00000001)));
  ui32Value = (*((volatile uint32_t *)(ui32Base + 0x0000002C)));
  ui32Value &= ~(0x00000200 | 0x00000004 | 0x00000002 | 0x00000001);
  ui32Value |= ui32Flags;
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) = ui32Value;
}


x86 assembly (clang, -O0):
<EMACPowerManagementControlSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edi
and    $0xfffffdf8,%edi
xor    $0xffffffff,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfffffdf8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACPowerManagementControlSet>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %esi,%ebx
not    %ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
or     $0x207,%ebx
mov    %ebx,%edi
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    $0xfffffdf8,%ecx
and    0x2c(%rax),%ecx
or     %r14d,%ecx
mov    %ecx,0x2c(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACPowerManagementControlSet(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 = icmp eq i32 %6, 1074708480
%8 = zext i1 %7 to i32
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %4
%11 = and i32 %10, -520
%12 = xor i32 %11, -1
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 44
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = and i32 %19, -520
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = or i32 %22, %21
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 44
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i32*
store volatile i32 %24, i32* %28
ret void
}

LLVM IR (-O2):
define void @EMACPowerManagementControlSet(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074708480
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, -520
%7 = xor i32 %6, -1
%8 = tail call i32 @ASSERT(i32 %7)
%9 = add nsw i32 %0, 44
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, -520
%14 = or i32 %13, %1
store volatile i32 %14, i32* %11
ret void
}