#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 BSP_Button2_Init(void) {
  (*((volatile uint32_t *)0x400FE608)) |= 0x00000008;
  while (((*((volatile uint32_t *)0x400FEA08)) & 0x08) == 0) {
  };
  (*((volatile uint32_t *)0x40007520)) = 0x4C4F434B;
  (*((volatile uint32_t *)0x40007524)) = 0xFF;
  (*((volatile uint32_t *)0x40007528)) &= ~0x80;
  (*((volatile uint32_t *)0x4000752C)) =
      ((*((volatile uint32_t *)0x4000752C)) & 0x0FFFFFFF) + 0x00000000;
  (*((volatile uint32_t *)0x40007400)) &= ~0x80;
  (*((volatile uint32_t *)0x40007420)) &= ~0x80;
  (*((volatile uint32_t *)0x40007510)) &= ~0x80;
  (*((volatile uint32_t *)0x4000751C)) |= 0x80;
}


x86 assembly (clang, -O0):
<BSP_Button2_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fe608,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x400fe608,%eax
mov    %ecx,(%rax)
mov    $0x400fea08,%eax
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    112d <BSP_Button2_Init+0x2d>
jmp    1115 <BSP_Button2_Init+0x15>
mov    $0x40007520,%eax
movl   $0x4c4f434b,(%rax)
mov    $0x40007524,%eax
movl   $0xff,(%rax)
mov    $0x40007528,%eax
mov    (%rax),%ecx
and    $0xffffff7f,%ecx
mov    $0x40007528,%eax
mov    %ecx,(%rax)
mov    $0x4000752c,%eax
mov    (%rax),%ecx
and    $0xfffffff,%ecx
add    $0x0,%ecx
mov    $0x4000752c,%eax
mov    %ecx,(%rax)
mov    $0x40007400,%eax
mov    (%rax),%ecx
and    $0xffffff7f,%ecx
mov    $0x40007400,%eax
mov    %ecx,(%rax)
mov    $0x40007420,%eax
mov    (%rax),%ecx
and    $0xffffff7f,%ecx
mov    $0x40007420,%eax
mov    %ecx,(%rax)
mov    $0x40007510,%eax
mov    (%rax),%ecx
and    $0xffffff7f,%ecx
mov    $0x40007510,%eax
mov    %ecx,(%rax)
mov    $0x4000751c,%eax
mov    (%rax),%ecx
or     $0x80,%ecx
mov    $0x4000751c,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_Button2_Init>:
orl    $0x8,0x400fe608
08
nopl   0x0(%rax,%rax,1)
testl  $0x8,0x400fea08
je     1110 <BSP_Button2_Init+0x10>
movl   $0x4c4f434b,0x40007520
4b 43 4f 4c
movl   $0xff,0x40007524
andl   $0xffffff7f,0x40007528
7f ff ff ff
andl   $0xfffffff,0x4000752c
ff ff ff 0f
andl   $0xffffff7f,0x40007400
7f ff ff ff
andl   $0xffffff7f,0x40007420
7f ff ff ff
andl   $0xffffff7f,0x40007510
7f ff ff ff
orl    $0x80,0x4000751c
ret

LLVM IR (-O0):
define void @BSP_Button2_Init() {
%1 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%2 = or i32 %1, 8
store volatile i32 %2, i32* inttoptr (i64 1074783752 to i32*)
br label %3
3: ; preds = %7, %0
%4 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%5 = and i32 %4, 8
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
store volatile i32 1280262987, i32* inttoptr (i64 1073771808 to i32*)
store volatile i32 255, i32* inttoptr (i64 1073771812 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 1073771816 to i32*)
%10 = and i32 %9, -129
store volatile i32 %10, i32* inttoptr (i64 1073771816 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 1073771820 to i32*)
%12 = and i32 %11, 268435455
%13 = add nsw i32 %12, 0
store volatile i32 %13, i32* inttoptr (i64 1073771820 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073771520 to i32*)
%15 = and i32 %14, -129
store volatile i32 %15, i32* inttoptr (i64 1073771520 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073771552 to i32*)
%17 = and i32 %16, -129
store volatile i32 %17, i32* inttoptr (i64 1073771552 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 1073771792 to i32*)
%19 = and i32 %18, -129
store volatile i32 %19, i32* inttoptr (i64 1073771792 to i32*)
%20 = load volatile i32, i32* inttoptr (i64 1073771804 to i32*)
%21 = or i32 %20, 128
store volatile i32 %21, i32* inttoptr (i64 1073771804 to i32*)
ret void
}

LLVM IR (-O2):
define void @BSP_Button2_Init() {
%1 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%2 = or i32 %1, 8
store volatile i32 %2, i32* inttoptr (i64 1074783752 to i32*)
br label %3
3: ; preds = %3, %0
%4 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%5 = and i32 %4, 8
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
store volatile i32 1280262987, i32* inttoptr (i64 1073771808 to i32*)
store volatile i32 255, i32* inttoptr (i64 1073771812 to i32*)
%8 = load volatile i32, i32* inttoptr (i64 1073771816 to i32*)
%9 = and i32 %8, -129
store volatile i32 %9, i32* inttoptr (i64 1073771816 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 1073771820 to i32*)
%11 = and i32 %10, 268435455
store volatile i32 %11, i32* inttoptr (i64 1073771820 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 1073771520 to i32*)
%13 = and i32 %12, -129
store volatile i32 %13, i32* inttoptr (i64 1073771520 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073771552 to i32*)
%15 = and i32 %14, -129
store volatile i32 %15, i32* inttoptr (i64 1073771552 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073771792 to i32*)
%17 = and i32 %16, -129
store volatile i32 %17, i32* inttoptr (i64 1073771792 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 1073771804 to i32*)
%19 = or i32 %18, 128
store volatile i32 %19, i32* inttoptr (i64 1073771804 to i32*)
ret void
}