#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 PRCMIORetentionDisable(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):
<PRCMIORetentionDisable>:
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 <PRCMIORetentionDisable+0x140>
mov    $0x4402e144,%eax
mov    (%rax),%rcx
and    $0xffffffffffffe2ff,%rcx
mov    $0x4402e144,%eax
mov    %rcx,(%rax)
mov    $0x4402e144,%eax
mov    (%rax),%rcx
or     $0x23,%rcx
mov    $0x4402e144,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     11a9 <PRCMIORetentionDisable+0x89>
mov    $0x4402fc0c,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xfffffffffffffffa,%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 <PRCMIORetentionDisable+0xc3>
mov    $0x4402fc18,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xffffffffffffff9f,%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 <PRCMIORetentionDisable+0xff>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xfffffffffffffefe,%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 <PRCMIORetentionDisable+0x13b>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xfffffffffffffdfb,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4402fc14,%edi
call   1030 <PRCMHIBRegWrite@plt>
jmp    1260 <PRCMIORetentionDisable+0x140>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMIORetentionDisable>:
push   %rbx
testq  $0xfffe,0x400
je     115b <PRCMIORetentionDisable+0x3b>
mov    %rdi,%rbx
andq   $0xffffffffffffe2ff,0x4402e144
44 ff e2 ff ff
orq    $0x23,0x4402e144
44 23
test   $0x1,%bl
jne    115d <PRCMIORetentionDisable+0x3d>
test   $0x2,%bl
jne    117d <PRCMIORetentionDisable+0x5d>
test   $0x4,%bl
jne    119d <PRCMIORetentionDisable+0x7d>
test   $0x8,%bl
jne    11bf <PRCMIORetentionDisable+0x9f>
pop    %rbx
ret
mov    $0x4402fc0c,%edi
call   1040 <PRCMHIBRegRead@plt>
and    $0xfffffffffffffffa,%rax
mov    $0x4402fc0c,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x2,%bl
je     1151 <PRCMIORetentionDisable+0x31>
mov    $0x4402fc18,%edi
call   1040 <PRCMHIBRegRead@plt>
and    $0xffffffffffffff9f,%rax
mov    $0x4402fc18,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x4,%bl
je     1156 <PRCMIORetentionDisable+0x36>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
and    $0xfffffffffffffefe,%rax
mov    $0x4402fc14,%edi
mov    %rax,%rsi
call   1030 <PRCMHIBRegWrite@plt>
test   $0x8,%bl
je     115b <PRCMIORetentionDisable+0x3b>
mov    $0x4402fc14,%edi
call   1040 <PRCMHIBRegRead@plt>
and    $0xfffffffffffffdfb,%rax
mov    $0x4402fc14,%edi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <PRCMHIBRegWrite@plt>

LLVM IR (-O0):
define void @PRCMIORetentionDisable(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 = and i64 %8, -7425
store volatile i64 %9, i64* inttoptr (i64 1141039428 to i64*)
%10 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%11 = or i64 %10, 35
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 = and i64 %17, -6
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 = and i64 %27, -97
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 = and i64 %37, -258
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 = and i64 %47, -517
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 @PRCMIORetentionDisable(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 = and i64 %6, -7425
store volatile i64 %7, i64* inttoptr (i64 1141039428 to i64*)
%8 = load volatile i64, i64* inttoptr (i64 1141039428 to i64*)
%9 = or i64 %8, 35
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 = and i64 %13, -6
%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 = and i64 %20, -97
%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 = and i64 %27, -258
%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 = and i64 %34, -517
%36 = tail call i32 @PRCMHIBRegWrite(i32 1141046292, i64 %35)
br label %37
37: ; preds = %30, %33, %1
ret void
}