#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 PRCMHIBRegRead(int);
int /*<<< orphan*/ PRCMHIBRegWrite(int, unsigned long);
void PRCMIORetentionEnable(unsigned long ulIORetGrpFlags) {
  unsigned long ulRegVal;
  if (((*((volatile unsigned long *)(0x00000400))) & 0xFFFF) >= 2) {
    (*((volatile unsigned long *)(0x4402E000 + 0x00000144))) |= 0x00001D00;
    (*((volatile unsigned long *)(0x4402E000 + 0x00000144))) &= ~(0x00000023);
    if (ulIORetGrpFlags & 0x00000001) {
      ulRegVal = PRCMHIBRegRead(0x4402F800 + 0x0000040C);
      ulRegVal |= 0x5;
      PRCMHIBRegWrite(0x4402F800 + 0x0000040C, ulRegVal);
    }
    if (ulIORetGrpFlags & 0x00000002) {
      ulRegVal = PRCMHIBRegRead(0x4402F800 + 0x00000418);
      ulRegVal |= ((0x3 << 5));
      PRCMHIBRegWrite(0x4402F800 + 0x00000418, ulRegVal);
    }
    if (ulIORetGrpFlags & 0x00000004) {
      ulRegVal = PRCMHIBRegRead(0x4402F800 + 0x00000414);
      ulRegVal |= 0x00000101;
      PRCMHIBRegWrite(0x4402F800 + 0x00000414, ulRegVal);
    }
    if (ulIORetGrpFlags & 0x00000008) {
      ulRegVal = PRCMHIBRegRead(0x4402F800 + 0x00000414);
      ulRegVal |= 0x00000204;
      PRCMHIBRegWrite(0x4402F800 + 0x00000414, ulRegVal);
    }
  }
}


