#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 EMACWoLEnter(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x400EC000);
  while ((*((volatile uint32_t *)(ui32Base + 0x00000C14))) == 0x00000001) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) &= ~0x00000008;
  (*((volatile uint32_t *)(ui32Base + 0x00000C18))) &= ~0x00002000;
  while (((*((volatile uint32_t *)(ui32Base + 0x00000024))) & 0x00000300) ==
         (0x00 << 8)) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000C18))) &= ~0x00000002;
}


x86 assembly (clang, -O0):
<EMACWoLEnter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc14,%eax
cltq
mov    (%rax),%eax
cmp    $0x1,%eax
jne    1149 <EMACWoLEnter+0x39>
jmp    112f <EMACWoLEnter+0x1f>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffff7,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0xc18,%eax
cltq
mov    (%rax),%ecx
and    $0xffffdfff,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x24,%eax
cltq
mov    (%rax),%eax
and    $0x300,%eax
cmp    $0x0,%eax
jne    1189 <EMACWoLEnter+0x79>
jmp    116c <EMACWoLEnter+0x5c>
mov    -0x4(%rbp),%eax
add    $0xc18,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACWoLEnter>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
nopw   0x0(%rax,%rax,1)
mov    0xc14(%rax),%ecx
cmp    $0x1,%ecx
je     1130 <EMACWoLEnter+0x20>
andl   $0xfffffff7,(%rax)
andl   $0xffffdfff,0xc18(%rax)
df ff ff
nopl   0x0(%rax,%rax,1)
testl  $0x300,0x24(%rax)
je     1150 <EMACWoLEnter+0x40>
andl   $0xfffffffd,0xc18(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @EMACWoLEnter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1074708480
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
br label %7
7: ; preds = %14, %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 3092
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %7
br label %7
15: ; preds = %7
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 0
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, -9
store volatile i32 %21, i32* %19
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 3096
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, -8193
store volatile i32 %27, i32* %25
br label %28
28: ; preds = %36, %15
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 36
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
%34 = and i32 %33, 768
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %28
br label %28
37: ; preds = %28
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 3096
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i32*
%42 = load volatile i32, i32* %41
%43 = and i32 %42, -3
store volatile i32 %43, i32* %41
ret void
}

LLVM IR (-O2):
define void @EMACWoLEnter(i32 %0) {
%2 = icmp eq i32 %0, 1074708480
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 3092
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
br label %8
8: ; preds = %8, %1
%9 = load volatile i32, i32* %7
%10 = icmp eq i32 %9, 1
br i1 %10, label %8, label %11
11: ; preds = %8
%12 = sext i32 %0 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -9
store volatile i32 %15, i32* %13
%16 = add nsw i32 %0, 3096
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = and i32 %19, -8193
store volatile i32 %20, i32* %18
%21 = add nsw i32 %0, 36
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
br label %24
24: ; preds = %24, %11
%25 = load volatile i32, i32* %23
%26 = and i32 %25, 768
%27 = icmp eq i32 %26, 0
br i1 %27, label %24, label %28
28: ; preds = %24
%29 = load volatile i32, i32* %18
%30 = and i32 %29, -3
store volatile i32 %30, i32* %18
ret void
}