#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 Bool;

/* Variables and functions */
scalar_t__ MapNotify;
Bool WaitForNotify(Display *d, XEvent *e, char *arg) {
  return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
}


x86 assembly (clang, -O0):
<WaitForNotify>:
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 <WaitForNotify+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):
<WaitForNotify>:
mov    (%rsi),%rcx
mov    0x2ede(%rip),%rdi
xor    %eax,%eax
cmp    (%rdi),%rcx
jne    111a <WaitForNotify+0x1a>
xor    %eax,%eax
cmp    %rdx,0x8(%rsi)
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 @WaitForNotify(i32* %0, %struct.TYPE_5__* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca %struct.TYPE_5__*
%6 = alloca i8*
store i32* %0, i32** %4
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %5
store i8* %2, i8** %6
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = load i64, i64* @MapNotify
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %3
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %13, i32 0, i32 1
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load i8*, i8** %6
%18 = ptrtoint i8* %17 to i64
%19 = icmp eq i64 %16, %18
br label %20
20: ; preds = %12, %3
%21 = phi i1 [ false, %3 ], [ %19, %12 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@MapNotify = global i64 0
define i32 @WaitForNotify(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 %14
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
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %8, %3
%15 = phi i32 [ 0, %3 ], [ %13, %8 ]
ret i32 %15
}