#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 Timer2_Init(void) {
  DisableInterrupts();
  (*((volatile uint32_t *)0x400FE604)) |= 0x00000004;
  while (((*((volatile uint32_t *)0x400FEA04)) & 0x00000004) == 0) {
  }
  (*((volatile uint32_t *)0x4003200C)) = 0x00;
  (*((volatile uint32_t *)0x40032000)) = 0x00;
  (*((volatile uint32_t *)0x40032004)) = 0x02;
  (*((volatile uint32_t *)0x40032028)) = 80000000 / 800000 - 1;
  (*((volatile uint32_t *)0x40032038)) = 0;
  (*((volatile uint32_t *)0x40032024)) = 0x01;
  (*((volatile uint32_t *)0x40032018)) |= 0x01;
  (*((volatile uint32_t *)0xE000E414)) =
      ((*((volatile uint32_t *)0xE000E414)) & 0x00FFFFFF) | (1 << 29);
  (*((volatile uint32_t *)0xE000E100)) = 1 << 23;
  EnableInterrupts();
}


x86 assembly (clang, -O0):
<Timer2_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <DisableInterrupts@plt>
mov    $0x400fe604,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0x400fe604,%eax
mov    %ecx,(%rax)
mov    $0x400fea04,%eax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1154 <Timer2_Init+0x34>
jmp    113c <Timer2_Init+0x1c>
mov    $0x4003200c,%eax
movl   $0x0,(%rax)
mov    $0x40032000,%eax
movl   $0x0,(%rax)
mov    $0x40032004,%eax
movl   $0x2,(%rax)
mov    $0x40032028,%eax
movl   $0x63,(%rax)
mov    $0x40032038,%eax
movl   $0x0,(%rax)
mov    $0x40032024,%eax
movl   $0x1,(%rax)
mov    $0x40032018,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x40032018,%eax
mov    %ecx,(%rax)
mov    $0xe000e414,%eax
mov    (%rax),%ecx
and    $0xffffff,%ecx
or     $0x20000000,%ecx
mov    $0xe000e414,%eax
mov    %ecx,(%rax)
mov    $0xe000e100,%eax
movl   $0x800000,(%rax)
mov    $0x0,%al
call   1040 <EnableInterrupts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timer2_Init>:
push   %rax
xor    %eax,%eax
call   1030 <DisableInterrupts@plt>
orl    $0x4,0x400fe604
04
testl  $0x4,0x400fea04
je     1130 <Timer2_Init+0x10>
movl   $0x0,0x4003200c
movl   $0x0,0x40032000
movl   $0x2,0x40032004
movl   $0x63,0x40032028
movl   $0x0,0x40032038
movl   $0x1,0x40032024
orl    $0x1,0x40032018
01
mov    $0xe000e414,%eax
mov    $0xffffff,%ecx
and    (%rax),%ecx
or     $0x20000000,%ecx
mov    %ecx,(%rax)
movl   $0x800000,-0x314(%rax)
xor    %eax,%eax
pop    %rcx
jmp    1040 <EnableInterrupts@plt>

LLVM IR (-O0):
define void @Timer2_Init() {
%1 = call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%3 = or i32 %2, 4
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, 4
%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 1073946636 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073946624 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073946628 to i32*)
store volatile i32 99, i32* inttoptr (i64 1073946664 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073946680 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073946660 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 1073946648 to i32*)
%11 = or i32 %10, 1
store volatile i32 %11, i32* inttoptr (i64 1073946648 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%13 = and i32 %12, 16777215
%14 = or i32 %13, 536870912
store volatile i32 %14, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 8388608, i32* inttoptr (i64 3758153984 to i32*)
%15 = call i32 (...) @EnableInterrupts()
ret void
}

LLVM IR (-O2):
define void @Timer2_Init() {
%1 = tail call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%3 = or i32 %2, 4
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, 4
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
store volatile i32 0, i32* inttoptr (i64 1073946636 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073946624 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073946628 to i32*)
store volatile i32 99, i32* inttoptr (i64 1073946664 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073946680 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073946660 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 1073946648 to i32*)
%10 = or i32 %9, 1
store volatile i32 %10, i32* inttoptr (i64 1073946648 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%12 = and i32 %11, 16777215
%13 = or i32 %12, 536870912
store volatile i32 %13, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 8388608, i32* inttoptr (i64 3758153984 to i32*)
%14 = tail call i32 (...) @EnableInterrupts()
ret void
}