#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 */
void Timer0_Init(uint32_t period) {
  (*((volatile uint32_t *)0x400FE604)) |= 0x01;
  (*((volatile uint32_t *)0x4003000C)) = 0x00000000;
  (*((volatile uint32_t *)0x40030000)) = 0x00000000;
  (*((volatile uint32_t *)0x40030004)) = 0x00000002;
  (*((volatile uint32_t *)0x40030028)) = period - 1;
  (*((volatile uint32_t *)0x40030038)) = 0;
  (*((volatile uint32_t *)0x40030024)) = 0x00000001;
  (*((volatile uint32_t *)0x40030018)) = 0x00000001;
  (*((volatile uint32_t *)0xE000E410)) =
      ((*((volatile uint32_t *)0xE000E410)) & 0x00FFFFFF) | 0x80000000;
  (*((volatile uint32_t *)0xE000E100)) = 1 << 19;
  (*((volatile uint32_t *)0x4003000C)) = 0x00000001;
}


x86 assembly (clang, -O0):
<Timer0_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x400fe604,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x400fe604,%eax
mov    %ecx,(%rax)
mov    $0x4003000c,%eax
movl   $0x0,(%rax)
mov    $0x40030000,%eax
movl   $0x0,(%rax)
mov    $0x40030004,%eax
movl   $0x2,(%rax)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x40030028,%eax
mov    %ecx,(%rax)
mov    $0x40030038,%eax
movl   $0x0,(%rax)
mov    $0x40030024,%eax
movl   $0x1,(%rax)
mov    $0x40030018,%eax
movl   $0x1,(%rax)
mov    $0xe000e410,%eax
mov    (%rax),%ecx
and    $0xffffff,%ecx
or     $0x80000000,%ecx
mov    $0xe000e410,%eax
mov    %ecx,(%rax)
mov    $0xe000e100,%eax
movl   $0x80000,(%rax)
mov    $0x4003000c,%eax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timer0_Init>:
orl    $0x1,0x400fe604
01
movl   $0x0,0x4003000c
movl   $0x0,0x40030000
movl   $0x2,0x40030004
add    $0xffffffff,%edi
mov    %edi,0x40030028
movl   $0x0,0x40030038
movl   $0x1,0x40030024
movl   $0x1,0x40030018
mov    $0xe000e410,%eax
mov    $0xffffff,%ecx
and    (%rax),%ecx
or     $0x80000000,%ecx
mov    %ecx,(%rax)
movl   $0x80000,-0x310(%rax)
movl   $0x1,0x4003000c
ret

LLVM IR (-O0):
define void @Timer0_Init(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 1074783748 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938444 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938432 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073938436 to i32*)
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 1
store volatile i32 %6, i32* inttoptr (i64 1073938472 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938488 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938468 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938456 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 3758154768 to i32*)
%8 = and i32 %7, 16777215
%9 = or i32 %8, -2147483648
store volatile i32 %9, i32* inttoptr (i64 3758154768 to i32*)
store volatile i32 524288, i32* inttoptr (i64 3758153984 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938444 to i32*)
ret void
}

LLVM IR (-O2):
define void @Timer0_Init(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%3 = or i32 %2, 1
store volatile i32 %3, i32* inttoptr (i64 1074783748 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938444 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938432 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073938436 to i32*)
%4 = add nsw i32 %0, -1
store volatile i32 %4, i32* inttoptr (i64 1073938472 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073938488 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938468 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938456 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 3758154768 to i32*)
%6 = and i32 %5, 16777215
%7 = or i32 %6, -2147483648
store volatile i32 %7, i32* inttoptr (i64 3758154768 to i32*)
store volatile i32 524288, i32* inttoptr (i64 3758153984 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073938444 to i32*)
ret void
}