#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 long PRCMHIBRegRead(int);
int /*<<< orphan*/ PRCMHIBRegWrite(int, unsigned long);
void PRCMHibernateIntervalSet(unsigned long long ullTicks) {
  unsigned long long ullRTCVal;
  PRCMHIBRegWrite(0x4402F800 + 0x0000000C, 0x1);
  ullRTCVal = PRCMHIBRegRead(0x4402F800 + 0x00000014);
  ullRTCVal = ullRTCVal << 32;
  ullRTCVal |= PRCMHIBRegRead(0x4402F800 + 0x00000010);
  ullRTCVal = ullRTCVal + ullTicks;
  PRCMHIBRegWrite(0x4402F800 + 0x0000001C, (unsigned long)(ullRTCVal));
  PRCMHIBRegWrite(0x4402F800 + 0x00000020, (unsigned long)(ullRTCVal >> 32));
}


x86 assembly (clang, -O0):
<PRCMHibernateIntervalSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4402f80c,%edi
mov    $0x1,%esi
call   1030 <PRCMHIBRegWrite@plt>
mov    $0x4402f814,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    $0x4402f810,%edi
call   1040 <PRCMHIBRegRead@plt>
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402f81c,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    -0x10(%rbp),%rsi
shr    $0x20,%rsi
mov    $0x4402f820,%edi
call   1030 <PRCMHIBRegWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMHibernateIntervalSet>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x1,%esi
mov    $0x4402f80c,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    $0x4402f814,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,%rbx
shl    $0x20,%rbx
mov    $0x4402f810,%edi
call   1040 <PRCMHIBRegRead@plt>
or     %rax,%rbx
add    %r14,%rbx
mov    $0x4402f81c,%edi
mov    %rbx,%rsi
call   1030 <PRCMHIBRegWrite@plt>
shr    $0x20,%rbx
mov    $0x4402f820,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <PRCMHIBRegWrite@plt>

LLVM IR (-O0):
define void @PRCMHibernateIntervalSet(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = call i32 @PRCMHIBRegWrite(i32 1141045260, i64 1)
%5 = call i64 @PRCMHIBRegRead(i32 1141045268)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = shl i64 %6, 32
store i64 %7, i64* %3
%8 = call i64 @PRCMHIBRegRead(i32 1141045264)
%9 = load i64, i64* %3
%10 = or i64 %9, %8
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = load i64, i64* %2
%13 = add i64 %11, %12
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = call i32 @PRCMHIBRegWrite(i32 1141045276, i64 %14)
%16 = load i64, i64* %3
%17 = lshr i64 %16, 32
%18 = call i32 @PRCMHIBRegWrite(i32 1141045280, i64 %17)
ret void
}

LLVM IR (-O2):
define void @PRCMHibernateIntervalSet(i64 %0) {
%2 = tail call i32 @PRCMHIBRegWrite(i32 1141045260, i64 1)
%3 = tail call i64 @PRCMHIBRegRead(i32 1141045268)
%4 = shl i64 %3, 32
%5 = tail call i64 @PRCMHIBRegRead(i32 1141045264)
%6 = or i64 %4, %5
%7 = add i64 %6, %0
%8 = tail call i32 @PRCMHIBRegWrite(i32 1141045276, i64 %7)
%9 = lshr i64 %7, 32
%10 = tail call i32 @PRCMHIBRegWrite(i32 1141045280, i64 %9)
ret void
}