#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ request_code;
  scalar_t__ error_code;
};
typedef TYPE_1__ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
scalar_t__ BadValue;
scalar_t__ X_KillClient;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, scalar_t__, scalar_t__);
int /*<<< orphan*/ stderr;
int xerrorxlib(int /*<<< orphan*/ *, TYPE_1__ *);
int xerror(Display *dpy, XErrorEvent *ee) {
  if (ee->request_code == X_KillClient && ee->error_code == BadValue)
    return 0;
  fprintf(stderr, "fatal error: request code %d, error code %d\n",
          ee->request_code, ee->error_code);
  return xerrorxlib(dpy, ee);
}


x86 assembly (clang, -O0):
<xerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%rax
jne    116b <xerror+0x4b>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2e7a(%rip),%rcx
cmp    (%rcx),%rax
jne    116b <xerror+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    119f <xerror+0x7f>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe76(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <xerrorxlib@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xerror>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rdx
mov    0x8(%rsi),%rcx
mov    0x2ea0(%rip),%rax
cmp    (%rax),%rdx
jne    1153 <xerror+0x33>
mov    0x2e8c(%rip),%rax
cmp    (%rax),%rcx
jne    1153 <xerror+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <xerrorxlib@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64, i64 }
@X_KillClient = global i64 0
@BadValue = global i64 0
@stderr = global i32 0
@.str = [45 x i8] c"fatal error: request code %d, error code %d\0A\00"
define i32 @xerror(i32* %0, %struct.TYPE_4__* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca %struct.TYPE_4__*
store i32* %0, i32** %4
store %struct.TYPE_4__* %1, %struct.TYPE_4__** %5
%6 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load i64, i64* @X_KillClient
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 1
%14 = load i64, i64* %13
%15 = load i64, i64* @BadValue
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 0, i32* %3
br label %30
18: ; preds = %11, %2
%19 = load i32, i32* @stderr
%20 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%24 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %23, i32 0, i32 1
%25 = load i64, i64* %24
%26 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %22, i64 %25)
%27 = load i32*, i32** %4
%28 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%29 = call i32 @xerrorxlib(i32* %27, %struct.TYPE_4__* %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %18, %17
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64, i64 }
@X_KillClient = global i64 0
@BadValue = global i64 0
@stderr = global i32 0
@.str = [45 x i8] c"fatal error: request code %d, error code %d\0A\00"
define i32 @xerror(i32* %0, %struct.TYPE_4__* %1) {
%3 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%4 = load i64, i64* %3
%5 = load i64, i64* @X_KillClient
%6 = icmp eq i64 %4, %5
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = load i64, i64* @BadValue
%10 = icmp eq i64 %8, %9
%11 = select i1 %6, i1 %10, i1 false
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %8)
%15 = tail call i32 @xerrorxlib(i32* %0, %struct.TYPE_4__* %1)
br label %16
16: ; preds = %2, %12
%17 = phi i32 [ %15, %12 ], [ 0, %2 ]
ret i32 %17
}