#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int);
void die(int code, int err, char *msg) {
  putc('\n', stderr);
  if (msg && *msg) {
    fputs(msg, stderr);
    fputs(": ", stderr);
  }
  fputs(strerror(err), stderr);
  putc('\n', stderr);
  exit(code);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a7 <die+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a7 <die+0x67>
mov    -0x10(%rbp),%rdi
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
lea    0xe5e(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%edi
call   1060 <strerror@plt>
mov    %rax,%rdi
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    0x2e8a(%rip),%r15
mov    (%r15),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
test   %rbx,%rbx
je     1187 <die+0x47>
cmpb   $0x0,(%rbx)
je     1187 <die+0x47>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <fputs@plt>
mov    (%r15),%esi
lea    0xe7e(%rip),%rdi
call   1030 <fputs@plt>
mov    %ebp,%edi
call   1060 <strerror@plt>
mov    (%r15),%esi
mov    %rax,%rdi
call   1030 <fputs@plt>
mov    (%r15),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    %r14d,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c": \00"
define void @die(i32 %0, i32 %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @putc(i8 signext 10, i32 %4)
%6 = icmp eq i8* %2, null
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fputs(i8* %2, i32 %11)
%13 = load i32, i32* @stderr
%14 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %10, %7, %3
%16 = tail call i8* @strerror(i32 %1)
%17 = load i32, i32* @stderr
%18 = tail call i32 @fputs(i8* %16, i32 %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 @putc(i8 signext 10, i32 %19)
%21 = tail call i32 @exit(i32 %0)
unreachable
}