#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*/ die(char *, char const *, int, char const *, char const *,
                       int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void dieif(const char *file, int line, const char *func, const char *msg,
           int die_req) {
  if (die_req) {
    die("%s:%d:%s: fatal error: %s (%s)\n", file, line, func, msg,
        strerror(errno));
  }
}


x86 assembly (clang, -O0):
<dieif>:
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     118f <dieif+0x6f>
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    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x48(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    %eax,%r9d
lea    0xe76(%rip),%rdi
call   1030 <die@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dieif>:
test   %r8d,%r8d
je     1169 <dieif+0x49>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
mov    %eax,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <die@plt>
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%s:%d:%s: fatal error: %s (%s)\0A\00"
@errno = global i32 0
define void @dieif(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* @errno
%19 = call i32 @strerror(i32 %18)
%20 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15, i8* %16, i8* %17, i32 %19)
br label %21
21: ; preds = %13, %5
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"%s:%d:%s: fatal error: %s (%s)\0A\00"
@errno = global i32 0
define void @dieif(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = icmp eq i32 %4, 0
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = load i32, i32* @errno
%9 = tail call i32 @strerror(i32 %8)
%10 = tail call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3, i32 %9)
br label %11
11: ; preds = %7, %5
ret void
}