void do_flash_write(void) {
  unsigned long i;
  while (!((*(((volatile unsigned int *)(0xFFFFFF68)))) & 0x1))
    ;
  for (i = 0; i < 64; i++)
    ((volatile unsigned int
          *)(0x00100000))[((*(((volatile unsigned int *)(0x00202300)))) * 64) +
                          i] = ((volatile unsigned int *)(0x00202100))[i];
  (*(((volatile unsigned int *)(0xFFFFFF64)))) =
      (0x5A000001 +
       (((*(((volatile unsigned int *)(0x00202300)))) & 0x000003FF) << 8));
  while (!((*(((volatile unsigned int *)(0xFFFFFF68)))) & 0x1))
    ;
}


x86 assembly (clang, -O0):
<do_flash_write>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffff68,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1123 <do_flash_write+0x23>
jmp    1128 <do_flash_write+0x28>
jmp    1104 <do_flash_write+0x4>
movq   $0x0,-0x8(%rbp)
cmpq   $0x40,-0x8(%rbp)
jae    1172 <do_flash_write+0x72>
mov    -0x8(%rbp),%rcx
mov    $0x202100,%eax
mov    (%rax,%rcx,4),%edx
mov    $0x202300,%eax
mov    (%rax),%eax
shl    $0x6,%eax
mov    %eax,%eax
mov    %eax,%ecx
add    -0x8(%rbp),%rcx
mov    $0x100000,%eax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <do_flash_write+0x30>
mov    $0x202300,%eax
mov    (%rax),%ecx
and    $0x3ff,%ecx
shl    $0x8,%ecx
add    $0x5a000001,%ecx
mov    $0xffffff64,%eax
mov    %ecx,(%rax)
mov    $0xffffff68,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ae <do_flash_write+0xae>
jmp    11b3 <do_flash_write+0xb3>
jmp    118f <do_flash_write+0x8f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_flash_write>:
mov    $0xffffff68,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x1,(%rax)
je     1110 <do_flash_write+0x10>
mov    $0x100000,%ecx
xor    %edx,%edx
nop
mov    0x102100(%rcx,%rdx,4),%esi
mov    0x202300,%edi
shl    $0x6,%edi
add    %rdx,%rdi
mov    %esi,(%rcx,%rdi,4)
mov    0x102104(%rcx,%rdx,4),%esi
mov    0x202300,%edi
shl    $0x6,%edi
add    %rdx,%rdi
mov    %esi,0x4(%rcx,%rdi,4)
add    $0x2,%rdx
cmp    $0x40,%rdx
jne    1120 <do_flash_write+0x20>
mov    0x202300,%ecx
shl    $0x8,%ecx
and    $0x3ff00,%ecx
or     $0x5a000001,%ecx
mov    %ecx,-0x4(%rax)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
testl  $0x1,(%rax)
je     1180 <do_flash_write+0x80>
ret

LLVM IR (-O0):
define void @do_flash_write() {
%1 = alloca i64
br label %2
2: ; preds = %7, %0
%3 = load volatile i32, i32* inttoptr (i64 4294967144 to i32*)
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %8
7: ; preds = %2
br label %2
8: ; preds = %2
store i64 0, i64* %1
br label %9
9: ; preds = %22, %8
%10 = load i64, i64* %1
%11 = icmp ult i64 %10, 64
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i64, i64* %1
%14 = getelementptr inbounds i32, i32* inttoptr (i64 2105600 to i32*), i64 %13
%15 = load volatile i32, i32* %14
%16 = load volatile i32, i32* inttoptr (i64 2106112 to i32*)
%17 = mul i32 %16, 64
%18 = zext i32 %17 to i64
%19 = load i64, i64* %1
%20 = add i64 %18, %19
%21 = getelementptr inbounds i32, i32* inttoptr (i64 1048576 to i32*), i64 %20
store volatile i32 %15, i32* %21
br label %22
22: ; preds = %12
%23 = load i64, i64* %1
%24 = add i64 %23, 1
store i64 %24, i64* %1
br label %9
25: ; preds = %9
%26 = load volatile i32, i32* inttoptr (i64 2106112 to i32*)
%27 = and i32 %26, 1023
%28 = shl i32 %27, 8
%29 = add i32 1509949441, %28
store volatile i32 %29, i32* inttoptr (i64 4294967140 to i32*)
br label %30
30: ; preds = %35, %25
%31 = load volatile i32, i32* inttoptr (i64 4294967144 to i32*)
%32 = and i32 %31, 1
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
br i1 %34, label %35, label %36
35: ; preds = %30
br label %30
36: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @do_flash_write() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i32, i32* inttoptr (i64 4294967144 to i32*)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %22, %5 ], [ 0, %1 ]
%7 = getelementptr inbounds i32, i32* inttoptr (i64 2105600 to i32*), i64 %6
%8 = load volatile i32, i32* %7
%9 = load volatile i32, i32* inttoptr (i64 2106112 to i32*)
%10 = shl i32 %9, 6
%11 = zext i32 %10 to i64
%12 = add nuw nsw i64 %6, %11
%13 = getelementptr inbounds i32, i32* inttoptr (i64 1048576 to i32*), i64 %12
store volatile i32 %8, i32* %13
%14 = or i64 %6, 1
%15 = getelementptr inbounds i32, i32* inttoptr (i64 2105600 to i32*), i64 %14
%16 = load volatile i32, i32* %15
%17 = load volatile i32, i32* inttoptr (i64 2106112 to i32*)
%18 = shl i32 %17, 6
%19 = zext i32 %18 to i64
%20 = add nuw nsw i64 %14, %19
%21 = getelementptr inbounds i32, i32* inttoptr (i64 1048576 to i32*), i64 %20
store volatile i32 %16, i32* %21
%22 = add nuw nsw i64 %6, 2
%23 = icmp eq i64 %22, 64
br i1 %23, label %24, label %5
24: ; preds = %5
%25 = load volatile i32, i32* inttoptr (i64 2106112 to i32*)
%26 = shl i32 %25, 8
%27 = and i32 %26, 261888
%28 = or i32 %27, 1509949441
store volatile i32 %28, i32* inttoptr (i64 4294967140 to i32*)
br label %29
29: ; preds = %29, %24
%30 = load volatile i32, i32* inttoptr (i64 4294967144 to i32*)
%31 = and i32 %30, 1
%32 = icmp eq i32 %31, 0
br i1 %32, label %29, label %33
33: ; preds = %29
ret void
}