#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__ xdestroywindow;
};
typedef TYPE_2__ XEvent;
typedef scalar_t__ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
scalar_t__ DestroyNotify;
int destroy_check(Display *display, XEvent *ev, XPointer win) {
  return ev->type == DestroyNotify &&
         ev->xdestroywindow.window == *((Window *)win);
}


x86 assembly (clang, -O0):
<destroy_check>:
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 <destroy_check+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):
<destroy_check>:
mov    (%rsi),%rcx
mov    0x2ede(%rip),%rdi
xor    %eax,%eax
cmp    (%rdi),%rcx
jne    111d <destroy_check+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 }
@DestroyNotify = global i64 0
define i32 @destroy_check(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 %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* @DestroyNotify
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %21
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 i64, i64* %6
%18 = inttoptr i64 %17 to i64*
%19 = load i64, i64* %18
%20 = icmp eq i64 %16, %19
br label %21
21: ; preds = %12, %3
%22 = phi i1 [ false, %3 ], [ %20, %12 ]
%23 = zext i1 %22 to i32
ret i32 %23
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@DestroyNotify = global i64 0
define i32 @destroy_check(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* @DestroyNotify
%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
}