#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 width;
  int height;
  int /*<<< orphan*/ y;
  int /*<<< orphan*/ x;
};
struct TYPE_5__ {
  int type;
  TYPE_1__ xexpose;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Pixmap;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultDepth(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
#define Expose 128
int /*<<< orphan*/ ExposureMask;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCopyArea(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/, int, int,
                             int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreatePixmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int, int, int /*<<< orphan*/, long,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int, int, int, int);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_2__ *);
int /*<<< orphan*/ *XOpenDisplay(char *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *pcDisplay;
  Display *dpy;
  int ret;
  if ((pcDisplay = getenv("DISPLAY")) == NULL) {
    fprintf(stderr, "Error: DISPLAY environment variable not set\n");
    exit(1);
  }
  if ((dpy = XOpenDisplay(pcDisplay)) == NULL) {
    fprintf(stderr, "Error: Can't open display: %s\n", pcDisplay);
    exit(1);
  }
  int width = 200;
  int height = 200;
  Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, width,
                                 height, 0, 0L, WhitePixel(dpy, 0));
  XSelectInput(dpy, w, ExposureMask);
  Pixmap canvas = XCreatePixmap(dpy, w, width, height, DefaultDepth(dpy, 0));
  GC gc = XCreateGC(dpy, canvas, 0, NULL);
  XSetForeground(dpy, gc, BlackPixel(dpy, 0));
  XFillRectangle(dpy, canvas, gc, 0, 0, width, height);
  XSetForeground(dpy, gc, WhitePixel(dpy, 0));
  XFillRectangle(dpy, canvas, gc, 50, 50, 50, 50);
  XCopyArea(dpy, canvas, w, gc, 0, 0, width, height, 0, 0);
  XMapWindow(dpy, w);
  for (;;) {
    XEvent e;
    XNextEvent(dpy, &e);
    switch (e.type) {
    case Expose:
      XCopyArea(dpy, canvas, w, gc, e.xexpose.x, e.xexpose.y, e.xexpose.width,
                e.xexpose.height, e.xexpose.x, e.xexpose.y);
      break;
    default:
      printf("Got event %d\n", e.type);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xc8,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xdbf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1275 <main+0x55>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1080 <XOpenDisplay@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12b1 <main+0x91>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
movl   $0xc8,-0x30(%rbp)
movl   $0xc8,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1070 <WhitePixel@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x9c(%rbp),%esi
mov    -0x98(%rbp),%r8d
mov    -0x94(%rbp),%r9d
xor    %ecx,%ecx
xor    %edx,%edx
mov    %ecx,%edx
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   10f0 <XCreateSimpleWindow@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    0x2c97(%rip),%rax
mov    (%rax),%edx
call   10c0 <XSelectInput@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   10d0 <DefaultDepth@plt>
mov    -0x90(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    %eax,%r8d
call   1140 <XCreatePixmap@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10e0 <XCreateGC@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1100 <BlackPixel@plt>
mov    -0x78(%rbp),%rdi
mov    -0x6c(%rbp),%esi
mov    %eax,%edx
call   1110 <XSetForeground@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    -0x30(%rbp),%r9d
mov    -0x34(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1050 <XFillRectangle@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1070 <WhitePixel@plt>
mov    -0x68(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    %eax,%edx
call   1110 <XSetForeground@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    $0x32,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x32,(%rsp)
call   1050 <XFillRectangle@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x30(%rbp),%r10d
mov    -0x34(%rbp),%eax
xor    %r9d,%r9d
mov    %r9d,%r8d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
call   10a0 <XCopyArea@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1120 <XMapWindow@plt>
mov    -0x28(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   10b0 <XNextEvent@plt>
mov    -0x58(%rbp),%eax
sub    $0x80,%eax
jne    14d6 <main+0x2b6>
jmp    1498 <main+0x278>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x48(%rbp),%r8d
mov    -0x4c(%rbp),%r9d
mov    -0x54(%rbp),%ebx
mov    -0x50(%rbp),%r11d
mov    -0x48(%rbp),%r10d
mov    -0x4c(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10a0 <XCopyArea@plt>
jmp    14e5 <main+0x2c5>
mov    -0x58(%rbp),%esi
lea    0xb74(%rip),%rdi
call   1060 <printf@plt>
jmp    1478 <main+0x258>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xdcb(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13f1 <main+0x1d1>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <XOpenDisplay@plt>
test   %rax,%rax
je     1412 <main+0x1f2>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <DefaultRootWindow@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xc8,%r8d
mov    $0xc8,%r9d
push   %rax
push   $0x0
push   $0x0
call   10f0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r14d
mov    0x2d39(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   10c0 <XSelectInput@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <DefaultDepth@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0xc8,%edx
mov    $0xc8,%ecx
mov    %eax,%r8d
call   1140 <XCreatePixmap@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   10e0 <XCreateGC@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1100 <BlackPixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1110 <XSetForeground@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0xc8,%r9d
push   $0xc8
call   1050 <XFillRectangle@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1110 <XSetForeground@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    $0x32,%ecx
mov    $0x32,%r8d
mov    $0x32,%r9d
push   $0x32
call   1050 <XFillRectangle@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    %r15d,%r12d
mov    %r15d,%esi
mov    %r14d,%edx
mov    %ebp,%r13d
mov    %ebp,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
push   $0xc8
push   $0xc8
call   10a0 <XCopyArea@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
mov    %r14d,%r15d
mov    %r14d,%esi
call   1120 <XMapWindow@plt>
mov    %rsp,%r14
jmp    13cd <main+0x1ad>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%r8d
mov    0xc(%rsp),%r9d
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%ebp
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r13d,%ecx
push   %r9
push   %r8
push   %rbp
push   %rax
call   10a0 <XCopyArea@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <XNextEvent@plt>
mov    (%rsp),%esi
cmp    $0x80,%esi
je     13a0 <main+0x180>
lea    0xc6a(%rip),%rdi
call   1060 <printf@plt>
jmp    13cd <main+0x1ad>
mov    0x2be8(%rip),%rax
mov    (%rax),%edi
lea    0xc07(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
lea    0xc13(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32 }
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"Error: DISPLAY environment variable not set\0A\00"
@.str.2 = [31 x i8] c"Error: Can't open display: %s\0A\00"
@ExposureMask = global i32 0
@.str.3 = [14 x i8] c"Got event %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.TYPE_5__
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %15, i8** %6
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8*, i8** %6
%23 = call i32* @XOpenDisplay(i8* %22)
store i32* %23, i32** %7
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %6
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %21
store i32 200, i32* %9
store i32 200, i32* %10
%31 = load i32*, i32** %7
%32 = load i32*, i32** %7
%33 = call i32 @DefaultRootWindow(i32* %32)
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = load i32*, i32** %7
%37 = call i32 @WhitePixel(i32* %36, i32 0)
%38 = call i32 @XCreateSimpleWindow(i32* %31, i32 %33, i32 0, i32 0, i32 %34, i32 %35, i32 0, i64 0, i32 %37)
store i32 %38, i32* %11
%39 = load i32*, i32** %7
%40 = load i32, i32* %11
%41 = load i32, i32* @ExposureMask
%42 = call i32 @XSelectInput(i32* %39, i32 %40, i32 %41)
%43 = load i32*, i32** %7
%44 = load i32, i32* %11
%45 = load i32, i32* %9
%46 = load i32, i32* %10
%47 = load i32*, i32** %7
%48 = call i32 @DefaultDepth(i32* %47, i32 0)
%49 = call i32 @XCreatePixmap(i32* %43, i32 %44, i32 %45, i32 %46, i32 %48)
store i32 %49, i32* %12
%50 = load i32*, i32** %7
%51 = load i32, i32* %12
%52 = call i32 @XCreateGC(i32* %50, i32 %51, i32 0, i32* null)
store i32 %52, i32* %13
%53 = load i32*, i32** %7
%54 = load i32, i32* %13
%55 = load i32*, i32** %7
%56 = call i32 @BlackPixel(i32* %55, i32 0)
%57 = call i32 @XSetForeground(i32* %53, i32 %54, i32 %56)
%58 = load i32*, i32** %7
%59 = load i32, i32* %12
%60 = load i32, i32* %13
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = call i32 @XFillRectangle(i32* %58, i32 %59, i32 %60, i32 0, i32 0, i32 %61, i32 %62)
%64 = load i32*, i32** %7
%65 = load i32, i32* %13
%66 = load i32*, i32** %7
%67 = call i32 @WhitePixel(i32* %66, i32 0)
%68 = call i32 @XSetForeground(i32* %64, i32 %65, i32 %67)
%69 = load i32*, i32** %7
%70 = load i32, i32* %12
%71 = load i32, i32* %13
%72 = call i32 @XFillRectangle(i32* %69, i32 %70, i32 %71, i32 50, i32 50, i32 50, i32 50)
%73 = load i32*, i32** %7
%74 = load i32, i32* %12
%75 = load i32, i32* %11
%76 = load i32, i32* %13
%77 = load i32, i32* %9
%78 = load i32, i32* %10
%79 = call i32 @XCopyArea(i32* %73, i32 %74, i32 %75, i32 %76, i32 0, i32 0, i32 %77, i32 %78, i32 0, i32 0)
%80 = load i32*, i32** %7
%81 = load i32, i32* %11
%82 = call i32 @XMapWindow(i32* %80, i32 %81)
br label %83
83: ; preds = %116, %30
%84 = load i32*, i32** %7
%85 = call i32 @XNextEvent(i32* %84, %struct.TYPE_5__* %14)
%86 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 0
%87 = load i32, i32* %86
switch i32 %87, label %112 [
i32 128, label %88
]
88: ; preds = %83
%89 = load i32*, i32** %7
%90 = load i32, i32* %12
%91 = load i32, i32* %11
%92 = load i32, i32* %13
%93 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%94 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %93, i32 0, i32 3
%95 = load i32, i32* %94
%96 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%97 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %96, i32 0, i32 2
%98 = load i32, i32* %97
%99 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%100 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %99, i32 0, i32 0
%101 = load i32, i32* %100
%102 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%103 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %102, i32 0, i32 1
%104 = load i32, i32* %103
%105 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%106 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %105, i32 0, i32 3
%107 = load i32, i32* %106
%108 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 1
%109 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %108, i32 0, i32 2
%110 = load i32, i32* %109
%111 = call i32 @XCopyArea(i32* %89, i32 %90, i32 %91, i32 %92, i32 %95, i32 %98, i32 %101, i32 %104, i32 %107, i32 %110)
br label %116
112: ; preds = %83
%113 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %114)
br label %116
116: ; preds = %112, %88
br label %83
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32 }
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"Error: DISPLAY environment variable not set\0A\00"
@.str.2 = [31 x i8] c"Error: Can't open display: %s\0A\00"
@ExposureMask = global i32 0
@.str.3 = [14 x i8] c"Got event %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.TYPE_5__
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = tail call i32* @XOpenDisplay(i8* %4)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %10
%18 = tail call i32 @DefaultRootWindow(i32* %11)
%19 = tail call i32 @WhitePixel(i32* %11, i32 0)
%20 = tail call i32 @XCreateSimpleWindow(i32* %11, i32 %18, i32 0, i32 0, i32 200, i32 200, i32 0, i64 0, i32 %19)
%21 = load i32, i32* @ExposureMask
%22 = tail call i32 @XSelectInput(i32* %11, i32 %20, i32 %21)
%23 = tail call i32 @DefaultDepth(i32* %11, i32 0)
%24 = tail call i32 @XCreatePixmap(i32* %11, i32 %20, i32 200, i32 200, i32 %23)
%25 = tail call i32 @XCreateGC(i32* %11, i32 %24, i32 0, i32* null)
%26 = tail call i32 @BlackPixel(i32* %11, i32 0)
%27 = tail call i32 @XSetForeground(i32* %11, i32 %25, i32 %26)
%28 = tail call i32 @XFillRectangle(i32* %11, i32 %24, i32 %25, i32 0, i32 0, i32 200, i32 200)
%29 = tail call i32 @WhitePixel(i32* %11, i32 0)
%30 = tail call i32 @XSetForeground(i32* %11, i32 %25, i32 %29)
%31 = tail call i32 @XFillRectangle(i32* %11, i32 %24, i32 %25, i32 50, i32 50, i32 50, i32 50)
%32 = tail call i32 @XCopyArea(i32* %11, i32 %24, i32 %20, i32 %25, i32 0, i32 0, i32 200, i32 200, i32 0, i32 0)
%33 = tail call i32 @XMapWindow(i32* %11, i32 %20)
%34 = bitcast %struct.TYPE_5__* %3 to i8*
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 0
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 3
%37 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 2
%38 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 0
%39 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 1
br label %40
40: ; preds = %52, %17
%41 = call i32 @XNextEvent(i32* %11, %struct.TYPE_5__* %3)
%42 = load i32, i32* %35
%43 = icmp eq i32 %42, 128
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load i32, i32* %36
%46 = load i32, i32* %37
%47 = load i32, i32* %38
%48 = load i32, i32* %39
%49 = call i32 @XCopyArea(i32* %11, i32 %24, i32 %20, i32 %25, i32 %45, i32 %46, i32 %47, i32 %48, i32 %45, i32 %46)
br label %52
50: ; preds = %40
%51 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %52
52: ; preds = %50, %44
br label %40
}