#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;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getenv(char *);
int /*<<< orphan*/ stderr;
void errxdisplay(char *display) {
  if (display == NULL)
    display = getenv("DISPLAY");
  fprintf(stderr, "xclip: Error: Can't open display: %s\n",
          display ? display : "(null)");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<errxdisplay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1157 <errxdisplay+0x27>
lea    0xeb2(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117b <errxdisplay+0x4b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    118b <errxdisplay+0x5b>
lea    0xeac(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    118b <errxdisplay+0x5b>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rdx
lea    0xe6f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<errxdisplay>:
push   %rax
test   %rdi,%rdi
jne    1145 <errxdisplay+0x15>
lea    0xec3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
mov    0x2e94(%rip),%rax
mov    (%rax),%eax
test   %rdi,%rdi
lea    0xed6(%rip),%rdx
cmovne %rdi,%rdx
lea    0xea5(%rip),%rsi
mov    %eax,%edi
call   1040 <fprintf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"xclip: Error: Can't open display: %s\0A\00"
@.str.2 = [7 x i8] c"(null)\00"
@EXIT_FAILURE = global i32 0
define void @errxdisplay(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %2
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i8*, i8** %2
br label %14
13: ; preds = %7
br label %14
14: ; preds = %13, %11
%15 = phi i8* [ %12, %11 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %13 ]
%16 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"xclip: Error: Can't open display: %s\0A\00"
@.str.2 = [7 x i8] c"(null)\00"
@EXIT_FAILURE = global i32 0
define void @errxdisplay(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = phi i8* [ %4, %3 ], [ %0, %1 ]
%7 = load i32, i32* @stderr
%8 = icmp eq i8* %6, null
%9 = select i1 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %6
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
}