#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 */

/* Variables and functions */
int /*<<< orphan*/ GenericFaultHandler(unsigned long *);
void HardFault_Handler(unsigned long *hardfault_args) {
  volatile unsigned long stacked_r0;
  volatile unsigned long stacked_r1;
  volatile unsigned long stacked_r2;
  volatile unsigned long stacked_r3;
  volatile unsigned long stacked_r12;
  volatile unsigned long stacked_lr;
  volatile unsigned long stacked_pc;
  volatile unsigned long stacked_psr;
  volatile unsigned long _CFSR;
  volatile unsigned long _HFSR;
  volatile unsigned long _DFSR;
  volatile unsigned long _AFSR;
  volatile unsigned long _BFAR;
  volatile unsigned long _MMAR;
  _CFSR = (*((volatile unsigned long *)(0xE000ED28)));
  _HFSR = (*((volatile unsigned long *)(0xE000ED2C)));
  _DFSR = (*((volatile unsigned long *)(0xE000ED30)));
  _AFSR = (*((volatile unsigned long *)(0xE000ED3C)));
  _MMAR = (*((volatile unsigned long *)(0xE000ED34)));
  _BFAR = (*((volatile unsigned long *)(0xE000ED38)));
  GenericFaultHandler(hardfault_args);
}


x86 assembly (clang, -O0):
<HardFault_Handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xe000ed28,%eax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    $0xe000ed2c,%eax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    $0xe000ed30,%eax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    $0xe000ed3c,%eax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    $0xe000ed34,%eax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    $0xe000ed38,%eax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <GenericFaultHandler@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HardFault_Handler>:
mov    $0xe000ed28,%eax
mov    (%rax),%rcx
mov    %rcx,-0x8(%rsp)
mov    0x4(%rax),%rcx
mov    %rcx,-0x10(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x18(%rsp)
mov    0x14(%rax),%rcx
mov    %rcx,-0x20(%rsp)
mov    0xc(%rax),%rcx
mov    %rcx,-0x30(%rsp)
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rsp)
jmp    1030 <GenericFaultHandler@plt>

LLVM IR (-O0):
define void @HardFault_Handler(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i64* %0, i64** %2
%17 = load volatile i64, i64* inttoptr (i64 3758157096 to i64*)
store volatile i64 %17, i64* %11
%18 = load volatile i64, i64* inttoptr (i64 3758157100 to i64*)
store volatile i64 %18, i64* %12
%19 = load volatile i64, i64* inttoptr (i64 3758157104 to i64*)
store volatile i64 %19, i64* %13
%20 = load volatile i64, i64* inttoptr (i64 3758157116 to i64*)
store volatile i64 %20, i64* %14
%21 = load volatile i64, i64* inttoptr (i64 3758157108 to i64*)
store volatile i64 %21, i64* %16
%22 = load volatile i64, i64* inttoptr (i64 3758157112 to i64*)
store volatile i64 %22, i64* %15
%23 = load i64*, i64** %2
%24 = call i32 @GenericFaultHandler(i64* %23)
ret void
}

LLVM IR (-O2):
define void @HardFault_Handler(i64* %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = bitcast i64* %2 to i8*
%9 = bitcast i64* %3 to i8*
%10 = bitcast i64* %4 to i8*
%11 = bitcast i64* %5 to i8*
%12 = bitcast i64* %6 to i8*
%13 = bitcast i64* %7 to i8*
%14 = load volatile i64, i64* inttoptr (i64 3758157096 to i64*)
store volatile i64 %14, i64* %2
%15 = load volatile i64, i64* inttoptr (i64 3758157100 to i64*)
store volatile i64 %15, i64* %3
%16 = load volatile i64, i64* inttoptr (i64 3758157104 to i64*)
store volatile i64 %16, i64* %4
%17 = load volatile i64, i64* inttoptr (i64 3758157116 to i64*)
store volatile i64 %17, i64* %5
%18 = load volatile i64, i64* inttoptr (i64 3758157108 to i64*)
store volatile i64 %18, i64* %7
%19 = load volatile i64, i64* inttoptr (i64 3758157112 to i64*)
store volatile i64 %19, i64* %6
%20 = tail call i32 @GenericFaultHandler(i64* %0)
ret void
}