#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*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ PropModeReplace;
int /*<<< orphan*/ XA_ATOM;
int /*<<< orphan*/ XChangeProperty(int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ const, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int, int /*<<< orphan*/,
                                   unsigned char const *, int);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
scalar_t__ strlen(char const *);
void setWindowTitle(const char *title, const Window *win, Display *dpy) {
  Atom wm_Name = XInternAtom(dpy, "_NET_WM_NAME", False);
  Atom utf8Str = XInternAtom(dpy, "UTF8_STRING", False);
  Atom winType = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
  Atom typeDialog = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
  XChangeProperty(dpy, *win, wm_Name, utf8Str, 8, PropModeReplace,
                  (const unsigned char *)title, (int)strlen(title));
  XChangeProperty(dpy, *win, winType, XA_ATOM, 32, PropModeReplace,
                  (unsigned char *)&typeDialog, 1);
}


x86 assembly (clang, -O0):
<setWindowTitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
lea    0xea8(%rip),%rsi
call   1040 <XInternAtom@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
lea    0xe99(%rip),%rsi
call   1040 <XInternAtom@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e59(%rip),%rax
mov    (%rax),%edx
lea    0xe89(%rip),%rsi
call   1040 <XInternAtom@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
lea    0xe81(%rip),%rsi
call   1040 <XInternAtom@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r9d
mov    -0x30(%rbp),%r10
mov    $0x8,%r8d
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <XChangeProperty@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x24(%rbp),%edx
mov    0x2dbe(%rip),%rax
mov    (%rax),%ecx
mov    0x2d9d(%rip),%rax
mov    (%rax),%r9d
lea    -0x28(%rbp),%rax
mov    $0x20,%r8d
mov    %rax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1050 <XChangeProperty@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setWindowTitle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %rdi,%r15
mov    0x2e92(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <XInternAtom@plt>
mov    %eax,0xc(%rsp)
mov    0x0(%rbp),%edx
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <XInternAtom@plt>
mov    %eax,%r14d
mov    0x0(%rbp),%edx
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1040 <XInternAtom@plt>
mov    %eax,0x10(%rsp)
mov    0x0(%rbp),%edx
lea    0xe94(%rip),%rsi
mov    %rbx,%rdi
call   1040 <XInternAtom@plt>
mov    %eax,0x14(%rsp)
mov    0x0(%r13),%r12d
mov    %r13,%rbp
mov    0x2e1d(%rip),%rax
mov    (%rax),%r13d
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    0xc(%rsp),%edx
mov    %r14d,%ecx
mov    $0x8,%r8d
mov    %r13d,%r9d
push   %rax
push   %r15
call   1050 <XChangeProperty@plt>
add    $0x10,%rsp
mov    0x0(%rbp),%esi
mov    0x2dfe(%rip),%rax
mov    (%rax),%ecx
mov    0x2ddd(%rip),%rax
mov    (%rax),%r9d
lea    0x14(%rsp),%rax
mov    %rbx,%rdi
mov    0x10(%rsp),%edx
mov    $0x20,%r8d
push   $0x1
push   %rax
call   1050 <XChangeProperty@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"_NET_WM_NAME\00"
@False = global i32 0
@.str.1 = [12 x i8] c"UTF8_STRING\00"
@.str.2 = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@.str.3 = [27 x i8] c"_NET_WM_WINDOW_TYPE_DIALOG\00"
@PropModeReplace = global i32 0
@XA_ATOM = global i32 0
define void @setWindowTitle(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%11 = load i32*, i32** %6
%12 = load i32, i32* @False
%13 = call i32 @XInternAtom(i32* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %7
%14 = load i32*, i32** %6
%15 = load i32, i32* @False
%16 = call i32 @XInternAtom(i32* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 %16, i32* %8
%17 = load i32*, i32** %6
%18 = load i32, i32* @False
%19 = call i32 @XInternAtom(i32* %17, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %18)
store i32 %19, i32* %9
%20 = load i32*, i32** %6
%21 = load i32, i32* @False
%22 = call i32 @XInternAtom(i32* %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %21)
store i32 %22, i32* %10
%23 = load i32*, i32** %6
%24 = load i32*, i32** %5
%25 = load i32, i32* %24
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = load i32, i32* @PropModeReplace
%29 = load i8*, i8** %4
%30 = load i8*, i8** %4
%31 = call i64 @strlen(i8* %30)
%32 = trunc i64 %31 to i32
%33 = call i32 @XChangeProperty(i32* %23, i32 %25, i32 %26, i32 %27, i32 8, i32 %28, i8* %29, i32 %32)
%34 = load i32*, i32** %6
%35 = load i32*, i32** %5
%36 = load i32, i32* %35
%37 = load i32, i32* %9
%38 = load i32, i32* @XA_ATOM
%39 = load i32, i32* @PropModeReplace
%40 = bitcast i32* %10 to i8*
%41 = call i32 @XChangeProperty(i32* %34, i32 %36, i32 %37, i32 %38, i32 32, i32 %39, i8* %40, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"_NET_WM_NAME\00"
@False = global i32 0
@.str.1 = [12 x i8] c"UTF8_STRING\00"
@.str.2 = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@.str.3 = [27 x i8] c"_NET_WM_WINDOW_TYPE_DIALOG\00"
@PropModeReplace = global i32 0
@XA_ATOM = global i32 0
define void @setWindowTitle(i8* %0, i32* nocapture %1, i32* %2) {
%4 = alloca i32
%5 = load i32, i32* @False
%6 = tail call i32 @XInternAtom(i32* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @False
%8 = tail call i32 @XInternAtom(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @False
%10 = tail call i32 @XInternAtom(i32* %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = bitcast i32* %4 to i8*
%12 = load i32, i32* @False
%13 = tail call i32 @XInternAtom(i32* %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %1
%15 = load i32, i32* @PropModeReplace
%16 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%17 = trunc i64 %16 to i32
%18 = tail call i32 @XChangeProperty(i32* %2, i32 %14, i32 %6, i32 %8, i32 8, i32 %15, i8* %0, i32 %17)
%19 = load i32, i32* %1
%20 = load i32, i32* @XA_ATOM
%21 = load i32, i32* @PropModeReplace
%22 = call i32 @XChangeProperty(i32* %2, i32 %19, i32 %10, i32 %20, i32 32, i32 %21, i8* %11, i32 1)
ret void
}