#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strerror(int);
void die(char *msg, int err) {
  printf(err ? "[-] %s: %s\n" : "[-] %s\n", msg, strerror(err));
  fflush(stdout);
  fflush(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
lea    0xeb3(%rip),%rax
lea    0xea0(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <strerror@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %esi,%esi
lea    0xebc(%rip),%rax
lea    0xea9(%rip),%rbx
cmove  %rax,%rbx
mov    %esi,%edi
call   1060 <strerror@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"[-] %s: %s\0A\00"
@.str.1 = [8 x i8] c"[-] %s\0A\00"
@stdout = global i32 0
@stderr = global i32 0
define void @die(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @printf(i8* %8, i8* %9, i32 %11)
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
%15 = load i32, i32* @stderr
%16 = call i32 @fflush(i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"[-] %s: %s\0A\00"
@.str.1 = [8 x i8] c"[-] %s\0A\00"
@stdout = global i32 0
@stderr = global i32 0
define void @die(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @strerror(i32 %1)
%6 = tail call i32 @printf(i8* %4, i8* %0, i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fflush(i32 %9)
%11 = tail call i32 @exit(i32 1)
unreachable
}