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

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


x86 assembly (clang, -O0):
<XCheckMaskEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <glinject_real_XCheckMaskEvent@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     116c <XCheckMaskEvent+0x4c>
mov    -0x18(%rbp),%rdi
call   1040 <glinject_handle_x11_event@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1134 <XCheckMaskEvent+0x14>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XCheckMaskEvent>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <glinject_real_XCheckMaskEvent@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1163 <XCheckMaskEvent+0x43>
mov    %r12,%rdi
call   1040 <glinject_handle_x11_event@plt>
test   %rax,%rax
jne    1140 <XCheckMaskEvent+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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