#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*/ DEBUG_ASSERT(int);
int /*<<< orphan*/ HibernateWriteComplete();
void HibernateDataSet(unsigned long *pulData, unsigned long ulCount) {
  unsigned long ulIdx;
  DEBUG_ASSERT(ulCount <= 64);
  DEBUG_ASSERT(pulData != 0);
  for (ulIdx = 0; ulIdx < ulCount; ulIdx++) {
    (*((volatile unsigned long *)(0x400FC030 + (ulIdx * 4)))) = pulData[ulIdx];
    HibernateWriteComplete();
  }
}


x86 assembly (clang, -O0):
<HibernateDataSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40,-0x10(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    119f <HibernateDataSet+0x7f>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
add    $0x400fc030,%rax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <HibernateWriteComplete@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115c <HibernateDataSet+0x3c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateDataSet>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x41,%rsi
setb   %dil
call   1040 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <DEBUG_ASSERT@plt>
test   %r15,%r15
je     117c <HibernateDataSet+0x5c>
mov    $0x400fc030,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rax
mov    %rax,(%r12)
xor    %eax,%eax
call   1030 <HibernateWriteComplete@plt>
add    $0x1,%rbx
add    $0x4,%r12
cmp    %rbx,%r15
jne    1160 <HibernateDataSet+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @HibernateDataSet(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = icmp ule i64 %6, 64
%8 = zext i1 %7 to i32
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64*, i64** %3
%11 = icmp ne i64* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @DEBUG_ASSERT(i32 %12)
store i64 0, i64* %5
br label %14
14: ; preds = %28, %2
%15 = load i64, i64* %5
%16 = load i64, i64* %4
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load i64*, i64** %3
%20 = load i64, i64* %5
%21 = getelementptr inbounds i64, i64* %19, i64 %20
%22 = load i64, i64* %21
%23 = load i64, i64* %5
%24 = mul i64 %23, 4
%25 = add i64 1074774064, %24
%26 = inttoptr i64 %25 to i64*
store volatile i64 %22, i64* %26
%27 = call i32 (...) @HibernateWriteComplete()
br label %28
28: ; preds = %18
%29 = load i64, i64* %5
%30 = add i64 %29, 1
store i64 %30, i64* %5
br label %14
31: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @HibernateDataSet(i64* %0, i64 %1) {
%3 = icmp ult i64 %1, 65
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ne i64* %0, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = icmp eq i64 %1, 0
br i1 %9, label %20, label %10
10: ; preds = %2, %10
%11 = phi i64 [ %18, %10 ], [ 0, %2 ]
%12 = getelementptr inbounds i64, i64* %0, i64 %11
%13 = load i64, i64* %12
%14 = shl i64 %11, 2
%15 = add i64 %14, 1074774064
%16 = inttoptr i64 %15 to i64*
store volatile i64 %13, i64* %16
%17 = tail call i32 (...) @HibernateWriteComplete()
%18 = add nuw i64 %11, 1
%19 = icmp eq i64 %18, %1
br i1 %19, label %20, label %10
20: ; preds = %10, %2
ret void
}