#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_19__ TYPE_5__;
typedef struct TYPE_18__ TYPE_3__;
typedef struct TYPE_17__ TYPE_2__;
typedef struct TYPE_16__ TYPE_1__;
typedef struct TYPE_15__ TYPE_10__;

/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};
struct TYPE_18__ {
  int flags;
  int min_width;
  int min_height;
  int /*<<< orphan*/ win_gravity;
  int /*<<< orphan*/ initial_state;
  void *input;
};
typedef TYPE_3__ XWMHints;
typedef TYPE_3__ XSizeHints;
struct TYPE_15__ {
  int state;
};
struct TYPE_16__ {
  int /*<<< orphan*/ *l;
};
struct TYPE_17__ {
  TYPE_1__ data;
  int /*<<< orphan*/ message_type;
};
struct TYPE_19__ {
  int type;
  TYPE_10__ xkey;
  TYPE_2__ xclient;
};
typedef TYPE_5__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ KeySym;
typedef int /*<<< orphan*/ Display;
typedef void *Bool;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
unsigned long BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ CLOCK_MONOTONIC_RAW;
#define ClientMessage 129
int ControlMask;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
scalar_t__ EINTR;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ ExposureMask;
void *False;
int InputHint;
int /*<<< orphan*/ IsCursorKey(int /*<<< orphan*/);
int /*<<< orphan*/ IsFunctionKey(int /*<<< orphan*/);
int /*<<< orphan*/ IsKeypadKey(int /*<<< orphan*/);
int /*<<< orphan*/ IsMiscFunctionKey(int /*<<< orphan*/);
int /*<<< orphan*/ IsModifierKey(int /*<<< orphan*/);
#define KeyPress 128
int /*<<< orphan*/ KeyPressMask;
int LockMask;
int Mod1Mask;
int Mod2Mask;
int Mod3Mask;
int Mod4Mask;
int Mod5Mask;
int /*<<< orphan*/ NormalState;
int PMinSize;
int PWinGravity;
int ShiftMask;
int StateHint;
int /*<<< orphan*/ StaticGravity;
void *True;
TYPE_3__ *XAllocSizeHints();
TYPE_3__ *XAllocWMHints();
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int, int, int /*<<< orphan*/,
                                       unsigned long, unsigned long);
