#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ window;
};
struct TYPE_5__ {
  scalar_t__ type;
  TYPE_1__ xmap;
};
typedef TYPE_2__ XEvent;
typedef scalar_t__ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ GL_FALSE;
int /*<<< orphan*/ GL_TRUE;
scalar_t__ MapNotify;
Bool WaitForMapNotify(Display *d, XEvent *e, char *arg) {
  if ((e->type == MapNotify) && (e->xmap.window == (Window)arg)) {
    return GL_TRUE;
  }
  return GL_FALSE;
}


x86 assembly (clang, -O0):
<WaitForMapNotify>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2ec2(%rip),%rcx
cmp    (%rcx),%rax
jne    114d <WaitForMapNotify+0x4d>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    114d <WaitForMapNotify+0x4d>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <WaitForMapNotify+0x59>
mov    0x2e94(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WaitForMapNotify>:
mov    (%rsi),%rax
mov    0x2ed6(%rip),%rcx
cmp    (%rcx),%rax
jne    111f <WaitForMapNotify+0x1f>
cmp    %rdx,0x8(%rsi)
jne    111f <WaitForMapNotify+0x1f>
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@MapNotify = global i64 0
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @WaitForMapNotify(i32* %0, %struct.TYPE_5__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.TYPE_5__*
%7 = alloca i8*
store i32* %0, i32** %5
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %6
store i8* %2, i8** %7
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @MapNotify
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %3
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%16 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = load i8*, i8** %7
%19 = ptrtoint i8* %18 to i64
%20 = icmp eq i64 %17, %19
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = load i32, i32* @GL_TRUE
store i32 %22, i32* %4
br label %25
23: ; preds = %13, %3
%24 = load i32, i32* @GL_FALSE
store i32 %24, i32* %4
br label %25
25: ; preds = %23, %21
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@MapNotify = global i64 0
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @WaitForMapNotify(i32* nocapture readnone %0, %struct.TYPE_5__* nocapture %1, i8* %2) {
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @MapNotify
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%10 = load i64, i64* %9
%11 = ptrtoint i8* %2 to i64
%12 = icmp eq i64 %10, %11
br i1 %12, label %14, label %13
13: ; preds = %8, %3
br label %14
14: ; preds = %8, %13
%15 = phi i32* [ @GL_FALSE, %13 ], [ @GL_TRUE, %8 ]
%16 = load i32, i32* %15
ret i32 %16
}