#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);
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count) {
  uint32_t ui32Idx;
  ASSERT(ui32Count <= 64);
  ASSERT(pui32Data != 0);
  for (ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++) {
    (*((volatile uint32_t *)(0x400FC030 + (ui32Idx * 4)))) = pui32Data[ui32Idx];
    _HibernateWriteComplete();
  }
}


x86 assembly (clang, -O0):
<HibernateDataSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1194 <HibernateDataSet+0x74>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
add    $0x400fc030,%eax
cltq
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <HibernateDataSet+0x39>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateDataSet>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x41,%esi
setl   %dil
call   1040 <ASSERT@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <ASSERT@plt>
test   %ebp,%ebp
jle    117a <HibernateDataSet+0x5a>
mov    %ebp,%ebp
shl    $0x2,%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,1),%eax
mov    %eax,0x400fc030(%rbx)
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
add    $0x4,%rbx
cmp    %rbx,%rbp
jne    1160 <HibernateDataSet+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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