void undefinedInstrException(unsigned int *address) {
  printf("***************************************\r\n");
  printf("*** UNDEFINED INSTRUCTION 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):
<undefinedInstrException>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116c <undefinedInstrException+0x5c>

x86 assembly (clang, -O2):
<undefinedInstrException>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf47(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%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 <undefinedInstrException+0x50>

LLVM IR (-O0):
@.str = [42 x i8] c"***************************************\0D\0A\00"
@.str.1 = [42 x i8] c"*** UNDEFINED INSTRUCTION EXCEPTION ***\0D\0A\00"
@.str.2 = [38 x i8] c"*** Instruction: 0x%08X ***\0D\0A\00"
@.str.3 = [38 x i8] c"*** Address: 0x%08X ***\0D\0A\00"
define void @undefinedInstrException(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 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 ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %1, %11
br label %11
}

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