#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 HibernateClockConfig(uint32_t ui32Config) {
  uint32_t ui32HIBCtl;

  ;
  ui32HIBCtl = (*((volatile uint32_t *)(0x400FC010)));
  ui32HIBCtl &= ~(0x00020000 | 0x00000000 | 0x00080000 | 0x00010000);
  ui32HIBCtl |=
      ui32Config & (0x00020000 | 0x00000000 | 0x00080000 | 0x00010000);
  if (ui32Config & 0x00080000) {
    ui32HIBCtl |= 0x00000040;
  }
  (*((volatile uint32_t *)(0x400FC010))) = ui32HIBCtl;
  _HibernateWriteComplete();
  if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
       (0x10000000 | 0x000A0000))) {
    (*((volatile uint32_t *)(0x400FCFC8))) =
        ui32Config & (0x00000001 | 0x00000002);
  }
}


x86 assembly (clang, -O0):
<HibernateClockConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x400fc010,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfff4ffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xb0000,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80000,%eax
cmp    $0x0,%eax
je     1158 <HibernateClockConfig+0x48>
mov    -0x8(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x400fc010,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x100a0000,%eax
jne    118d <HibernateClockConfig+0x7d>
mov    -0x4(%rbp),%ecx
and    $0x3,%ecx
mov    $0x400fcfc8,%eax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateClockConfig>:
push   %rbx
mov    %edi,%ebx
mov    $0xfff4ffff,%eax
and    0x400fc010,%eax
mov    %edi,%ecx
and    $0xb0000,%ecx
mov    %edi,%edx
shr    $0xd,%edx
and    $0x40,%edx
or     %ecx,%edx
or     %eax,%edx
mov    %edx,0x400fc010
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x100a0000,%eax
jne    115e <HibernateClockConfig+0x4e>
and    $0x3,%ebx
mov    %ebx,0x400fcfc8
pop    %rbx
ret

LLVM IR (-O0):
define void @HibernateClockConfig(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, -720897
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = and i32 %7, 720896
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = and i32 %11, 524288
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i32, i32* %3
%16 = or i32 %15, 64
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %1
%18 = load i32, i32* %3
store volatile i32 %18, i32* inttoptr (i64 1074774032 to i32*)
%19 = call i32 (...) @_HibernateWriteComplete()
%20 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%21 = and i32 %20, 1895759872
%22 = icmp eq i32 %21, 269090816
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i32, i32* %2
%25 = and i32 %24, 3
store volatile i32 %25, i32* inttoptr (i64 1074778056 to i32*)
br label %26
26: ; preds = %23, %17
ret void
}

LLVM IR (-O2):
define void @HibernateClockConfig(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
%3 = and i32 %2, -720897
%4 = and i32 %0, 720896
%5 = lshr i32 %0, 13
%6 = and i32 %5, 64
%7 = or i32 %6, %4
%8 = or i32 %7, %3
store volatile i32 %8, i32* inttoptr (i64 1074774032 to i32*)
%9 = tail call i32 (...) @_HibernateWriteComplete()
%10 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%11 = and i32 %10, 1895759872
%12 = icmp eq i32 %11, 269090816
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = and i32 %0, 3
store volatile i32 %14, i32* inttoptr (i64 1074778056 to i32*)
br label %15
15: ; preds = %13, %1
ret void
}