#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*/ False;
scalar_t__ None;
scalar_t__ Success;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XA_STRING;
scalar_t__ XGetWindowProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/, int,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              scalar_t__ *, int *, unsigned long *,
                              unsigned long *, unsigned char **);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
Bool xscreensaver_window_p(Display *dpy, Window window) {
  Atom type;
  int format;
  unsigned long nitems, bytesafter;
  unsigned char *version;
  if (XGetWindowProperty(dpy, window,
                         XInternAtom(dpy, "_SCREENSAVER_VERSION", False), 0, 1,
                         False, XA_STRING, &type, &format, &nitems, &bytesafter,
                         &version) == Success &&
      type != None)
    return True;
  return False;
}


x86 assembly (clang, -O0):
<xscreensaver_window_p>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,-0x28(%rbp)
mov    %esi,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
lea    0xea7(%rip),%rsi
call   1030 <XInternAtom@plt>
mov    -0x68(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    %eax,%edx
mov    0x2e6a(%rip),%rax
mov    (%rax),%r9d
mov    0x2e68(%rip),%rax
mov    (%rax),%r15d
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x38(%rbp),%r14
lea    -0x3c(%rbp),%rbx
lea    -0x48(%rbp),%r11
lea    -0x50(%rbp),%r10
lea    -0x58(%rbp),%rax
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>
mov    0x2e38(%rip),%rcx
cmp    (%rcx),%rax
jne    11ee <xscreensaver_window_p+0xce>
mov    -0x38(%rbp),%rax
mov    0x2dfc(%rip),%rcx
cmp    (%rcx),%rax
je     11ee <xscreensaver_window_p+0xce>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    11fa <xscreensaver_window_p+0xda>
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<xscreensaver_window_p>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0xebb(%rip),%rsi
call   1030 <XInternAtom@plt>
mov    0x0(%rbp),%r9d
mov    0x2e8b(%rip),%rcx
mov    (%rcx),%r10d
lea    0x10(%rsp),%r11
lea    0x18(%rsp),%r15
lea    0x20(%rsp),%r12
lea    0xc(%rsp),%r13
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
push   %r11
push   %r15
push   %r12
push   %r13
lea    0x20(%rsp),%rax
push   %rax
push   %r10
call   1040 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%rax
jne    11b8 <xscreensaver_window_p+0x98>
mov    (%rsp),%rax
mov    0x2e24(%rip),%rcx
cmp    (%rcx),%rax
je     11b8 <xscreensaver_window_p+0x98>
mov    0x2e10(%rip),%rbp
mov    0x0(%rbp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"_SCREENSAVER_VERSION\00"
@False = global i32 0
@XA_STRING = global i32 0
@Success = global i64 0
@None = global i64 0
@True = global i32 0
define i32 @xscreensaver_window_p(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = load i32*, i32** %4
%14 = load i32, i32* @False
%15 = call i32 @XInternAtom(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @False
%17 = load i32, i32* @XA_STRING
%18 = call i64 @XGetWindowProperty(i32* %11, i32 %12, i32 %15, i32 0, i32 1, i32 %16, i32 %17, i64* %6, i32* %7, i64* %8, i64* %9, i8** %10)
%19 = load i64, i64* @Success
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i64, i64* %6
%23 = load i64, i64* @None
%24 = icmp ne i64 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* @True
store i32 %26, i32* %3
br label %29
27: ; preds = %21, %2
%28 = load i32, i32* @False
store i32 %28, i32* %3
br label %29
29: ; preds = %27, %25
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [21 x i8] c"_SCREENSAVER_VERSION\00"
@False = global i32 0
@XA_STRING = global i32 0
@Success = global i64 0
@None = global i64 0
@True = global i32 0
define i32 @xscreensaver_window_p(i32* %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = bitcast i64* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i64* %5 to i8*
%11 = bitcast i64* %6 to i8*
%12 = bitcast i8** %7 to i8*
%13 = load i32, i32* @False
%14 = tail call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @False
%16 = load i32, i32* @XA_STRING
%17 = call i64 @XGetWindowProperty(i32* %0, i32 %1, i32 %14, i32 0, i32 1, i32 %15, i32 %16, i64* %3, i32* %4, i64* %5, i64* %6, i8** %7)
%18 = load i64, i64* @Success
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i64, i64* %3
%22 = load i64, i64* @None
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20, %2
br label %25
25: ; preds = %20, %24
%26 = phi i32* [ @False, %24 ], [ @True, %20 ]
%27 = load i32, i32* %26
ret i32 %27
}