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

/* Type definitions */
typedef int /*<<< orphan*/ xcb_window_t;
struct TYPE_4__ {
  int /*<<< orphan*/ atom;
};
typedef TYPE_1__ xcb_intern_atom_reply_t;
typedef int /*<<< orphan*/ xcb_intern_atom_cookie_t;
typedef int /*<<< orphan*/ xcb_connection_t;
typedef int /*<<< orphan*/ xcb_atom_t;

/* Variables and functions */
int /*<<< orphan*/ XCB_ATOM_ATOM;
int /*<<< orphan*/ XCB_ATOM_STRING;
int /*<<< orphan*/ XCB_ATOM_WM_CLASS;
int /*<<< orphan*/ XCB_ATOM_WM_NAME;
int /*<<< orphan*/ XCB_PROP_MODE_REPLACE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(TYPE_1__ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ xcb_change_property(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int,
                                       int /*<<< orphan*/, char *);
int /*<<< orphan*/
xcb_change_property_checked(int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_intern_atom(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, char *);
TYPE_1__ *xcb_intern_atom_reply(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/ *);
void setWindowProperties(xcb_connection_t *connection, xcb_window_t window,
                         char *title) {
  xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window,
                      XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, strlen(title),
                      title);
  xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window,
                      XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, strlen(title),
                      title);
  xcb_atom_t window_type_atom, window_type_dock_atom;
  xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(
      connection, 0, strlen("_NET_WM_WINDOW_TYPE"), "_NET_WM_WINDOW_TYPE");
  xcb_intern_atom_reply_t *atom_reply =
      xcb_intern_atom_reply(connection, atom_cookie, NULL);
  if (!atom_reply) {
    fprintf(stderr, "Unable to set window type. You will need to manually set "
                    "your window manager to run lighthouse as you'd like.");
  } else {
    window_type_atom = atom_reply->atom;
    free(atom_reply);
    atom_cookie =
        xcb_intern_atom(connection, 0, strlen("_NET_WM_WINDOW_TYPE_DOCK"),
                        "_NET_WM_WINDOW_TYPE_DOCK");
    atom_reply = xcb_intern_atom_reply(connection, atom_cookie, NULL);
    if (atom_reply) {
      window_type_dock_atom = atom_reply->atom;
      free(atom_reply);
      xcb_change_property_checked(connection, XCB_PROP_MODE_REPLACE, window,
                                  window_type_atom, XCB_ATOM_ATOM, 32, 1,
                                  &window_type_dock_atom);
    } else {
      fprintf(stderr,
              "Unable to set window type. You will need to manually set your "
              "window manager to run lighthouse as you'd like.");
    }
  }
  return;
}


