void dataAbortException(unsigned int *address) {
  printf("*******************************\r\n");
  printf("*** DATA ABORT EXCEPTION    ***\r\n");
  printf("*** Instruction: 0x%08X ***\r\n", *address);
  printf("*** Address:     0x%08X ***\r\n", address);
  printf("*******************************\r\n");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<dataAbortException>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116c <dataAbortException+0x5c>

x86 assembly (clang, -O2):
<dataAbortException>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf2f(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
nopl   0x0(%rax,%rax,1)
jmp    1170 <dataAbortException+0x50>

LLVM IR (-O0):
@.str = [34 x i8] c"*******************************\0D\0A\00"
@.str.1 = [34 x i8] c"*** DATA ABORT EXCEPTION ***\0D\0A\00"
@.str.2 = [30 x i8] c"*** Instruction: 0x%08X ***\0D\0A\00"
@.str.3 = [30 x i8] c"*** Address: 0x%08X ***\0D\0A\00"
define void @dataAbortException(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %1, %11
br label %11
}

LLVM IR (-O2):
@.str.2 = [30 x i8] c"*** Instruction: 0x%08X ***\0D\0A\00"
@.str.3 = [30 x i8] c"*** Address: 0x%08X ***\0D\0A\00"
@str.4 = [33 x i8] c"*** DATA ABORT EXCEPTION ***\0D\00"
@str.5 = [33 x i8] c"*******************************\0D\00"
define void @dataAbortException(i32* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0))
%4 = load i32, i32* %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32* %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
br label %8
8: ; preds = %1, %8
br label %8
}