#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_15__ TYPE_8__;
typedef struct TYPE_14__ TYPE_5__;
typedef struct TYPE_13__ TYPE_4__;
typedef struct TYPE_12__ TYPE_3__;
typedef struct TYPE_11__ TYPE_2__;
typedef struct TYPE_10__ TYPE_1__;

/* Type definitions */
struct TYPE_15__ {
  int keycode;
};
struct TYPE_12__ {
  int x;
  int y;
  int button;
};
struct TYPE_11__ {
  int width;
  int height;
};
struct TYPE_10__ {
  int x;
  int y;
};
struct TYPE_13__ {
  int type;
  TYPE_8__ xkey;
  TYPE_3__ xbutton;
  TYPE_2__ xresizerequest;
  TYPE_1__ xmotion;
};
typedef TYPE_4__ XEvent;
struct TYPE_14__ {
  int /*<<< orphan*/ pixel;
};
typedef TYPE_5__ XColor;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Colormap;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int);
int ButtonPressMask;
int /*<<< orphan*/ DefaultColormap(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultGC(int /*<<< orphan*/ *, int);
int DefaultScreen(int /*<<< orphan*/ *);
int Expose;
int ExposureMask;
int KeyPress;
int KeyPressMask;
int PointerMotionMask;
int ResizeRedirectMask;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XAllocColor(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               TYPE_5__ *);
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XDrawString(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               int /*<<< orphan*/, int, int, char *, int);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int, int, int, int);
char *XKeysymToString(unsigned long);
unsigned long XLookupKeysym(TYPE_8__ *, int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_4__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XParseColor(int /*<<< orphan*/ *, int /*<<< orphan*/, char *,
                               TYPE_5__ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  bool q = false;
  if (argv[1] != NULL && strcmp(argv[1], "-q") == 0)
    q = true;
  Display *disp;
  Window win;
  XEvent e;
  int screen;
  int winy = 0;
  int winx = 0;
  int winheight = 910;
  int winwidth = 1285;
  int borderwidth = 1;
  char *msg = "Clear screen";
  int bwidth = strlen(msg) * 6;
  int bheight = 15;
  int btop = 20;
  int bmargin = 2;
  int bleft = winwidth - bwidth - 20;
  GC blue;
  XColor blue_color;
  Colormap colormap;
  char blueidk[] = "#0000FF";
  GC red;
  XColor red_color;
  Colormap rcolormap;
  char redidk[] = "#FF0000";
  GC white;
  XColor white_color;
  Colormap wcolormap;
  char whiteidk[] = "#FFFFFF";
  disp = XOpenDisplay(NULL);
  if (disp == NULL) {
    fprintf(stderr, "Cannot open display\n");
    exit(1);
  }
  screen = DefaultScreen(disp);
  win = XCreateSimpleWindow(disp, RootWindow(disp, screen), winx, winy,
                            winwidth, winheight, borderwidth,
                            BlackPixel(disp, screen), WhitePixel(disp, screen));
  XSelectInput(disp, win,
               ExposureMask | KeyPressMask | PointerMotionMask |
                   ButtonPressMask | ResizeRedirectMask);
  XMapWindow(disp, win);
  colormap = DefaultColormap(disp, 0);
  blue = XCreateGC(disp, win, 0, 0);
  XParseColor(disp, colormap, blueidk, &blue_color);
  XAllocColor(disp, colormap, &blue_color);
  XSetForeground(disp, blue, blue_color.pixel);
  rcolormap = DefaultColormap(disp, 0);
  red = XCreateGC(disp, win, 0, 0);
  XParseColor(disp, colormap, redidk, &red_color);
  XAllocColor(disp, colormap, &red_color);
  XSetForeground(disp, red, red_color.pixel);
  wcolormap = DefaultColormap(disp, 0);
  white = XCreateGC(disp, win, 0, 0);
  XParseColor(disp, wcolormap, whiteidk, &white_color);
  XAllocColor(disp, wcolormap, &white_color);
  XSetForeground(disp, white, white_color.pixel);
  while (1) {
    XNextEvent(disp, &e);
    if (e.type == Expose) {
      if (!q)
        printf("Clearing & repainting window...\n");
      XFillRectangle(disp, win, white, 0, 0, winwidth, winheight);
      XFillRectangle(disp, win, red, bleft, btop, bwidth, bheight);
      XDrawString(disp, win, white, bleft + bmargin, btop + bmargin + 9, msg,
                  strlen(msg));
    }
    if (e.type == 6) {
      int x = e.xmotion.x;
      int y = e.xmotion.y;
      if (!q)
        printf("Mouse moved. X: %d, Y: %d\n", x, y);
      XFillRectangle(disp, win, blue, x, y, 10, 10);
    }
    if (e.type == 25) {
      int width = e.xresizerequest.width;
      int height = e.xresizerequest.height;
      if (!q)
        printf("Window resize. Width: %d, Height: %d\n", width, height);
      winheight = height;
      winwidth = width;
      bleft = winwidth - bwidth - 20;
      XFillRectangle(disp, win, red, bleft, btop, bwidth, bheight);
      XDrawString(disp, win, white, bleft + bmargin, btop + bmargin + 9, msg,
                  strlen(msg));
    }
    if (e.type == 4) {
      int x = e.xbutton.x;
      int y = e.xbutton.y;
      int button = e.xbutton.button;
      if (!q)
        printf("Button pressed. X: %d, Y: %d Button: %d\n", x, y, button);
      if (button == 1) {
        XFillRectangle(disp, win, DefaultGC(disp, screen), x, y, 20, 20);
        if (y < bheight + btop && x < bwidth + bleft) {
          if (y > btop && x > bleft) {
            if (!q)
              printf("You've hitten the button!!\nClearing...\n");
            XFillRectangle(disp, win, white, 0, 0, winwidth, winheight);
            if (!q)
              printf("Repainting clearbutton...\n");
            XFillRectangle(disp, win, red, bleft, btop, bwidth, bheight);
            XDrawString(disp, win, white, bleft + bmargin, btop + bmargin + 9,
                        msg, strlen(msg));
          }
        }
      }
    }
    if (e.type == KeyPress) {
      if (!q)
        printf("Keycode: %d\n", e.xkey.keycode);
      unsigned long keysym = XLookupKeysym(&e.xkey, 0);
      if (!q)
        printf("Keysym: %lu\n", keysym);
      char *ascii = XKeysymToString(keysym);
      if (!q)
        printf("ASCII: %s\n", ascii);
      if (keysym == 65307) {
        printf("Exiting...\n");
        XCloseDisplay(disp);
        return 0;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     12e4 <main+0x54>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd32(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12e4 <main+0x54>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x38e,-0x58(%rbp)
movl   $0x505,-0x5c(%rbp)
movl   $0x1,-0x60(%rbp)
lea    0xcf5(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <strlen@plt>
imul   $0x6,%eax,%eax
mov    %eax,-0x6c(%rbp)
movl   $0xf,-0x70(%rbp)
movl   $0x14,-0x74(%rbp)
movl   $0x2,-0x78(%rbp)
mov    -0x5c(%rbp),%eax
sub    -0x6c(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0x7c(%rbp)
mov    0xcc7(%rip),%rax
mov    %rax,-0x94(%rbp)
mov    0xcc1(%rip),%rax
mov    %rax,-0xac(%rbp)
mov    0xcbb(%rip),%rax
mov    %rax,-0xc4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <XOpenDisplay@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    13a3 <main+0x113>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
lea    0xc94(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1180 <DefaultScreen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   10e0 <RootWindow@plt>
mov    %eax,-0x10c(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x108(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x100(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0xfc(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0xf8(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1130 <BlackPixel@plt>
mov    %eax,-0xf4(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1080 <WhitePixel@plt>
mov    -0x118(%rbp),%rdi
mov    -0x10c(%rbp),%esi
mov    -0x108(%rbp),%edx
mov    -0x104(%rbp),%ecx
mov    -0x100(%rbp),%r8d
mov    -0xfc(%rbp),%r9d
mov    -0xf8(%rbp),%r11d
mov    -0xf4(%rbp),%r10d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1120 <XCreateSimpleWindow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2b39(%rip),%rax
mov    (%rax),%edx
mov    0x2b58(%rip),%rax
or     (%rax),%edx
mov    0x2b6f(%rip),%rax
or     (%rax),%edx
mov    0x2b4e(%rip),%rax
or     (%rax),%edx
mov    0x2b1d(%rip),%rax
or     (%rax),%edx
call   10f0 <XSelectInput@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1160 <XMapWindow@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1140 <DefaultColormap@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1110 <XCreateGC@plt>
mov    %eax,-0x80(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8c(%rbp),%esi
lea    -0x94(%rbp),%rdx
lea    -0x88(%rbp),%rcx
call   1190 <XParseColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8c(%rbp),%esi
lea    -0x88(%rbp),%rdx
call   1030 <XAllocColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0x80(%rbp),%esi
mov    -0x88(%rbp),%edx
call   1150 <XSetForeground@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1140 <DefaultColormap@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1110 <XCreateGC@plt>
mov    %eax,-0x98(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8c(%rbp),%esi
lea    -0xac(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
call   1190 <XParseColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8c(%rbp),%esi
lea    -0xa0(%rbp),%rdx
call   1030 <XAllocColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0x98(%rbp),%esi
mov    -0xa0(%rbp),%edx
call   1150 <XSetForeground@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1140 <DefaultColormap@plt>
mov    %eax,-0xbc(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1110 <XCreateGC@plt>
mov    %eax,-0xb0(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xbc(%rbp),%esi
lea    -0xc4(%rbp),%rdx
lea    -0xb8(%rbp),%rcx
call   1190 <XParseColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0xbc(%rbp),%esi
lea    -0xb8(%rbp),%rdx
call   1030 <XAllocColor@plt>
mov    -0x20(%rbp),%rdi
mov    -0xb0(%rbp),%esi
mov    -0xb8(%rbp),%edx
call   1150 <XSetForeground@plt>
mov    -0x20(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   10c0 <XNextEvent@plt>
mov    -0x48(%rbp),%eax
mov    0x29dc(%rip),%rcx
cmp    (%rcx),%eax
jne    16e7 <main+0x457>
cmpl   $0x0,-0x14(%rbp)
jne    1624 <main+0x394>
lea    0xa20(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0x5c(%rbp),%r9d
mov    -0x58(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1060 <XFillRectangle@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x98(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    -0x74(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
mov    -0x70(%rbp),%eax
mov    %eax,(%rsp)
call   1060 <XFillRectangle@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x130(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    -0x7c(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x128(%rbp)
mov    -0x74(%rbp),%eax
add    -0x78(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x124(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x138(%rbp),%rdi
mov    -0x130(%rbp),%esi
mov    -0x12c(%rbp),%edx
mov    -0x128(%rbp),%ecx
mov    -0x124(%rbp),%r8d
mov    -0x120(%rbp),%r9
mov    %eax,(%rsp)
call   1100 <XDrawString@plt>
cmpl   $0x6,-0x48(%rbp)
jne    1750 <main+0x4c0>
mov    -0x2c(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xcc(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1727 <main+0x497>
mov    -0xc8(%rbp),%esi
mov    -0xcc(%rbp),%edx
lea    0x93e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0xc8(%rbp),%ecx
mov    -0xcc(%rbp),%r8d
mov    $0xa,%r9d
movl   $0xa,(%rsp)
call   1060 <XFillRectangle@plt>
cmpl   $0x19,-0x48(%rbp)
jne    184f <main+0x5bf>
mov    -0x34(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1790 <main+0x500>
mov    -0xd0(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0x8f0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xd4(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0xd0(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
sub    -0x6c(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x98(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    -0x74(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
mov    -0x70(%rbp),%eax
mov    %eax,(%rsp)
call   1060 <XFillRectangle@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x150(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0x14c(%rbp)
mov    -0x7c(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x148(%rbp)
mov    -0x74(%rbp),%eax
add    -0x78(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x144(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%esi
mov    -0x14c(%rbp),%edx
mov    -0x148(%rbp),%ecx
mov    -0x144(%rbp),%r8d
mov    -0x140(%rbp),%r9
mov    %eax,(%rsp)
call   1100 <XDrawString@plt>
cmpl   $0x4,-0x48(%rbp)
jne    1a41 <main+0x7b1>
mov    -0x40(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0xe0(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    189e <main+0x60e>
mov    -0xd8(%rbp),%esi
mov    -0xdc(%rbp),%edx
mov    -0xe0(%rbp),%ecx
lea    0x808(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x1,-0xe0(%rbp)
jne    1a3c <main+0x7ac>
mov    -0x20(%rbp),%rax
mov    %rax,-0x168(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x15c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1050 <DefaultGC@plt>
mov    -0x168(%rbp),%rdi
mov    -0x15c(%rbp),%esi
mov    %eax,%edx
mov    -0xd8(%rbp),%ecx
mov    -0xdc(%rbp),%r8d
mov    $0x14,%r9d
movl   $0x14,(%rsp)
call   1060 <XFillRectangle@plt>
mov    -0xdc(%rbp),%eax
mov    -0x70(%rbp),%ecx
add    -0x74(%rbp),%ecx
cmp    %ecx,%eax
jge    1a37 <main+0x7a7>
mov    -0xd8(%rbp),%eax
mov    -0x6c(%rbp),%ecx
add    -0x7c(%rbp),%ecx
cmp    %ecx,%eax
jge    1a37 <main+0x7a7>
mov    -0xdc(%rbp),%eax
cmp    -0x74(%rbp),%eax
jle    1a32 <main+0x7a2>
mov    -0xd8(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jle    1a32 <main+0x7a2>
cmpl   $0x0,-0x14(%rbp)
jne    1957 <main+0x6c7>
lea    0x778(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0x5c(%rbp),%r9d
mov    -0x58(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1060 <XFillRectangle@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1991 <main+0x701>
lea    0x766(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x98(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    -0x74(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
mov    -0x70(%rbp),%eax
mov    %eax,(%rsp)
call   1060 <XFillRectangle@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x188(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x180(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0x17c(%rbp)
mov    -0x7c(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x178(%rbp)
mov    -0x74(%rbp),%eax
add    -0x78(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x174(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x188(%rbp),%rdi
mov    -0x180(%rbp),%esi
mov    -0x17c(%rbp),%edx
mov    -0x178(%rbp),%ecx
mov    -0x174(%rbp),%r8d
mov    -0x170(%rbp),%r9
mov    %eax,(%rsp)
call   1100 <XDrawString@plt>
jmp    1a37 <main+0x7a7>
jmp    1a3c <main+0x7ac>
jmp    1a41 <main+0x7b1>
mov    -0x48(%rbp),%eax
mov    0x257d(%rip),%rcx
cmp    (%rcx),%eax
jne    1b0d <main+0x87d>
cmpl   $0x0,-0x14(%rbp)
jne    1a6e <main+0x7de>
mov    -0x44(%rbp),%esi
lea    0x6a4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x48(%rbp),%rdi
add    $0x4,%rdi
xor    %esi,%esi
call   10d0 <XLookupKeysym@plt>
mov    %rax,-0xe8(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1aa3 <main+0x813>
mov    -0xe8(%rbp),%rsi
lea    0x67c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xe8(%rbp),%rdi
call   11b0 <XKeysymToString@plt>
mov    %rax,-0xf0(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1ad5 <main+0x845>
mov    -0xf0(%rbp),%rsi
lea    0x657(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpq   $0xff1b,-0xe8(%rbp)
jne    1b08 <main+0x878>
lea    0x643(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rdi
call   11a0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret
jmp    1b0d <main+0x87d>
jmp    15ed <main+0x35d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     12d0 <main+0x30>
lea    0xd3f(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
setne  0x27(%rsp)
jmp    12d5 <main+0x35>
movb   $0x1,0x27(%rsp)
lea    0xd27(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
movabs $0x46463030303023,%rax
mov    %rax,0xa0(%rsp)
movabs $0x30303030464623,%rax
mov    %rax,0x98(%rsp)
movabs $0x46464646464623,%rax
mov    %rax,0x90(%rsp)
xor    %edi,%edi
call   10b0 <XOpenDisplay@plt>
test   %rax,%rax
je     18ea <main+0x64a>
mov    %rax,%r15
add    %ebx,%ebx
lea    (%rbx,%rbx,2),%ecx
mov    $0x4f1,%edx
mov    %rcx,0x40(%rsp)
sub    %ecx,%edx
mov    %rdx,0x38(%rsp)
mov    %rax,%rdi
call   1190 <DefaultScreen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %eax,%esi
call   10f0 <RootWindow@plt>
mov    %eax,%r14d
mov    %r15,%rdi
mov    %ebx,%esi
call   1140 <BlackPixel@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %ebx,0x60(%rsp)
mov    %ebx,%esi
call   1090 <WhitePixel@plt>
mov    %eax,0x10(%rsp)
mov    %ebp,0x8(%rsp)
movl   $0x1,(%rsp)
movl   $0x505,0x34(%rsp)
movl   $0x38e,0x2c(%rsp)
mov    %r15,%rdi
mov    %r14d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x505,%r8d
mov    $0x38e,%r9d
call   1130 <XCreateSimpleWindow@plt>
mov    0x2bf4(%rip),%rcx
mov    0x2c15(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2c2a(%rip),%rcx
or     (%rcx),%edx
mov    0x2c09(%rip),%rcx
or     (%rcx),%edx
mov    %eax,%r12d
mov    0x2bd5(%rip),%rax
or     (%rax),%edx
mov    %r15,%rdi
mov    %r12d,%esi
call   1100 <XSelectInput@plt>
mov    %r15,%rdi
mov    %r12d,%esi
call   1170 <XMapWindow@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1150 <DefaultColormap@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %r12d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1120 <XCreateGC@plt>
mov    %eax,%ebx
lea    0xa0(%rsp),%rdx
lea    0x58(%rsp),%r14
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rcx
call   11a0 <XParseColor@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1030 <XAllocColor@plt>
mov    0x58(%rsp),%edx
mov    %r15,%rdi
mov    %ebx,0x64(%rsp)
mov    %ebx,%esi
call   1160 <XSetForeground@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1150 <DefaultColormap@plt>
mov    %r15,%rdi
mov    %r12d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1120 <XCreateGC@plt>
mov    %eax,%ebx
lea    0x98(%rsp),%rdx
lea    0x50(%rsp),%r14
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rcx
call   11a0 <XParseColor@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1030 <XAllocColor@plt>
mov    0x50(%rsp),%edx
mov    %r15,%rdi
mov    %ebx,0x30(%rsp)
mov    %ebx,%esi
call   1160 <XSetForeground@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1150 <DefaultColormap@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1120 <XCreateGC@plt>
mov    %eax,%ebp
lea    0x90(%rsp),%rdx
lea    0x48(%rsp),%r14
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rcx
call   11a0 <XParseColor@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    %ebp,%r14d
call   1030 <XAllocColor@plt>
mov    0x48(%rsp),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1160 <XSetForeground@plt>
mov    %ebp,0x28(%rsp)
jmp    155d <main+0x2bd>
nopl   0x0(%rax,%rax,1)
mov    0x6c(%rsp),%esi
lea    0xb84(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x6c(%rsp),%rdi
xor    %esi,%esi
call   10e0 <XLookupKeysym@plt>
mov    %rax,%rbp
lea    0xb74(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rdi
call   11c0 <XKeysymToString@plt>
lea    0xb68(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    $0xff1b,%rbp
mov    0x28(%rsp),%r14d
je     18c2 <main+0x622>
mov    %r15,%rdi
lea    0x68(%rsp),%rsi
call   10d0 <XNextEvent@plt>
mov    0x68(%rsp),%eax
mov    0x2a6b(%rip),%rcx
cmp    (%rcx),%eax
je     1590 <main+0x2f0>
cmp    $0x6,%eax
je     1627 <main+0x387>
cmp    $0x19,%eax
je     1681 <main+0x3e1>
jmp    170d <main+0x46d>
cmpb   $0x0,0x27(%rsp)
mov    0x34(%rsp),%ebx
je     15a7 <main+0x307>
lea    0xb5e(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c(%rsp),%eax
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %ebx,%r9d
call   1070 <XFillRectangle@plt>
movl   $0xf,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    0x30(%rsp),%edx
mov    0x38(%rsp),%rbx
mov    %ebx,%ecx
mov    $0x14,%r8d
mov    0x40(%rsp),%r9
call   1070 <XFillRectangle@plt>
add    $0x2,%ebx
lea    0xa0d(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    $0x1f,%r8d
mov    %rbp,%r9
call   1110 <XDrawString@plt>
mov    0x68(%rsp),%eax
cmp    $0x6,%eax
jne    1582 <main+0x2e2>
mov    0x84(%rsp),%ebp
mov    0x88(%rsp),%ebx
cmpb   $0x0,0x27(%rsp)
je     164e <main+0x3ae>
lea    0x9e2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <printf@plt>
movl   $0xa,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    0x64(%rsp),%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    $0xa,%r9d
call   1070 <XFillRectangle@plt>
mov    0x68(%rsp),%eax
mov    0x28(%rsp),%r14d
cmp    $0x19,%eax
jne    170d <main+0x46d>
mov    0x7c(%rsp),%ebx
mov    0x80(%rsp),%eax
mov    %eax,0x2c(%rsp)
cmpb   $0x0,0x27(%rsp)
je     16ab <main+0x40b>
lea    0x9a2(%rip),%rdi
mov    %ebx,%esi
mov    0x2c(%rsp),%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebx,0x34(%rsp)
mov    0x40(%rsp),%r9
sub    %r9d,%ebx
lea    -0x14(%rbx),%ecx
movl   $0xf,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    0x30(%rsp),%edx
mov    %rcx,0x38(%rsp)
mov    $0x14,%r8d
call   1070 <XFillRectangle@plt>
add    $0xffffffee,%ebx
lea    0x91e(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    $0x1f,%r8d
mov    %rbp,%r9
call   1110 <XDrawString@plt>
mov    0x68(%rsp),%eax
mov    %r12d,%r13d
cmp    $0x4,%eax
jne    1880 <main+0x5e0>
mov    0x70(%rsp),%r14d
mov    0x74(%rsp),%r12d
mov    0x78(%rsp),%ebx
cmpb   $0x0,0x27(%rsp)
je     1744 <main+0x4a4>
lea    0x931(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
cmp    $0x1,%ebx
jne    1880 <main+0x5e0>
mov    %r15,%rbx
mov    %r15,%rdi
mov    0x60(%rsp),%esi
call   1060 <DefaultGC@plt>
movl   $0x14,(%rsp)
mov    %r15,%rdi
mov    %r13d,%esi
mov    %eax,%edx
mov    %r14d,%ecx
mov    %r12d,%r8d
mov    $0x14,%r9d
call   1070 <XFillRectangle@plt>
cmp    $0x15,%r12d
jl     1880 <main+0x5e0>
cmp    $0x22,%r12d
jg     1880 <main+0x5e0>
mov    0x40(%rsp),%rax
mov    0x38(%rsp),%rcx
add    %ecx,%eax
cmp    %eax,%r14d
jge    1880 <main+0x5e0>
cmp    0x38(%rsp),%r14d
jle    1880 <main+0x5e0>
cmpb   $0x0,0x27(%rsp)
mov    0x34(%rsp),%ebx
je     17f9 <main+0x559>
lea    0x8fd(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c(%rsp),%eax
mov    %eax,(%rsp)
mov    %r15,%r12
mov    %r15,%rdi
mov    %r13d,%r14d
mov    %r13d,%esi
mov    0x28(%rsp),%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %ebx,%r9d
call   1070 <XFillRectangle@plt>
lea    0x8f4(%rip),%rdi
call   1040 <puts@plt>
jmp    181d <main+0x57d>
mov    0x2c(%rsp),%eax
mov    %eax,(%rsp)
mov    %r15,%r12
mov    %r15,%rdi
mov    %r13d,%r14d
mov    %r13d,%esi
mov    0x28(%rsp),%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %ebx,%r9d
call   1070 <XFillRectangle@plt>
movl   $0xf,(%rsp)
mov    %r12,%rdi
mov    %r14d,%esi
mov    0x30(%rsp),%edx
mov    0x38(%rsp),%rbx
mov    %ebx,%ecx
mov    $0x14,%r8d
mov    0x40(%rsp),%r9
call   1070 <XFillRectangle@plt>
add    $0x2,%ebx
lea    0x7b4(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
mov    %r12,%rdi
mov    %r14d,%esi
mov    0x28(%rsp),%edx
mov    %ebx,%ecx
mov    $0x1f,%r8d
mov    %rbp,%r9
call   1110 <XDrawString@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x68(%rsp),%eax
mov    0x273d(%rip),%rcx
cmp    (%rcx),%eax
mov    %r13d,%r12d
mov    0x28(%rsp),%r14d
jne    155d <main+0x2bd>
cmpb   $0x0,0x27(%rsp)
jne    1500 <main+0x260>
lea    0x6c(%rsp),%rdi
xor    %esi,%esi
call   10e0 <XLookupKeysym@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   11c0 <XKeysymToString@plt>
jmp    154b <main+0x2ab>
lea    0x7eb(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   11b0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x26c7(%rip),%rax
mov    (%rax),%edi
lea    0x716(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_13__ = type { i32, %struct.TYPE_15__, %struct.TYPE_12__, %struct.TYPE_11__, %struct.TYPE_10__ }
%struct.TYPE_15__ = type { i32 }
%struct.TYPE_12__ = type { i32, i32, i32 }
%struct.TYPE_11__ = type { i32, i32 }
%struct.TYPE_10__ = type { i32, i32 }
%struct.TYPE_14__ = type { i32 }
@.str = [3 x i8] c"-q\00"
@.str.1 = [13 x i8] c"Clear screen\00"
@__const.main.blueidk = [8 x i8] c"FF\00"
@__const.main.redidk = [8 x i8] c"#FF0000\00"
@__const.main.whiteidk = [8 x i8] c"#FFFFFF\00"
@stderr = global i32 0
@.str.2 = [21 x i8] c"Cannot open display\0A\00"
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@PointerMotionMask = global i32 0
@ButtonPressMask = global i32 0
@ResizeRedirectMask = global i32 0
@Expose = global i32 0
@.str.3 = [33 x i8] c"Clearing & repainting window...\0A\00"
@.str.4 = [27 x i8] c"Mouse moved. X: %d, Y: %d\0A\00"
@.str.5 = [38 x i8] c"Window resize. Width: %d, Height: %d\0A\00"
@.str.6 = [41 x i8] c"Button pressed. X: %d, Y: %d Button: %d\0A\00"
@.str.7 = [40 x i8] c"You've hitten the button!!\0AClearing...\0A\00"
@.str.8 = [27 x i8] c"Repainting clearbutton...\0A\00"
@KeyPress = global i32 0
@.str.9 = [13 x i8] c"Keycode: %d\0A\00"
@.str.10 = [13 x i8] c"Keysym: %lu\0A\00"
@.str.11 = [11 x i8] c"ASCII: %s\0A\00"
@.str.12 = [12 x i8] c"Exiting...\0A\00"
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 %struct.TYPE_13__
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca %struct.TYPE_14__
%24 = alloca i32
%25 = alloca [8 x i8]
%26 = alloca i32
%27 = alloca %struct.TYPE_14__
%28 = alloca i32
%29 = alloca [8 x i8]
%30 = alloca i32
%31 = alloca %struct.TYPE_14__
%32 = alloca i32
%33 = alloca [8 x i8]
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i64
%42 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %54
47: ; preds = %2
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %47
store i32 1, i32* %6
br label %54
54: ; preds = %53, %47, %2
store i32 0, i32* %11
store i32 0, i32* %12
store i32 910, i32* %13
store i32 1285, i32* %14
store i32 1, i32* %15
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %16
%55 = load i8*, i8** %16
%56 = call i32 @strlen(i8* %55)
%57 = mul nsw i32 %56, 6
store i32 %57, i32* %17
store i32 15, i32* %18
store i32 20, i32* %19
store i32 2, i32* %20
%58 = load i32, i32* %14
%59 = load i32, i32* %17
%60 = sub nsw i32 %58, %59
%61 = sub nsw i32 %60, 20
store i32 %61, i32* %21
%62 = bitcast [8 x i8]* %25 to i8*
%63 = bitcast [8 x i8]* %29 to i8*
%64 = bitcast [8 x i8]* %33 to i8*
%65 = call i32* @XOpenDisplay(i32* null)
store i32* %65, i32** %7
%66 = load i32*, i32** %7
%67 = icmp eq i32* %66, null
br i1 %67, label %68, label %72
68: ; preds = %54
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %54
%73 = load i32*, i32** %7
%74 = call i32 @DefaultScreen(i32* %73)
store i32 %74, i32* %10
%75 = load i32*, i32** %7
%76 = load i32*, i32** %7
%77 = load i32, i32* %10
%78 = call i32 @RootWindow(i32* %76, i32 %77)
%79 = load i32, i32* %12
%80 = load i32, i32* %11
%81 = load i32, i32* %14
%82 = load i32, i32* %13
%83 = load i32, i32* %15
%84 = load i32*, i32** %7
%85 = load i32, i32* %10
%86 = call i32 @BlackPixel(i32* %84, i32 %85)
%87 = load i32*, i32** %7
%88 = load i32, i32* %10
%89 = call i32 @WhitePixel(i32* %87, i32 %88)
%90 = call i32 @XCreateSimpleWindow(i32* %75, i32 %78, i32 %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %86, i32 %89)
store i32 %90, i32* %8
%91 = load i32*, i32** %7
%92 = load i32, i32* %8
%93 = load i32, i32* @ExposureMask
%94 = load i32, i32* @KeyPressMask
%95 = or i32 %93, %94
%96 = load i32, i32* @PointerMotionMask
%97 = or i32 %95, %96
%98 = load i32, i32* @ButtonPressMask
%99 = or i32 %97, %98
%100 = load i32, i32* @ResizeRedirectMask
%101 = or i32 %99, %100
%102 = call i32 @XSelectInput(i32* %91, i32 %92, i32 %101)
%103 = load i32*, i32** %7
%104 = load i32, i32* %8
%105 = call i32 @XMapWindow(i32* %103, i32 %104)
%106 = load i32*, i32** %7
%107 = call i32 @DefaultColormap(i32* %106, i32 0)
store i32 %107, i32* %24
%108 = load i32*, i32** %7
%109 = load i32, i32* %8
%110 = call i32 @XCreateGC(i32* %108, i32 %109, i32 0, i32 0)
store i32 %110, i32* %22
%111 = load i32*, i32** %7
%112 = load i32, i32* %24
%113 = getelementptr inbounds [8 x i8], [8 x i8]* %25, i64 0, i64 0
%114 = call i32 @XParseColor(i32* %111, i32 %112, i8* %113, %struct.TYPE_14__* %23)
%115 = load i32*, i32** %7
%116 = load i32, i32* %24
%117 = call i32 @XAllocColor(i32* %115, i32 %116, %struct.TYPE_14__* %23)
%118 = load i32*, i32** %7
%119 = load i32, i32* %22
%120 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %23, i32 0, i32 0
%121 = load i32, i32* %120
%122 = call i32 @XSetForeground(i32* %118, i32 %119, i32 %121)
%123 = load i32*, i32** %7
%124 = call i32 @DefaultColormap(i32* %123, i32 0)
store i32 %124, i32* %28
%125 = load i32*, i32** %7
%126 = load i32, i32* %8
%127 = call i32 @XCreateGC(i32* %125, i32 %126, i32 0, i32 0)
store i32 %127, i32* %26
%128 = load i32*, i32** %7
%129 = load i32, i32* %24
%130 = getelementptr inbounds [8 x i8], [8 x i8]* %29, i64 0, i64 0
%131 = call i32 @XParseColor(i32* %128, i32 %129, i8* %130, %struct.TYPE_14__* %27)
%132 = load i32*, i32** %7
%133 = load i32, i32* %24
%134 = call i32 @XAllocColor(i32* %132, i32 %133, %struct.TYPE_14__* %27)
%135 = load i32*, i32** %7
%136 = load i32, i32* %26
%137 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %27, i32 0, i32 0
%138 = load i32, i32* %137
%139 = call i32 @XSetForeground(i32* %135, i32 %136, i32 %138)
%140 = load i32*, i32** %7
%141 = call i32 @DefaultColormap(i32* %140, i32 0)
store i32 %141, i32* %32
%142 = load i32*, i32** %7
%143 = load i32, i32* %8
%144 = call i32 @XCreateGC(i32* %142, i32 %143, i32 0, i32 0)
store i32 %144, i32* %30
%145 = load i32*, i32** %7
%146 = load i32, i32* %32
%147 = getelementptr inbounds [8 x i8], [8 x i8]* %33, i64 0, i64 0
%148 = call i32 @XParseColor(i32* %145, i32 %146, i8* %147, %struct.TYPE_14__* %31)
%149 = load i32*, i32** %7
%150 = load i32, i32* %32
%151 = call i32 @XAllocColor(i32* %149, i32 %150, %struct.TYPE_14__* %31)
%152 = load i32*, i32** %7
%153 = load i32, i32* %30
%154 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %31, i32 0, i32 0
%155 = load i32, i32* %154
%156 = call i32 @XSetForeground(i32* %152, i32 %153, i32 %155)
br label %157
157: ; preds = %72, %399
%158 = load i32*, i32** %7
%159 = call i32 @XNextEvent(i32* %158, %struct.TYPE_13__* %9)
%160 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 0
%161 = load i32, i32* %160
%162 = load i32, i32* @Expose
%163 = icmp eq i32 %161, %162
br i1 %163, label %164, label %198
164: ; preds = %157
%165 = load i32, i32* %6
%166 = icmp ne i32 %165, 0
br i1 %166, label %169, label %167
167: ; preds = %164
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %169
169: ; preds = %167, %164
%170 = load i32*, i32** %7
%171 = load i32, i32* %8
%172 = load i32, i32* %30
%173 = load i32, i32* %14
%174 = load i32, i32* %13
%175 = call i32 @XFillRectangle(i32* %170, i32 %171, i32 %172, i32 0, i32 0, i32 %173, i32 %174)
%176 = load i32*, i32** %7
%177 = load i32, i32* %8
%178 = load i32, i32* %26
%179 = load i32, i32* %21
%180 = load i32, i32* %19
%181 = load i32, i32* %17
%182 = load i32, i32* %18
%183 = call i32 @XFillRectangle(i32* %176, i32 %177, i32 %178, i32 %179, i32 %180, i32 %181, i32 %182)
%184 = load i32*, i32** %7
%185 = load i32, i32* %8
%186 = load i32, i32* %30
%187 = load i32, i32* %21
%188 = load i32, i32* %20
%189 = add nsw i32 %187, %188
%190 = load i32, i32* %19
%191 = load i32, i32* %20
%192 = add nsw i32 %190, %191
%193 = add nsw i32 %192, 9
%194 = load i8*, i8** %16
%195 = load i8*, i8** %16
%196 = call i32 @strlen(i8* %195)
%197 = call i32 @XDrawString(i32* %184, i32 %185, i32 %186, i32 %189, i32 %193, i8* %194, i32 %196)
br label %198
198: ; preds = %169, %157
%199 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 0
%200 = load i32, i32* %199
%201 = icmp eq i32 %200, 6
br i1 %201, label %202, label %222
202: ; preds = %198
%203 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 4
%204 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %203, i32 0, i32 0
%205 = load i32, i32* %204
store i32 %205, i32* %34
%206 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 4
%207 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %206, i32 0, i32 1
%208 = load i32, i32* %207
store i32 %208, i32* %35
%209 = load i32, i32* %6
%210 = icmp ne i32 %209, 0
br i1 %210, label %215, label %211
211: ; preds = %202
%212 = load i32, i32* %34
%213 = load i32, i32* %35
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %212, i32 %213)
br label %215
215: ; preds = %211, %202
%216 = load i32*, i32** %7
%217 = load i32, i32* %8
%218 = load i32, i32* %22
%219 = load i32, i32* %34
%220 = load i32, i32* %35
%221 = call i32 @XFillRectangle(i32* %216, i32 %217, i32 %218, i32 %219, i32 %220, i32 10, i32 10)
br label %222
222: ; preds = %215, %198
%223 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 0
%224 = load i32, i32* %223
%225 = icmp eq i32 %224, 25
br i1 %225, label %226, label %268
226: ; preds = %222
%227 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 3
%228 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %227, i32 0, i32 0
%229 = load i32, i32* %228
store i32 %229, i32* %36
%230 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 3
%231 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %230, i32 0, i32 1
%232 = load i32, i32* %231
store i32 %232, i32* %37
%233 = load i32, i32* %6
%234 = icmp ne i32 %233, 0
br i1 %234, label %239, label %235
235: ; preds = %226
%236 = load i32, i32* %36
%237 = load i32, i32* %37
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %236, i32 %237)
br label %239
239: ; preds = %235, %226
%240 = load i32, i32* %37
store i32 %240, i32* %13
%241 = load i32, i32* %36
store i32 %241, i32* %14
%242 = load i32, i32* %14
%243 = load i32, i32* %17
%244 = sub nsw i32 %242, %243
%245 = sub nsw i32 %244, 20
store i32 %245, i32* %21
%246 = load i32*, i32** %7
%247 = load i32, i32* %8
%248 = load i32, i32* %26
%249 = load i32, i32* %21
%250 = load i32, i32* %19
%251 = load i32, i32* %17
%252 = load i32, i32* %18
%253 = call i32 @XFillRectangle(i32* %246, i32 %247, i32 %248, i32 %249, i32 %250, i32 %251, i32 %252)
%254 = load i32*, i32** %7
%255 = load i32, i32* %8
%256 = load i32, i32* %30
%257 = load i32, i32* %21
%258 = load i32, i32* %20
%259 = add nsw i32 %257, %258
%260 = load i32, i32* %19
%261 = load i32, i32* %20
%262 = add nsw i32 %260, %261
%263 = add nsw i32 %262, 9
%264 = load i8*, i8** %16
%265 = load i8*, i8** %16
%266 = call i32 @strlen(i8* %265)
%267 = call i32 @XDrawString(i32* %254, i32 %255, i32 %256, i32 %259, i32 %263, i8* %264, i32 %266)
br label %268
268: ; preds = %239, %222
%269 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 0
%270 = load i32, i32* %269
%271 = icmp eq i32 %270, 4
br i1 %271, label %272, label %362
272: ; preds = %268
%273 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 2
%274 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %273, i32 0, i32 0
%275 = load i32, i32* %274
store i32 %275, i32* %38
%276 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 2
%277 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %276, i32 0, i32 1
%278 = load i32, i32* %277
store i32 %278, i32* %39
%279 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 2
%280 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %279, i32 0, i32 2
%281 = load i32, i32* %280
store i32 %281, i32* %40
%282 = load i32, i32* %6
%283 = icmp ne i32 %282, 0
br i1 %283, label %289, label %284
284: ; preds = %272
%285 = load i32, i32* %38
%286 = load i32, i32* %39
%287 = load i32, i32* %40
%288 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i32 %285, i32 %286, i32 %287)
br label %289
289: ; preds = %284, %272
%290 = load i32, i32* %40
%291 = icmp eq i32 %290, 1
br i1 %291, label %292, label %361
292: ; preds = %289
%293 = load i32*, i32** %7
%294 = load i32, i32* %8
%295 = load i32*, i32** %7
%296 = load i32, i32* %10
%297 = call i32 @DefaultGC(i32* %295, i32 %296)
%298 = load i32, i32* %38
%299 = load i32, i32* %39
%300 = call i32 @XFillRectangle(i32* %293, i32 %294, i32 %297, i32 %298, i32 %299, i32 20, i32 20)
%301 = load i32, i32* %39
%302 = load i32, i32* %18
%303 = load i32, i32* %19
%304 = add nsw i32 %302, %303
%305 = icmp slt i32 %301, %304
br i1 %305, label %306, label %360
306: ; preds = %292
%307 = load i32, i32* %38
%308 = load i32, i32* %17
%309 = load i32, i32* %21
%310 = add nsw i32 %308, %309
%311 = icmp slt i32 %307, %310
br i1 %311, label %312, label %360
312: ; preds = %306
%313 = load i32, i32* %39
%314 = load i32, i32* %19
%315 = icmp sgt i32 %313, %314
br i1 %315, label %316, label %359
316: ; preds = %312
%317 = load i32, i32* %38
%318 = load i32, i32* %21
%319 = icmp sgt i32 %317, %318
br i1 %319, label %320, label %359
320: ; preds = %316
%321 = load i32, i32* %6
%322 = icmp ne i32 %321, 0
br i1 %322, label %325, label %323
323: ; preds = %320
%324 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
br label %325
325: ; preds = %323, %320
%326 = load i32*, i32** %7
%327 = load i32, i32* %8
%328 = load i32, i32* %30
%329 = load i32, i32* %14
%330 = load i32, i32* %13
%331 = call i32 @XFillRectangle(i32* %326, i32 %327, i32 %328, i32 0, i32 0, i32 %329, i32 %330)
%332 = load i32, i32* %6
%333 = icmp ne i32 %332, 0
br i1 %333, label %336, label %334
334: ; preds = %325
%335 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %336
336: ; preds = %334, %325
%337 = load i32*, i32** %7
%338 = load i32, i32* %8
%339 = load i32, i32* %26
%340 = load i32, i32* %21
%341 = load i32, i32* %19
%342 = load i32, i32* %17
%343 = load i32, i32* %18
%344 = call i32 @XFillRectangle(i32* %337, i32 %338, i32 %339, i32 %340, i32 %341, i32 %342, i32 %343)
%345 = load i32*, i32** %7
%346 = load i32, i32* %8
%347 = load i32, i32* %30
%348 = load i32, i32* %21
%349 = load i32, i32* %20
%350 = add nsw i32 %348, %349
%351 = load i32, i32* %19
%352 = load i32, i32* %20
%353 = add nsw i32 %351, %352
%354 = add nsw i32 %353, 9
%355 = load i8*, i8** %16
%356 = load i8*, i8** %16
%357 = call i32 @strlen(i8* %356)
%358 = call i32 @XDrawString(i32* %345, i32 %346, i32 %347, i32 %350, i32 %354, i8* %355, i32 %357)
br label %359
359: ; preds = %336, %316, %312
br label %360
360: ; preds = %359, %306, %292
br label %361
361: ; preds = %360, %289
br label %362
362: ; preds = %361, %268
%363 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 0
%364 = load i32, i32* %363
%365 = load i32, i32* @KeyPress
%366 = icmp eq i32 %364, %365
br i1 %366, label %367, label %399
367: ; preds = %362
%368 = load i32, i32* %6
%369 = icmp ne i32 %368, 0
br i1 %369, label %375, label %370
370: ; preds = %367
%371 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 1
%372 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %371, i32 0, i32 0
%373 = load i32, i32* %372
%374 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %373)
br label %375
375: ; preds = %370, %367
%376 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %9, i32 0, i32 1
%377 = call i64 @XLookupKeysym(%struct.TYPE_15__* %376, i32 0)
store i64 %377, i64* %41
%378 = load i32, i32* %6
%379 = icmp ne i32 %378, 0
br i1 %379, label %383, label %380
380: ; preds = %375
%381 = load i64, i64* %41
%382 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i64 %381)
br label %383
383: ; preds = %380, %375
%384 = load i64, i64* %41
%385 = call i8* @XKeysymToString(i64 %384)
store i8* %385, i8** %42
%386 = load i32, i32* %6
%387 = icmp ne i32 %386, 0
br i1 %387, label %391, label %388
388: ; preds = %383
%389 = load i8*, i8** %42
%390 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %389)
br label %391
391: ; preds = %388, %383
%392 = load i64, i64* %41
%393 = icmp eq i64 %392, 65307
br i1 %393, label %394, label %398
394: ; preds = %391
%395 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%396 = load i32*, i32** %7
%397 = call i32 @XCloseDisplay(i32* %396)
ret i32 0
398: ; preds = %391
br label %399
399: ; preds = %398, %362
br label %157
}

LLVM IR (-O2):
%struct.TYPE_13__ = type { i32, %struct.TYPE_15__, %struct.TYPE_12__, %struct.TYPE_11__, %struct.TYPE_10__ }
%struct.TYPE_15__ = type { i32 }
%struct.TYPE_12__ = type { i32, i32, i32 }
%struct.TYPE_11__ = type { i32, i32 }
%struct.TYPE_10__ = type { i32, i32 }
%struct.TYPE_14__ = type { i32 }
@.str = [3 x i8] c"-q\00"
@.str.1 = [13 x i8] c"Clear screen\00"
@stderr = global i32 0
@.str.2 = [21 x i8] c"Cannot open display\0A\00"
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@PointerMotionMask = global i32 0
@ButtonPressMask = global i32 0
@ResizeRedirectMask = global i32 0
@Expose = global i32 0
@.str.4 = [27 x i8] c"Mouse moved. X: %d, Y: %d\0A\00"
@.str.5 = [38 x i8] c"Window resize. Width: %d, Height: %d\0A\00"
@.str.6 = [41 x i8] c"Button pressed. X: %d, Y: %d Button: %d\0A\00"
@KeyPress = global i32 0
@.str.9 = [13 x i8] c"Keycode: %d\0A\00"
@.str.10 = [13 x i8] c"Keysym: %lu\0A\00"
@.str.11 = [11 x i8] c"ASCII: %s\0A\00"
@str = [11 x i8] c"Exiting...\00"
@str.13 = [39 x i8] c"You've hitten the button!!\0AClearing...\00"
@str.14 = [26 x i8] c"Repainting clearbutton...\00"
@str.15 = [32 x i8] c"Clearing & repainting window...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.TYPE_13__
%4 = alloca %struct.TYPE_14__
%5 = alloca i64
%6 = alloca %struct.TYPE_14__
%7 = alloca i64
%8 = alloca %struct.TYPE_14__
%9 = alloca i64
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %2
%14 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %13, %2
%17 = phi i1 [ true, %2 ], [ %15, %13 ]
%18 = bitcast %struct.TYPE_13__* %3 to i8*
%19 = tail call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%20 = mul nsw i32 %19, 6
%21 = bitcast %struct.TYPE_14__* %4 to i8*
%22 = bitcast i64* %5 to i8*
store i64 19780421150584867, i64* %5
%23 = bitcast %struct.TYPE_14__* %6 to i8*
%24 = bitcast i64* %7 to i8*
store i64 13563782408586787, i64* %7
%25 = bitcast %struct.TYPE_14__* %8 to i8*
%26 = bitcast i64* %9 to i8*
store i64 19780516010411555, i64* %9
%27 = tail call i32* @XOpenDisplay(i32* null)
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %33
29: ; preds = %16
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %16
%34 = sub i32 1265, %20
%35 = tail call i32 @DefaultScreen(i32* %27)
%36 = tail call i32 @RootWindow(i32* %27, i32 %35)
%37 = tail call i32 @BlackPixel(i32* %27, i32 %35)
%38 = tail call i32 @WhitePixel(i32* %27, i32 %35)
%39 = tail call i32 @XCreateSimpleWindow(i32* %27, i32 %36, i32 0, i32 0, i32 1285, i32 910, i32 1, i32 %37, i32 %38)
%40 = load i32, i32* @ExposureMask
%41 = load i32, i32* @KeyPressMask
%42 = or i32 %41, %40
%43 = load i32, i32* @PointerMotionMask
%44 = or i32 %42, %43
%45 = load i32, i32* @ButtonPressMask
%46 = or i32 %44, %45
%47 = load i32, i32* @ResizeRedirectMask
%48 = or i32 %46, %47
%49 = tail call i32 @XSelectInput(i32* %27, i32 %39, i32 %48)
%50 = tail call i32 @XMapWindow(i32* %27, i32 %39)
%51 = tail call i32 @DefaultColormap(i32* %27, i32 0)
%52 = tail call i32 @XCreateGC(i32* %27, i32 %39, i32 0, i32 0)
%53 = call i32 @XParseColor(i32* %27, i32 %51, i8* %22, %struct.TYPE_14__* %4)
%54 = call i32 @XAllocColor(i32* %27, i32 %51, %struct.TYPE_14__* %4)
%55 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %4, i64 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @XSetForeground(i32* %27, i32 %52, i32 %56)
%58 = call i32 @DefaultColormap(i32* %27, i32 0)
%59 = call i32 @XCreateGC(i32* %27, i32 %39, i32 0, i32 0)
%60 = call i32 @XParseColor(i32* %27, i32 %51, i8* %24, %struct.TYPE_14__* %6)
%61 = call i32 @XAllocColor(i32* %27, i32 %51, %struct.TYPE_14__* %6)
%62 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %6, i64 0, i32 0
%63 = load i32, i32* %62
%64 = call i32 @XSetForeground(i32* %27, i32 %59, i32 %63)
%65 = call i32 @DefaultColormap(i32* %27, i32 0)
%66 = call i32 @XCreateGC(i32* %27, i32 %39, i32 0, i32 0)
%67 = call i32 @XParseColor(i32* %27, i32 %65, i8* %26, %struct.TYPE_14__* %8)
%68 = call i32 @XAllocColor(i32* %27, i32 %65, %struct.TYPE_14__* %8)
%69 = getelementptr inbounds %struct.TYPE_14__, %struct.TYPE_14__* %8, i64 0, i32 0
%70 = load i32, i32* %69
%71 = call i32 @XSetForeground(i32* %27, i32 %66, i32 %70)
%72 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 0
%73 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 4, i32 0
%74 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 4, i32 1
%75 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 3, i32 0
%76 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 3, i32 1
%77 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 2, i32 0
%78 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 2, i32 1
%79 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 2, i32 2
%80 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 1
%81 = getelementptr inbounds %struct.TYPE_13__, %struct.TYPE_13__* %3, i64 0, i32 1, i32 0
br label %82
82: ; preds = %182, %33
%83 = phi i32 [ %34, %33 ], [ %129, %182 ]
%84 = phi i32 [ 1285, %33 ], [ %130, %182 ]
%85 = phi i32 [ 910, %33 ], [ %131, %182 ]
%86 = call i32 @XNextEvent(i32* %27, %struct.TYPE_13__* %3)
%87 = load i32, i32* %72
%88 = load i32, i32* @Expose
%89 = icmp eq i32 %87, %88
br i1 %89, label %90, label %100
90: ; preds = %82
br i1 %17, label %91, label %93
91: ; preds = %90
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.15, i64 0, i64 0))
br label %93
93: ; preds = %91, %90
%94 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %66, i32 0, i32 0, i32 %84, i32 %85)
%95 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %59, i32 %83, i32 20, i32 %20, i32 15)
%96 = add nsw i32 %83, 2
%97 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%98 = call i32 @XDrawString(i32* %27, i32 %39, i32 %66, i32 %96, i32 31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %97)
%99 = load i32, i32* %72
br label %100
100: ; preds = %93, %82
%101 = phi i32 [ %99, %93 ], [ %87, %82 ]
%102 = icmp eq i32 %101, 6
br i1 %102, label %103, label %111
103: ; preds = %100
%104 = load i32, i32* %73
%105 = load i32, i32* %74
br i1 %17, label %106, label %108
106: ; preds = %103
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %104, i32 %105)
br label %108
108: ; preds = %106, %103
%109 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %52, i32 %104, i32 %105, i32 10, i32 10)
%110 = load i32, i32* %72
br label %111
111: ; preds = %108, %100
%112 = phi i32 [ %110, %108 ], [ %101, %100 ]
%113 = icmp eq i32 %112, 25
br i1 %113, label %114, label %127
114: ; preds = %111
%115 = load i32, i32* %75
%116 = load i32, i32* %76
br i1 %17, label %117, label %119
117: ; preds = %114
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %115, i32 %116)
br label %119
119: ; preds = %117, %114
%120 = sub nsw i32 %115, %20
%121 = add nsw i32 %120, -20
%122 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %59, i32 %121, i32 20, i32 %20, i32 15)
%123 = add nsw i32 %120, -18
%124 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%125 = call i32 @XDrawString(i32* %27, i32 %39, i32 %66, i32 %123, i32 31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %124)
%126 = load i32, i32* %72
br label %127
127: ; preds = %119, %111
%128 = phi i32 [ %126, %119 ], [ %112, %111 ]
%129 = phi i32 [ %121, %119 ], [ %83, %111 ]
%130 = phi i32 [ %115, %119 ], [ %84, %111 ]
%131 = phi i32 [ %116, %119 ], [ %85, %111 ]
%132 = icmp eq i32 %128, 4
br i1 %132, label %133, label %164
133: ; preds = %127
%134 = load i32, i32* %77
%135 = load i32, i32* %78
%136 = load i32, i32* %79
br i1 %17, label %137, label %139
137: ; preds = %133
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i32 %134, i32 %135, i32 %136)
br label %139
139: ; preds = %137, %133
%140 = icmp eq i32 %136, 1
br i1 %140, label %141, label %164
141: ; preds = %139
%142 = call i32 @DefaultGC(i32* %27, i32 %35)
%143 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %142, i32 %134, i32 %135, i32 20, i32 20)
%144 = icmp slt i32 %135, 35
%145 = add nsw i32 %129, %20
%146 = icmp slt i32 %134, %145
%147 = select i1 %144, i1 %146, i1 false
%148 = icmp sgt i32 %135, 20
%149 = and i1 %148, %147
%150 = icmp sgt i32 %134, %129
%151 = select i1 %149, i1 %150, i1 false
br i1 %151, label %152, label %164
152: ; preds = %141
br i1 %17, label %153, label %157
153: ; preds = %152
%154 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.13, i64 0, i64 0))
%155 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %66, i32 0, i32 0, i32 %130, i32 %131)
%156 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.14, i64 0, i64 0))
br label %159
157: ; preds = %152
%158 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %66, i32 0, i32 0, i32 %130, i32 %131)
br label %159
159: ; preds = %157, %153
%160 = call i32 @XFillRectangle(i32* %27, i32 %39, i32 %59, i32 %129, i32 20, i32 %20, i32 15)
%161 = add nsw i32 %129, 2
%162 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%163 = call i32 @XDrawString(i32* %27, i32 %39, i32 %66, i32 %161, i32 31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %162)
br label %164
164: ; preds = %139, %159, %141, %127
%165 = load i32, i32* %72
%166 = load i32, i32* @KeyPress
%167 = icmp eq i32 %165, %166
br i1 %167, label %168, label %182
168: ; preds = %164
br i1 %17, label %172, label %169
169: ; preds = %168
%170 = call i64 @XLookupKeysym(%struct.TYPE_15__* %80, i32 0)
%171 = call i8* @XKeysymToString(i64 %170)
br label %179
172: ; preds = %168
%173 = load i32, i32* %81
%174 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %173)
%175 = call i64 @XLookupKeysym(%struct.TYPE_15__* %80, i32 0)
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i64 %175)
%177 = call i8* @XKeysymToString(i64 %175)
%178 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %177)
br label %179
179: ; preds = %169, %172
%180 = phi i64 [ %175, %172 ], [ %170, %169 ]
%181 = icmp eq i64 %180, 65307
br i1 %181, label %183, label %182
182: ; preds = %179, %164
br label %82
183: ; preds = %179
%184 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%185 = call i32 @XCloseDisplay(i32* %27)
ret i32 0
}