#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__ {
  int request_code;
  int /*<<< orphan*/ error_code;
};
typedef TYPE_1__ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BadDrawable;
int /*<<< orphan*/ BadWindow;
#define X_GetGeometry 130
#define X_GetWindowAttributes 129
#define X_QueryTree 128
int XmuPrintDefaultErrorMessage(int /*<<< orphan*/ *, TYPE_1__ *,
                                int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int XmuSimpleErrorHandler(Display *dpy, XErrorEvent *errorp) {
  switch (errorp->request_code) {
  case X_QueryTree:
  case X_GetWindowAttributes:
    if (errorp->error_code == BadWindow)
      return 0;
    break;
  case X_GetGeometry:
    if (errorp->error_code == BadDrawable)
      return 0;
    break;
  }
  return XmuPrintDefaultErrorMessage(dpy, errorp, stderr);
}


x86 assembly (clang, -O0):
<XmuSimpleErrorHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     114d <XmuSimpleErrorHandler+0x3d>
jmp    113a <XmuSimpleErrorHandler+0x2a>
mov    -0x1c(%rbp),%eax
sub    $0x82,%eax
je     1174 <XmuSimpleErrorHandler+0x64>
jmp    119b <XmuSimpleErrorHandler+0x8b>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2e8d(%rip),%rcx
cmp    (%rcx),%eax
jne    116f <XmuSimpleErrorHandler+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <XmuSimpleErrorHandler+0xa4>
jmp    119b <XmuSimpleErrorHandler+0x8b>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2e5e(%rip),%rcx
cmp    (%rcx),%eax
jne    1196 <XmuSimpleErrorHandler+0x86>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <XmuSimpleErrorHandler+0xa4>
jmp    119b <XmuSimpleErrorHandler+0x8b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2e26(%rip),%rax
mov    (%rax),%edx
call   1030 <XmuPrintDefaultErrorMessage@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XmuSimpleErrorHandler>:
mov    (%rsi),%eax
lea    -0x80(%rax),%ecx
cmp    $0x2,%ecx
jae    112a <XmuSimpleErrorHandler+0x1a>
mov    0x4(%rsi),%eax
mov    0x2ec4(%rip),%rcx
cmp    (%rcx),%eax
je     113f <XmuSimpleErrorHandler+0x2f>
jmp    1142 <XmuSimpleErrorHandler+0x32>
cmp    $0x82,%eax
jne    1142 <XmuSimpleErrorHandler+0x32>
mov    0x4(%rsi),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
jne    1142 <XmuSimpleErrorHandler+0x32>
xor    %eax,%eax
ret
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
jmp    1030 <XmuPrintDefaultErrorMessage@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i32 }
@BadWindow = global i32 0
@BadDrawable = global i32 0
@stderr = global i32 0
define i32 @XmuSimpleErrorHandler(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 i32, i32* %7
switch i32 %8, label %25 [
i32 128, label %9
i32 129, label %9
i32 130, label %17
]
9: ; preds = %2, %2
%10 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = load i32, i32* @BadWindow
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %9
store i32 0, i32* %3
br label %30
16: ; preds = %9
br label %25
17: ; preds = %2
%18 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 1
%20 = load i32, i32* %19
%21 = load i32, i32* @BadDrawable
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 0, i32* %3
br label %30
24: ; preds = %17
br label %25
25: ; preds = %2, %24, %16
%26 = load i32*, i32** %4
%27 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%28 = load i32, i32* @stderr
%29 = call i32 @XmuPrintDefaultErrorMessage(i32* %26, %struct.TYPE_4__* %27, i32 %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %25, %23, %15
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i32 }
@BadWindow = global i32 0
@BadDrawable = global i32 0
@stderr = global i32 0
define i32 @XmuSimpleErrorHandler(i32* %0, %struct.TYPE_4__* %1) {
%3 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 128, label %5
i32 129, label %5
i32 130, label %10
]
5: ; preds = %2, %2
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = load i32, i32* @BadWindow
%9 = icmp eq i32 %7, %8
br i1 %9, label %18, label %15
10: ; preds = %2
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%12 = load i32, i32* %11
%13 = load i32, i32* @BadDrawable
%14 = icmp eq i32 %12, %13
br i1 %14, label %18, label %15
15: ; preds = %10, %5, %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @XmuPrintDefaultErrorMessage(i32* %0, %struct.TYPE_4__* %1, i32 %16)
br label %18
18: ; preds = %10, %5, %15
%19 = phi i32 [ %17, %15 ], [ 0, %5 ], [ 0, %10 ]
ret i32 %19
}