x86 assembly (clang, -O0):
<setWindowProperties>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2e39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    %eax,%r10d
mov    -0x18(%rbp),%rax
mov    $0x8,%r9d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1090 <xcb_change_property@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    %eax,%r10d
mov    -0x18(%rbp),%rax
mov    $0x8,%r9d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1090 <xcb_change_property@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xd9d(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
lea    0xd89(%rip),%rcx
call   1060 <xcb_intern_atom@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1080 <xcb_intern_atom_reply@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12b8 <setWindowProperties+0x148>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
lea    0xd66(%rip),%rsi
call   1070 <fprintf@plt>
jmp    137d <setWindowProperties+0x20d>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    0xda9(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
lea    0xd95(%rip),%rcx
call   1060 <xcb_intern_atom@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1080 <xcb_intern_atom_reply@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1363 <setWindowProperties+0x1f3>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x8(%rbp),%rdi
mov    0x2c97(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    0x2c98(%rip),%rax
mov    (%rax),%r8d
mov    $0x20,%r9d
lea    -0x20(%rbp),%rax
movl   $0x1,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <xcb_change_property_checked@plt>
jmp    1378 <setWindowProperties+0x208>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
lea    0xca1(%rip),%rsi
call   1070 <fprintf@plt>
jmp    137d <setWindowProperties+0x20d>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setWindowProperties>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %rdi,%r12
mov    0x2e3d(%rip),%rax
mov    (%rax),%r13d
mov    0x2e4b(%rip),%rax
mov    (%rax),%r14d
mov    0x2e51(%rip),%rax
mov    (%rax),%ebx
mov    %rdx,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    %ebx,%r8d
mov    $0x8,%r9d
push   %rbp
push   %rax
call   1090 <xcb_change_property@plt>
add    $0x10,%rsp
mov    0x2df8(%rip),%rax
mov    (%rax),%ebx
mov    0x2dd7(%rip),%rax
mov    (%rax),%r14d
mov    0x2e0d(%rip),%rax
mov    (%rax),%r13d
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    %r13d,%r8d
mov    $0x8,%r9d
push   %rbp
push   %rax
call   1090 <xcb_change_property@plt>
add    $0x10,%rsp
lea    0xdec(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1060 <xcb_intern_atom@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1080 <xcb_intern_atom_reply@plt>
test   %rax,%rax
je     12c6 <setWindowProperties+0x156>
mov    (%rax),%r14d
mov    %rax,%rdi
call   1040 <free@plt>
lea    0xe30(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1060 <xcb_intern_atom@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1080 <xcb_intern_atom_reply@plt>
test   %rax,%rax
je     12c6 <setWindowProperties+0x156>
mov    (%rax),%ecx
mov    %ecx,0x4(%rsp)
mov    %rax,%rdi
call   1040 <free@plt>
mov    0x2d39(%rip),%rax
mov    (%rax),%esi
mov    0x2d40(%rip),%rax
mov    (%rax),%r8d
lea    0x4(%rsp),%rax
mov    %r12,%rdi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    $0x20,%r9d
push   %rax
push   $0x1
call   1030 <xcb_change_property_checked@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <fprintf@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32 }
@XCB_PROP_MODE_REPLACE = global i32 0
@XCB_ATOM_WM_NAME = global i32 0
@XCB_ATOM_STRING = global i32 0
@XCB_ATOM_WM_CLASS = global i32 0
@.str = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@stderr = global i32 0
@.str.1 = [110 x i8] c"Unable to set window type. You will need to manually set your window manager to run lighthouse as you'd like.\00"
@.str.2 = [25 x i8] c"_NET_WM_WINDOW_TYPE_DOCK\00"
@XCB_ATOM_ATOM = global i32 0
define void @setWindowProperties(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.TYPE_4__*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%11 = load i32*, i32** %4
%12 = load i32, i32* @XCB_PROP_MODE_REPLACE
%13 = load i32, i32* %5
%14 = load i32, i32* @XCB_ATOM_WM_NAME
%15 = load i32, i32* @XCB_ATOM_STRING
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = load i8*, i8** %6
%19 = call i32 @xcb_change_property(i32* %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 8, i32 %17, i8* %18)
%20 = load i32*, i32** %4
%21 = load i32, i32* @XCB_PROP_MODE_REPLACE
%22 = load i32, i32* %5
%23 = load i32, i32* @XCB_ATOM_WM_CLASS
%24 = load i32, i32* @XCB_ATOM_STRING
%25 = load i8*, i8** %6
%26 = call i32 @strlen(i8* %25)
%27 = load i8*, i8** %6
%28 = call i32 @xcb_change_property(i32* %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 8, i32 %26, i8* %27)
%29 = load i32*, i32** %4
%30 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @xcb_intern_atom(i32* %29, i32 0, i32 %30, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 %31, i32* %9
%32 = load i32*, i32** %4
%33 = load i32, i32* %9
%34 = call %struct.TYPE_4__* @xcb_intern_atom_reply(i32* %32, i32 %33, i32* null)
store %struct.TYPE_4__* %34, %struct.TYPE_4__** %10
%35 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%36 = icmp ne %struct.TYPE_4__* %35, null
br i1 %36, label %40, label %37
37: ; preds = %3
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0))
br label %70
40: ; preds = %3
%41 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%42 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %41, i32 0, i32 0
%43 = load i32, i32* %42
store i32 %43, i32* %7
%44 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%45 = call i32 @free(%struct.TYPE_4__* %44)
%46 = load i32*, i32** %4
%47 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 @xcb_intern_atom(i32* %46, i32 0, i32 %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 %48, i32* %9
%49 = load i32*, i32** %4
%50 = load i32, i32* %9
%51 = call %struct.TYPE_4__* @xcb_intern_atom_reply(i32* %49, i32 %50, i32* null)
store %struct.TYPE_4__* %51, %struct.TYPE_4__** %10
%52 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%53 = icmp ne %struct.TYPE_4__* %52, null
br i1 %53, label %54, label %66
54: ; preds = %40
%55 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%56 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %55, i32 0, i32 0
%57 = load i32, i32* %56
store i32 %57, i32* %8
%58 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%59 = call i32 @free(%struct.TYPE_4__* %58)
%60 = load i32*, i32** %4
%61 = load i32, i32* @XCB_PROP_MODE_REPLACE
%62 = load i32, i32* %5
%63 = load i32, i32* %7
%64 = load i32, i32* @XCB_ATOM_ATOM
%65 = call i32 @xcb_change_property_checked(i32* %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 32, i32 1, i32* %8)
br label %69
66: ; preds = %40
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0))
br label %69
69: ; preds = %66, %54
br label %70
70: ; preds = %69, %37
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32 }
@XCB_PROP_MODE_REPLACE = global i32 0
@XCB_ATOM_WM_NAME = global i32 0
@XCB_ATOM_STRING = global i32 0
@XCB_ATOM_WM_CLASS = global i32 0
@.str = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@stderr = global i32 0
@.str.1 = [110 x i8] c"Unable to set window type. You will need to manually set your window manager to run lighthouse as you'd like.\00"
@.str.2 = [25 x i8] c"_NET_WM_WINDOW_TYPE_DOCK\00"
@XCB_ATOM_ATOM = global i32 0
define void @setWindowProperties(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = load i32, i32* @XCB_PROP_MODE_REPLACE
%6 = load i32, i32* @XCB_ATOM_WM_NAME
%7 = load i32, i32* @XCB_ATOM_STRING
%8 = tail call i32 @strlen(i8* %2)
%9 = tail call i32 @xcb_change_property(i32* %0, i32 %5, i32 %1, i32 %6, i32 %7, i32 8, i32 %8, i8* %2)
%10 = load i32, i32* @XCB_PROP_MODE_REPLACE
%11 = load i32, i32* @XCB_ATOM_WM_CLASS
%12 = load i32, i32* @XCB_ATOM_STRING
%13 = tail call i32 @strlen(i8* %2)
%14 = tail call i32 @xcb_change_property(i32* %0, i32 %10, i32 %1, i32 %11, i32 %12, i32 8, i32 %13, i8* %2)
%15 = bitcast i32* %4 to i8*
%16 = tail call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @xcb_intern_atom(i32* %0, i32 0, i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%18 = tail call %struct.TYPE_4__* @xcb_intern_atom_reply(i32* %0, i32 %17, i32* null)
%19 = icmp eq %struct.TYPE_4__* %18, null
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0))
br label %41
23: ; preds = %3
%24 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i64 0, i32 0
%25 = load i32, i32* %24
%26 = tail call i32 @free(%struct.TYPE_4__* %18)
%27 = tail call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i32 @xcb_intern_atom(i32* %0, i32 0, i32 %27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%29 = tail call %struct.TYPE_4__* @xcb_intern_atom_reply(i32* %0, i32 %28, i32* null)
%30 = icmp eq %struct.TYPE_4__* %29, null
br i1 %30, label %38, label %31
31: ; preds = %23
%32 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %29, i64 0, i32 0
%33 = load i32, i32* %32
store i32 %33, i32* %4
%34 = tail call i32 @free(%struct.TYPE_4__* %29)
%35 = load i32, i32* @XCB_PROP_MODE_REPLACE
%36 = load i32, i32* @XCB_ATOM_ATOM
%37 = call i32 @xcb_change_property_checked(i32* %0, i32 %35, i32 %1, i32 %25, i32 %36, i32 32, i32 1, i32* %4)
br label %41
38: ; preds = %23
%39 = load i32, i32* @stderr
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %31, %38, %20
ret void
}