#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 */
typedef int /*<<< orphan*/ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Bool;

/* Variables and functions */
scalar_t__ glinject_handle_x11_event(int /*<<< orphan*/ *);
scalar_t__ glinject_real_XCheckWindowEvent(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/, long,
                                           int /*<<< orphan*/ *);
Bool XCheckWindowEvent(Display *dpy, Window w, long mask, XEvent *event) {
  Bool return_val;
  do {
    return_val = glinject_real_XCheckWindowEvent(dpy, w, mask, event);
  } while (return_val && glinject_handle_x11_event(event));
  return return_val;
}


x86 assembly (clang, -O0):
<XCheckWindowEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <glinject_real_XCheckWindowEvent@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x29(%rbp)
je     1172 <XCheckWindowEvent+0x52>
mov    -0x20(%rbp),%rdi
call   1040 <glinject_handle_x11_event@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1137 <XCheckWindowEvent+0x17>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XCheckWindowEvent>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <glinject_real_XCheckWindowEvent@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1166 <XCheckWindowEvent+0x46>
mov    %rbx,%rdi
call   1040 <glinject_handle_x11_event@plt>
test   %rax,%rax
jne    1140 <XCheckWindowEvent+0x20>
mov    %rbp,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @XCheckWindowEvent(i32* %0, i32 %1, i64 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i64
store i32* %0, i32** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
br label %10
10: ; preds = %23, %4
%11 = load i32*, i32** %5
%12 = load i32, i32* %6
%13 = load i64, i64* %7
%14 = load i32*, i32** %8
%15 = call i64 @glinject_real_XCheckWindowEvent(i32* %11, i32 %12, i64 %13, i32* %14)
store i64 %15, i64* %9
br label %16
16: ; preds = %10
%17 = load i64, i64* %9
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32*, i32** %8
%21 = call i64 @glinject_handle_x11_event(i32* %20)
%22 = icmp ne i64 %21, 0
br label %23
23: ; preds = %19, %16
%24 = phi i1 [ false, %16 ], [ %22, %19 ]
br i1 %24, label %10, label %25
25: ; preds = %23
%26 = load i64, i64* %9
ret i64 %26
}

LLVM IR (-O2):
define i64 @XCheckWindowEvent(i32* %0, i32 %1, i64 %2, i32* %3) {
br label %5
5: ; preds = %8, %4
%6 = tail call i64 @glinject_real_XCheckWindowEvent(i32* %0, i32 %1, i64 %2, i32* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i64 @glinject_handle_x11_event(i32* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %5, %8
ret i64 %6
}