void assert_report(const char *file, int line, const char *func,
                   const char *targetname, const char *title) {
  if (file == (void *)0)
    file = "??";
  if (func == (void *)0 || *func == '\0')
    func = "unknown";
  ShowError("--- %s --------------------------------------------\n", title);
  ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func);
  ShowError("--- end %s ----------------------------------------\n", title);
}


x86 assembly (clang, -O0):
<assert_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1141 <assert_report+0x31>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115c <assert_report+0x4c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1167 <assert_report+0x57>
lea    0xea0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <ShowError@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <ShowError@plt>
mov    -0x28(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <ShowError@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_report>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r15
mov    %rcx,%r14
mov    %esi,%r12d
test   %rdx,%rdx
je     112e <assert_report+0x1e>
mov    %rdx,%rbx
cmpb   $0x0,(%rdx)
jne    1135 <assert_report+0x25>
lea    0xece(%rip),%rbx
test   %rdi,%rdi
lea    0xec1(%rip),%rbp
cmovne %rdi,%rbp
lea    0xec1(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <ShowError@plt>
lea    0xee5(%rip),%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
mov    %r14,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <ShowError@plt>
lea    0xee9(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <ShowError@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"??\00"
@.str.1 = [8 x i8] c"unknown\00"
@.str.2 = [53 x i8] c"--- %s --------------------------------------------\0A\00"
@.str.3 = [30 x i8] c"%s:%d: '%s' in function `%s'\0A\00"
@.str.4 = [53 x i8] c"--- end %s ----------------------------------------\0A\00"
define void @assert_report(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %6
br label %14
14: ; preds = %13, %5
%15 = load i8*, i8** %8
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = load i8*, i8** %8
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17, %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %23
23: ; preds = %22, %17
%24 = load i8*, i8** %10
%25 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = load i8*, i8** %9
%29 = load i8*, i8** %8
%30 = call i32 (i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %26, i32 %27, i8* %28, i8* %29)
%31 = load i8*, i8** %10
%32 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i8* %31)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"??\00"
@.str.1 = [8 x i8] c"unknown\00"
@.str.2 = [53 x i8] c"--- %s --------------------------------------------\0A\00"
@.str.3 = [30 x i8] c"%s:%d: '%s' in function `%s'\0A\00"
@.str.4 = [53 x i8] c"--- end %s ----------------------------------------\0A\00"
define void @assert_report(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %2, null
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %5
br label %11
11: ; preds = %10, %7
%12 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %10 ], [ %2, %7 ]
%13 = icmp eq i8* %0, null
%14 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0
%15 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%16 = tail call i32 (i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %14, i32 %1, i8* %3, i8* %12)
%17 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ShowError to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i8* %4)
ret void
}