void die(const char *file, int line, const char *function, const char *message,
         int _errno) {
  if (_errno)
    error("%s:%d: %s: %s: %s", file, line, function, message, strerror(_errno));
  else if (message)
    error("%s:%d: %s: %s", file, line, function, message);
  else
    error("%s:%d: %s", file, line, function);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1190 <die+0x70>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x48(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    %rax,%r9
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <error@plt>
jmp    11db <die+0xbb>
cmpq   $0x0,-0x20(%rbp)
je     11bd <die+0x9d>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <error@plt>
jmp    11d6 <die+0xb6>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <error@plt>
jmp    11db <die+0xbb>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbp
test   %r8d,%r8d
je     1167 <die+0x47>
mov    %r8d,%edi
call   1040 <strerror@plt>
lea    0xeb9(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %rbx,%r8
mov    %rax,%r9
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <error@plt>
test   %rbx,%rbx
je     1190 <die+0x70>
lea    0xe9f(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %rbx,%r8
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <error@plt>
lea    0xe89(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s:%d: %s: %s: %s\00"
@.str.1 = [14 x i8] c"%s:%d: %s: %s\00"
@.str.2 = [10 x i8] c"%s:%d: %s\00"
define void @die(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %5
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = load i8*, i8** %8
%17 = load i8*, i8** %9
%18 = load i32, i32* %10
%19 = call i8* @strerror(i32 %18)
%20 = call i32 (i8*, i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15, i8* %16, i8* %17, i8* %19)
br label %36
21: ; preds = %5
%22 = load i8*, i8** %9
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = load i32, i32* %7
%27 = load i8*, i8** %8
%28 = load i8*, i8** %9
%29 = call i32 (i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %25, i32 %26, i8* %27, i8* %28)
br label %35
30: ; preds = %21
%31 = load i8*, i8** %6
%32 = load i32, i32* %7
%33 = load i8*, i8** %8
%34 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32 %32, i8* %33)
br label %35
35: ; preds = %30, %24
br label %36
36: ; preds = %35, %13
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s:%d: %s: %s: %s\00"
@.str.1 = [14 x i8] c"%s:%d: %s: %s\00"
@.str.2 = [10 x i8] c"%s:%d: %s\00"
define void @die(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = icmp eq i32 %4, 0
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = tail call i8* @strerror(i32 %4)
%9 = tail call i32 (i8*, i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3, i8* %8)
br label %16
10: ; preds = %5
%11 = icmp eq i8* %3, null
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = tail call i32 (i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3)
br label %16
14: ; preds = %10
%15 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
br label %16
16: ; preds = %12, %14, %7
ret void
}