#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 scalar_t__ volatile uint8_t;
typedef scalar_t__ volatile uint32_t;
typedef scalar_t__ volatile uint16_t;

/* Variables and functions */
void rcc_clock_init(void) {
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) |=
      (uint32_t)0x00000001;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) &=
      (uint32_t)0xF8FF0000;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) &=
      (uint32_t)0xFEF6FFFF;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) &=
      (uint32_t)0xFFFBFFFF;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) &=
      (uint32_t)0xFF80FFFF;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x08)) = 0x009F0000;
  volatile uint32_t StartUpCounter = 0, HSEStatus = 0;
  *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) |=
      ((uint32_t)((uint32_t)0x00010000));
  do {
    HSEStatus =
        *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) &
        ((uint32_t)0x00020000);
    StartUpCounter++;
  } while ((HSEStatus == 0) && (StartUpCounter != ((uint16_t)0x0500)));
  if ((*((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x00)) &
       ((uint32_t)0x00020000)) != 0)
    HSEStatus = (uint32_t)0x01;
  else
    HSEStatus = (uint32_t)0x00;
  if (HSEStatus == (uint32_t)0x01) {
    *((volatile uint32_t *)(((volatile uint32_t)0x40022000) + 0x00)) |=
        ((uint8_t)0x10);
    *((volatile uint32_t *)(((volatile uint32_t)0x40022000) + 0x00)) &=
        (uint32_t)((uint32_t) ~((uint8_t)0x03));
    *((volatile uint32_t *)(((volatile uint32_t)0x40022000) + 0x00)) |=
        (uint32_t)((uint8_t)0x00);
    *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) |=
        (uint32_t)((uint32_t)0x00000000);
    *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) |=
        (uint32_t)((uint32_t)0x00000000);
    *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) |=
        (uint32_t)((uint32_t)0x00000000);
    *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) &=
        (uint32_t)((uint32_t) ~(((uint32_t)0x00000003)));
    *((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) |=
        (uint32_t)((uint32_t)0x00000001);
    while ((*((volatile uint32_t *)(((volatile uint32_t)0x40021000) + 0x04)) &
            (uint32_t)((uint32_t)0x0000000C)) != (uint32_t)0x04)
      ;
  } else {
  }
}


x86 assembly (clang, -O0):
<rcc_clock_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40021000,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0x40021000,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
movabs $0xf8ff0000,%rax
and    %rax,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021000,%eax
mov    (%rax),%rcx
movabs $0xfef6ffff,%rax
and    %rax,%rcx
mov    $0x40021000,%eax
mov    %rcx,(%rax)
mov    $0x40021000,%eax
mov    (%rax),%rcx
movabs $0xfffbffff,%rax
and    %rax,%rcx
mov    $0x40021000,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
movabs $0xff80ffff,%rax
and    %rax,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021008,%eax
movq   $0x9f0000,(%rax)
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x40021000,%eax
mov    (%rax),%rcx
or     $0x10000,%rcx
mov    $0x40021000,%eax
mov    %rcx,(%rax)
mov    $0x40021000,%eax
mov    (%rax),%rax
and    $0x20000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    1200 <rcc_clock_init+0x100>
mov    -0x8(%rbp),%rax
cmp    $0x500,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11bf <rcc_clock_init+0xbf>
mov    $0x40021000,%eax
mov    (%rax),%rax
and    $0x20000,%rax
cmp    $0x0,%rax
je     1230 <rcc_clock_init+0x130>
movq   $0x1,-0x10(%rbp)
jmp    1238 <rcc_clock_init+0x138>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    $0x1,%rax
jne    1306 <rcc_clock_init+0x206>
mov    $0x40022000,%eax
mov    (%rax),%rcx
or     $0x10,%rcx
mov    $0x40022000,%eax
mov    %rcx,(%rax)
mov    $0x40022000,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffc,%rcx
mov    $0x40022000,%eax
mov    %rcx,(%rax)
mov    $0x40022000,%eax
mov    (%rax),%rcx
or     $0x0,%rcx
mov    $0x40022000,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
or     $0x0,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
or     $0x0,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
or     $0x0,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffc,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0x40021004,%eax
mov    %rcx,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%rax
and    $0xc,%rax
cmp    $0x4,%rax
je     1301 <rcc_clock_init+0x201>
jmp    12e6 <rcc_clock_init+0x1e6>
jmp    130b <rcc_clock_init+0x20b>
jmp    130b <rcc_clock_init+0x20b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcc_clock_init>:
orq    $0x1,0x40021000
40 01
mov    $0xf8ff0000,%eax
and    %rax,0x40021004
40
mov    $0xfef6ffff,%eax
and    %rax,0x40021000
40
mov    $0xfffbffff,%eax
and    %rax,0x40021000
40
mov    $0xff80ffff,%eax
and    %rax,0x40021004
40
movq   $0x9f0000,0x40021008
movq   $0x0,-0x8(%rsp)
movq   $0x0,-0x10(%rsp)
orq    $0x10000,0x40021000
nopw   0x0(%rax,%rax,1)
mov    0x40021000,%rax
40
and    $0x20000,%eax
mov    %rax,-0x10(%rsp)
addq   $0x1,-0x8(%rsp)
cmpq   $0x0,-0x10(%rsp)
jne    119d <rcc_clock_init+0x9d>
mov    -0x8(%rsp),%rax
cmp    $0x500,%rax
jne    1170 <rcc_clock_init+0x70>
testq  $0x20000,0x40021000
jne    11b6 <rcc_clock_init+0xb6>
movq   $0x0,-0x10(%rsp)
jmp    11bf <rcc_clock_init+0xbf>
movq   $0x1,-0x10(%rsp)
mov    -0x10(%rsp),%rax
cmp    $0x1,%rax
jne    1240 <rcc_clock_init+0x140>
orq    $0x10,0x40022000
40 10
andq   $0xfffffffffffffffc,0x40022000
40 fc
mov    0x40022000,%rax
40
mov    %rax,0x40022000
40
mov    0x40021004,%rax
40
mov    %rax,0x40021004
40
mov    0x40021004,%rax
40
mov    %rax,0x40021004
40
mov    0x40021004,%rax
40
mov    %rax,0x40021004
40
andq   $0xfffffffffffffffc,0x40021004
40 fc
orq    $0x1,0x40021004
40 01
xchg   %ax,%ax
mov    0x40021004,%rax
40
and    $0xc,%eax
cmp    $0x4,%eax
jne    1230 <rcc_clock_init+0x130>
ret

