#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ from_configure;
  int /*<<< orphan*/ window;
  int /*<<< orphan*/ event;
  int /*<<< orphan*/ *display;
};
struct TYPE_5__ {
  TYPE_1__ xunmap;
  int /*<<< orphan*/ type;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ CopyFromParent;
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ False;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int SubstructureNotifyMask;
int SubstructureRedirectMask;
int /*<<< orphan*/ UnmapNotify;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int, int, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSendEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int, TYPE_2__ *);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XSync(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XUnmapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int main() {
  Display *display;
  Window win;
  XEvent report;
  XEvent msg;
  int x = 50, y = 50, h = 100, w = 400;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  win = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10,
                      CopyFromParent, CopyFromParent, CopyFromParent, 0, NULL);
  XSetWindowBackground(display, win, WhitePixel(display, 0));
  XMapWindow(display, win);
  XFlush(display);
  usleep(10000);
  msg.type = UnmapNotify;
  msg.xunmap.display = display;
  msg.xunmap.event = RootWindow(display, DefaultScreen(display));
  msg.xunmap.window = win;
  msg.xunmap.from_configure = False;
  XSendEvent(display, RootWindow(display, DefaultScreen(display)), False,
             SubstructureRedirectMask | SubstructureNotifyMask, &msg);
  usleep(10000);
  XUnmapWindow(display, win);
  XSync(display, False);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xc8,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x32,-0x64(%rbp)
movl   $0x32,-0x68(%rbp)
movl   $0x64,-0x6c(%rbp)
movl   $0x190,-0x70(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1238 <main+0x68>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    13ce <main+0x1fe>
mov    -0x18(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1090 <RootWindow@plt>
mov    -0xa0(%rbp),%rdi
mov    %eax,%esi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
mov    -0x70(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
mov    0x2d54(%rip),%rax
mov    (%rax),%r11d
mov    0x2d4a(%rip),%rax
mov    (%rax),%r10d
mov    0x2d40(%rip),%rax
mov    (%rax),%eax
xor    %ebx,%ebx
xor    %ebx,%ebx
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movq   $0x0,0x28(%rsp)
call   1070 <XCreateWindow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <WhitePixel@plt>
mov    -0x98(%rbp),%rdi
mov    -0x8c(%rbp),%esi
mov    %eax,%edx
call   10d0 <XSetWindowBackground@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10c0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <XFlush@plt>
mov    $0x2710,%edi
call   10f0 <usleep@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%esi
call   1090 <RootWindow@plt>
mov    %eax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2c9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
call   1090 <RootWindow@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%esi
mov    0x2c66(%rip),%rax
mov    (%rax),%edx
mov    0x2c3d(%rip),%rax
mov    (%rax),%ecx
mov    0x2c24(%rip),%rax
or     (%rax),%ecx
lea    -0x60(%rbp),%r8
call   1030 <XSendEvent@plt>
mov    $0x2710,%edi
call   10f0 <usleep@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10a0 <XUnmapWindow@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c28(%rip),%rax
mov    (%rax),%esi
call   1080 <XSync@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xc8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %ebp,%ebp
xor    %edi,%edi
call   1050 <XOpenDisplay@plt>
test   %rax,%rax
je     12f4 <main+0x124>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1090 <RootWindow@plt>
mov    0x2dc2(%rip),%rcx
mov    (%rcx),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x32,%edx
mov    $0x32,%ecx
mov    $0x190,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   1070 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   10d0 <XSetWindowBackground@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10c0 <XMapWindow@plt>
mov    %rbx,%rdi
call   10b0 <XFlush@plt>
mov    $0x2710,%edi
call   10f0 <usleep@plt>
mov    0x2d68(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
call   10e0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <RootWindow@plt>
mov    %eax,0x8(%rsp)
mov    %ebp,0x4(%rsp)
mov    0x2d54(%rip),%r14
mov    (%r14),%eax
mov    %eax,(%rsp)
mov    %rbx,%rdi
call   10e0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <RootWindow@plt>
mov    (%r14),%edx
mov    0x2d12(%rip),%rsi
mov    0x2cfb(%rip),%rcx
mov    (%rcx),%ecx
or     (%rsi),%ecx
mov    %rsp,%r8
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <XSendEvent@plt>
mov    $0x2710,%edi
call   10f0 <usleep@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10a0 <XUnmapWindow@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1080 <XSync@plt>
mov    $0x1,%ebp
jmp    1309 <main+0x139>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0xcfc(%rip),%rsi
call   1060 <fprintf@plt>
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32 }
%struct.TYPE_4__ = type { i32, i32, i32, i32* }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@UnmapNotify = global i32 0
@False = global i32 0
@SubstructureRedirectMask = global i32 0
@SubstructureNotifyMask = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct.TYPE_5__
%5 = alloca %struct.TYPE_5__
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %6
store i32 50, i32* %7
store i32 100, i32* %8
store i32 400, i32* %9
%10 = call i32* @XOpenDisplay(i32* null)
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %73
16: ; preds = %0
%17 = load i32*, i32** %2
%18 = load i32*, i32** %2
%19 = call i32 @RootWindow(i32* %18, i32 0)
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = load i32, i32* @CopyFromParent
%25 = load i32, i32* @CopyFromParent
%26 = load i32, i32* @CopyFromParent
%27 = call i32 @XCreateWindow(i32* %17, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 10, i32 %24, i32 %25, i32 %26, i32 0, i32* null)
store i32 %27, i32* %3
%28 = load i32*, i32** %2
%29 = load i32, i32* %3
%30 = load i32*, i32** %2
%31 = call i32 @WhitePixel(i32* %30, i32 0)
%32 = call i32 @XSetWindowBackground(i32* %28, i32 %29, i32 %31)
%33 = load i32*, i32** %2
%34 = load i32, i32* %3
%35 = call i32 @XMapWindow(i32* %33, i32 %34)
%36 = load i32*, i32** %2
%37 = call i32 @XFlush(i32* %36)
%38 = call i32 @usleep(i32 10000)
%39 = load i32, i32* @UnmapNotify
%40 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
store i32 %39, i32* %40
%41 = load i32*, i32** %2
%42 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%43 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %42, i32 0, i32 3
store i32* %41, i32** %43
%44 = load i32*, i32** %2
%45 = load i32*, i32** %2
%46 = call i32 @DefaultScreen(i32* %45)
%47 = call i32 @RootWindow(i32* %44, i32 %46)
%48 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%49 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %48, i32 0, i32 2
store i32 %47, i32* %49
%50 = load i32, i32* %3
%51 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%52 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %51, i32 0, i32 1
store i32 %50, i32* %52
%53 = load i32, i32* @False
%54 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%55 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %54, i32 0, i32 0
store i32 %53, i32* %55
%56 = load i32*, i32** %2
%57 = load i32*, i32** %2
%58 = load i32*, i32** %2
%59 = call i32 @DefaultScreen(i32* %58)
%60 = call i32 @RootWindow(i32* %57, i32 %59)
%61 = load i32, i32* @False
%62 = load i32, i32* @SubstructureRedirectMask
%63 = load i32, i32* @SubstructureNotifyMask
%64 = or i32 %62, %63
%65 = call i32 @XSendEvent(i32* %56, i32 %60, i32 %61, i32 %64, %struct.TYPE_5__* %5)
%66 = call i32 @usleep(i32 10000)
%67 = load i32*, i32** %2
%68 = load i32, i32* %3
%69 = call i32 @XUnmapWindow(i32* %67, i32 %68)
%70 = load i32*, i32** %2
%71 = load i32, i32* @False
%72 = call i32 @XSync(i32* %70, i32 %71)
store i32 1, i32* %1
br label %73
73: ; preds = %16, %13
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32 }
%struct.TYPE_4__ = type { i32, i32, i32, i32* }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@UnmapNotify = global i32 0
@False = global i32 0
@SubstructureRedirectMask = global i32 0
@SubstructureNotifyMask = global i32 0
define i32 @main() {
%1 = alloca %struct.TYPE_5__
%2 = bitcast %struct.TYPE_5__* %1 to i8*
%3 = tail call i32* @XOpenDisplay(i32* null)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %37
8: ; preds = %0
%9 = tail call i32 @RootWindow(i32* %3, i32 0)
%10 = load i32, i32* @CopyFromParent
%11 = tail call i32 @XCreateWindow(i32* %3, i32 %9, i32 50, i32 50, i32 400, i32 100, i32 10, i32 %10, i32 %10, i32 %10, i32 0, i32* null)
%12 = tail call i32 @WhitePixel(i32* %3, i32 0)
%13 = tail call i32 @XSetWindowBackground(i32* %3, i32 %11, i32 %12)
%14 = tail call i32 @XMapWindow(i32* %3, i32 %11)
%15 = tail call i32 @XFlush(i32* %3)
%16 = tail call i32 @usleep(i32 10000)
%17 = load i32, i32* @UnmapNotify
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
store i32 %17, i32* %18
%19 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 3
store i32* %3, i32** %19
%20 = tail call i32 @DefaultScreen(i32* %3)
%21 = tail call i32 @RootWindow(i32* %3, i32 %20)
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 2
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 1
store i32 %11, i32* %23
%24 = load i32, i32* @False
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = tail call i32 @DefaultScreen(i32* %3)
%27 = tail call i32 @RootWindow(i32* %3, i32 %26)
%28 = load i32, i32* @False
%29 = load i32, i32* @SubstructureRedirectMask
%30 = load i32, i32* @SubstructureNotifyMask
%31 = or i32 %30, %29
%32 = call i32 @XSendEvent(i32* %3, i32 %27, i32 %28, i32 %31, %struct.TYPE_5__* %1)
%33 = call i32 @usleep(i32 10000)
%34 = call i32 @XUnmapWindow(i32* %3, i32 %11)
%35 = load i32, i32* @False
%36 = call i32 @XSync(i32* %3, i32 %35)
br label %37
37: ; preds = %8, %5
%38 = phi i32 [ 0, %5 ], [ 1, %8 ]
ret i32 %38
}