int /*<<< orphan*/ XDestroyWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XFree(TYPE_3__ *);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *, void *);
int /*<<< orphan*/ XK_Down;
int /*<<< orphan*/ XK_Escape;
int /*<<< orphan*/ XK_Left;
int /*<<< orphan*/ XK_Return;
int /*<<< orphan*/ XK_Right;
int /*<<< orphan*/ XK_Up;
int /*<<< orphan*/ XK_q;
char *XKeysymToString(int /*<<< orphan*/);
int /*<<< orphan*/ XLookupKeysym(TYPE_10__ *, int);
int XLookupString(TYPE_10__ *, char *, int, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XMoveWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                               int);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_5__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
scalar_t__ XPending(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSetWMProtocols(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XTranslateCoordinates(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, int /*<<< orphan*/,
                                         int *, int *, int /*<<< orphan*/ *);
int /*<<< orphan*/ XWindowEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/, TYPE_5__ *);
int /*<<< orphan*/ Xutf8SetWMProperties(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, char *, char *,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, TYPE_3__ *,
                                        TYPE_3__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
scalar_t__ errno;
int nanosleep(struct timespec *, struct timespec *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ timespec_diff(struct timespec *, struct timespec *);
int main(int argc, char *argv[]) {
  Display *dpy = XOpenDisplay(NULL);
  if (dpy == NULL) {
    return EXIT_FAILURE;
  }
  unsigned long black = BlackPixel(dpy, DefaultScreen(dpy));
  Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 800, 600,
                                   0, black, black);
  XWMHints *wmhints = XAllocWMHints();
  wmhints->flags = InputHint | StateHint;
  wmhints->input = True;
  wmhints->initial_state = NormalState;
  XSizeHints *sizehints = XAllocSizeHints();
  sizehints->flags = PMinSize | PWinGravity;
  sizehints->min_width = 400;
  sizehints->min_height = 300;
  sizehints->win_gravity = StaticGravity;
  Xutf8SetWMProperties(dpy, win, "Phase 01", "", NULL, 0, sizehints, wmhints,
                       NULL);
  XSelectInput(dpy, win, ExposureMask);
  Atom wm_protocol = XInternAtom(dpy, "WM_PROTOCOLS", True);
  Atom wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
  XSetWMProtocols(dpy, win, &wm_delete, 1);
  XMapWindow(dpy, win);
  XEvent e;
  XWindowEvent(dpy, win, ExposureMask, &e);
  int pos_x = 0;
  int pos_y = 0;
  Window child;
  XTranslateCoordinates(dpy, win, DefaultRootWindow(dpy), 0, 0, &pos_x, &pos_y,
                        &child);
  printf("x: %d, y: %d\n", pos_x, pos_y);
  XSelectInput(dpy, win, KeyPressMask);
  Bool done = False;
  struct timespec prev, curr;
  clock_gettime(CLOCK_MONOTONIC_RAW, &curr);
  prev.tv_sec = curr.tv_sec;
  prev.tv_nsec = curr.tv_nsec;
  double mill_store = 0;
  KeySym event_key_0, event_key_1, lookup_keysym;
  char *key_0_string = NULL, *key_1_string = NULL, lookup_buffer[20];
  int lookup_buffer_size = 20, charcount = 0;
  Bool chatting = False;
  while (!done) {
    clock_gettime(CLOCK_MONOTONIC_RAW, &curr);
    mill_store += timespec_diff(&curr, &prev);
    while (XPending(dpy) > 0) {
      XNextEvent(dpy, &e);
      switch (e.type) {
      case ClientMessage:
        if (e.xclient.message_type == wm_protocol) {
          if (e.xclient.data.l[0] == wm_delete) {
            done = True;
          }
        }
        break;
      case KeyPress:
        charcount = XLookupString(&(e.xkey), lookup_buffer, lookup_buffer_size,
                                  &lookup_keysym, NULL);
        event_key_0 = XLookupKeysym(&(e.xkey), 0);
        event_key_1 = XLookupKeysym(&(e.xkey), 1);
        key_0_string = XKeysymToString(event_key_0);
        key_1_string = XKeysymToString(event_key_1);
        if (XK_Return == event_key_0) {
          if (chatting) {
            printf("\n-Done Chatting-\n");
            chatting = False;
          } else {
            printf("Message: \n");
            chatting = True;
          }
        } else if (event_key_0 == XK_Escape) {
          done = True;
          printf("Pressed Escape, quitting.\n");
          continue;
        } else if (XK_q == event_key_0 && e.xkey.state & ControlMask) {
          done = True;
          printf("Pressed Ctrl+q, quitting.\n");
          continue;
        } else if (XK_Left == event_key_0) {
          pos_x -= 50;
          XMoveWindow(dpy, win, pos_x, pos_y);
        } else if (XK_Right == event_key_0) {
          pos_x += 50;
          XMoveWindow(dpy, win, pos_x, pos_y);
        } else if (XK_Up == event_key_0) {
          pos_y -= 50;
          XMoveWindow(dpy, win, pos_x, pos_y);
        } else if (XK_Down == event_key_0) {
          pos_y += 50;
          XMoveWindow(dpy, win, pos_x, pos_y);
        }
        if (chatting) {
          printf("%s", lookup_buffer);
        } else {
          printf("Key pressed: %s - %s", key_0_string, key_1_string);
          if (e.xkey.state & ShiftMask) {
            printf(" | Shift");
          }
          if (e.xkey.state & LockMask) {
            printf(" | Lock");
          }
          if (e.xkey.state & ControlMask) {
            printf(" | Ctrl");
          }
          if (e.xkey.state & Mod1Mask) {
            printf(" | Alt");
          }
          if (e.xkey.state & Mod2Mask) {
            printf(" | Num Lock");
          }
          if (e.xkey.state & Mod3Mask) {
            printf(" | Mod3");
          }
          if (e.xkey.state & Mod4Mask) {
            printf(" | Mod4");
          }
          if (e.xkey.state & Mod5Mask) {
            printf(" | Mod5");
          }
          if (IsCursorKey(event_key_0)) {
            printf(" | Cursor Key (0)");
          }
          if (IsCursorKey(event_key_1)) {
            printf(" | Cursor Key (1)");
          }
          if (IsFunctionKey(event_key_0)) {
            printf(" | Function key (0)");
          }
          if (IsFunctionKey(event_key_1)) {
            printf(" | Function key (1)");
          }
          if (IsKeypadKey(event_key_0)) {
            printf(" | keypad (0)");
          }
          if (IsKeypadKey(event_key_1)) {
            printf(" | keypad (1)");
          }
          if (IsMiscFunctionKey(event_key_0)) {
            printf(" | Fn (0)");
          }
          if (IsMiscFunctionKey(event_key_1)) {
            printf(" | Fn (1)");
          }
          if (IsModifierKey(event_key_0)) {
            printf(" | Modifier (0)");
          }
          if (IsModifierKey(event_key_1)) {
            printf(" | Modifier (1)");
          }
          printf("\n");
        }
        break;
      }
    }
    if (mill_store > 16.6 && !done) {
      for (; mill_store > 16.6 && !done; mill_store -= 16.6) {
      }
    }
    prev.tv_sec = curr.tv_sec;
    prev.tv_nsec = curr.tv_nsec;
    if (mill_store < 16.6 && !done) {
      struct timespec sleep_required, sleep_remaining;
      int was_error = 0;
      sleep_remaining.tv_sec = mill_store / 1000.0;
      sleep_remaining.tv_nsec = ((int)mill_store % 1000) * 1000000;
      do {
        sleep_required.tv_sec = sleep_remaining.tv_sec;
        sleep_required.tv_nsec = sleep_remaining.tv_nsec;
        errno = 0;
        was_error = nanosleep(&sleep_required, &sleep_remaining);
      } while (was_error == -1 && errno == EINTR);
    }
  }
  XFree(sizehints);
  sizehints = NULL;
  XFree(wmhints);
  wmhints = NULL;
  XDestroyWindow(dpy, win);
  XCloseDisplay(dpy);
  dpy = NULL;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   2120 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    2342 <main+0x42>
mov    0x2c08(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    2de5 <main+0xae5>
mov    -0x18(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x18(%rbp),%rdi
call   2200 <DefaultScreen@plt>
mov    -0x120(%rbp),%rdi
mov    %eax,%esi
call   21c0 <BlackPixel@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x18(%rbp),%rdi
call   2090 <DefaultRootWindow@plt>
mov    -0x118(%rbp),%rdi
mov    %eax,%esi
mov    -0x20(%rbp),%r10
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    $0x320,%r8d
mov    $0x258,%r9d
mov    %ecx,%edx
movl   $0x0,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   21a0 <XCreateSimpleWindow@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   2150 <XAllocWMHints@plt>
mov    %rax,-0x30(%rbp)
mov    0x2c00(%rip),%rax
mov    (%rax),%ecx
mov    0x2c27(%rip),%rax
or     (%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2bb0(%rip),%rax
mov    (%rax),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    0x2b3e(%rip),%rax
mov    (%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    $0x0,%al
call   2140 <XAllocSizeHints@plt>
mov    %rax,-0x38(%rbp)
mov    0x2b03(%rip),%rax
mov    (%rax),%ecx
mov    0x2b72(%rip),%rax
or     (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
movl   $0x190,0x4(%rax)
mov    -0x38(%rbp),%rax
movl   $0x12c,0x8(%rax)
mov    0x2add(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x38(%rbp),%r10
mov    -0x30(%rbp),%rax
lea    0xbb6(%rip),%rdx
lea    0xc00(%rip),%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   2110 <Xutf8SetWMProperties@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2a94(%rip),%rax
mov    (%rax),%edx
call   2190 <XSelectInput@plt>
mov    -0x18(%rbp),%rdi
mov    0x2af2(%rip),%rax
mov    (%rax),%rdx
lea    0xb71(%rip),%rsi
call   2170 <XInternAtom@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2ad5(%rip),%rax
mov    (%rax),%rdx
lea    0xb61(%rip),%rsi
call   2170 <XInternAtom@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    $0x1,%ecx
call   2130 <XSetWMProtocols@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   21d0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2a24(%rip),%rax
mov    (%rax),%edx
lea    -0x58(%rbp),%rcx
call   21e0 <XWindowEvent@plt>
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x108(%rbp)
mov    -0x18(%rbp),%rdi
call   2090 <DefaultRootWindow@plt>
mov    -0x110(%rbp),%rdi
mov    -0x108(%rbp),%esi
mov    %eax,%edx
xor    %r8d,%r8d
lea    -0x5c(%rbp),%r9
lea    -0x60(%rbp),%r10
lea    -0x64(%rbp),%rax
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   2030 <XTranslateCoordinates@plt>
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
lea    0xac9(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2a1d(%rip),%rax
mov    (%rax),%edx
call   2190 <XSelectInput@plt>
mov    0x2a1f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    0x29e1(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rsi
call   2070 <clock_gettime@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movq   $0x0,-0xb0(%rbp)
movq   $0x0,-0xb8(%rbp)
movl   $0x14,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
mov    0x29b1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
cmpq   $0x0,-0x70(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    2620 <main+0x320>
jmp    2d9a <main+0xa9a>
mov    0x2959(%rip),%rax
mov    (%rax),%edi
lea    -0x90(%rbp),%rsi
call   2070 <clock_gettime@plt>
lea    -0x90(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   21f0 <timespec_diff@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x18(%rbp),%rdi
call   2080 <XPending@plt>
cmp    $0x0,%rax
jle    2bfa <main+0x8fa>
mov    -0x18(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   2160 <XNextEvent@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x124(%rbp)
sub    $0x80,%eax
je     26dc <main+0x3dc>
jmp    2693 <main+0x393>
mov    -0x124(%rbp),%eax
sub    $0x81,%eax
jne    2bf5 <main+0x8f5>
jmp    26a9 <main+0x3a9>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    26d7 <main+0x3d7>
mov    -0x50(%rbp),%rax
mov    (%rax),%eax
cmp    -0x40(%rbp),%eax
jne    26d2 <main+0x3d2>
mov    0x28c5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
jmp    26d7 <main+0x3d7>
jmp    2bf5 <main+0x8f5>
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
lea    -0xd0(%rbp),%rsi
mov    -0xd4(%rbp),%edx
lea    -0xa4(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   2050 <XLookupString@plt>
mov    %eax,-0xd8(%rbp)
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
xor    %esi,%esi
call   2180 <XLookupKeysym@plt>
mov    %eax,-0x9c(%rbp)
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
mov    $0x1,%esi
call   2180 <XLookupKeysym@plt>
mov    %eax,-0xa0(%rbp)
mov    -0x9c(%rbp),%edi
call   2220 <XKeysymToString@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xa0(%rbp),%edi
call   2220 <XKeysymToString@plt>
mov    %rax,-0xb8(%rbp)
mov    0x2790(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    27c4 <main+0x4c4>
cmpq   $0x0,-0xe0(%rbp)
je     27a0 <main+0x4a0>
lea    0x8c2(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    0x281f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
jmp    27bf <main+0x4bf>
lea    0x8b0(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    0x27db(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
jmp    2932 <main+0x632>
mov    -0x9c(%rbp),%eax
mov    0x277f(%rip),%rcx
cmp    (%rcx),%eax
jne    27fa <main+0x4fa>
mov    0x27b0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
lea    0x874(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
jmp    265a <main+0x35a>
mov    0x2797(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    2845 <main+0x545>
mov    -0x54(%rbp),%eax
mov    0x279f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2845 <main+0x545>
mov    0x2765(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
lea    0x844(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
jmp    265a <main+0x35a>
mov    0x278c(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    287a <main+0x57a>
mov    -0x5c(%rbp),%eax
sub    $0x32,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
call   20c0 <XMoveWindow@plt>
jmp    2923 <main+0x623>
mov    0x2767(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    28af <main+0x5af>
mov    -0x5c(%rbp),%eax
add    $0x32,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
call   20c0 <XMoveWindow@plt>
jmp    291e <main+0x61e>
mov    0x26aa(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    28e4 <main+0x5e4>
mov    -0x60(%rbp),%eax
sub    $0x32,%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
call   20c0 <XMoveWindow@plt>
jmp    2919 <main+0x619>
mov    0x267d(%rip),%rax
mov    (%rax),%eax
cmp    -0x9c(%rbp),%eax
jne    2914 <main+0x614>
mov    -0x60(%rbp),%eax
add    $0x32,%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
call   20c0 <XMoveWindow@plt>
jmp    2919 <main+0x619>
jmp    291e <main+0x61e>
jmp    2923 <main+0x623>
jmp    2928 <main+0x628>
jmp    292d <main+0x62d>
jmp    2932 <main+0x632>
cmpq   $0x0,-0xe0(%rbp)
je     295a <main+0x65a>
lea    -0xd0(%rbp),%rsi
lea    0x75c(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
jmp    2bf0 <main+0x8f0>
mov    -0xb0(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    0x729(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x2640(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2999 <main+0x699>
lea    0x71b(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x25a5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     29bc <main+0x6bc>
lea    0x701(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x25f2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     29df <main+0x6df>
lea    0x6e6(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x25bf(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a02 <main+0x702>
lea    0x6cb(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x24fc(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a25 <main+0x725>
lea    0x6af(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x2549(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a48 <main+0x748>
lea    0x698(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x258e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a6b <main+0x76b>
lea    0x67d(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x2483(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a8e <main+0x78e>
lea    0x662(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x9c(%rbp),%edi
call   21b0 <IsCursorKey@plt>
cmp    $0x0,%eax
je     2ab0 <main+0x7b0>
lea    0x648(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0xa0(%rbp),%edi
call   21b0 <IsCursorKey@plt>
cmp    $0x0,%eax
je     2ad2 <main+0x7d2>
lea    0x638(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x9c(%rbp),%edi
call   2060 <IsFunctionKey@plt>
cmp    $0x0,%eax
je     2af4 <main+0x7f4>
lea    0x628(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0xa0(%rbp),%edi
call   2060 <IsFunctionKey@plt>
cmp    $0x0,%eax
je     2b16 <main+0x816>
lea    0x61a(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x9c(%rbp),%edi
call   2100 <IsKeypadKey@plt>
cmp    $0x0,%eax
je     2b38 <main+0x838>
lea    0x60c(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0xa0(%rbp),%edi
call   2100 <IsKeypadKey@plt>
cmp    $0x0,%eax
je     2b5a <main+0x85a>
lea    0x5f8(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x9c(%rbp),%edi
call   20e0 <IsMiscFunctionKey@plt>
cmp    $0x0,%eax
je     2b7c <main+0x87c>
lea    0x5e4(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0xa0(%rbp),%edi
call   20e0 <IsMiscFunctionKey@plt>
cmp    $0x0,%eax
je     2b9e <main+0x89e>
lea    0x5cc(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0x9c(%rbp),%edi
call   2040 <IsModifierKey@plt>
cmp    $0x0,%eax
je     2bc0 <main+0x8c0>
lea    0x5b4(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
mov    -0xa0(%rbp),%edi
call   2040 <IsModifierKey@plt>
cmp    $0x0,%eax
je     2be2 <main+0x8e2>
lea    0x5a2(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
lea    0x477(%rip),%rdi
mov    $0x0,%al
call   20a0 <printf@plt>
jmp    2bf5 <main+0x8f5>
jmp    265a <main+0x35a>
movsd  -0x98(%rbp),%xmm0
ff
movsd  0x3f6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    2c94 <main+0x994>
cmpq   $0x0,-0x70(%rbp)
jne    2c94 <main+0x994>
jmp    2c24 <main+0x924>
movsd  -0x98(%rbp),%xmm0
ff
xor    %eax,%eax
movsd  0x3ca(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x125(%rbp)
jbe    2c56 <main+0x956>
cmpq   $0x0,-0x70(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x125(%rbp)
mov    -0x125(%rbp),%al
test   $0x1,%al
jne    2c69 <main+0x969>
jmp    2c8f <main+0x98f>
jmp    2c6e <main+0x96e>
movsd  -0x98(%rbp),%xmm0
ff
movsd  0x382(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    2c24 <main+0x924>
jmp    2c94 <main+0x994>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x78(%rbp)
movsd  0x34e(%rip),%xmm0
ucomisd -0x98(%rbp),%xmm0
ff
jbe    2d95 <main+0xa95>
cmpq   $0x0,-0x70(%rbp)
jne    2d95 <main+0xa95>
movl   $0x0,-0x104(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  0x323(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
cvttsd2si -0x98(%rbp),%eax
ff
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0xf4240,%edx,%eax
mov    %eax,-0xf8(%rbp)
movsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
mov    -0xf8(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    0x2228(%rip),%rax
movq   $0x0,(%rax)
lea    -0xf0(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   20d0 <nanosleep@plt>
mov    %eax,-0x104(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x104(%rbp)
mov    %al,-0x126(%rbp)
jne    2d82 <main+0xa82>
mov    0x21ec(%rip),%rax
mov    (%rax),%rax
mov    0x21c2(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x126(%rbp)
mov    -0x126(%rbp),%al
test   $0x1,%al
jne    2d0d <main+0xa0d>
jmp    2d95 <main+0xa95>
jmp    2609 <main+0x309>
mov    -0x38(%rbp),%rdi
call   20b0 <XFree@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   20b0 <XFree@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   20f0 <XDestroyWindow@plt>
mov    -0x18(%rbp),%rdi
call   2210 <XCloseDisplay@plt>
movq   $0x0,-0x18(%rbp)
mov    0x2148(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
xor    %edi,%edi
call   2140 <XOpenDisplay@plt>
test   %rax,%rax
je     2595 <main+0x275>
mov    %rax,%rbx
mov    %rax,%rdi
call   2220 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   21e0 <BlackPixel@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   20b0 <DefaultRootWindow@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x320,%r8d
mov    $0x258,%r9d
push   %rbp
push   %rbp
push   $0x0
call   21c0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r15d
xor    %eax,%eax
call   2170 <XAllocWMHints@plt>
mov    0x2c30(%rip),%rcx
mov    0x2c59(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %rax,%rbp
mov    %edx,(%rax)
mov    0x2be1(%rip),%r12
mov    (%r12),%rax
mov    %rax,0x18(%rbp)
mov    0x2b72(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rbp)
xor    %eax,%eax
call   2160 <XAllocSizeHints@plt>
mov    0x2b3f(%rip),%rdx
mov    0x2bb0(%rip),%rcx
mov    (%rcx),%ecx
or     (%rdx),%ecx
mov    %ecx,(%rax)
movabs $0x12c00000190,%rcx
mov    %rcx,0x4(%rax)
mov    0x2b25(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0xc(%rax)
sub    $0x8,%rsp
lea    0xc15(%rip),%rdx
lea    0xc42(%rip),%rcx
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
mov    %rbp,0xa8(%rsp)
push   %rbp
mov    %rax,0xa8(%rsp)
push   %rax
call   2130 <Xutf8SetWMProperties@plt>
add    $0x20,%rsp
mov    0x2ae6(%rip),%r14
mov    (%r14),%edx
mov    %rbx,%rdi
mov    %r15d,%esi
call   21b0 <XSelectInput@plt>
mov    (%r12),%rdx
lea    0xbce(%rip),%rsi
mov    %rbx,%rdi
call   2190 <XInternAtom@plt>
mov    %eax,0x44(%rsp)
mov    (%r12),%rdx
lea    0xbc4(%rip),%rsi
mov    %rbx,%rdi
call   2190 <XInternAtom@plt>
mov    %eax,0x1c(%rsp)
lea    0x1c(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x1,%ecx
call   2150 <XSetWMProtocols@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   21f0 <XMapWindow@plt>
mov    (%r14),%edx
lea    0x20(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15d,%esi
call   2200 <XWindowEvent@plt>
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
mov    %rbx,%rdi
call   20b0 <DefaultRootWindow@plt>
lea    0xac(%rsp),%r11
lea    0x4(%rsp),%r10
lea    0x8(%rsp),%r9
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
push   %r11
push   %r10
call   2030 <XTranslateCoordinates@plt>
add    $0x10,%rsp
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xb43(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x2a96(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%r14
mov    %rbx,%rdi
mov    %r15d,0xc(%rsp)
mov    %r15d,%esi
call   21b0 <XSelectInput@plt>
mov    0x2a8a(%rip),%rax
mov    (%rax),%rbp
mov    0x2a50(%rip),%rax
mov    (%rax),%edi
lea    0x70(%rsp),%rsi
call   2090 <clock_gettime@plt>
movsd  0x70(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
mov    0x78(%rsp),%eax
mov    %eax,0x88(%rsp)
test   %rbp,%rbp
je     25b0 <main+0x290>
mov    0x90(%rsp),%rdi
call   20d0 <XFree@plt>
mov    0x98(%rsp),%rdi
call   20d0 <XFree@plt>
mov    %r14,%rbx
mov    %r14,%rdi
mov    0xc(%rsp),%esi
call   2110 <XDestroyWindow@plt>
mov    %r14,%rdi
call   2230 <XCloseDisplay@plt>
mov    0x2995(%rip),%rax
jmp    259c <main+0x27c>
mov    0x29a4(%rip),%rax
mov    (%rax),%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29f9(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
xorpd  %xmm1,%xmm1
jmp    25e2 <main+0x2c2>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x38(%rsp),%xmm1
mov    %rbp,%r14
test   %rbx,%rbx
jne    255b <main+0x23b>
movsd  %xmm1,0x38(%rsp)
mov    0x2991(%rip),%rax
mov    (%rax),%edi
lea    0x70(%rsp),%rbp
mov    %rbp,%rsi
call   2090 <clock_gettime@plt>
mov    %rbp,%rdi
lea    0x80(%rsp),%rsi
call   2210 <timespec_diff@plt>
mov    %rax,%rbx
mov    %r14,%rbp
mov    %r14,%rdi
call   20a0 <XPending@plt>
test   %rax,%rax
mov    %rbx,0xa0(%rsp)
jle    2a50 <main+0x730>
xor    %ebx,%ebx
jmp    2660 <main+0x340>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2949(%rip),%rax
mov    (%rax),%rbx
call   2080 <puts@plt>
mov    %rbp,%rdi
call   20a0 <XPending@plt>
test   %rax,%rax
jle    2a52 <main+0x732>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
call   2180 <XNextEvent@plt>
mov    0x20(%rsp),%eax
cmp    $0x80,%eax
jne    273b <main+0x41b>
mov    %rbx,0x48(%rsp)
lea    0x24(%rsp),%rbx
mov    %rbx,%rdi
lea    0xb0(%rsp),%rsi
mov    $0x14,%edx
lea    0xa8(%rsp),%rcx
xor    %r8d,%r8d
call   2060 <XLookupString@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   21a0 <XLookupKeysym@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    $0x1,%esi
call   21a0 <XLookupKeysym@plt>
mov    %eax,%r14d
mov    %r13d,%edi
call   2240 <XKeysymToString@plt>
mov    %rax,%r12
mov    %r14d,%edi
call   2240 <XKeysymToString@plt>
mov    %rax,%r15
mov    0x2810(%rip),%rax
cmp    %r13d,(%rax)
je     2774 <main+0x454>
lea    0xa6c(%rip),%rdi
mov    0x2859(%rip),%rax
cmp    (%rax),%r13d
je     2640 <main+0x320>
mov    0x2891(%rip),%rax
cmp    %r13d,(%rax)
jne    2726 <main+0x406>
mov    0x28a5(%rip),%rax
mov    (%rax),%eax
lea    0xa26(%rip),%rdi
test   %eax,0x24(%rsp)
jne    2640 <main+0x320>
mov    0x28ab(%rip),%rax
cmp    %r13d,(%rax)
jne    2791 <main+0x471>
mov    0x8(%rsp),%edx
add    $0xffffffce,%edx
jmp    27a4 <main+0x484>
cmp    $0x81,%eax
jne    264f <main+0x32f>
mov    0x44(%rsp),%eax
cmp    %eax,0x30(%rsp)
jne    264f <main+0x32f>
mov    0x28(%rsp),%rax
mov    (%rax),%eax
cmp    0x1c(%rsp),%eax
jne    264f <main+0x32f>
mov    0x2824(%rip),%rax
mov    (%rax),%rbx
jmp    264f <main+0x32f>
cmpq   $0x0,0x10(%rsp)
je     27ae <main+0x48e>
lea    0x9fd(%rip),%rdi
call   2080 <puts@plt>
mov    0x2821(%rip),%rax
jmp    27c1 <main+0x4a1>
mov    0x2850(%rip),%rax
cmp    %r13d,(%rax)
jne    27e9 <main+0x4c9>
mov    0x8(%rsp),%edx
add    $0x32,%edx
mov    %edx,0x8(%rsp)
mov    0x4(%rsp),%ecx
jmp    2819 <main+0x4f9>
lea    0x9c1(%rip),%rdi
call   2080 <puts@plt>
mov    0x27cf(%rip),%rax
mov    (%rax),%rax
test   %rax,%rax
je     282f <main+0x50f>
mov    %rax,0x10(%rsp)
lea    0x88a(%rip),%rdi
lea    0xb0(%rsp),%rsi
xor    %eax,%eax
call   20c0 <printf@plt>
jmp    2a40 <main+0x720>
mov    0x2770(%rip),%rax
cmp    %r13d,(%rax)
jne    27fe <main+0x4de>
mov    0x4(%rsp),%ecx
add    $0xffffffce,%ecx
jmp    2811 <main+0x4f1>
mov    0x2763(%rip),%rax
cmp    %r13d,(%rax)
jne    2825 <main+0x505>
mov    0x4(%rsp),%ecx
add    $0x32,%ecx
mov    %ecx,0x4(%rsp)
mov    0x8(%rsp),%edx
mov    %rbp,%rdi
mov    0xc(%rsp),%esi
call   20e0 <XMoveWindow@plt>
mov    0x10(%rsp),%rax
test   %rax,%rax
jne    27c9 <main+0x4a9>
lea    0x817(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x2772(%rip),%rcx
test   %eax,(%rcx)
je     2864 <main+0x544>
lea    0x809(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x26dd(%rip),%rcx
test   %eax,(%rcx)
je     2881 <main+0x561>
lea    0x7f5(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x2730(%rip),%rcx
test   %eax,(%rcx)
je     289e <main+0x57e>
lea    0x7e0(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x2703(%rip),%rcx
test   %eax,(%rcx)
je     28bb <main+0x59b>
lea    0x7cb(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x2646(%rip),%rcx
test   %eax,(%rcx)
je     28d8 <main+0x5b8>
lea    0x7b5(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x2699(%rip),%rcx
test   %eax,(%rcx)
je     28f5 <main+0x5d5>
lea    0x7a4(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x26e4(%rip),%rcx
test   %eax,(%rcx)
je     2912 <main+0x5f2>
lea    0x78f(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    0x24(%rsp),%eax
mov    0x25df(%rip),%rcx
test   %eax,(%rcx)
je     292b <main+0x60b>
lea    0x77a(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r13d,%edi
call   21d0 <IsCursorKey@plt>
test   %eax,%eax
je     2945 <main+0x625>
lea    0x768(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r14d,%edi
call   21d0 <IsCursorKey@plt>
test   %eax,%eax
je     295f <main+0x63f>
lea    0x760(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r13d,%edi
call   2070 <IsFunctionKey@plt>
test   %eax,%eax
je     2979 <main+0x659>
lea    0x758(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r14d,%edi
call   2070 <IsFunctionKey@plt>
test   %eax,%eax
je     2993 <main+0x673>
lea    0x752(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r13d,%edi
call   2120 <IsKeypadKey@plt>
test   %eax,%eax
je     29ad <main+0x68d>
lea    0x74c(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r14d,%edi
call   2120 <IsKeypadKey@plt>
test   %eax,%eax
je     29c7 <main+0x6a7>
lea    0x740(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r13d,%edi
call   2100 <IsMiscFunctionKey@plt>
test   %eax,%eax
je     29e1 <main+0x6c1>
lea    0x734(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r14d,%edi
call   2100 <IsMiscFunctionKey@plt>
test   %eax,%eax
je     29fb <main+0x6db>
lea    0x724(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r13d,%edi
call   2050 <IsModifierKey@plt>
test   %eax,%eax
je     2a15 <main+0x6f5>
lea    0x714(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    %r14d,%edi
call   2050 <IsModifierKey@plt>
test   %eax,%eax
je     2a2f <main+0x70f>
lea    0x70a(%rip),%rdi
xor    %eax,%eax
call   20c0 <printf@plt>
mov    $0xa,%edi
call   2040 <putchar@plt>
xor    %eax,%eax
mov    %rax,0x10(%rsp)
mov    0x48(%rsp),%rbx
jmp    264f <main+0x32f>
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sdq 0xa0(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x58f(%rip),%xmm2
ucomisd %xmm2,%xmm1
jbe    2aa0 <main+0x780>
test   %rbx,%rbx
jne    2aa0 <main+0x780>
movsd  0x584(%rip),%xmm0
mov    0x24cd(%rip),%rsi
nopl   0x0(%rax,%rax,1)
addsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
ja     2a90 <main+0x770>
jmp    2aa7 <main+0x787>
nopl   0x0(%rax)
mov    0x24b1(%rip),%rsi
movsd  0x70(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
mov    0x78(%rsp),%eax
mov    %eax,0x88(%rsp)
ucomisd %xmm1,%xmm2
jbe    25d6 <main+0x2b6>
test   %rbx,%rbx
jne    25d6 <main+0x2b6>
movapd %xmm1,%xmm0
divsd  0x530(%rip),%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  %xmm1,0x38(%rsp)
cvttsd2si %xmm1,%eax
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0xf4240,%eax,%eax
mov    %eax,0x58(%rsp)
movsd  %xmm0,0x60(%rsp)
mov    %eax,0x68(%rsp)
movq   $0x0,(%rsi)
nopl   0x0(%rax)
lea    0x60(%rsp),%rdi
lea    0x50(%rsp),%rsi
call   20f0 <nanosleep@plt>
mov    0x2412(%rip),%rcx
cmp    $0xffffffff,%eax
jne    25d0 <main+0x2b0>
mov    0x23e2(%rip),%rax
mov    (%rax),%rax
cmp    %rax,(%rcx)
jne    25d0 <main+0x2b0>
movsd  0x50(%rsp),%xmm0
mov    0x58(%rsp),%eax
movsd  %xmm0,0x60(%rsp)
mov    %eax,0x68(%rsp)
movq   $0x0,(%rcx)
jmp    2b30 <main+0x810>

LLVM IR (-O0):
%struct.TYPE_18__ = type { i32, i32, i32, i32, i32, i8* }
%struct.TYPE_19__ = type { i32, %struct.TYPE_15__, %struct.TYPE_17__ }
%struct.TYPE_15__ = type { i32 }
%struct.TYPE_17__ = type { %struct.TYPE_16__, i32 }
%struct.TYPE_16__ = type { i32* }
%struct.timespec = type { double, i32 }
@EXIT_FAILURE = global i32 0
@InputHint = global i32 0
@StateHint = global i32 0
@True = global i8* null
@NormalState = global i32 0
@PMinSize = global i32 0
@PWinGravity = global i32 0
@StaticGravity = global i32 0
@.str = [9 x i8] c"Phase 01\00"
@.str.1 = [1 x i8] zeroinitializer
@ExposureMask = global i32 0
@.str.2 = [13 x i8] c"WM_PROTOCOLS\00"
@.str.3 = [17 x i8] c"WM_DELETE_WINDOW\00"
@.str.4 = [14 x i8] c"x: %d, y: %d\0A\00"
@KeyPressMask = global i32 0
@False = global i8* null
@CLOCK_MONOTONIC_RAW = global i32 0
@XK_Return = global i32 0
@.str.5 = [18 x i8] c"\0A-Done Chatting-\0A\00"
@.str.6 = [11 x i8] c"Message: \0A\00"
@XK_Escape = global i32 0
@.str.7 = [27 x i8] c"Pressed Escape, quitting.\0A\00"
@XK_q = global i32 0
@ControlMask = global i32 0
@.str.8 = [27 x i8] c"Pressed Ctrl+q, quitting.\0A\00"
@XK_Left = global i32 0
@XK_Right = global i32 0
@XK_Up = global i32 0
@XK_Down = global i32 0
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [21 x i8] c"Key pressed: %s - %s\00"
@ShiftMask = global i32 0
@.str.11 = [9 x i8] c" | Shift\00"
@LockMask = global i32 0
@.str.12 = [8 x i8] c" | Lock\00"
@.str.13 = [8 x i8] c" | Ctrl\00"
@Mod1Mask = global i32 0
@.str.14 = [7 x i8] c" | Alt\00"
@Mod2Mask = global i32 0
@.str.15 = [12 x i8] c" | Num Lock\00"
@Mod3Mask = global i32 0
@.str.16 = [8 x i8] c" | Mod3\00"
@Mod4Mask = global i32 0
@.str.17 = [8 x i8] c" | Mod4\00"
@Mod5Mask = global i32 0
@.str.18 = [8 x i8] c" | Mod5\00"
@.str.19 = [18 x i8] c" | Cursor Key (0)\00"
@.str.20 = [18 x i8] c" | Cursor Key (1)\00"
@.str.21 = [20 x i8] c" | Function key (0)\00"
@.str.22 = [20 x i8] c" | Function key (1)\00"
@.str.23 = [14 x i8] c" | keypad (0)\00"
@.str.24 = [14 x i8] c" | keypad (1)\00"
@.str.25 = [10 x i8] c" | Fn (0)\00"
@.str.26 = [10 x i8] c" | Fn (1)\00"
@.str.27 = [16 x i8] c" | Modifier (0)\00"
@.str.28 = [16 x i8] c" | Modifier (1)\00"
@.str.29 = [2 x i8] c"\0A\00"
@errno = global i64 0
@EINTR = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
%9 = alloca %struct.TYPE_18__*
%10 = alloca %struct.TYPE_18__*
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.TYPE_19__
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca %struct.timespec
%19 = alloca %struct.timespec
%20 = alloca double
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca [20 x i8]
%27 = alloca i32
%28 = alloca i32
%29 = alloca i8*
%30 = alloca %struct.timespec
%31 = alloca %struct.timespec
%32 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%33 = call i32* @XOpenDisplay(i32* null)
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %38
36: ; preds = %2
%37 = load i32, i32* @EXIT_FAILURE
store i32 %37, i32* %3
br label %478
38: ; preds = %2
%39 = load i32*, i32** %6
%40 = load i32*, i32** %6
%41 = call i32 @DefaultScreen(i32* %40)
%42 = call i64 @BlackPixel(i32* %39, i32 %41)
store i64 %42, i64* %7
%43 = load i32*, i32** %6
%44 = load i32*, i32** %6
%45 = call i32 @DefaultRootWindow(i32* %44)
%46 = load i64, i64* %7
%47 = load i64, i64* %7
%48 = call i32 @XCreateSimpleWindow(i32* %43, i32 %45, i32 0, i32 0, i32 800, i32 600, i32 0, i64 %46, i64 %47)
store i32 %48, i32* %8
%49 = call %struct.TYPE_18__* (...) @XAllocWMHints()
store %struct.TYPE_18__* %49, %struct.TYPE_18__** %9
%50 = load i32, i32* @InputHint
%51 = load i32, i32* @StateHint
%52 = or i32 %50, %51
%53 = load %struct.TYPE_18__*, %struct.TYPE_18__** %9
%54 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %53, i32 0, i32 0
store i32 %52, i32* %54
%55 = load i8*, i8** @True
%56 = load %struct.TYPE_18__*, %struct.TYPE_18__** %9
%57 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %56, i32 0, i32 5
store i8* %55, i8** %57
%58 = load i32, i32* @NormalState
%59 = load %struct.TYPE_18__*, %struct.TYPE_18__** %9
%60 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %59, i32 0, i32 4
store i32 %58, i32* %60
%61 = call %struct.TYPE_18__* (...) @XAllocSizeHints()
store %struct.TYPE_18__* %61, %struct.TYPE_18__** %10
%62 = load i32, i32* @PMinSize
%63 = load i32, i32* @PWinGravity
%64 = or i32 %62, %63
%65 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%66 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %65, i32 0, i32 0
store i32 %64, i32* %66
%67 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%68 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %67, i32 0, i32 1
store i32 400, i32* %68
%69 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%70 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %69, i32 0, i32 2
store i32 300, i32* %70
%71 = load i32, i32* @StaticGravity
%72 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%73 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %72, i32 0, i32 3
store i32 %71, i32* %73
%74 = load i32*, i32** %6
%75 = load i32, i32* %8
%76 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%77 = load %struct.TYPE_18__*, %struct.TYPE_18__** %9
%78 = call i32 @Xutf8SetWMProperties(i32* %74, i32 %75, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32* null, i32 0, %struct.TYPE_18__* %76, %struct.TYPE_18__* %77, i32* null)
%79 = load i32*, i32** %6
%80 = load i32, i32* %8
%81 = load i32, i32* @ExposureMask
%82 = call i32 @XSelectInput(i32* %79, i32 %80, i32 %81)
%83 = load i32*, i32** %6
%84 = load i8*, i8** @True
%85 = call i32 @XInternAtom(i32* %83, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %84)
store i32 %85, i32* %11
%86 = load i32*, i32** %6
%87 = load i8*, i8** @True
%88 = call i32 @XInternAtom(i32* %86, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %87)
store i32 %88, i32* %12
%89 = load i32*, i32** %6
%90 = load i32, i32* %8
%91 = call i32 @XSetWMProtocols(i32* %89, i32 %90, i32* %12, i32 1)
%92 = load i32*, i32** %6
%93 = load i32, i32* %8
%94 = call i32 @XMapWindow(i32* %92, i32 %93)
%95 = load i32*, i32** %6
%96 = load i32, i32* %8
%97 = load i32, i32* @ExposureMask
%98 = call i32 @XWindowEvent(i32* %95, i32 %96, i32 %97, %struct.TYPE_19__* %13)
store i32 0, i32* %14
store i32 0, i32* %15
%99 = load i32*, i32** %6
%100 = load i32, i32* %8
%101 = load i32*, i32** %6
%102 = call i32 @DefaultRootWindow(i32* %101)
%103 = call i32 @XTranslateCoordinates(i32* %99, i32 %100, i32 %102, i32 0, i32 0, i32* %14, i32* %15, i32* %16)
%104 = load i32, i32* %14
%105 = load i32, i32* %15
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %104, i32 %105)
%107 = load i32*, i32** %6
%108 = load i32, i32* %8
%109 = load i32, i32* @KeyPressMask
%110 = call i32 @XSelectInput(i32* %107, i32 %108, i32 %109)
%111 = load i8*, i8** @False
store i8* %111, i8** %17
%112 = load i32, i32* @CLOCK_MONOTONIC_RAW
%113 = call i32 @clock_gettime(i32 %112, %struct.timespec* %19)
%114 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 0
%115 = load double, double* %114
%116 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 0
store double %115, double* %116
%117 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 1
%118 = load i32, i32* %117
%119 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 1
store i32 %118, i32* %119
store double 0.000000e+00, double* %20
store i8* null, i8** %24
store i8* null, i8** %25
store i32 20, i32* %27
store i32 0, i32* %28
%120 = load i8*, i8** @False
store i8* %120, i8** %29
br label %121
121: ; preds = %466, %38
%122 = load i8*, i8** %17
%123 = icmp ne i8* %122, null
%124 = xor i1 %123, true
br i1 %124, label %125, label %467
125: ; preds = %121
%126 = load i32, i32* @CLOCK_MONOTONIC_RAW
%127 = call i32 @clock_gettime(i32 %126, %struct.timespec* %19)
%128 = call i64 @timespec_diff(%struct.timespec* %19, %struct.timespec* %18)
%129 = sitofp i64 %128 to double
%130 = load double, double* %20
%131 = fadd double %130, %129
store double %131, double* %20
br label %132
132: ; preds = %405, %204, %190, %125
%133 = load i32*, i32** %6
%134 = call i64 @XPending(i32* %133)
%135 = icmp sgt i64 %134, 0
br i1 %135, label %136, label %406
136: ; preds = %132
%137 = load i32*, i32** %6
%138 = call i32 @XNextEvent(i32* %137, %struct.TYPE_19__* %13)
%139 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 0
%140 = load i32, i32* %139
switch i32 %140, label %405 [
i32 129, label %141
i32 128, label %160
]
141: ; preds = %136
%142 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 2
%143 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %142, i32 0, i32 1
%144 = load i32, i32* %143
%145 = load i32, i32* %11
%146 = icmp eq i32 %144, %145
br i1 %146, label %147, label %159
147: ; preds = %141
%148 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 2
%149 = getelementptr inbounds %struct.TYPE_17__, %struct.TYPE_17__* %148, i32 0, i32 0
%150 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %149, i32 0, i32 0
%151 = load i32*, i32** %150
%152 = getelementptr inbounds i32, i32* %151, i64 0
%153 = load i32, i32* %152
%154 = load i32, i32* %12
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %158
156: ; preds = %147
%157 = load i8*, i8** @True
store i8* %157, i8** %17
br label %158
158: ; preds = %156, %147
br label %159
159: ; preds = %158, %141
br label %405
160: ; preds = %136
%161 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%162 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%163 = load i32, i32* %27
%164 = call i32 @XLookupString(%struct.TYPE_15__* %161, i8* %162, i32 %163, i32* %23, i32* null)
store i32 %164, i32* %28
%165 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%166 = call i32 @XLookupKeysym(%struct.TYPE_15__* %165, i32 0)
store i32 %166, i32* %21
%167 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%168 = call i32 @XLookupKeysym(%struct.TYPE_15__* %167, i32 1)
store i32 %168, i32* %22
%169 = load i32, i32* %21
%170 = call i8* @XKeysymToString(i32 %169)
store i8* %170, i8** %24
%171 = load i32, i32* %22
%172 = call i8* @XKeysymToString(i32 %171)
store i8* %172, i8** %25
%173 = load i32, i32* @XK_Return
%174 = load i32, i32* %21
%175 = icmp eq i32 %173, %174
br i1 %175, label %176, label %186
176: ; preds = %160
%177 = load i8*, i8** %29
%178 = icmp ne i8* %177, null
br i1 %178, label %179, label %182
179: ; preds = %176
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%181 = load i8*, i8** @False
store i8* %181, i8** %29
br label %185
182: ; preds = %176
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%184 = load i8*, i8** @True
store i8* %184, i8** %29
br label %185
185: ; preds = %182, %179
br label %261
186: ; preds = %160
%187 = load i32, i32* %21
%188 = load i32, i32* @XK_Escape
%189 = icmp eq i32 %187, %188
br i1 %189, label %190, label %193
190: ; preds = %186
%191 = load i8*, i8** @True
store i8* %191, i8** %17
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %132
193: ; preds = %186
%194 = load i32, i32* @XK_q
%195 = load i32, i32* %21
%196 = icmp eq i32 %194, %195
br i1 %196, label %197, label %207
197: ; preds = %193
%198 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%199 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %198, i32 0, i32 0
%200 = load i32, i32* %199
%201 = load i32, i32* @ControlMask
%202 = and i32 %200, %201
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %207
204: ; preds = %197
%205 = load i8*, i8** @True
store i8* %205, i8** %17
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %132
207: ; preds = %197, %193
%208 = load i32, i32* @XK_Left
%209 = load i32, i32* %21
%210 = icmp eq i32 %208, %209
br i1 %210, label %211, label %219
211: ; preds = %207
%212 = load i32, i32* %14
%213 = sub nsw i32 %212, 50
store i32 %213, i32* %14
%214 = load i32*, i32** %6
%215 = load i32, i32* %8
%216 = load i32, i32* %14
%217 = load i32, i32* %15
%218 = call i32 @XMoveWindow(i32* %214, i32 %215, i32 %216, i32 %217)
br label %258
219: ; preds = %207
%220 = load i32, i32* @XK_Right
%221 = load i32, i32* %21
%222 = icmp eq i32 %220, %221
br i1 %222, label %223, label %231
223: ; preds = %219
%224 = load i32, i32* %14
%225 = add nsw i32 %224, 50
store i32 %225, i32* %14
%226 = load i32*, i32** %6
%227 = load i32, i32* %8
%228 = load i32, i32* %14
%229 = load i32, i32* %15
%230 = call i32 @XMoveWindow(i32* %226, i32 %227, i32 %228, i32 %229)
br label %257
231: ; preds = %219
%232 = load i32, i32* @XK_Up
%233 = load i32, i32* %21
%234 = icmp eq i32 %232, %233
br i1 %234, label %235, label %243
235: ; preds = %231
%236 = load i32, i32* %15
%237 = sub nsw i32 %236, 50
store i32 %237, i32* %15
%238 = load i32*, i32** %6
%239 = load i32, i32* %8
%240 = load i32, i32* %14
%241 = load i32, i32* %15
%242 = call i32 @XMoveWindow(i32* %238, i32 %239, i32 %240, i32 %241)
br label %256
243: ; preds = %231
%244 = load i32, i32* @XK_Down
%245 = load i32, i32* %21
%246 = icmp eq i32 %244, %245
br i1 %246, label %247, label %255
247: ; preds = %243
%248 = load i32, i32* %15
%249 = add nsw i32 %248, 50
store i32 %249, i32* %15
%250 = load i32*, i32** %6
%251 = load i32, i32* %8
%252 = load i32, i32* %14
%253 = load i32, i32* %15
%254 = call i32 @XMoveWindow(i32* %250, i32 %251, i32 %252, i32 %253)
br label %255
255: ; preds = %247, %243
br label %256
256: ; preds = %255, %235
br label %257
257: ; preds = %256, %223
br label %258
258: ; preds = %257, %211
br label %259
259: ; preds = %258
br label %260
260: ; preds = %259
br label %261
261: ; preds = %260, %185
%262 = load i8*, i8** %29
%263 = icmp ne i8* %262, null
br i1 %263, label %264, label %267
264: ; preds = %261
%265 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%266 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %265)
br label %404
267: ; preds = %261
%268 = load i8*, i8** %24
%269 = load i8*, i8** %25
%270 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %268, i8* %269)
%271 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%272 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %271, i32 0, i32 0
%273 = load i32, i32* %272
%274 = load i32, i32* @ShiftMask
%275 = and i32 %273, %274
%276 = icmp ne i32 %275, 0
br i1 %276, label %277, label %279
277: ; preds = %267
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %279
279: ; preds = %277, %267
%280 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%281 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %280, i32 0, i32 0
%282 = load i32, i32* %281
%283 = load i32, i32* @LockMask
%284 = and i32 %282, %283
%285 = icmp ne i32 %284, 0
br i1 %285, label %286, label %288
286: ; preds = %279
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
br label %288
288: ; preds = %286, %279
%289 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%290 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %289, i32 0, i32 0
%291 = load i32, i32* %290
%292 = load i32, i32* @ControlMask
%293 = and i32 %291, %292
%294 = icmp ne i32 %293, 0
br i1 %294, label %295, label %297
295: ; preds = %288
%296 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %297
297: ; preds = %295, %288
%298 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%299 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %298, i32 0, i32 0
%300 = load i32, i32* %299
%301 = load i32, i32* @Mod1Mask
%302 = and i32 %300, %301
%303 = icmp ne i32 %302, 0
br i1 %303, label %304, label %306
304: ; preds = %297
%305 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
br label %306
306: ; preds = %304, %297
%307 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%308 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %307, i32 0, i32 0
%309 = load i32, i32* %308
%310 = load i32, i32* @Mod2Mask
%311 = and i32 %309, %310
%312 = icmp ne i32 %311, 0
br i1 %312, label %313, label %315
313: ; preds = %306
%314 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %315
315: ; preds = %313, %306
%316 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%317 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %316, i32 0, i32 0
%318 = load i32, i32* %317
%319 = load i32, i32* @Mod3Mask
%320 = and i32 %318, %319
%321 = icmp ne i32 %320, 0
br i1 %321, label %322, label %324
322: ; preds = %315
%323 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
br label %324
324: ; preds = %322, %315
%325 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%326 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %325, i32 0, i32 0
%327 = load i32, i32* %326
%328 = load i32, i32* @Mod4Mask
%329 = and i32 %327, %328
%330 = icmp ne i32 %329, 0
br i1 %330, label %331, label %333
331: ; preds = %324
%332 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
br label %333
333: ; preds = %331, %324
%334 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %13, i32 0, i32 1
%335 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %334, i32 0, i32 0
%336 = load i32, i32* %335
%337 = load i32, i32* @Mod5Mask
%338 = and i32 %336, %337
%339 = icmp ne i32 %338, 0
br i1 %339, label %340, label %342
340: ; preds = %333
%341 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
br label %342
342: ; preds = %340, %333
%343 = load i32, i32* %21
%344 = call i32 @IsCursorKey(i32 %343)
%345 = icmp ne i32 %344, 0
br i1 %345, label %346, label %348
346: ; preds = %342
%347 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0))
br label %348
348: ; preds = %346, %342
%349 = load i32, i32* %22
%350 = call i32 @IsCursorKey(i32 %349)
%351 = icmp ne i32 %350, 0
br i1 %351, label %352, label %354
352: ; preds = %348
%353 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0))
br label %354
354: ; preds = %352, %348
%355 = load i32, i32* %21
%356 = call i32 @IsFunctionKey(i32 %355)
%357 = icmp ne i32 %356, 0
br i1 %357, label %358, label %360
358: ; preds = %354
%359 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.21, i64 0, i64 0))
br label %360
360: ; preds = %358, %354
%361 = load i32, i32* %22
%362 = call i32 @IsFunctionKey(i32 %361)
%363 = icmp ne i32 %362, 0
br i1 %363, label %364, label %366
364: ; preds = %360
%365 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
br label %366
366: ; preds = %364, %360
%367 = load i32, i32* %21
%368 = call i32 @IsKeypadKey(i32 %367)
%369 = icmp ne i32 %368, 0
br i1 %369, label %370, label %372
370: ; preds = %366
%371 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0))
br label %372
372: ; preds = %370, %366
%373 = load i32, i32* %22
%374 = call i32 @IsKeypadKey(i32 %373)
%375 = icmp ne i32 %374, 0
br i1 %375, label %376, label %378
376: ; preds = %372
%377 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0))
br label %378
378: ; preds = %376, %372
%379 = load i32, i32* %21
%380 = call i32 @IsMiscFunctionKey(i32 %379)
%381 = icmp ne i32 %380, 0
br i1 %381, label %382, label %384
382: ; preds = %378
%383 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0))
br label %384
384: ; preds = %382, %378
%385 = load i32, i32* %22
%386 = call i32 @IsMiscFunctionKey(i32 %385)
%387 = icmp ne i32 %386, 0
br i1 %387, label %388, label %390
388: ; preds = %384
%389 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0))
br label %390
390: ; preds = %388, %384
%391 = load i32, i32* %21
%392 = call i32 @IsModifierKey(i32 %391)
%393 = icmp ne i32 %392, 0
br i1 %393, label %394, label %396
394: ; preds = %390
%395 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0))
br label %396
396: ; preds = %394, %390
%397 = load i32, i32* %22
%398 = call i32 @IsModifierKey(i32 %397)
%399 = icmp ne i32 %398, 0
br i1 %399, label %400, label %402
400: ; preds = %396
%401 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0))
br label %402
402: ; preds = %400, %396
%403 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.29, i64 0, i64 0))
br label %404
404: ; preds = %402, %264
br label %405
405: ; preds = %136, %404, %159
br label %132
406: ; preds = %132
%407 = load double, double* %20
%408 = fcmp ogt double %407, 1.660000e+01
br i1 %408, label %409, label %427
409: ; preds = %406
%410 = load i8*, i8** %17
%411 = icmp ne i8* %410, null
br i1 %411, label %427, label %412
412: ; preds = %409
br label %413
413: ; preds = %423, %412
%414 = load double, double* %20
%415 = fcmp ogt double %414, 1.660000e+01
br i1 %415, label %416, label %420
416: ; preds = %413
%417 = load i8*, i8** %17
%418 = icmp ne i8* %417, null
%419 = xor i1 %418, true
br label %420
420: ; preds = %416, %413
%421 = phi i1 [ false, %413 ], [ %419, %416 ]
br i1 %421, label %422, label %426
422: ; preds = %420
br label %423
423: ; preds = %422
%424 = load double, double* %20
%425 = fsub double %424, 1.660000e+01
store double %425, double* %20
br label %413
426: ; preds = %420
br label %427
427: ; preds = %426, %409, %406
%428 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 0
%429 = load double, double* %428
%430 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 0
store double %429, double* %430
%431 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 1
%432 = load i32, i32* %431
%433 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 1
store i32 %432, i32* %433
%434 = load double, double* %20
%435 = fcmp olt double %434, 1.660000e+01
br i1 %435, label %436, label %466
436: ; preds = %427
%437 = load i8*, i8** %17
%438 = icmp ne i8* %437, null
br i1 %438, label %466, label %439
439: ; preds = %436
store i32 0, i32* %32
%440 = load double, double* %20
%441 = fdiv double %440, 1.000000e+03
%442 = getelementptr inbounds %struct.timespec, %struct.timespec* %31, i32 0, i32 0
store double %441, double* %442
%443 = load double, double* %20
%444 = fptosi double %443 to i32
%445 = srem i32 %444, 1000
%446 = mul nsw i32 %445, 1000000
%447 = getelementptr inbounds %struct.timespec, %struct.timespec* %31, i32 0, i32 1
store i32 %446, i32* %447
br label %448
448: ; preds = %463, %439
%449 = getelementptr inbounds %struct.timespec, %struct.timespec* %31, i32 0, i32 0
%450 = load double, double* %449
%451 = getelementptr inbounds %struct.timespec, %struct.timespec* %30, i32 0, i32 0
store double %450, double* %451
%452 = getelementptr inbounds %struct.timespec, %struct.timespec* %31, i32 0, i32 1
%453 = load i32, i32* %452
%454 = getelementptr inbounds %struct.timespec, %struct.timespec* %30, i32 0, i32 1
store i32 %453, i32* %454
store i64 0, i64* @errno
%455 = call i32 @nanosleep(%struct.timespec* %30, %struct.timespec* %31)
store i32 %455, i32* %32
br label %456
456: ; preds = %448
%457 = load i32, i32* %32
%458 = icmp eq i32 %457, -1
br i1 %458, label %459, label %463
459: ; preds = %456
%460 = load i64, i64* @errno
%461 = load i64, i64* @EINTR
%462 = icmp eq i64 %460, %461
br label %463
463: ; preds = %459, %456
%464 = phi i1 [ false, %456 ], [ %462, %459 ]
br i1 %464, label %448, label %465
465: ; preds = %463
br label %466
466: ; preds = %465, %436, %427
br label %121
467: ; preds = %121
%468 = load %struct.TYPE_18__*, %struct.TYPE_18__** %10
%469 = call i32 @XFree(%struct.TYPE_18__* %468)
store %struct.TYPE_18__* null, %struct.TYPE_18__** %10
%470 = load %struct.TYPE_18__*, %struct.TYPE_18__** %9
%471 = call i32 @XFree(%struct.TYPE_18__* %470)
store %struct.TYPE_18__* null, %struct.TYPE_18__** %9
%472 = load i32*, i32** %6
%473 = load i32, i32* %8
%474 = call i32 @XDestroyWindow(i32* %472, i32 %473)
%475 = load i32*, i32** %6
%476 = call i32 @XCloseDisplay(i32* %475)
store i32* null, i32** %6
%477 = load i32, i32* @EXIT_SUCCESS
store i32 %477, i32* %3
br label %478
478: ; preds = %467, %36
%479 = load i32, i32* %3
ret i32 %479
}

LLVM IR (-O2):
%struct.TYPE_19__ = type { i32, %struct.TYPE_15__, %struct.TYPE_17__ }
%struct.TYPE_15__ = type { i32 }
%struct.TYPE_17__ = type { %struct.TYPE_16__, i32 }
%struct.TYPE_16__ = type { i32* }
%struct.timespec = type { double, i32 }
%struct.TYPE_18__ = type { i32, i32, i32, i32, i32, i8* }
@EXIT_FAILURE = global i32 0
@InputHint = global i32 0
@StateHint = global i32 0
@True = global i8* null
@NormalState = global i32 0
@PMinSize = global i32 0
@PWinGravity = global i32 0
@StaticGravity = global i32 0
@.str = [9 x i8] c"Phase 01\00"
@.str.1 = [1 x i8] zeroinitializer
@ExposureMask = global i32 0
@.str.2 = [13 x i8] c"WM_PROTOCOLS\00"
@.str.3 = [17 x i8] c"WM_DELETE_WINDOW\00"
@.str.4 = [14 x i8] c"x: %d, y: %d\0A\00"
@KeyPressMask = global i32 0
@False = global i8* null
@CLOCK_MONOTONIC_RAW = global i32 0
@XK_Return = global i32 0
@XK_Escape = global i32 0
@XK_q = global i32 0
@ControlMask = global i32 0
@XK_Left = global i32 0
@XK_Right = global i32 0
@XK_Up = global i32 0
@XK_Down = global i32 0
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [21 x i8] c"Key pressed: %s - %s\00"
@ShiftMask = global i32 0
@.str.11 = [9 x i8] c" | Shift\00"
@LockMask = global i32 0
@.str.12 = [8 x i8] c" | Lock\00"
@.str.13 = [8 x i8] c" | Ctrl\00"
@Mod1Mask = global i32 0
@.str.14 = [7 x i8] c" | Alt\00"
@Mod2Mask = global i32 0
@.str.15 = [12 x i8] c" | Num Lock\00"
@Mod3Mask = global i32 0
@.str.16 = [8 x i8] c" | Mod3\00"
@Mod4Mask = global i32 0
@.str.17 = [8 x i8] c" | Mod4\00"
@Mod5Mask = global i32 0
@.str.18 = [8 x i8] c" | Mod5\00"
@.str.19 = [18 x i8] c" | Cursor Key (0)\00"
@.str.20 = [18 x i8] c" | Cursor Key (1)\00"
@.str.21 = [20 x i8] c" | Function key (0)\00"
@.str.22 = [20 x i8] c" | Function key (1)\00"
@.str.23 = [14 x i8] c" | keypad (0)\00"
@.str.24 = [14 x i8] c" | keypad (1)\00"
@.str.25 = [10 x i8] c" | Fn (0)\00"
@.str.26 = [10 x i8] c" | Fn (1)\00"
@.str.27 = [16 x i8] c" | Modifier (0)\00"
@.str.28 = [16 x i8] c" | Modifier (1)\00"
@errno = global i64 0
@EINTR = global i64 0
@EXIT_SUCCESS = global i32 0
@str = [26 x i8] c"Pressed Ctrl+q, quitting.\00"
@str.30 = [26 x i8] c"Pressed Escape, quitting.\00"
@str.31 = [10 x i8] c"Message: \00"
@str.32 = [17 x i8] c"\0A-Done Chatting-\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_19__
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timespec
%9 = alloca %struct.timespec
%10 = alloca i32
%11 = alloca [20 x i8]
%12 = alloca %struct.timespec
%13 = alloca %struct.timespec
%14 = tail call i32* @XOpenDisplay(i32* null)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i32, i32* @EXIT_FAILURE
br label %354
18: ; preds = %2
%19 = tail call i32 @DefaultScreen(i32* %14)
%20 = tail call i64 @BlackPixel(i32* %14, i32 %19)
%21 = tail call i32 @DefaultRootWindow(i32* %14)
%22 = tail call i32 @XCreateSimpleWindow(i32* %14, i32 %21, i32 0, i32 0, i32 800, i32 600, i32 0, i64 %20, i64 %20)
%23 = tail call %struct.TYPE_18__* (...) @XAllocWMHints()
%24 = load i32, i32* @InputHint
%25 = load i32, i32* @StateHint
%26 = or i32 %25, %24
%27 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %23, i64 0, i32 0
store i32 %26, i32* %27
%28 = load i8*, i8** @True
%29 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %23, i64 0, i32 5
store i8* %28, i8** %29
%30 = load i32, i32* @NormalState
%31 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %23, i64 0, i32 4
store i32 %30, i32* %31
%32 = tail call %struct.TYPE_18__* (...) @XAllocSizeHints()
%33 = load i32, i32* @PMinSize
%34 = load i32, i32* @PWinGravity
%35 = or i32 %34, %33
%36 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %32, i64 0, i32 0
store i32 %35, i32* %36
%37 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %32, i64 0, i32 1
store i32 400, i32* %37
%38 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %32, i64 0, i32 2
store i32 300, i32* %38
%39 = load i32, i32* @StaticGravity
%40 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %32, i64 0, i32 3
store i32 %39, i32* %40
%41 = tail call i32 @Xutf8SetWMProperties(i32* %14, i32 %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32* null, i32 0, %struct.TYPE_18__* %32, %struct.TYPE_18__* %23, i32* null)
%42 = load i32, i32* @ExposureMask
%43 = tail call i32 @XSelectInput(i32* %14, i32 %22, i32 %42)
%44 = load i8*, i8** @True
%45 = tail call i32 @XInternAtom(i32* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = bitcast i32* %3 to i8*
%47 = load i8*, i8** @True
%48 = tail call i32 @XInternAtom(i32* %14, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %47)
store i32 %48, i32* %3
%49 = call i32 @XSetWMProtocols(i32* %14, i32 %22, i32* %3, i32 1)
%50 = call i32 @XMapWindow(i32* %14, i32 %22)
%51 = bitcast %struct.TYPE_19__* %4 to i8*
%52 = load i32, i32* @ExposureMask
%53 = call i32 @XWindowEvent(i32* %14, i32 %22, i32 %52, %struct.TYPE_19__* %4)
%54 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%55 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%56 = bitcast i32* %7 to i8*
%57 = call i32 @DefaultRootWindow(i32* %14)
%58 = call i32 @XTranslateCoordinates(i32* %14, i32 %22, i32 %57, i32 0, i32 0, i32* %5, i32* %6, i32* %7)
%59 = load i32, i32* %5
%60 = load i32, i32* %6
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %59, i32 %60)
%62 = load i32, i32* @KeyPressMask
%63 = call i32 @XSelectInput(i32* %14, i32 %22, i32 %62)
%64 = load i8*, i8** @False
%65 = bitcast %struct.timespec* %8 to i8*
%66 = bitcast %struct.timespec* %9 to i8*
%67 = load i32, i32* @CLOCK_MONOTONIC_RAW
%68 = call i32 @clock_gettime(i32 %67, %struct.timespec* %9)
%69 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i64 0, i32 0
%70 = load double, double* %69
%71 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i64 0, i32 0
store double %70, double* %71
%72 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i64 0, i32 1
%73 = load i32, i32* %72
%74 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i64 0, i32 1
store i32 %73, i32* %74
%75 = bitcast i32* %10 to i8*
%76 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 0
%77 = icmp eq i8* %64, null
br i1 %77, label %78, label %348
78: ; preds = %18
%79 = load i8*, i8** @False
%80 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %4, i64 0, i32 0
%81 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %4, i64 0, i32 1
%82 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %81, i64 0, i32 0
%83 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %4, i64 0, i32 2, i32 1
%84 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %4, i64 0, i32 2, i32 0, i32 0
%85 = bitcast %struct.timespec* %12 to i8*
%86 = bitcast %struct.timespec* %13 to i8*
%87 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i64 0, i32 0
%88 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i64 0, i32 1
%89 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 0
%90 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i64 0, i32 1
br label %91
91: ; preds = %78, %346
%92 = phi i8* [ %79, %78 ], [ %310, %346 ]
%93 = phi double [ 0.000000e+00, %78 ], [ %320, %346 ]
%94 = load i32, i32* @CLOCK_MONOTONIC_RAW
%95 = call i32 @clock_gettime(i32 %94, %struct.timespec* %9)
%96 = call i64 @timespec_diff(%struct.timespec* %9, %struct.timespec* %8)
%97 = sitofp i64 %96 to double
%98 = fadd double %93, %97
%99 = call i64 @XPending(i32* %14)
%100 = icmp sgt i64 %99, 0
br i1 %100, label %101, label %309
101: ; preds = %91, %304
%102 = phi i8* [ %306, %304 ], [ %92, %91 ]
%103 = phi i8* [ %305, %304 ], [ null, %91 ]
br label %104
104: ; preds = %101, %137
%105 = phi i8* [ %103, %101 ], [ %139, %137 ]
%106 = call i32 @XNextEvent(i32* %14, %struct.TYPE_19__* %4)
%107 = load i32, i32* %80
switch i32 %107, label %304 [
i32 129, label %108
i32 128, label %118
]
108: ; preds = %104
%109 = load i32, i32* %83
%110 = icmp eq i32 %109, %45
br i1 %110, label %111, label %304
111: ; preds = %108
%112 = load i32*, i32** %84
%113 = load i32, i32* %112
%114 = load i32, i32* %3
%115 = icmp eq i32 %113, %114
%116 = load i8*, i8** @True
%117 = select i1 %115, i8* %116, i8* %105
br label %304
118: ; preds = %104
%119 = call i32 @XLookupString(%struct.TYPE_15__* %81, i8* %76, i32 20, i32* %10, i32* null)
%120 = call i32 @XLookupKeysym(%struct.TYPE_15__* %81, i32 0)
%121 = call i32 @XLookupKeysym(%struct.TYPE_15__* %81, i32 1)
%122 = call i8* @XKeysymToString(i32 %120)
%123 = call i8* @XKeysymToString(i32 %121)
%124 = load i32, i32* @XK_Return
%125 = icmp eq i32 %124, %120
br i1 %125, label %126, label %134
126: ; preds = %118
%127 = icmp eq i8* %102, null
br i1 %127, label %131, label %128
128: ; preds = %126
%129 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.32, i64 0, i64 0))
%130 = load i8*, i8** @False
br label %183
131: ; preds = %126
%132 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.31, i64 0, i64 0))
%133 = load i8*, i8** @True
br label %183
134: ; preds = %118
%135 = load i32, i32* @XK_Escape
%136 = icmp eq i32 %120, %135
br i1 %136, label %137, label %143
137: ; preds = %134, %146
%138 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), %146 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.30, i64 0, i64 0), %134 ]
%139 = load i8*, i8** @True
%140 = call i32 @puts(i8* dereferenceable(1) %138)
%141 = call i64 @XPending(i32* %14)
%142 = icmp sgt i64 %141, 0
br i1 %142, label %104, label %309
143: ; preds = %134
%144 = load i32, i32* @XK_q
%145 = icmp eq i32 %144, %120
br i1 %145, label %146, label %151
146: ; preds = %143
%147 = load i32, i32* %82
%148 = load i32, i32* @ControlMask
%149 = and i32 %148, %147
%150 = icmp eq i32 %149, 0
br i1 %150, label %151, label %137
151: ; preds = %146, %143
%152 = load i32, i32* @XK_Left
%153 = icmp eq i32 %152, %120
br i1 %153, label %154, label %159
154: ; preds = %151
%155 = load i32, i32* %5
%156 = add nsw i32 %155, -50
store i32 %156, i32* %5
%157 = load i32, i32* %6
%158 = call i32 @XMoveWindow(i32* %14, i32 %22, i32 %156, i32 %157)
br label %183
159: ; preds = %151
%160 = load i32, i32* @XK_Right
%161 = icmp eq i32 %160, %120
br i1 %161, label %162, label %167
162: ; preds = %159
%163 = load i32, i32* %5
%164 = add nsw i32 %163, 50
store i32 %164, i32* %5
%165 = load i32, i32* %6
%166 = call i32 @XMoveWindow(i32* %14, i32 %22, i32 %164, i32 %165)
br label %183
167: ; preds = %159
%168 = load i32, i32* @XK_Up
%169 = icmp eq i32 %168, %120
br i1 %169, label %170, label %175
170: ; preds = %167
%171 = load i32, i32* %6
%172 = add nsw i32 %171, -50
store i32 %172, i32* %6
%173 = load i32, i32* %5
%174 = call i32 @XMoveWindow(i32* %14, i32 %22, i32 %173, i32 %172)
br label %183
175: ; preds = %167
%176 = load i32, i32* @XK_Down
%177 = icmp eq i32 %176, %120
br i1 %177, label %178, label %183
178: ; preds = %175
%179 = load i32, i32* %6
%180 = add nsw i32 %179, 50
store i32 %180, i32* %6
%181 = load i32, i32* %5
%182 = call i32 @XMoveWindow(i32* %14, i32 %22, i32 %181, i32 %180)
br label %183
183: ; preds = %154, %170, %178, %175, %162, %128, %131
%184 = phi i8* [ %130, %128 ], [ %133, %131 ], [ %102, %154 ], [ %102, %162 ], [ %102, %170 ], [ %102, %178 ], [ %102, %175 ]
%185 = icmp eq i8* %184, null
br i1 %185, label %188, label %186
186: ; preds = %183
%187 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %76)
br label %304
188: ; preds = %183
%189 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %122, i8* %123)
%190 = load i32, i32* %82
%191 = load i32, i32* @ShiftMask
%192 = and i32 %191, %190
%193 = icmp eq i32 %192, 0
br i1 %193, label %197, label %194
194: ; preds = %188
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%196 = load i32, i32* %82
br label %197
197: ; preds = %194, %188
%198 = phi i32 [ %196, %194 ], [ %190, %188 ]
%199 = load i32, i32* @LockMask
%200 = and i32 %199, %198
%201 = icmp eq i32 %200, 0
br i1 %201, label %205, label %202
202: ; preds = %197
%203 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%204 = load i32, i32* %82
br label %205
205: ; preds = %202, %197
%206 = phi i32 [ %204, %202 ], [ %198, %197 ]
%207 = load i32, i32* @ControlMask
%208 = and i32 %207, %206
%209 = icmp eq i32 %208, 0
br i1 %209, label %213, label %210
210: ; preds = %205
%211 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%212 = load i32, i32* %82
br label %213
213: ; preds = %210, %205
%214 = phi i32 [ %212, %210 ], [ %206, %205 ]
%215 = load i32, i32* @Mod1Mask
%216 = and i32 %215, %214
%217 = icmp eq i32 %216, 0
br i1 %217, label %221, label %218
218: ; preds = %213
%219 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%220 = load i32, i32* %82
br label %221
221: ; preds = %218, %213
%222 = phi i32 [ %220, %218 ], [ %214, %213 ]
%223 = load i32, i32* @Mod2Mask
%224 = and i32 %223, %222
%225 = icmp eq i32 %224, 0
br i1 %225, label %229, label %226
226: ; preds = %221
%227 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
%228 = load i32, i32* %82
br label %229
229: ; preds = %226, %221
%230 = phi i32 [ %228, %226 ], [ %222, %221 ]
%231 = load i32, i32* @Mod3Mask
%232 = and i32 %231, %230
%233 = icmp eq i32 %232, 0
br i1 %233, label %237, label %234
234: ; preds = %229
%235 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
%236 = load i32, i32* %82
br label %237
237: ; preds = %234, %229
%238 = phi i32 [ %236, %234 ], [ %230, %229 ]
%239 = load i32, i32* @Mod4Mask
%240 = and i32 %239, %238
%241 = icmp eq i32 %240, 0
br i1 %241, label %245, label %242
242: ; preds = %237
%243 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%244 = load i32, i32* %82
br label %245
245: ; preds = %242, %237
%246 = phi i32 [ %244, %242 ], [ %238, %237 ]
%247 = load i32, i32* @Mod5Mask
%248 = and i32 %247, %246
%249 = icmp eq i32 %248, 0
br i1 %249, label %252, label %250
250: ; preds = %245
%251 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
br label %252
252: ; preds = %250, %245
%253 = call i32 @IsCursorKey(i32 %120)
%254 = icmp eq i32 %253, 0
br i1 %254, label %257, label %255
255: ; preds = %252
%256 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0))
br label %257
257: ; preds = %255, %252
%258 = call i32 @IsCursorKey(i32 %121)
%259 = icmp eq i32 %258, 0
br i1 %259, label %262, label %260
260: ; preds = %257
%261 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0))
br label %262
262: ; preds = %260, %257
%263 = call i32 @IsFunctionKey(i32 %120)
%264 = icmp eq i32 %263, 0
br i1 %264, label %267, label %265
265: ; preds = %262
%266 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.21, i64 0, i64 0))
br label %267
267: ; preds = %265, %262
%268 = call i32 @IsFunctionKey(i32 %121)
%269 = icmp eq i32 %268, 0
br i1 %269, label %272, label %270
270: ; preds = %267
%271 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
br label %272
272: ; preds = %270, %267
%273 = call i32 @IsKeypadKey(i32 %120)
%274 = icmp eq i32 %273, 0
br i1 %274, label %277, label %275
275: ; preds = %272
%276 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0))
br label %277
277: ; preds = %275, %272
%278 = call i32 @IsKeypadKey(i32 %121)
%279 = icmp eq i32 %278, 0
br i1 %279, label %282, label %280
280: ; preds = %277
%281 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0))
br label %282
282: ; preds = %280, %277
%283 = call i32 @IsMiscFunctionKey(i32 %120)
%284 = icmp eq i32 %283, 0
br i1 %284, label %287, label %285
285: ; preds = %282
%286 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0))
br label %287
287: ; preds = %285, %282
%288 = call i32 @IsMiscFunctionKey(i32 %121)
%289 = icmp eq i32 %288, 0
br i1 %289, label %292, label %290
290: ; preds = %287
%291 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0))
br label %292
292: ; preds = %290, %287
%293 = call i32 @IsModifierKey(i32 %120)
%294 = icmp eq i32 %293, 0
br i1 %294, label %297, label %295
295: ; preds = %292
%296 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0))
br label %297
297: ; preds = %295, %292
%298 = call i32 @IsModifierKey(i32 %121)
%299 = icmp eq i32 %298, 0
br i1 %299, label %302, label %300
300: ; preds = %297
%301 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.28, i64 0, i64 0))
br label %302
302: ; preds = %300, %297
%303 = call i32 @putchar(i32 10)
br label %304
304: ; preds = %104, %111, %186, %302, %108
%305 = phi i8* [ %105, %186 ], [ %105, %302 ], [ %105, %108 ], [ %117, %111 ], [ %105, %104 ]
%306 = phi i8* [ %184, %186 ], [ null, %302 ], [ %102, %108 ], [ %102, %111 ], [ %102, %104 ]
%307 = call i64 @XPending(i32* %14)
%308 = icmp sgt i64 %307, 0
br i1 %308, label %101, label %309
309: ; preds = %304, %137, %91
%310 = phi i8* [ %92, %91 ], [ %102, %137 ], [ %306, %304 ]
%311 = phi i8* [ null, %91 ], [ %139, %137 ], [ %305, %304 ]
%312 = fcmp ule double %98, 1.660000e+01
%313 = icmp ne i8* %311, null
%314 = select i1 %312, i1 true, i1 %313
br i1 %314, label %319, label %315
315: ; preds = %309, %315
%316 = phi double [ %317, %315 ], [ %98, %309 ]
%317 = fadd double %316, -1.660000e+01
%318 = fcmp ogt double %317, 1.660000e+01
br i1 %318, label %315, label %319
319: ; preds = %315, %309
%320 = phi double [ %98, %309 ], [ %317, %315 ]
%321 = load double, double* %69
store double %321, double* %71
%322 = load i32, i32* %72
store i32 %322, i32* %74
%323 = fcmp uge double %320, 1.660000e+01
%324 = select i1 %323, i1 true, i1 %313
br i1 %324, label %346, label %325
325: ; preds = %319
%326 = fdiv double %320, 1.000000e+03
store double %326, double* %87
%327 = fptosi double %320 to i32
%328 = srem i32 %327, 1000
%329 = mul nsw i32 %328, 1000000
store i32 %329, i32* %88
store double %326, double* %89
store i32 %329, i32* %90
store i64 0, i64* @errno
%330 = call i32 @nanosleep(%struct.timespec* %12, %struct.timespec* %13)
%331 = icmp eq i32 %330, -1
%332 = load i64, i64* @errno
%333 = load i64, i64* @EINTR
%334 = icmp eq i64 %332, %333
%335 = select i1 %331, i1 %334, i1 false
br i1 %335, label %336, label %345
336: ; preds = %325, %336
%337 = load double, double* %87
%338 = load i32, i32* %88
store double %337, double* %89
store i32 %338, i32* %90
store i64 0, i64* @errno
%339 = call i32 @nanosleep(%struct.timespec* %12, %struct.timespec* %13)
%340 = icmp eq i32 %339, -1
%341 = load i64, i64* @errno
%342 = load i64, i64* @EINTR
%343 = icmp eq i64 %341, %342
%344 = select i1 %340, i1 %343, i1 false
br i1 %344, label %336, label %345
345: ; preds = %336, %325
br label %346
346: ; preds = %345, %319
%347 = icmp eq i8* %311, null
br i1 %347, label %91, label %348
348: ; preds = %346, %18
%349 = call i32 @XFree(%struct.TYPE_18__* %32)
%350 = call i32 @XFree(%struct.TYPE_18__* %23)
%351 = call i32 @XDestroyWindow(i32* %14, i32 %22)
%352 = call i32 @XCloseDisplay(i32* %14)
%353 = load i32, i32* @EXIT_SUCCESS
br label %354
354: ; preds = %348, %16
%355 = phi i32 [ %17, %16 ], [ %353, %348 ]
ret i32 %355
}