LLVM IR (-O0):
define void @rcc_clock_init() {
%1 = alloca i64
%2 = alloca i64
%3 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%4 = or i64 %3, 1
store volatile i64 %4, i64* inttoptr (i64 1073876992 to i64*)
%5 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%6 = and i64 %5, 4177461248
store volatile i64 %6, i64* inttoptr (i64 1073876996 to i64*)
%7 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%8 = and i64 %7, 4277600255
store volatile i64 %8, i64* inttoptr (i64 1073876992 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%10 = and i64 %9, 4294705151
store volatile i64 %10, i64* inttoptr (i64 1073876992 to i64*)
%11 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%12 = and i64 %11, 4286644223
store volatile i64 %12, i64* inttoptr (i64 1073876996 to i64*)
store volatile i64 10420224, i64* inttoptr (i64 1073877000 to i64*)
store volatile i64 0, i64* %1
store volatile i64 0, i64* %2
%13 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%14 = or i64 %13, 65536
store volatile i64 %14, i64* inttoptr (i64 1073876992 to i64*)
br label %15
15: ; preds = %26, %0
%16 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%17 = and i64 %16, 131072
store volatile i64 %17, i64* %2
%18 = load volatile i64, i64* %1
%19 = add nsw i64 %18, 1
store volatile i64 %19, i64* %1
br label %20
20: ; preds = %15
%21 = load volatile i64, i64* %2
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load volatile i64, i64* %1
%25 = icmp ne i64 %24, 1280
br label %26
26: ; preds = %23, %20
%27 = phi i1 [ false, %20 ], [ %25, %23 ]
br i1 %27, label %15, label %28
28: ; preds = %26
%29 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%30 = and i64 %29, 131072
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store volatile i64 1, i64* %2
br label %34
33: ; preds = %28
store volatile i64 0, i64* %2
br label %34
34: ; preds = %33, %32
%35 = load volatile i64, i64* %2
%36 = icmp eq i64 %35, 1
br i1 %36, label %37, label %60
37: ; preds = %34
%38 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
%39 = or i64 %38, 16
store volatile i64 %39, i64* inttoptr (i64 1073881088 to i64*)
%40 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
%41 = and i64 %40, -4
store volatile i64 %41, i64* inttoptr (i64 1073881088 to i64*)
%42 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
%43 = or i64 %42, 0
store volatile i64 %43, i64* inttoptr (i64 1073881088 to i64*)
%44 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%45 = or i64 %44, 0
store volatile i64 %45, i64* inttoptr (i64 1073876996 to i64*)
%46 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%47 = or i64 %46, 0
store volatile i64 %47, i64* inttoptr (i64 1073876996 to i64*)
%48 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%49 = or i64 %48, 0
store volatile i64 %49, i64* inttoptr (i64 1073876996 to i64*)
%50 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%51 = and i64 %50, -4
store volatile i64 %51, i64* inttoptr (i64 1073876996 to i64*)
%52 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%53 = or i64 %52, 1
store volatile i64 %53, i64* inttoptr (i64 1073876996 to i64*)
br label %54
54: ; preds = %58, %37
%55 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%56 = and i64 %55, 12
%57 = icmp ne i64 %56, 4
br i1 %57, label %58, label %59
58: ; preds = %54
br label %54
59: ; preds = %54
br label %61
60: ; preds = %34
br label %61
61: ; preds = %60, %59
ret void
}

LLVM IR (-O2):
define void @rcc_clock_init() {
%1 = alloca i64
%2 = alloca i64
%3 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%4 = or i64 %3, 1
store volatile i64 %4, i64* inttoptr (i64 1073876992 to i64*)
%5 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%6 = and i64 %5, 4177461248
store volatile i64 %6, i64* inttoptr (i64 1073876996 to i64*)
%7 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%8 = and i64 %7, 4277600255
store volatile i64 %8, i64* inttoptr (i64 1073876992 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%10 = and i64 %9, 4294705151
store volatile i64 %10, i64* inttoptr (i64 1073876992 to i64*)
%11 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%12 = and i64 %11, 4286644223
store volatile i64 %12, i64* inttoptr (i64 1073876996 to i64*)
store volatile i64 10420224, i64* inttoptr (i64 1073877000 to i64*)
%13 = bitcast i64* %1 to i8*
store volatile i64 0, i64* %1
%14 = bitcast i64* %2 to i8*
store volatile i64 0, i64* %2
%15 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%16 = or i64 %15, 65536
store volatile i64 %16, i64* inttoptr (i64 1073876992 to i64*)
br label %17
17: ; preds = %24, %0
%18 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%19 = and i64 %18, 131072
store volatile i64 %19, i64* %2
%20 = load volatile i64, i64* %1
%21 = add nsw i64 %20, 1
store volatile i64 %21, i64* %1
%22 = load volatile i64, i64* %2
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load volatile i64, i64* %1
%26 = icmp eq i64 %25, 1280
br i1 %26, label %27, label %17
27: ; preds = %17, %24
%28 = load volatile i64, i64* inttoptr (i64 1073876992 to i64*)
%29 = and i64 %28, 131072
%30 = icmp eq i64 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store volatile i64 1, i64* %2
br label %33
32: ; preds = %27
store volatile i64 0, i64* %2
br label %33
33: ; preds = %32, %31
%34 = load volatile i64, i64* %2
%35 = icmp eq i64 %34, 1
br i1 %35, label %36, label %53
36: ; preds = %33
%37 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
%38 = or i64 %37, 16
store volatile i64 %38, i64* inttoptr (i64 1073881088 to i64*)
%39 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
%40 = and i64 %39, -4
store volatile i64 %40, i64* inttoptr (i64 1073881088 to i64*)
%41 = load volatile i64, i64* inttoptr (i64 1073881088 to i64*)
store volatile i64 %41, i64* inttoptr (i64 1073881088 to i64*)
%42 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
store volatile i64 %42, i64* inttoptr (i64 1073876996 to i64*)
%43 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
store volatile i64 %43, i64* inttoptr (i64 1073876996 to i64*)
%44 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
store volatile i64 %44, i64* inttoptr (i64 1073876996 to i64*)
%45 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%46 = and i64 %45, -4
store volatile i64 %46, i64* inttoptr (i64 1073876996 to i64*)
%47 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%48 = or i64 %47, 1
store volatile i64 %48, i64* inttoptr (i64 1073876996 to i64*)
br label %49
49: ; preds = %49, %36
%50 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%51 = and i64 %50, 12
%52 = icmp eq i64 %51, 4
br i1 %52, label %53, label %49
53: ; preds = %49, %33
ret void
}