#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*/ DisableInterrupts();
int /*<<< orphan*/ EnableInterrupts();
void Timer1_Init(void) {
  DisableInterrupts();
  (*((volatile uint32_t *)0x400FE604)) |= 0x00000002;
  while (((*((volatile uint32_t *)0x400FEA04)) & 0x00000002) == 0) {
  }
  (*((volatile uint32_t *)0x4003100C)) = 0x00;
  (*((volatile uint32_t *)0x40031000)) = 0x00;
  (*((volatile uint32_t *)0x40031004)) = 0x02;
  (*((volatile uint32_t *)0x40031028)) = 80000000 / 60 - 1;
  (*((volatile uint32_t *)0x40031038)) = 0;
  (*((volatile uint32_t *)0x40031024)) = 0x01;
  (*((volatile uint32_t *)0x40031018)) |= 0x01;
  (*((volatile uint32_t *)0xE000E414)) =
      ((*((volatile uint32_t *)0xE000E414)) & 0x00FFFFFF) | (2 << 29);
  (*((volatile uint32_t *)0xE000E100)) = 1 << 21;
  EnableInterrupts();
}


x86 assembly (clang, -O0):
<Timer1_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <DisableInterrupts@plt>
mov    $0x400fe604,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0x400fe604,%eax
mov    %ecx,(%rax)
mov    $0x400fea04,%eax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1154 <Timer1_Init+0x34>
jmp    113c <Timer1_Init+0x1c>
mov    $0x4003100c,%eax
movl   $0x0,(%rax)
mov    $0x40031000,%eax
movl   $0x0,(%rax)
mov    $0x40031004,%eax
movl   $0x2,(%rax)
mov    $0x40031028,%eax
movl   $0x145854,(%rax)
mov    $0x40031038,%eax
movl   $0x0,(%rax)
mov    $0x40031024,%eax
movl   $0x1,(%rax)
mov    $0x40031018,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x40031018,%eax
mov    %ecx,(%rax)
mov    $0xe000e414,%eax
mov    (%rax),%ecx
and    $0xffffff,%ecx
or     $0x40000000,%ecx
mov    $0xe000e414,%eax
mov    %ecx,(%rax)
mov    $0xe000e100,%eax
movl   $0x200000,(%rax)
mov    $0x0,%al
call   1040 <EnableInterrupts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timer1_Init>:
push   %rax
xor    %eax,%eax
call   1030 <DisableInterrupts@plt>
orl    $0x2,0x400fe604
02
testl  $0x2,0x400fea04
je     1130 <Timer1_Init+0x10>
movl   $0x0,0x4003100c
movl   $0x0,0x40031000
movl   $0x2,0x40031004
movl   $0x145854,0x40031028
movl   $0x0,0x40031038
movl   $0x1,0x40031024
orl    $0x1,0x40031018
01
mov    $0xe000e414,%eax
mov    $0xffffff,%ecx
and    (%rax),%ecx
or     $0x40000000,%ecx
mov    %ecx,(%rax)
movl   $0x200000,-0x314(%rax)
xor    %eax,%eax
pop    %rcx
jmp    1040 <EnableInterrupts@plt>

LLVM IR (-O0):
define void @Timer1_Init() {
%1 = call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%3 = or i32 %2, 2
store volatile i32 %3, i32* inttoptr (i64 1074783748 to i32*)
br label %4
4: ; preds = %8, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784772 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
store volatile i32 0, i32* inttoptr (i64 1073942540 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073942528 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073942532 to i32*)
store volatile i32 1333332, i32* inttoptr (i64 1073942568 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073942584 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073942564 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 1073942552 to i32*)
%11 = or i32 %10, 1
store volatile i32 %11, i32* inttoptr (i64 1073942552 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%13 = and i32 %12, 16777215
%14 = or i32 %13, 1073741824
store volatile i32 %14, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 2097152, i32* inttoptr (i64 3758153984 to i32*)
%15 = call i32 (...) @EnableInterrupts()
ret void
}

LLVM IR (-O2):
define void @Timer1_Init() {
%1 = tail call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%3 = or i32 %2, 2
store volatile i32 %3, i32* inttoptr (i64 1074783748 to i32*)
br label %4
4: ; preds = %4, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784772 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
store volatile i32 0, i32* inttoptr (i64 1073942540 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073942528 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073942532 to i32*)
store volatile i32 1333332, i32* inttoptr (i64 1073942568 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073942584 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073942564 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 1073942552 to i32*)
%10 = or i32 %9, 1
store volatile i32 %10, i32* inttoptr (i64 1073942552 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%12 = and i32 %11, 16777215
%13 = or i32 %12, 1073741824
store volatile i32 %13, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 2097152, i32* inttoptr (i64 3758153984 to i32*)
%14 = tail call i32 (...) @EnableInterrupts()
ret void
}