x86 assembly (clang, -O0):
<PRCMIORetentionEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x400,%eax
mov    (%rax),%rax
and    $0xffff,%rax
cmp    $0x2,%rax
jb     1260 <PRCMIORetentionEnable+0x140>
mov    $0x4402e144,%eax
mov    (%rax),%rcx
or     $0x1d00,%rcx
mov    $0x4402e144,%eax
mov    %rcx,(%rax)
mov    $0x4402e144,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffdc,%rcx
mov    $0x4402e144,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     11a9 <PRCMIORetentionEnable+0x89>
mov    $0x4402fc0c,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc0c,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    -0x8(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     11e3 <PRCMIORetentionEnable+0xc3>
mov    $0x4402fc18,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0x60,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc18,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    -0x8(%rbp),%rax
and    $0x4,%rax
cmp    $0x0,%rax
je     121f <PRCMIORetentionEnable+0xff>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0x101,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc14,%edi
call   1030 <PRCMHIBRegWrite@plt>
mov    -0x8(%rbp),%rax
and    $0x8,%rax
cmp    $0x0,%rax
je     125b <PRCMIORetentionEnable+0x13b>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0x204,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc14,%edi
call   1030 <PRCMHIBRegWrite@plt>
jmp    1260 <PRCMIORetentionEnable+0x140>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMIORetentionEnable>:
push   %rbx
testq  $0xfffe,0x400
je     115b <PRCMIORetentionEnable+0x3b>
mov    %rdi,%rbx
orq    $0x1d00,0x4402e144
andq   $0xffffffffffffffdc,0x4402e144
44 dc
test   $0x1,%bl
jne    115d <PRCMIORetentionEnable+0x3d>
test   $0x2,%bl
jne    117d <PRCMIORetentionEnable+0x5d>
test   $0x4,%bl
jne    119d <PRCMIORetentionEnable+0x7d>
test   $0x8,%bl
jne    11bf <PRCMIORetentionEnable+0x9f>
pop    %rbx
ret
mov    $0x4402fc0c,%edi
call   1040 <PRCMHIBRegRead@plt>
or     $0x5,%rax
mov    $0x4402fc0c,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x2,%bl
je     1151 <PRCMIORetentionEnable+0x31>
mov    $0x4402fc18,%edi
call   1040 <PRCMHIBRegRead@plt>
or     $0x60,%rax
mov    $0x4402fc18,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x4,%bl
je     1156 <PRCMIORetentionEnable+0x36>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
or     $0x101,%rax
mov    $0x4402fc14,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x8,%bl
je     115b <PRCMIORetentionEnable+0x3b>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
or     $0x204,%rax
mov    $0x4402fc14,%edi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <PRCMHIBRegWrite@plt>

LLVM IR (-O0):
define void @PRCMIORetentionEnable(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1024 to i64*)
%5 = and i64 %4, 65535
%6 = icmp uge i64 %5, 2
br i1 %6, label %7, label %52
7: ; preds = %1
%8 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%9 = or i64 %8, 7424
store volatile i64 %9, i64* inttoptr (i64 1141039428 to i64*)
%10 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%11 = and i64 %10, -36
store volatile i64 %11, i64* inttoptr (i64 1141039428 to i64*)
%12 = load i64, i64* %2
%13 = and i64 %12, 1
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %7
%16 = call i64 @PRCMHIBRegRead(i32 1141046284)
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = or i64 %17, 5
store i64 %18, i64* %3
%19 = load i64, i64* %3
%20 = call i32 @PRCMHIBRegWrite(i32 1141046284, i64 %19)
br label %21
21: ; preds = %15, %7
%22 = load i64, i64* %2
%23 = and i64 %22, 2
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = call i64 @PRCMHIBRegRead(i32 1141046296)
store i64 %26, i64* %3
%27 = load i64, i64* %3
%28 = or i64 %27, 96
store i64 %28, i64* %3
%29 = load i64, i64* %3
%30 = call i32 @PRCMHIBRegWrite(i32 1141046296, i64 %29)
br label %31
31: ; preds = %25, %21
%32 = load i64, i64* %2
%33 = and i64 %32, 4
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %31
%36 = call i64 @PRCMHIBRegRead(i32 1141046292)
store i64 %36, i64* %3
%37 = load i64, i64* %3
%38 = or i64 %37, 257
store i64 %38, i64* %3
%39 = load i64, i64* %3
%40 = call i32 @PRCMHIBRegWrite(i32 1141046292, i64 %39)
br label %41
41: ; preds = %35, %31
%42 = load i64, i64* %2
%43 = and i64 %42, 8
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %41
%46 = call i64 @PRCMHIBRegRead(i32 1141046292)
store i64 %46, i64* %3
%47 = load i64, i64* %3
%48 = or i64 %47, 516
store i64 %48, i64* %3
%49 = load i64, i64* %3
%50 = call i32 @PRCMHIBRegWrite(i32 1141046292, i64 %49)
br label %51
51: ; preds = %45, %41
br label %52
52: ; preds = %51, %1
ret void
}

LLVM IR (-O2):
define void @PRCMIORetentionEnable(i64 %0) {
%2 = load volatile i64, i64* inttoptr (i64 1024 to i64*)
%3 = and i64 %2, 65534
%4 = icmp eq i64 %3, 0
br i1 %4, label %37, label %5
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%7 = or i64 %6, 7424
store volatile i64 %7, i64* inttoptr (i64 1141039428 to i64*)
%8 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%9 = and i64 %8, -36
store volatile i64 %9, i64* inttoptr (i64 1141039428 to i64*)
%10 = and i64 %0, 1
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %5
%13 = tail call i64 @PRCMHIBRegRead(i32 1141046284)
%14 = or i64 %13, 5
%15 = tail call i32 @PRCMHIBRegWrite(i32 1141046284, i64 %14)
br label %16
16: ; preds = %12, %5
%17 = and i64 %0, 2
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i64 @PRCMHIBRegRead(i32 1141046296)
%21 = or i64 %20, 96
%22 = tail call i32 @PRCMHIBRegWrite(i32 1141046296, i64 %21)
br label %23
23: ; preds = %19, %16
%24 = and i64 %0, 4
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i64 @PRCMHIBRegRead(i32 1141046292)
%28 = or i64 %27, 257
%29 = tail call i32 @PRCMHIBRegWrite(i32 1141046292, i64 %28)
br label %30
30: ; preds = %26, %23
%31 = and i64 %0, 8
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = tail call i64 @PRCMHIBRegRead(i32 1141046292)
%35 = or i64 %34, 516
%36 = tail call i32 @PRCMHIBRegWrite(i32 1141046292, i64 %35)
br label %37
37: ; preds = %30, %33, %1
ret void
}