#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 */
unsigned long PRCMHIBRegRead(int);
int /*<<< orphan*/ PRCMHIBRegWrite(int, unsigned long);
void PRCMHibernateWakeupSourceDisable(unsigned long ulHIBWakupSrc) {
  unsigned long ulRegValue;
  ulRegValue = PRCMHIBRegRead(0x4402F800 + 0x00000018);
  ulRegValue &= ~(ulHIBWakupSrc & 0x1);
  PRCMHIBRegWrite(0x4402F800 + 0x00000018, ulRegValue);
  ulRegValue = PRCMHIBRegRead(0x4402F800 + 0x00000404);
  ulRegValue &= ~((ulHIBWakupSrc >> 16) & 0xFF);
  PRCMHIBRegWrite(0x4402F800 + 0x00000404, ulRegValue);
}


x86 assembly (clang, -O0):
<PRCMHibernateWakeupSourceDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4402f818,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
xor    $0xffffffffffffffff,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402f818,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    $0x4402fc04,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
xor    $0xffffffffffffffff,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc04,%edi
call   1030 <PRCMHIBRegWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMHibernateWakeupSourceDisable>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %r14d,%ebx
not    %ebx
mov    $0x4402f818,%edi
call   1040 <PRCMHIBRegRead@plt>
or     $0xfffffffffffffffe,%rbx
and    %rax,%rbx
mov    $0x4402f818,%edi
mov    %rbx,%rsi
call   1030 <PRCMHIBRegWrite@plt>
mov    $0x4402fc04,%edi
call   1040 <PRCMHIBRegRead@plt>
shr    $0x10,%r14d
not    %r14d
or     $0xffffffffffffff00,%r14
and    %rax,%r14
mov    $0x4402fc04,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <PRCMHIBRegWrite@plt>

LLVM IR (-O0):
define void @PRCMHibernateWakeupSourceDisable(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = call i64 @PRCMHIBRegRead(i32 1141045272)
store i64 %4, i64* %3
%5 = load i64, i64* %2
%6 = and i64 %5, 1
%7 = xor i64 %6, -1
%8 = load i64, i64* %3
%9 = and i64 %8, %7
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = call i32 @PRCMHIBRegWrite(i32 1141045272, i64 %10)
%12 = call i64 @PRCMHIBRegRead(i32 1141046276)
store i64 %12, i64* %3
%13 = load i64, i64* %2
%14 = lshr i64 %13, 16
%15 = and i64 %14, 255
%16 = xor i64 %15, -1
%17 = load i64, i64* %3
%18 = and i64 %17, %16
store i64 %18, i64* %3
%19 = load i64, i64* %3
%20 = call i32 @PRCMHIBRegWrite(i32 1141046276, i64 %19)
ret void
}

LLVM IR (-O2):
define void @PRCMHibernateWakeupSourceDisable(i64 %0) {
%2 = tail call i64 @PRCMHIBRegRead(i32 1141045272)
%3 = and i64 %0, 1
%4 = xor i64 %3, -1
%5 = and i64 %2, %4
%6 = tail call i32 @PRCMHIBRegWrite(i32 1141045272, i64 %5)
%7 = tail call i64 @PRCMHIBRegRead(i32 1141046276)
%8 = lshr i64 %0, 16
%9 = and i64 %8, 255
%10 = xor i64 %9, -1
%11 = and i64 %7, %10
%12 = tail call i32 @PRCMHIBRegWrite(i32 1141046276, i64 %11)
ret void
}