#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_FAILURE;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void _die_if(int condition, char *message) {
  if (!condition)
    return;
  if (errno)
    perror(message);
  else {
    fputs(message, stderr);
    fputs("\n", stderr);
  }
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<_die_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114f <_die_if+0x1f>
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e82(%rip),%rax
cmpq   $0x0,(%rax)
je     116e <_die_if+0x3e>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
jmp    1195 <_die_if+0x65>
mov    -0x10(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
lea    0xe70(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<_die_if>:
test   %edi,%edi
jne    1135 <_die_if+0x5>
ret
push   %rbx
mov    0x2e9b(%rip),%rax
cmpq   $0x0,(%rax)
je     1159 <_die_if+0x29>
mov    %rsi,%rdi
call   1040 <perror@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    0x2e80(%rip),%rbx
mov    (%rbx),%eax
mov    %rsi,%rdi
mov    %eax,%esi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xe8b(%rip),%rdi
call   1030 <fputs@plt>
jmp    114b <_die_if+0x1b>

LLVM IR (-O0):
@errno = global i64 0
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@EXIT_FAILURE = global i32 0
define void @_die_if(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
ret void
8: ; preds = %2
%9 = load i64, i64* @errno
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = call i32 @perror(i8* %12)
br label %20
14: ; preds = %8
%15 = load i8*, i8** %4
%16 = load i32, i32* @stderr
%17 = call i32 @fputs(i8* %15, i32 %16)
%18 = load i32, i32* @stderr
%19 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %14, %11
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
}

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