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

/* Variables and functions */
scalar_t__ MapNotify;
Bool wait_for_notify(Display *dpy, XEvent *xev, XPointer arg) {
  (void)dpy;
  return xev->type == MapNotify && xev->xmap.window == *(Window *)arg;
}


x86 assembly (clang, -O0):
<wait_for_notify>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
mov    0x2ec8(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x19(%rbp)
jne    1141 <wait_for_notify+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_notify>:
mov    (%rsi),%rcx
mov    0x2ede(%rip),%rdi
xor    %eax,%eax
cmp    (%rdi),%rcx
jne    111d <wait_for_notify+0x1d>
mov    0x8(%rsi),%rcx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@MapNotify = global i64 0
define i32 @wait_for_notify(i32* %0, %struct.TYPE_5__* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca %struct.TYPE_5__*
%6 = alloca i64
store i32* %0, i32** %4
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%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 %22
13: ; preds = %3
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%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 i64, i64* %6
%19 = inttoptr i64 %18 to i64*
%20 = load i64, i64* %19
%21 = icmp eq i64 %17, %20
br label %22
22: ; preds = %13, %3
%23 = phi i1 [ false, %3 ], [ %21, %13 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@MapNotify = global i64 0
define i32 @wait_for_notify(i32* nocapture readnone %0, %struct.TYPE_5__* nocapture %1, i64 %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 %15
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 = inttoptr i64 %2 to i64*
%12 = load i64, i64* %11
%13 = icmp eq i64 %10, %12
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %8, %3
%16 = phi i32 [ 0, %3 ], [ %14, %8 ]
ret i32 %16
}