void FlashInit() {
  unsigned long ulMWRAllow;
  unsigned int i = 0;
  ulMWRAllow = (*((volatile unsigned long *)(0x400FB980)));
  (*((volatile unsigned long *)(0x400FB980))) = 0xA5A5A5A5;
  (*((volatile unsigned long *)(0x400FA000 + 0x00000048))) |= 0x00000001;
  (*((volatile unsigned long *)(0x400FA000 + 0x00000040))) |= 0x00000003;
  (*((volatile unsigned long *)(0x400FA000 + 0x00000300))) = 0;
  (*((volatile unsigned long *)(0x400FA000 + 0x00000000))) = (1 << 8);
  (*((volatile unsigned long *)(0x400FA000 + 0x00000300))) |= 0x00000001;
  (*((volatile unsigned long *)(0x400FA000 + 0x00000300))) |= 0x00000002;
  (*((volatile unsigned long *)(0x400FA600 + 0x00000000))) = 0xA;
  (*((volatile unsigned long *)(0x400FB980))) = ulMWRAllow;
  for (i = 0; i < 7; i++) {
    __asm(" NOP");
  }
}


x86 assembly (clang, -O0):
<FlashInit>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0xc(%rbp)
mov    $0x400fb980,%eax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    $0x400fb980,%eax
mov    $0xa5a5a5a5,%ecx
mov    %rcx,(%rax)
mov    $0x400fa048,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0x400fa048,%eax
mov    %rcx,(%rax)
mov    $0x400fa040,%eax
mov    (%rax),%rcx
or     $0x3,%rcx
mov    $0x400fa040,%eax
mov    %rcx,(%rax)
mov    $0x400fa300,%eax
movq   $0x0,(%rax)
mov    $0x400fa000,%eax
movq   $0x100,(%rax)
mov    $0x400fa300,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0x400fa300,%eax
mov    %rcx,(%rax)
mov    $0x400fa300,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0x400fa300,%eax
mov    %rcx,(%rax)
mov    $0x400fa600,%eax
movq   $0xa,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x400fb980,%eax
mov    %rcx,(%rax)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jae    11c4 <FlashInit+0xc4>
nop
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <FlashInit+0xab>
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashInit>:
mov    0x400fb980,%rax
40
mov    $0xa5a5a5a5,%ecx
mov    %rcx,0x400fb980
40
orq    $0x1,0x400fa048
40 01
orq    $0x3,0x400fa040
40 03
movq   $0x0,0x400fa300
movq   $0x100,0x400fa000
orq    $0x1,0x400fa300
40 01
orq    $0x2,0x400fa300
40 02
movq   $0xa,0x400fa600
mov    %rax,0x400fb980
40
nop
nop
nop
nop
nop
nop
nop
ret

LLVM IR (-O0):
define void @FlashInit() {
%1 = alloca i64
%2 = alloca i32
store i32 0, i32* %2
%3 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store i64 %3, i64* %1
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%4 = load volatile i64, i64* inttoptr (i64 1074765896 to i64*)
%5 = or i64 %4, 1
store volatile i64 %5, i64* inttoptr (i64 1074765896 to i64*)
%6 = load volatile i64, i64* inttoptr (i64 1074765888 to i64*)
%7 = or i64 %6, 3
store volatile i64 %7, i64* inttoptr (i64 1074765888 to i64*)
store volatile i64 0, i64* inttoptr (i64 1074766592 to i64*)
store volatile i64 256, i64* inttoptr (i64 1074765824 to i64*)
%8 = load volatile i64, i64* inttoptr (i64 1074766592 to i64*)
%9 = or i64 %8, 1
store volatile i64 %9, i64* inttoptr (i64 1074766592 to i64*)
%10 = load volatile i64, i64* inttoptr (i64 1074766592 to i64*)
%11 = or i64 %10, 2
store volatile i64 %11, i64* inttoptr (i64 1074766592 to i64*)
store volatile i64 10, i64* inttoptr (i64 1074767360 to i64*)
%12 = load i64, i64* %1
store volatile i64 %12, i64* inttoptr (i64 1074772352 to i64*)
store i32 0, i32* %2
br label %13
13: ; preds = %17, %0
%14 = load i32, i32* %2
%15 = icmp ult i32 %14, 7
br i1 %15, label %16, label %20
16: ; preds = %13
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = add i32 %18, 1
store i32 %19, i32* %2
br label %13
20: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @FlashInit() {
%1 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%2 = load volatile i64, i64* inttoptr (i64 1074765896 to i64*)
%3 = or i64 %2, 1
store volatile i64 %3, i64* inttoptr (i64 1074765896 to i64*)
%4 = load volatile i64, i64* inttoptr (i64 1074765888 to i64*)
%5 = or i64 %4, 3
store volatile i64 %5, i64* inttoptr (i64 1074765888 to i64*)
store volatile i64 0, i64* inttoptr (i64 1074766592 to i64*)
store volatile i64 256, i64* inttoptr (i64 1074765824 to i64*)
%6 = load volatile i64, i64* inttoptr (i64 1074766592 to i64*)
%7 = or i64 %6, 1
store volatile i64 %7, i64* inttoptr (i64 1074766592 to i64*)
%8 = load volatile i64, i64* inttoptr (i64 1074766592 to i64*)
%9 = or i64 %8, 2
store volatile i64 %9, i64* inttoptr (i64 1074766592 to i64*)
store volatile i64 10, i64* inttoptr (i64 1074767360 to i64*)
store volatile i64 %1, i64* inttoptr (i64 1074772352 to i64*)
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect " NOP", "~{dirflag},~{fpsr},~{flags}"()
ret void
}