#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*/ _HibernateWriteComplete();
void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count) {
  uint32_t ui32Idx;
  ;
  ;
  for (ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++) {
    (*((volatile unsigned long *)(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)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1163 <HibernateDataSet+0x53>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movslq (%rax,%rcx,4),%rcx
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
add    $0x400fc030,%eax
cltq
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <HibernateDataSet+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateDataSet>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114b <HibernateDataSet+0x3b>
mov    %rdi,%r14
mov    %esi,%r15d
shl    $0x2,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movslq (%r14,%rbx,1),%rax
mov    %rax,0x400fc030(%rbx)
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1130 <HibernateDataSet+0x20>
pop    %rbx
pop    %r14
pop    %r15
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
store i32 0, i32* %5
br label %6
6: ; preds = %23, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, 4
%19 = add nsw i32 1074774064, %18
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i64*
store volatile i64 %16, i64* %21
%22 = call i32 (...) @_HibernateWriteComplete()
br label %23
23: ; preds = %10
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %6
26: ; preds = %6
ret void
}

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