#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, int);
int /*<<< orphan*/ PRCMPeripheralClkDisable(int, int);
int /*<<< orphan*/ PRCMPeripheralClkEnable(int, int);
int /*<<< orphan*/ PRCMPeripheralReset(int);
int PRCMSysResetCauseGet();
void PRCMCC3200MCUInit() {
  unsigned long ulRegValue;
  (*((volatile unsigned long *)(0x4402F064))) |= 0x800000;
  ulRegValue = PRCMHIBRegRead(0x4402F800 + 0x00000418);
  PRCMHIBRegWrite(0x4402F800 + 0x00000418, ulRegValue | (1 << 4));
  (*((volatile unsigned long *)(0x4402E16C))) |= 0x3C;
  PRCMPeripheralClkEnable(0x00000005, 0x00000001);
  PRCMPeripheralReset(0x00000005);
  PRCMPeripheralClkDisable(0x00000005, 0x00000001);
  if (PRCMSysResetCauseGet() == 0x00000000) {
    PRCMHIBRegWrite(0x4402F804, 0x1);
  }
  if ((((*((volatile unsigned long *)(0x4402F0C8))) & 0xFF) == 0x2)) {
    (*((volatile unsigned long *)(0x4402E110))) =
        (((*((volatile unsigned long *)(0x4402E110))) & ~0xC0F) | 0x2);
    (*((volatile unsigned long *)(0x4402E114))) =
        (((*((volatile unsigned long *)(0x4402E110))) & ~0xC0F) | 0x2);
  }
  (*((volatile unsigned long *)(0x4402E184))) |= 0x2;
  if (((*((volatile unsigned long *)(0x4402E0A4))) & 0xF) == 0x1) {
    (*((volatile unsigned long *)(0x4402E0A4))) =
        (((*((volatile unsigned long *)(0x4402E0A4))) & ~0xF));
  }
  if (((*((volatile unsigned long *)(0x4402E0A8))) & 0xF) == 0x1) {
    (*((volatile unsigned long *)(0x4402E0A8))) =
        (((*((volatile unsigned long *)(0x4402E0A8))) & ~0xF));
  }
  if ((((*((volatile unsigned long *)(0x4402DC78))) >> 22) & 0xF) == 0xE) {
    (*((volatile unsigned long *)(0x4402F0B0))) =
        (((*((volatile unsigned long *)(0x4402F0B0))) & ~(0x00FC0000)) |
         (0x32 << 18));
  } else {
    (*((volatile unsigned long *)(0x4402F0B0))) =
        (((*((volatile unsigned long *)(0x4402F0B0))) & ~(0x00FC0000)) |
         (0x29 << 18));
  }
  (*((volatile unsigned long *)(0x4402FC74))) &= ~(0x10000000);
  (*((volatile unsigned long *)(0x4402F0A8))) |= 0x00000004;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4402f064,%eax
mov    (%rax),%rcx
or     $0x800000,%rcx
mov    $0x4402f064,%eax
mov    %rcx,(%rax)
mov    $0x4402fc18,%edi
call   1070 <PRCMHIBRegRead@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     $0x10,%rax
mov    %eax,%esi
mov    $0x4402fc18,%edi
call   1060 <PRCMHIBRegWrite@plt>
mov    $0x4402e16c,%eax
mov    (%rax),%rcx
or     $0x3c,%rcx
mov    $0x4402e16c,%eax
mov    %rcx,(%rax)
mov    $0x5,%edi
mov    $0x1,%esi
call   1040 <PRCMPeripheralClkEnable@plt>
mov    $0x5,%edi
call   1030 <PRCMPeripheralReset@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1080 <PRCMPeripheralClkDisable@plt>
mov    $0x0,%al
call   1050 <PRCMSysResetCauseGet@plt>
cmp    $0x0,%eax
jne    11fc <PRCMCC3200MCUInit+0x9c>
mov    $0x4402f804,%edi
mov    $0x1,%esi
call   1060 <PRCMHIBRegWrite@plt>
mov    $0x4402f0c8,%eax
mov    (%rax),%rax
and    $0xff,%rax
cmp    $0x2,%rax
jne    124a <PRCMCC3200MCUInit+0xea>
mov    $0x4402e110,%eax
mov    (%rax),%rcx
and    $0xfffffffffffff3f0,%rcx
or     $0x2,%rcx
mov    $0x4402e110,%eax
mov    %rcx,(%rax)
mov    $0x4402e110,%eax
mov    (%rax),%rcx
and    $0xfffffffffffff3f0,%rcx
or     $0x2,%rcx
mov    $0x4402e114,%eax
mov    %rcx,(%rax)
mov    $0x4402e184,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0x4402e184,%eax
mov    %rcx,(%rax)
mov    $0x4402e0a4,%eax
mov    (%rax),%rax
and    $0xf,%rax
cmp    $0x1,%rax
jne    1288 <PRCMCC3200MCUInit+0x128>
mov    $0x4402e0a4,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffff0,%rcx
mov    $0x4402e0a4,%eax
mov    %rcx,(%rax)
mov    $0x4402e0a8,%eax
mov    (%rax),%rax
and    $0xf,%rax
cmp    $0x1,%rax
jne    12b2 <PRCMCC3200MCUInit+0x152>
mov    $0x4402e0a8,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffff0,%rcx
mov    $0x4402e0a8,%eax
mov    %rcx,(%rax)
mov    $0x4402dc78,%eax
mov    (%rax),%rax
shr    $0x16,%rax
and    $0xf,%rax
cmp    $0xe,%rax
jne    12ef <PRCMCC3200MCUInit+0x18f>
mov    $0x4402f0b0,%eax
mov    (%rax),%rcx
and    $0xffffffffff03ffff,%rcx
or     $0xc80000,%rcx
mov    $0x4402f0b0,%eax
mov    %rcx,(%rax)
jmp    130d <PRCMCC3200MCUInit+0x1ad>
mov    $0x4402f0b0,%eax
mov    (%rax),%rcx
and    $0xffffffffff03ffff,%rcx
or     $0xa40000,%rcx
mov    $0x4402f0b0,%eax
mov    %rcx,(%rax)
mov    $0x4402fc74,%eax
mov    (%rax),%rcx
and    $0xffffffffefffffff,%rcx
mov    $0x4402fc74,%eax
mov    %rcx,(%rax)
mov    $0x4402f0a8,%eax
mov    (%rax),%rcx
or     $0x4,%rcx
mov    $0x4402f0a8,%eax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
orq    $0x800000,0x4402f064
mov    $0x4402fc18,%edi
call   1070 <PRCMHIBRegRead@plt>
or     $0x10,%eax
mov    $0x4402fc18,%edi
mov    %eax,%esi
call   1060 <PRCMHIBRegWrite@plt>
orq    $0x3c,0x4402e16c
44 3c
mov    $0x5,%edi
mov    $0x1,%esi
call   1040 <PRCMPeripheralClkEnable@plt>
mov    $0x5,%edi
call   1030 <PRCMPeripheralReset@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1080 <PRCMPeripheralClkDisable@plt>
xor    %eax,%eax
call   1050 <PRCMSysResetCauseGet@plt>
test   %eax,%eax
jne    11d1 <PRCMCC3200MCUInit+0x71>
mov    $0x4402f804,%edi
mov    $0x1,%esi
call   1060 <PRCMHIBRegWrite@plt>
mov    0x4402f0c8,%rax
44
cmp    $0x2,%al
jne    120f <PRCMCC3200MCUInit+0xaf>
mov    $0xfffffffffffff3f0,%rax
mov    0x4402e110,%rcx
44
and    %rax,%rcx
or     $0x2,%rcx
mov    %rcx,0x4402e110
44
and    0x4402e110,%rax
44
or     $0x2,%rax
mov    %rax,0x4402e114
44
orq    $0x2,0x4402e184
44 02
mov    0x4402e0a4,%rax
44
and    $0xf,%eax
cmp    $0x1,%eax
jne    1231 <PRCMCC3200MCUInit+0xd1>
andq   $0xfffffffffffffff0,0x4402e0a4
44 f0
mov    0x4402e0a8,%rax
44
and    $0xf,%eax
cmp    $0x1,%eax
jne    124a <PRCMCC3200MCUInit+0xea>
andq   $0xfffffffffffffff0,0x4402e0a8
44 f0
mov    0x4402dc78,%rax
44
and    $0x3c00000,%eax
mov    $0xffffffffff03ffff,%rcx
and    0x4402f0b0,%rcx
44
cmp    $0x3800000,%eax
mov    $0xc80000,%eax
mov    $0xa40000,%edx
cmove  %rax,%rdx
or     %rcx,%rdx
mov    %rdx,0x4402f0b0
44
andq   $0xffffffffefffffff,0x4402fc74
44 ff ff ff ef
orq    $0x4,0x4402f0a8
44 04
pop    %rax
ret

LLVM IR (-O0):
define void @PRCMCC3200MCUInit() {
%1 = alloca i64
%2 = load volatile i64, i64* inttoptr (i64 1141043300 to i64*)
%3 = or i64 %2, 8388608
store volatile i64 %3, i64* inttoptr (i64 1141043300 to i64*)
%4 = call i64 @PRCMHIBRegRead(i32 1141046296)
store i64 %4, i64* %1
%5 = load i64, i64* %1
%6 = or i64 %5, 16
%7 = trunc i64 %6 to i32
%8 = call i32 @PRCMHIBRegWrite(i32 1141046296, i32 %7)
%9 = load volatile i64, i64* inttoptr (i64 1141039468 to i64*)
%10 = or i64 %9, 60
store volatile i64 %10, i64* inttoptr (i64 1141039468 to i64*)
%11 = call i32 @PRCMPeripheralClkEnable(i32 5, i32 1)
%12 = call i32 @PRCMPeripheralReset(i32 5)
%13 = call i32 @PRCMPeripheralClkDisable(i32 5, i32 1)
%14 = call i32 (...) @PRCMSysResetCauseGet()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @PRCMHIBRegWrite(i32 1141045252, i32 1)
br label %18
18: ; preds = %16, %0
%19 = load volatile i64, i64* inttoptr (i64 1141043400 to i64*)
%20 = and i64 %19, 255
%21 = icmp eq i64 %20, 2
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load volatile i64, i64* inttoptr (i64 1141039376 to i64*)
%24 = and i64 %23, -3088
%25 = or i64 %24, 2
store volatile i64 %25, i64* inttoptr (i64 1141039376 to i64*)
%26 = load volatile i64, i64* inttoptr (i64 1141039376 to i64*)
%27 = and i64 %26, -3088
%28 = or i64 %27, 2
store volatile i64 %28, i64* inttoptr (i64 1141039380 to i64*)
br label %29
29: ; preds = %22, %18
%30 = load volatile i64, i64* inttoptr (i64 1141039492 to i64*)
%31 = or i64 %30, 2
store volatile i64 %31, i64* inttoptr (i64 1141039492 to i64*)
%32 = load volatile i64, i64* inttoptr (i64 1141039268 to i64*)
%33 = and i64 %32, 15
%34 = icmp eq i64 %33, 1
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = load volatile i64, i64* inttoptr (i64 1141039268 to i64*)
%37 = and i64 %36, -16
store volatile i64 %37, i64* inttoptr (i64 1141039268 to i64*)
br label %38
38: ; preds = %35, %29
%39 = load volatile i64, i64* inttoptr (i64 1141039272 to i64*)
%40 = and i64 %39, 15
%41 = icmp eq i64 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load volatile i64, i64* inttoptr (i64 1141039272 to i64*)
%44 = and i64 %43, -16
store volatile i64 %44, i64* inttoptr (i64 1141039272 to i64*)
br label %45
45: ; preds = %42, %38
%46 = load volatile i64, i64* inttoptr (i64 1141038200 to i64*)
%47 = lshr i64 %46, 22
%48 = and i64 %47, 15
%49 = icmp eq i64 %48, 14
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load volatile i64, i64* inttoptr (i64 1141043376 to i64*)
%52 = and i64 %51, -16515073
%53 = or i64 %52, 13107200
store volatile i64 %53, i64* inttoptr (i64 1141043376 to i64*)
br label %58
54: ; preds = %45
%55 = load volatile i64, i64* inttoptr (i64 1141043376 to i64*)
%56 = and i64 %55, -16515073
%57 = or i64 %56, 10747904
store volatile i64 %57, i64* inttoptr (i64 1141043376 to i64*)
br label %58
58: ; preds = %54, %50
%59 = load volatile i64, i64* inttoptr (i64 1141046388 to i64*)
%60 = and i64 %59, -268435457
store volatile i64 %60, i64* inttoptr (i64 1141046388 to i64*)
%61 = load volatile i64, i64* inttoptr (i64 1141043368 to i64*)
%62 = or i64 %61, 4
store volatile i64 %62, i64* inttoptr (i64 1141043368 to i64*)
ret void
}

LLVM IR (-O2):
define void @PRCMCC3200MCUInit() {
%1 = load volatile i64, i64* inttoptr (i64 1141043300 to i64*)
%2 = or i64 %1, 8388608
store volatile i64 %2, i64* inttoptr (i64 1141043300 to i64*)
%3 = tail call i64 @PRCMHIBRegRead(i32 1141046296)
%4 = trunc i64 %3 to i32
%5 = or i32 %4, 16
%6 = tail call i32 @PRCMHIBRegWrite(i32 1141046296, i32 %5)
%7 = load volatile i64, i64* inttoptr (i64 1141039468 to i64*)
%8 = or i64 %7, 60
store volatile i64 %8, i64* inttoptr (i64 1141039468 to i64*)
%9 = tail call i32 @PRCMPeripheralClkEnable(i32 5, i32 1)
%10 = tail call i32 @PRCMPeripheralReset(i32 5)
%11 = tail call i32 @PRCMPeripheralClkDisable(i32 5, i32 1)
%12 = tail call i32 (...) @PRCMSysResetCauseGet()
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = tail call i32 @PRCMHIBRegWrite(i32 1141045252, i32 1)
br label %16
16: ; preds = %14, %0
%17 = load volatile i64, i64* inttoptr (i64 1141043400 to i64*)
%18 = and i64 %17, 255
%19 = icmp eq i64 %18, 2
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load volatile i64, i64* inttoptr (i64 1141039376 to i64*)
%22 = and i64 %21, -3088
%23 = or i64 %22, 2
store volatile i64 %23, i64* inttoptr (i64 1141039376 to i64*)
%24 = load volatile i64, i64* inttoptr (i64 1141039376 to i64*)
%25 = and i64 %24, -3088
%26 = or i64 %25, 2
store volatile i64 %26, i64* inttoptr (i64 1141039380 to i64*)
br label %27
27: ; preds = %20, %16
%28 = load volatile i64, i64* inttoptr (i64 1141039492 to i64*)
%29 = or i64 %28, 2
store volatile i64 %29, i64* inttoptr (i64 1141039492 to i64*)
%30 = load volatile i64, i64* inttoptr (i64 1141039268 to i64*)
%31 = and i64 %30, 15
%32 = icmp eq i64 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = load volatile i64, i64* inttoptr (i64 1141039268 to i64*)
%35 = and i64 %34, -16
store volatile i64 %35, i64* inttoptr (i64 1141039268 to i64*)
br label %36
36: ; preds = %33, %27
%37 = load volatile i64, i64* inttoptr (i64 1141039272 to i64*)
%38 = and i64 %37, 15
%39 = icmp eq i64 %38, 1
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load volatile i64, i64* inttoptr (i64 1141039272 to i64*)
%42 = and i64 %41, -16
store volatile i64 %42, i64* inttoptr (i64 1141039272 to i64*)
br label %43
43: ; preds = %40, %36
%44 = load volatile i64, i64* inttoptr (i64 1141038200 to i64*)
%45 = and i64 %44, 62914560
%46 = icmp eq i64 %45, 58720256
%47 = load volatile i64, i64* inttoptr (i64 1141043376 to i64*)
%48 = and i64 %47, -16515073
%49 = select i1 %46, i64 13107200, i64 10747904
%50 = or i64 %48, %49
store volatile i64 %50, i64* inttoptr (i64 1141043376 to i64*)
%51 = load volatile i64, i64* inttoptr (i64 1141046388 to i64*)
%52 = and i64 %51, -268435457
store volatile i64 %52, i64* inttoptr (i64 1141046388 to i64*)
%53 = load volatile i64, i64* inttoptr (i64 1141043368 to i64*)
%54 = or i64 %53, 4
store volatile i64 %54, i64* inttoptr (i64 1141043368 to i64*)
ret void
}