#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*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;
typedef scalar_t__ Atom;

/* Variables and functions */
int /*<<< orphan*/ AnyPropertyType;
int /*<<< orphan*/ False;
scalar_t__ None;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XFree(unsigned char *);
int /*<<< orphan*/ XGetWindowProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      scalar_t__, int /*<<< orphan*/,
                                      int /*<<< orphan*/, int /*<<< orphan*/,
                                      int /*<<< orphan*/, scalar_t__ *, int *,
                                      unsigned long *, unsigned long *,
                                      unsigned char **);
Bool Window_Has_Property(Display *dpy, Window win, Atom atom) {
  Atom type_ret;
  int format_ret;
  unsigned char *prop_ret;
  unsigned long bytes_after, num_ret;
  type_ret = None;
  prop_ret = NULL;
  XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType, &type_ret,
                     &format_ret, &num_ret, &bytes_after, &prop_ret);
  if (prop_ret)
    XFree(prop_ret);
  return (type_ret != None) ? True : False;
}


x86 assembly (clang, -O0):
<Window_Has_Property>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %rdx,-0x30(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    0x2e80(%rip),%rax
mov    (%rax),%r9d
mov    0x2e86(%rip),%rax
mov    (%rax),%r15d
xor    %r8d,%r8d
lea    -0x38(%rbp),%r14
lea    -0x3c(%rbp),%rbx
lea    -0x58(%rbp),%r11
lea    -0x50(%rbp),%r10
lea    -0x48(%rbp),%rax
mov    %r8d,%ecx
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1040 <XGetWindowProperty@plt>
cmpq   $0x0,-0x48(%rbp)
je     11bd <Window_Has_Property+0x9d>
mov    -0x48(%rbp),%rdi
call   1030 <XFree@plt>
mov    -0x38(%rbp),%rax
mov    0x2e10(%rip),%rcx
cmp    (%rcx),%rax
je     11e2 <Window_Has_Property+0xc2>
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
jmp    11ee <Window_Has_Property+0xce>
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<Window_Has_Property>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    0x2ea4(%rip),%r14
mov    (%r14),%rax
mov    %rax,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e94(%rip),%rbx
mov    (%rbx),%r9d
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
lea    0x8(%rsp),%r10
lea    0x28(%rsp),%r11
lea    0x20(%rsp),%r15
lea    0x1c(%rsp),%r12
lea    0x10(%rsp),%r13
xor    %ecx,%ecx
xor    %r8d,%r8d
push   %r10
push   %r11
push   %r15
push   %r12
push   %r13
push   %rax
call   1040 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     1199 <Window_Has_Property+0x79>
call   1030 <XFree@plt>
mov    0x10(%rsp),%rax
cmp    (%r14),%rax
je     11aa <Window_Has_Property+0x8a>
mov    0x2e26(%rip),%rbx
mov    (%rbx),%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@None = global i64 0
@False = global i32 0
@AnyPropertyType = global i32 0
@True = global i32 0
define i32 @Window_Has_Property(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%12 = load i64, i64* @None
store i64 %12, i64* %7
store i8* null, i8** %9
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = load i64, i64* %6
%16 = load i32, i32* @False
%17 = load i32, i32* @AnyPropertyType
%18 = call i32 @XGetWindowProperty(i32* %13, i32 %14, i64 %15, i32 0, i32 0, i32 %16, i32 %17, i64* %7, i32* %8, i64* %11, i64* %10, i8** %9)
%19 = load i8*, i8** %9
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i8*, i8** %9
%23 = call i32 @XFree(i8* %22)
br label %24
24: ; preds = %21, %3
%25 = load i64, i64* %7
%26 = load i64, i64* @None
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* @True
br label %32
30: ; preds = %24
%31 = load i32, i32* @False
br label %32
32: ; preds = %30, %28
%33 = phi i32 [ %29, %28 ], [ %31, %30 ]
ret i32 %33
}

LLVM IR (-O2):
@None = global i64 0
@False = global i32 0
@AnyPropertyType = global i32 0
@True = global i32 0
define i32 @Window_Has_Property(i32* %0, i32 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = bitcast i64* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i8** %6 to i8*
%12 = bitcast i64* %7 to i8*
%13 = bitcast i64* %8 to i8*
%14 = load i64, i64* @None
store i64 %14, i64* %4
store i8* null, i8** %6
%15 = load i32, i32* @False
%16 = load i32, i32* @AnyPropertyType
%17 = call i32 @XGetWindowProperty(i32* %0, i32 %1, i64 %2, i32 0, i32 0, i32 %15, i32 %16, i64* %4, i32* %5, i64* %8, i64* %7, i8** %6)
%18 = load i8*, i8** %6
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %3
%21 = call i32 @XFree(i8* %18)
br label %22
22: ; preds = %20, %3
%23 = load i64, i64* %4
%24 = load i64, i64* @None
%25 = icmp eq i64 %23, %24
%26 = load i32, i32* @True
%27 = load i32, i32* @False
%28 = select i1 %25, i32 %27, i32 %26
ret i32 %28
}