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

/* Variables and functions */
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ XA_CARDINAL;
int /*<<< orphan*/ XA_WINDOW;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ get_property(int /*<<< orphan*/ *, int /*<<< orphan*/,
                        int /*<<< orphan*/, char *, unsigned long *,
                        unsigned long *);
int /*<<< orphan*/ stderr;
Window *get_client_list(Display *disp, unsigned long *size,
                        unsigned long *items) {
  void *res;
  if ((res = (Window *)get_property(disp, DefaultRootWindow(disp), XA_WINDOW,
                                    "_NET_CLIENT_LIST", size, items)) == NULL) {
    if ((res =
             (Window *)get_property(disp, DefaultRootWindow(disp), XA_CARDINAL,
                                    "_WIN_CLIENT_LIST", size, items)) == NULL) {
      fprintf(stderr, "Cannot get client list properties. \n"
                      "(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)"
                      "\n");
      return NULL;
    }
  }
  return (Window *)res;
}


x86 assembly (clang, -O0):
<get_client_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
mov    0x2e76(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xe8d(%rip),%rcx
call   1030 <get_property@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11ef <get_client_list+0xbf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
mov    0x2e2c(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xe5c(%rip),%rcx
call   1030 <get_property@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11ea <get_client_list+0xba>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe4a(%rip),%rsi
call   1050 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f7 <get_client_list+0xc7>
jmp    11ef <get_client_list+0xbf>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_client_list>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <DefaultRootWindow@plt>
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edx
lea    0xead(%rip),%rcx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%r8
mov    %r14,%r9
call   1030 <get_property@plt>
test   %rax,%rax
jne    11ac <get_client_list+0x7c>
mov    %rbx,%rdi
call   1040 <DefaultRootWindow@plt>
mov    0x2e59(%rip),%rcx
mov    (%rcx),%edx
lea    0xe91(%rip),%rcx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%r8
mov    %r14,%r9
call   1030 <get_property@plt>
test   %rax,%rax
jne    11ac <get_client_list+0x7c>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@XA_WINDOW = global i32 0
@.str = [17 x i8] c"_NET_CLIENT_LIST\00"
@XA_CARDINAL = global i32 0
@.str.1 = [17 x i8] c"_WIN_CLIENT_LIST\00"
@stderr = global i32 0
@.str.2 = [76 x i8] c"Cannot get client list properties. \0A(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)\0A\00"
define i32* @get_client_list(i32* %0, i64* %1, i64* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i8*
store i32* %0, i32** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
%9 = load i32*, i32** %5
%10 = load i32*, i32** %5
%11 = call i32 @DefaultRootWindow(i32* %10)
%12 = load i32, i32* @XA_WINDOW
%13 = load i64*, i64** %6
%14 = load i64*, i64** %7
%15 = call i64 @get_property(i32* %9, i32 %11, i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64* %13, i64* %14)
%16 = inttoptr i64 %15 to i32*
%17 = bitcast i32* %16 to i8*
store i8* %17, i8** %8
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %34
19: ; preds = %3
%20 = load i32*, i32** %5
%21 = load i32*, i32** %5
%22 = call i32 @DefaultRootWindow(i32* %21)
%23 = load i32, i32* @XA_CARDINAL
%24 = load i64*, i64** %6
%25 = load i64*, i64** %7
%26 = call i64 @get_property(i32* %20, i32 %22, i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %24, i64* %25)
%27 = inttoptr i64 %26 to i32*
%28 = bitcast i32* %27 to i8*
store i8* %28, i8** %8
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %33
30: ; preds = %19
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
store i32* null, i32** %4
br label %37
33: ; preds = %19
br label %34
34: ; preds = %33, %3
%35 = load i8*, i8** %8
%36 = bitcast i8* %35 to i32*
store i32* %36, i32** %4
br label %37
37: ; preds = %34, %30
%38 = load i32*, i32** %4
ret i32* %38
}

LLVM IR (-O2):
@XA_WINDOW = global i32 0
@.str = [17 x i8] c"_NET_CLIENT_LIST\00"
@XA_CARDINAL = global i32 0
@.str.1 = [17 x i8] c"_WIN_CLIENT_LIST\00"
@stderr = global i32 0
@.str.2 = [76 x i8] c"Cannot get client list properties. \0A(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)\0A\00"
define i32* @get_client_list(i32* %0, i64* %1, i64* %2) {
%4 = tail call i32 @DefaultRootWindow(i32* %0)
%5 = load i32, i32* @XA_WINDOW
%6 = tail call i64 @get_property(i32* %0, i32 %4, i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %3
%9 = tail call i32 @DefaultRootWindow(i32* %0)
%10 = load i32, i32* @XA_CARDINAL
%11 = tail call i64 @get_property(i32* %0, i32 %9, i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
br label %19
16: ; preds = %8, %3
%17 = phi i64 [ %11, %8 ], [ %6, %3 ]
%18 = inttoptr i64 %17 to i32*
br label %19
19: ; preds = %16, %13
%20 = phi i32* [ null, %13 ], [ %18, %16 ]
ret i32* %20
}