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

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef void *Atom;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ DefaultGC(int /*<<< orphan*/ *, int);
int DefaultScreen(int /*<<< orphan*/ *);
scalar_t__ Expose;
int /*<<< orphan*/ False;
scalar_t__ KeyPress;
int /*<<< orphan*/ PropModeReplace;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XA_ATOM;
int /*<<< orphan*/ XChangeProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   void *, int /*<<< orphan*/, int,
                                   int /*<<< orphan*/, unsigned char *, int);
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
void *XInternAtom(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_1__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  Display *d = XOpenDisplay(NULL);
  int s = DefaultScreen(d);
  Window w = XCreateSimpleWindow(d, RootWindow(d, s), 400, 400, 900, 600, 1,
                                 BlackPixel(d, s), WhitePixel(d, s));
  Atom window_type = XInternAtom(d, "_NET_WM_WINDOW_TYPE", False);
  long value = XInternAtom(d, "_NET_WM_WINDOW_TYPE_DOCK", False);
  XChangeProperty(d, w, window_type, XA_ATOM, 32, PropModeReplace,
                  (unsigned char *)&value, 1);
  XEvent e;
  XMapWindow(d, w);
  while (1) {
    XNextEvent(d, &e);
    if (e.type == Expose) {
      XFillRectangle(d, w, DefaultGC(d, s), 0, 0, 0, 0);
    }
    if (e.type == KeyPress)
      break;
  }
  XCloseDisplay(d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10a0 <RootWindow@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10c0 <BlackPixel@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <WhitePixel@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%r10d
mov    $0x190,%ecx
mov    $0x384,%r8d
mov    $0x258,%r9d
mov    %ecx,%edx
movl   $0x1,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   10b0 <XCreateSimpleWindow@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d6e(%rip),%rax
mov    (%rax),%edx
lea    0xd85(%rip),%rsi
call   1080 <XInternAtom@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d51(%rip),%rax
mov    (%rax),%edx
lea    0xd7c(%rip),%rsi
call   1080 <XInternAtom@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    0x2d35(%rip),%rax
mov    (%rax),%ecx
mov    0x2d04(%rip),%rax
mov    (%rax),%r9d
lea    -0x30(%rbp),%rax
mov    $0x20,%r8d
mov    %rax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1090 <XChangeProperty@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   10d0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <XNextEvent@plt>
mov    -0x38(%rbp),%rax
mov    0x2cda(%rip),%rcx
cmp    (%rcx),%rax
jne    133f <main+0x16f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <DefaultGC@plt>
mov    -0x58(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    %eax,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1040 <XFillRectangle@plt>
mov    -0x38(%rbp),%rax
mov    0x2c86(%rip),%rcx
cmp    (%rcx),%rax
jne    1358 <main+0x188>
jmp    135d <main+0x18d>
jmp    12e6 <main+0x116>
mov    -0x18(%rbp),%rdi
call   10f0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1060 <XOpenDisplay@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10e0 <DefaultScreen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <RootWindow@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   10c0 <BlackPixel@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x190,%edx
mov    $0x190,%ecx
mov    $0x384,%r8d
mov    $0x258,%r9d
push   %rax
push   %r15
push   $0x1
call   10b0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r15d
mov    0x2d91(%rip),%r12
mov    (%r12),%edx
lea    0xda6(%rip),%rsi
mov    %rbx,%rdi
call   1080 <XInternAtom@plt>
mov    %rax,%rbp
mov    (%r12),%edx
lea    0xda4(%rip),%rsi
mov    %rbx,%rdi
call   1080 <XInternAtom@plt>
mov    %rax,0x10(%rsp)
mov    0x2d64(%rip),%rax
mov    (%rax),%ecx
mov    0x2d33(%rip),%rax
mov    (%rax),%r9d
lea    0x10(%rsp),%rax
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
mov    $0x20,%r8d
push   $0x1
push   %rax
call   1090 <XChangeProperty@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
call   10d0 <XMapWindow@plt>
lea    0x8(%rsp),%r12
mov    0x2d11(%rip),%r13
mov    0x2d02(%rip),%rbp
jmp    12d6 <main+0x106>
cmp    0x0(%rbp),%rax
je     131d <main+0x14d>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <XNextEvent@plt>
mov    0x8(%rsp),%rax
cmp    0x0(%r13),%rax
jne    12d0 <main+0x100>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <DefaultGC@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
call   1040 <XFillRectangle@plt>
add    $0x10,%rsp
mov    0x8(%rsp),%rax
jmp    12d0 <main+0x100>
mov    %rbx,%rdi
call   10f0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@.str = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@False = global i32 0
@.str.1 = [25 x i8] c"_NET_WM_WINDOW_TYPE_DOCK\00"
@XA_ATOM = global i32 0
@PropModeReplace = global i32 0
@Expose = global i64 0
@KeyPress = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca %struct.TYPE_3__
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32* @XOpenDisplay(i32* null)
store i32* %12, i32** %6
%13 = load i32*, i32** %6
%14 = call i32 @DefaultScreen(i32* %13)
store i32 %14, i32* %7
%15 = load i32*, i32** %6
%16 = load i32*, i32** %6
%17 = load i32, i32* %7
%18 = call i32 @RootWindow(i32* %16, i32 %17)
%19 = load i32*, i32** %6
%20 = load i32, i32* %7
%21 = call i32 @BlackPixel(i32* %19, i32 %20)
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = call i32 @WhitePixel(i32* %22, i32 %23)
%25 = call i32 @XCreateSimpleWindow(i32* %15, i32 %18, i32 400, i32 400, i32 900, i32 600, i32 1, i32 %21, i32 %24)
store i32 %25, i32* %8
%26 = load i32*, i32** %6
%27 = load i32, i32* @False
%28 = call i8* @XInternAtom(i32* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %27)
store i8* %28, i8** %9
%29 = load i32*, i32** %6
%30 = load i32, i32* @False
%31 = call i8* @XInternAtom(i32* %29, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = ptrtoint i8* %31 to i64
store i64 %32, i64* %10
%33 = load i32*, i32** %6
%34 = load i32, i32* %8
%35 = load i8*, i8** %9
%36 = load i32, i32* @XA_ATOM
%37 = load i32, i32* @PropModeReplace
%38 = bitcast i64* %10 to i8*
%39 = call i32 @XChangeProperty(i32* %33, i32 %34, i8* %35, i32 %36, i32 32, i32 %37, i8* %38, i32 1)
%40 = load i32*, i32** %6
%41 = load i32, i32* %8
%42 = call i32 @XMapWindow(i32* %40, i32 %41)
br label %43
43: ; preds = %2, %63
%44 = load i32*, i32** %6
%45 = call i32 @XNextEvent(i32* %44, %struct.TYPE_3__* %11)
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 0
%47 = load i64, i64* %46
%48 = load i64, i64* @Expose
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %57
50: ; preds = %43
%51 = load i32*, i32** %6
%52 = load i32, i32* %8
%53 = load i32*, i32** %6
%54 = load i32, i32* %7
%55 = call i32 @DefaultGC(i32* %53, i32 %54)
%56 = call i32 @XFillRectangle(i32* %51, i32 %52, i32 %55, i32 0, i32 0, i32 0, i32 0)
br label %57
57: ; preds = %50, %43
%58 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 0
%59 = load i64, i64* %58
%60 = load i64, i64* @KeyPress
%61 = icmp eq i64 %59, %60
br i1 %61, label %62, label %63
62: ; preds = %57
br label %64
63: ; preds = %57
br label %43
64: ; preds = %62
%65 = load i32*, i32** %6
%66 = call i32 @XCloseDisplay(i32* %65)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@.str = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@False = global i32 0
@.str.1 = [25 x i8] c"_NET_WM_WINDOW_TYPE_DOCK\00"
@XA_ATOM = global i32 0
@PropModeReplace = global i32 0
@Expose = global i64 0
@KeyPress = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca %struct.TYPE_3__
%5 = tail call i32* @XOpenDisplay(i32* null)
%6 = tail call i32 @DefaultScreen(i32* %5)
%7 = tail call i32 @RootWindow(i32* %5, i32 %6)
%8 = tail call i32 @BlackPixel(i32* %5, i32 %6)
%9 = tail call i32 @WhitePixel(i32* %5, i32 %6)
%10 = tail call i32 @XCreateSimpleWindow(i32* %5, i32 %7, i32 400, i32 400, i32 900, i32 600, i32 1, i32 %8, i32 %9)
%11 = load i32, i32* @False
%12 = tail call i8* @XInternAtom(i32* %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = bitcast i64* %3 to i8*
%14 = load i32, i32* @False
%15 = tail call i8* @XInternAtom(i32* %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = ptrtoint i8* %15 to i64
store i64 %16, i64* %3
%17 = load i32, i32* @XA_ATOM
%18 = load i32, i32* @PropModeReplace
%19 = call i32 @XChangeProperty(i32* %5, i32 %10, i8* %12, i32 %17, i32 32, i32 %18, i8* %13, i32 1)
%20 = bitcast %struct.TYPE_3__* %4 to i8*
%21 = call i32 @XMapWindow(i32* %5, i32 %10)
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 0
br label %23
23: ; preds = %32, %2
%24 = call i32 @XNextEvent(i32* %5, %struct.TYPE_3__* %4)
%25 = load i64, i64* %22
%26 = load i64, i64* @Expose
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = call i32 @DefaultGC(i32* %5, i32 %6)
%30 = call i32 @XFillRectangle(i32* %5, i32 %10, i32 %29, i32 0, i32 0, i32 0, i32 0)
%31 = load i64, i64* %22
br label %32
32: ; preds = %28, %23
%33 = phi i64 [ %31, %28 ], [ %25, %23 ]
%34 = load i64, i64* @KeyPress
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %23
36: ; preds = %32
%37 = call i32 @XCloseDisplay(i32* %5)
ret i32 0
}