void GenericFaultHandler(unsigned long *fault_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;
  stacked_r0 = ((unsigned long)fault_args[0]);
  stacked_r1 = ((unsigned long)fault_args[1]);
  stacked_r2 = ((unsigned long)fault_args[2]);
  stacked_r3 = ((unsigned long)fault_args[3]);
  stacked_r12 = ((unsigned long)fault_args[4]);
  stacked_lr = ((unsigned long)fault_args[5]);
  stacked_pc = ((unsigned long)fault_args[6]);
  stacked_psr = ((unsigned long)fault_args[7]);
  _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)));
  while (1) {
  }
}


x86 assembly (clang, -O0):
<GenericFaultHandler>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rax
mov    %rax,-0x48(%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)
jmp    11af <GenericFaultHandler+0xaf>

x86 assembly (clang, -O2):
<GenericFaultHandler>:
mov    (%rdi),%rax
mov    %rax,-0x8(%rsp)
mov    0x8(%rdi),%rax
mov    %rax,-0x10(%rsp)
mov    0x10(%rdi),%rax
mov    %rax,-0x18(%rsp)
mov    0x18(%rdi),%rax
mov    %rax,-0x20(%rsp)
mov    0x20(%rdi),%rax
mov    %rax,-0x28(%rsp)
mov    0x28(%rdi),%rax
mov    %rax,-0x30(%rsp)
mov    0x30(%rdi),%rax
mov    %rax,-0x38(%rsp)
mov    0x38(%rdi),%rax
mov    %rax,-0x40(%rsp)
mov    $0xe000ed28,%eax
mov    (%rax),%rcx
mov    %rcx,-0x48(%rsp)
mov    0x4(%rax),%rcx
mov    %rcx,-0x50(%rsp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x58(%rsp)
mov    0x14(%rax),%rcx
mov    %rcx,-0x60(%rsp)
mov    0xc(%rax),%rcx
mov    %rcx,-0x70(%rsp)
mov    0x10(%rax),%rax
mov    %rax,-0x68(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1190 <GenericFaultHandler+0x90>

LLVM IR (-O0):
define void @GenericFaultHandler(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 i64*, i64** %2
%18 = getelementptr inbounds i64, i64* %17, i64 0
%19 = load i64, i64* %18
store volatile i64 %19, i64* %3
%20 = load i64*, i64** %2
%21 = getelementptr inbounds i64, i64* %20, i64 1
%22 = load i64, i64* %21
store volatile i64 %22, i64* %4
%23 = load i64*, i64** %2
%24 = getelementptr inbounds i64, i64* %23, i64 2
%25 = load i64, i64* %24
store volatile i64 %25, i64* %5
%26 = load i64*, i64** %2
%27 = getelementptr inbounds i64, i64* %26, i64 3
%28 = load i64, i64* %27
store volatile i64 %28, i64* %6
%29 = load i64*, i64** %2
%30 = getelementptr inbounds i64, i64* %29, i64 4
%31 = load i64, i64* %30
store volatile i64 %31, i64* %7
%32 = load i64*, i64** %2
%33 = getelementptr inbounds i64, i64* %32, i64 5
%34 = load i64, i64* %33
store volatile i64 %34, i64* %8
%35 = load i64*, i64** %2
%36 = getelementptr inbounds i64, i64* %35, i64 6
%37 = load i64, i64* %36
store volatile i64 %37, i64* %9
%38 = load i64*, i64** %2
%39 = getelementptr inbounds i64, i64* %38, i64 7
%40 = load i64, i64* %39
store volatile i64 %40, i64* %10
%41 = load volatile i64, i64* inttoptr (i64 3758157096 to i64*)
store volatile i64 %41, i64* %11
%42 = load volatile i64, i64* inttoptr (i64 3758157100 to i64*)
store volatile i64 %42, i64* %12
%43 = load volatile i64, i64* inttoptr (i64 3758157104 to i64*)
store volatile i64 %43, i64* %13
%44 = load volatile i64, i64* inttoptr (i64 3758157116 to i64*)
store volatile i64 %44, i64* %14
%45 = load volatile i64, i64* inttoptr (i64 3758157108 to i64*)
store volatile i64 %45, i64* %16
%46 = load volatile i64, i64* inttoptr (i64 3758157112 to i64*)
store volatile i64 %46, i64* %15
br label %47
47: ; preds = %1, %47
br label %47
}

LLVM IR (-O2):
define void @GenericFaultHandler(i64* nocapture %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 = bitcast i64* %2 to i8*
%17 = bitcast i64* %3 to i8*
%18 = bitcast i64* %4 to i8*
%19 = bitcast i64* %5 to i8*
%20 = bitcast i64* %6 to i8*
%21 = bitcast i64* %7 to i8*
%22 = bitcast i64* %8 to i8*
%23 = bitcast i64* %9 to i8*
%24 = bitcast i64* %10 to i8*
%25 = bitcast i64* %11 to i8*
%26 = bitcast i64* %12 to i8*
%27 = bitcast i64* %13 to i8*
%28 = bitcast i64* %14 to i8*
%29 = bitcast i64* %15 to i8*
%30 = load i64, i64* %0
store volatile i64 %30, i64* %2
%31 = getelementptr inbounds i64, i64* %0, i64 1
%32 = load i64, i64* %31
store volatile i64 %32, i64* %3
%33 = getelementptr inbounds i64, i64* %0, i64 2
%34 = load i64, i64* %33
store volatile i64 %34, i64* %4
%35 = getelementptr inbounds i64, i64* %0, i64 3
%36 = load i64, i64* %35
store volatile i64 %36, i64* %5
%37 = getelementptr inbounds i64, i64* %0, i64 4
%38 = load i64, i64* %37
store volatile i64 %38, i64* %6
%39 = getelementptr inbounds i64, i64* %0, i64 5
%40 = load i64, i64* %39
store volatile i64 %40, i64* %7
%41 = getelementptr inbounds i64, i64* %0, i64 6
%42 = load i64, i64* %41
store volatile i64 %42, i64* %8
%43 = getelementptr inbounds i64, i64* %0, i64 7
%44 = load i64, i64* %43
store volatile i64 %44, i64* %9
%45 = load volatile i64, i64* inttoptr (i64 3758157096 to i64*)
store volatile i64 %45, i64* %10
%46 = load volatile i64, i64* inttoptr (i64 3758157100 to i64*)
store volatile i64 %46, i64* %11
%47 = load volatile i64, i64* inttoptr (i64 3758157104 to i64*)
store volatile i64 %47, i64* %12
%48 = load volatile i64, i64* inttoptr (i64 3758157116 to i64*)
store volatile i64 %48, i64* %13
%49 = load volatile i64, i64* inttoptr (i64 3758157108 to i64*)
store volatile i64 %49, i64* %15
%50 = load volatile i64, i64* inttoptr (i64 3758157112 to i64*)
store volatile i64 %50, i64* %14
br label %51
51: ; preds = %51, %1
br label %51
}