#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_XCheckTypedEvent(int /*<<< orphan*/ *, int,
                                          int /*<<< orphan*/ *);
Bool XCheckTypedEvent(Display *dpy, int type, XEvent *event) {
  Bool return_val;
  do {
    return_val = glinject_real_XCheckTypedEvent(dpy, type, event);
  } while (return_val && glinject_handle_x11_event(event));
  return return_val;
}


x86 assembly (clang, -O0):
<XCheckTypedEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <glinject_real_XCheckTypedEvent@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     116a <XCheckTypedEvent+0x4a>
mov    -0x18(%rbp),%rdi
call   1030 <glinject_handle_x11_event@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1133 <XCheckTypedEvent+0x13>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XCheckTypedEvent>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <glinject_real_XCheckTypedEvent@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1153 <XCheckTypedEvent+0x33>
mov    %rbx,%rdi
call   1030 <glinject_handle_x11_event@plt>
test   %rax,%rax
jne    1130 <XCheckTypedEvent+0x10>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @XCheckTypedEvent(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
br label %8
8: ; preds = %20, %3
%9 = load i32*, i32** %4
%10 = load i32, i32* %5
%11 = load i32*, i32** %6
%12 = call i64 @glinject_real_XCheckTypedEvent(i32* %9, i32 %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 @XCheckTypedEvent(i32* %0, i32 %1, i32* %2) {
br label %4
4: ; preds = %7, %3
%5 = tail call i64 @glinject_real_XCheckTypedEvent(i32* %0, i32 %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
}