#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 */

/* Variables and functions */
int /*<<< orphan*/ BootActivate();
void BootComCanCheckActivationRequest(void) {
  unsigned char data[2];
  if (((*((volatile unsigned long *)0xE004401C)) & (0x01)) == 0) {
    return;
  }
  if ((*((volatile unsigned long *)0xE0044024)) != (0x667)) {
    return;
  }
  data[0] = (unsigned char)(*((volatile unsigned long *)0xE0044028));
  data[1] = (unsigned char)((*((volatile unsigned long *)0xE0044028)) >> 8);
  (*((volatile unsigned long *)0xE0044004)) = (0x04);
  if ((data[0] == 0xff) && (data[1] == 0x00)) {
    BootActivate();
  }
}


x86 assembly (clang, -O0):
<BootComCanCheckActivationRequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xe004401c,%eax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    1133 <BootComCanCheckActivationRequest+0x23>
jmp    1195 <BootComCanCheckActivationRequest+0x85>
mov    $0xe0044024,%eax
mov    (%rax),%rax
cmp    $0x667,%rax
je     114c <BootComCanCheckActivationRequest+0x3c>
jmp    1195 <BootComCanCheckActivationRequest+0x85>
mov    $0xe0044028,%eax
mov    (%rax),%rax
mov    %al,-0x2(%rbp)
mov    $0xe0044028,%eax
mov    (%rax),%rax
shr    $0x8,%rax
mov    %al,-0x1(%rbp)
mov    $0xe0044004,%eax
movq   $0x4,(%rax)
movzbl -0x2(%rbp),%eax
cmp    $0xff,%eax
jne    1195 <BootComCanCheckActivationRequest+0x85>
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1195 <BootComCanCheckActivationRequest+0x85>
mov    $0x0,%al
call   1030 <BootActivate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BootComCanCheckActivationRequest>:
mov    $0xe0044028,%eax
testq  $0x1,-0xc(%rax)
je     1151 <BootComCanCheckActivationRequest+0x41>
mov    -0x4(%rax),%rcx
cmp    $0x667,%rcx
jne    1151 <BootComCanCheckActivationRequest+0x41>
mov    (%rax),%rdx
mov    (%rax),%rcx
movq   $0x4,-0x24(%rax)
cmp    $0xff,%dl
jne    1151 <BootComCanCheckActivationRequest+0x41>
and    $0xff00,%ecx
test   %rcx,%rcx
jne    1151 <BootComCanCheckActivationRequest+0x41>
xor    %eax,%eax
jmp    1030 <BootActivate@plt>
ret

LLVM IR (-O0):
define void @BootComCanCheckActivationRequest() {
%1 = alloca [2 x i8]
%2 = load volatile i64, i64* inttoptr (i64 3758374940 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %29
6: ; preds = %0
%7 = load volatile i64, i64* inttoptr (i64 3758374948 to i64*)
%8 = icmp ne i64 %7, 1639
br i1 %8, label %9, label %10
9: ; preds = %6
br label %29
10: ; preds = %6
%11 = load volatile i64, i64* inttoptr (i64 3758374952 to i64*)
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
store i8 %12, i8* %13
%14 = load volatile i64, i64* inttoptr (i64 3758374952 to i64*)
%15 = lshr i64 %14, 8
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
store i8 %16, i8* %17
store volatile i64 4, i64* inttoptr (i64 3758374916 to i64*)
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 255
br i1 %21, label %22, label %29
22: ; preds = %10
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 (...) @BootActivate()
br label %29
29: ; preds = %5, %9, %27, %22, %10
ret void
}

LLVM IR (-O2):
define void @BootComCanCheckActivationRequest() {
%1 = load volatile i64, i64* inttoptr (i64 3758374940 to i64*)
%2 = and i64 %1, 1
%3 = icmp eq i64 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %0
%5 = load volatile i64, i64* inttoptr (i64 3758374948 to i64*)
%6 = icmp eq i64 %5, 1639
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load volatile i64, i64* inttoptr (i64 3758374952 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 3758374952 to i64*)
store volatile i64 4, i64* inttoptr (i64 3758374916 to i64*)
%10 = and i64 %8, 255
%11 = icmp eq i64 %10, 255
%12 = and i64 %9, 65280
%13 = icmp eq i64 %12, 0
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = tail call i32 (...) @BootActivate()
br label %17
17: ; preds = %7, %15, %4, %0
ret void
}