#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 Timer1_Init(uint32_t period) {
  unsigned long volatile delay;
  (*((volatile uint32_t *)0x400FE604)) |= 0x02;
  delay = (*((volatile uint32_t *)0x400FE604));
  (*((volatile uint32_t *)0x4003100C)) = 0x00000000;
  (*((volatile uint32_t *)0x40031000)) = 0x00000000;
  (*((volatile uint32_t *)0x40031004)) = 0x00000002;
  (*((volatile uint32_t *)0x40031028)) = period - 1;
  (*((volatile uint32_t *)0x40031038)) = 0;
  (*((volatile uint32_t *)0x40031024)) = 0x00000001;
  (*((volatile uint32_t *)0x40031018)) = 0x00000001;
  (*((volatile uint32_t *)0xE000E414)) =
      ((*((volatile uint32_t *)0xE000E414)) & 0xFFFF00FF) | 0x00A0A000;
  (*((volatile uint32_t *)0xE000E100)) = 11 << 21;
}


x86 assembly (clang, -O0):
<Timer1_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x400fe604,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0x400fe604,%eax
mov    %ecx,(%rax)
mov    $0x400fe604,%eax
mov    (%rax),%eax
cltq
mov    %rax,-0x10(%rbp)
mov    $0x4003100c,%eax
movl   $0x0,(%rax)
mov    $0x40031000,%eax
movl   $0x0,(%rax)
mov    $0x40031004,%eax
movl   $0x2,(%rax)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x40031028,%eax
mov    %ecx,(%rax)
mov    $0x40031038,%eax
movl   $0x0,(%rax)
mov    $0x40031024,%eax
movl   $0x1,(%rax)
mov    $0x40031018,%eax
movl   $0x1,(%rax)
mov    $0xe000e414,%eax
mov    (%rax),%ecx
and    $0xffff00ff,%ecx
or     $0xa0a000,%ecx
mov    $0xe000e414,%eax
mov    %ecx,(%rax)
mov    $0xe000e100,%eax
movl   $0x1600000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timer1_Init>:
orl    $0x2,0x400fe604
02
movslq 0x400fe604,%rax
40
mov    %rax,-0x8(%rsp)
movl   $0x0,0x4003100c
movl   $0x0,0x40031000
movl   $0x2,0x40031004
add    $0xffffffff,%edi
mov    %edi,0x40031028
movl   $0x0,0x40031038
movl   $0x1,0x40031024
movl   $0x1,0x40031018
mov    $0xe000e414,%eax
mov    $0xff5f00ff,%ecx
and    (%rax),%ecx
or     $0xa0a000,%ecx
mov    %ecx,(%rax)
movl   $0x1600000,-0x314(%rax)
ret

LLVM IR (-O0):
define void @Timer1_Init(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%5 = or i32 %4, 2
store volatile i32 %5, i32* inttoptr (i64 1074783748 to i32*)
%6 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%7 = sext i32 %6 to i64
store volatile i64 %7, i64* %3
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*)
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
store volatile i32 %9, 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*)
store volatile i32 1, i32* inttoptr (i64 1073942552 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%11 = and i32 %10, -65281
%12 = or i32 %11, 10526720
store volatile i32 %12, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 23068672, i32* inttoptr (i64 3758153984 to i32*)
ret void
}

LLVM IR (-O2):
define void @Timer1_Init(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%5 = or i32 %4, 2
store volatile i32 %5, i32* inttoptr (i64 1074783748 to i32*)
%6 = load volatile i32, i32* inttoptr (i64 1074783748 to i32*)
%7 = sext i32 %6 to i64
store volatile i64 %7, i64* %2
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*)
%8 = add nsw i32 %0, -1
store volatile i32 %8, 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*)
store volatile i32 1, i32* inttoptr (i64 1073942552 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 3758154772 to i32*)
%10 = and i32 %9, -10551041
%11 = or i32 %10, 10526720
store volatile i32 %11, i32* inttoptr (i64 3758154772 to i32*)
store volatile i32 23068672, i32* inttoptr (i64 3758153984 to i32*)
ret void
}