#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_9__ TYPE_3__;
typedef struct TYPE_8__ TYPE_2__;
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  int /*<<< orphan*/ visual;
  int /*<<< orphan*/ depth;
};
typedef TYPE_1__ XVisualInfo;
struct TYPE_8__ {
  unsigned char *value;
  int format;
  int /*<<< orphan*/ nitems;
  int /*<<< orphan*/ encoding;
};
typedef TYPE_2__ XTextProperty;
struct TYPE_9__ {
  scalar_t__ background_pixel;
  scalar_t__ border_pixel;
  int /*<<< orphan*/ colormap;
};
typedef TYPE_3__ XSetWindowAttributes;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ AllocNone;
int CWBackPixel;
int CWBorderPixel;
int CWColormap;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ False;
int /*<<< orphan*/ InputOutput;
int /*<<< orphan*/ KeyPressMask;
int /*<<< orphan*/ TrueColor;
int /*<<< orphan*/ XA_STRING;
int /*<<< orphan*/ XCreateColormap(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 TYPE_3__ *);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XMatchVisualInfo(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                    int, int /*<<< orphan*/, TYPE_1__ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSetWMName(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              TYPE_2__ *);
int /*<<< orphan*/ XSetWMProtocols(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getpid();
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
void create_window(Display *display, Atom *ptr) {
  Window win;
  XTextProperty window_name;
  XVisualInfo vinfo;
  XSetWindowAttributes attr;
  char title[64];
  XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo);
  attr.colormap = XCreateColormap(display, DefaultRootWindow(display),
                                  vinfo.visual, AllocNone);
  attr.border_pixel = 0;
  attr.background_pixel = 0;
  win = XCreateWindow(display, DefaultRootWindow(display), 0, 0, 850, 700, 0,
                      vinfo.depth, InputOutput, vinfo.visual,
                      CWColormap | CWBorderPixel | CWBackPixel, &attr);
  if (!win) {
    fprintf(stderr, "Unable to create window.\n");
    exit(1);
  }
  *ptr = XInternAtom(display, "WM_DELETE_WINDOW", False);
  XSetWMProtocols(display, win, ptr, 1);
  XSelectInput(display, win, KeyPressMask);
  XMapWindow(display, win);
  sprintf(title, "[%d] xfiller", getpid());
  window_name.value = (unsigned char *)title;
  window_name.encoding = XA_STRING;
  window_name.format = 8;
  window_name.nitems = strlen(title);
  XSetWMName(display, win, &window_name);
}


x86 assembly (clang, -O0):
<create_window>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xe0,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x18(%rbp),%rdi
call   1110 <DefaultScreen@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%esi
mov    0x2d86(%rip),%rax
mov    (%rax),%ecx
mov    $0x20,%edx
lea    -0x48(%rbp),%r8
call   10d0 <XMatchVisualInfo@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <DefaultRootWindow@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%esi
mov    -0x48(%rbp),%edx
mov    0x2d5f(%rip),%rax
mov    (%rax),%ecx
call   10c0 <XCreateColormap@plt>
mov    %eax,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <DefaultRootWindow@plt>
mov    -0xa8(%rbp),%rdi
mov    %eax,%esi
mov    -0x44(%rbp),%r14d
mov    0x2cf5(%rip),%rax
mov    (%rax),%ebx
mov    -0x48(%rbp),%r11d
mov    0x2d08(%rip),%rax
mov    (%rax),%r10d
mov    0x2d36(%rip),%rax
or     (%rax),%r10d
mov    0x2d1c(%rip),%rax
or     (%rax),%r10d
xor    %ecx,%ecx
mov    $0x352,%r8d
mov    $0x2bc,%r9d
lea    -0x60(%rbp),%rax
mov    %ecx,%edx
movl   $0x0,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   10a0 <XCreateWindow@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    132b <create_window+0x13b>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
lea    0xce4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c9a(%rip),%rax
mov    (%rax),%edx
lea    0xcdb(%rip),%rsi
call   1090 <XInternAtom@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    $0x1,%ecx
call   1080 <XSetWMProtocols@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2c59(%rip),%rax
mov    (%rax),%edx
call   10b0 <XSelectInput@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10e0 <XMapWindow@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0xc0(%rbp),%rdi
mov    %eax,%edx
lea    0xc84(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
movl   $0x8,-0x38(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x40(%rbp),%rdx
call   1030 <XSetWMName@plt>
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_window>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1110 <DefaultScreen@plt>
mov    0x2d9f(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%r8
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x20,%edx
call   10d0 <XMatchVisualInfo@plt>
mov    %rbx,%rdi
call   1050 <DefaultRootWindow@plt>
mov    (%rsp),%edx
mov    0x2d89(%rip),%rcx
mov    (%rcx),%ecx
mov    %rbx,%rdi
mov    %eax,%esi
call   10c0 <XCreateColormap@plt>
mov    %eax,0x30(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rbx,%rdi
call   1050 <DefaultRootWindow@plt>
mov    (%rsp),%r11d
mov    0x4(%rsp),%r10d
mov    0x2d31(%rip),%rcx
mov    0x2d4a(%rip),%rdx
mov    0x2d7b(%rip),%rsi
mov    (%rsi),%ebp
or     (%rdx),%ebp
mov    (%rcx),%r15d
mov    0x2d5d(%rip),%rcx
or     (%rcx),%ebp
lea    0x20(%rsp),%r12
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x352,%r8d
mov    $0x2bc,%r9d
push   %r12
push   %rbp
push   %r11
push   %r15
push   %r10
push   $0x0
call   10a0 <XCreateWindow@plt>
add    $0x30,%rsp
test   %eax,%eax
je     1369 <create_window+0x179>
mov    %eax,%ebp
mov    0x2d0c(%rip),%rax
mov    (%rax),%edx
lea    0xd4d(%rip),%rsi
mov    %rbx,%rdi
call   1090 <XInternAtom@plt>
mov    %eax,(%r14)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1080 <XSetWMProtocols@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   10b0 <XSelectInput@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10e0 <XMapWindow@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd16(%rip),%rsi
lea    0x40(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%edx
call   10f0 <sprintf@plt>
mov    %r14,0x8(%rsp)
mov    0x2ca8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
movl   $0x8,0x10(%rsp)
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,0x14(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <XSetWMName@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
lea    0xc87(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_8__ = type { i8*, i32, i32, i32 }
%struct.TYPE_7__ = type { i32, i32 }
%struct.TYPE_9__ = type { i64, i64, i32 }
@TrueColor = global i32 0
@AllocNone = global i32 0
@InputOutput = global i32 0
@CWColormap = global i32 0
@CWBorderPixel = global i32 0
@CWBackPixel = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Unable to create window.\0A\00"
@.str.1 = [17 x i8] c"WM_DELETE_WINDOW\00"
@False = global i32 0
@KeyPressMask = global i32 0
@.str.2 = [13 x i8] c"[%d] xfiller\00"
@XA_STRING = global i32 0
define void @create_window(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.TYPE_8__
%7 = alloca %struct.TYPE_7__
%8 = alloca %struct.TYPE_9__
%9 = alloca [64 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
%10 = load i32*, i32** %3
%11 = load i32*, i32** %3
%12 = call i32 @DefaultScreen(i32* %11)
%13 = load i32, i32* @TrueColor
%14 = call i32 @XMatchVisualInfo(i32* %10, i32 %12, i32 32, i32 %13, %struct.TYPE_7__* %7)
%15 = load i32*, i32** %3
%16 = load i32*, i32** %3
%17 = call i32 @DefaultRootWindow(i32* %16)
%18 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load i32, i32* @AllocNone
%21 = call i32 @XCreateColormap(i32* %15, i32 %17, i32 %19, i32 %20)
%22 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %8, i32 0, i32 2
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %8, i32 0, i32 1
store i64 0, i64* %23
%24 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %8, i32 0, i32 0
store i64 0, i64* %24
%25 = load i32*, i32** %3
%26 = load i32*, i32** %3
%27 = call i32 @DefaultRootWindow(i32* %26)
%28 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i32 0, i32 1
%29 = load i32, i32* %28
%30 = load i32, i32* @InputOutput
%31 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i32 0, i32 0
%32 = load i32, i32* %31
%33 = load i32, i32* @CWColormap
%34 = load i32, i32* @CWBorderPixel
%35 = or i32 %33, %34
%36 = load i32, i32* @CWBackPixel
%37 = or i32 %35, %36
%38 = call i32 @XCreateWindow(i32* %25, i32 %27, i32 0, i32 0, i32 850, i32 700, i32 0, i32 %29, i32 %30, i32 %32, i32 %37, %struct.TYPE_9__* %8)
store i32 %38, i32* %5
%39 = load i32, i32* %5
%40 = icmp ne i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %2
%46 = load i32*, i32** %3
%47 = load i32, i32* @False
%48 = call i32 @XInternAtom(i32* %46, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = load i32*, i32** %4
store i32 %48, i32* %49
%50 = load i32*, i32** %3
%51 = load i32, i32* %5
%52 = load i32*, i32** %4
%53 = call i32 @XSetWMProtocols(i32* %50, i32 %51, i32* %52, i32 1)
%54 = load i32*, i32** %3
%55 = load i32, i32* %5
%56 = load i32, i32* @KeyPressMask
%57 = call i32 @XSelectInput(i32* %54, i32 %55, i32 %56)
%58 = load i32*, i32** %3
%59 = load i32, i32* %5
%60 = call i32 @XMapWindow(i32* %58, i32 %59)
%61 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%62 = call i32 (...) @getpid()
%63 = call i32 @sprintf(i8* %61, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%65 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %6, i32 0, i32 0
store i8* %64, i8** %65
%66 = load i32, i32* @XA_STRING
%67 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %6, i32 0, i32 3
store i32 %66, i32* %67
%68 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %6, i32 0, i32 1
store i32 8, i32* %68
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%70 = call i32 @strlen(i8* %69)
%71 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %6, i32 0, i32 2
store i32 %70, i32* %71
%72 = load i32*, i32** %3
%73 = load i32, i32* %5
%74 = call i32 @XSetWMName(i32* %72, i32 %73, %struct.TYPE_8__* %6)
ret void
}

LLVM IR (-O2):
%struct.TYPE_8__ = type { i8*, i32, i32, i32 }
%struct.TYPE_7__ = type { i32, i32 }
%struct.TYPE_9__ = type { i64, i64, i32 }
@TrueColor = global i32 0
@AllocNone = global i32 0
@InputOutput = global i32 0
@CWColormap = global i32 0
@CWBorderPixel = global i32 0
@CWBackPixel = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Unable to create window.\0A\00"
@.str.1 = [17 x i8] c"WM_DELETE_WINDOW\00"
@False = global i32 0
@KeyPressMask = global i32 0
@.str.2 = [13 x i8] c"[%d] xfiller\00"
@XA_STRING = global i32 0
define void @create_window(i32* %0, i32* %1) {
%3 = alloca %struct.TYPE_8__
%4 = alloca %struct.TYPE_7__
%5 = alloca %struct.TYPE_9__
%6 = alloca [64 x i8]
%7 = bitcast %struct.TYPE_8__* %3 to i8*
%8 = bitcast %struct.TYPE_7__* %4 to i8*
%9 = bitcast %struct.TYPE_9__* %5 to i8*
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%11 = tail call i32 @DefaultScreen(i32* %0)
%12 = load i32, i32* @TrueColor
%13 = call i32 @XMatchVisualInfo(i32* %0, i32 %11, i32 32, i32 %12, %struct.TYPE_7__* %4)
%14 = call i32 @DefaultRootWindow(i32* %0)
%15 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %4, i64 0, i32 0
%16 = load i32, i32* %15
%17 = load i32, i32* @AllocNone
%18 = call i32 @XCreateColormap(i32* %0, i32 %14, i32 %16, i32 %17)
%19 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %5, i64 0, i32 2
store i32 %18, i32* %19
%20 = bitcast %struct.TYPE_9__* %5 to i8*
%21 = call i32 @DefaultRootWindow(i32* %0)
%22 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %4, i64 0, i32 1
%23 = load i32, i32* %22
%24 = load i32, i32* @InputOutput
%25 = load i32, i32* %15
%26 = load i32, i32* @CWColormap
%27 = load i32, i32* @CWBorderPixel
%28 = or i32 %27, %26
%29 = load i32, i32* @CWBackPixel
%30 = or i32 %28, %29
%31 = call i32 @XCreateWindow(i32* %0, i32 %21, i32 0, i32 0, i32 850, i32 700, i32 0, i32 %23, i32 %24, i32 %25, i32 %30, %struct.TYPE_9__* %5)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %2
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %2
%38 = load i32, i32* @False
%39 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %38)
store i32 %39, i32* %1
%40 = call i32 @XSetWMProtocols(i32* %0, i32 %31, i32* %1, i32 1)
%41 = load i32, i32* @KeyPressMask
%42 = call i32 @XSelectInput(i32* %0, i32 %31, i32 %41)
%43 = call i32 @XMapWindow(i32* %0, i32 %31)
%44 = call i32 (...) @getpid()
%45 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %3, i64 0, i32 0
store i8* %10, i8** %46
%47 = load i32, i32* @XA_STRING
%48 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %3, i64 0, i32 3
store i32 %47, i32* %48
%49 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %3, i64 0, i32 1
store i32 8, i32* %49
%50 = call i32 @strlen(i8* %10)
%51 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %3, i64 0, i32 2
store i32 %50, i32* %51
%52 = call i32 @XSetWMName(i32* %0, i32 %31, %struct.TYPE_8__* %3)
ret void
}