#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*/ 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 ShiftMask;
int StateHint;
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_Escape;
int /*<<< orphan*/ XK_Return;
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*/ 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*/ 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;
  sizehints->min_width = 400;
  sizehints->min_height = 300;
  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);
  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;
        }
        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    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   2100 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    2322 <main+0x42>
mov    0x2c50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    2c46 <main+0x966>
mov    -0x18(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x18(%rbp),%rdi
call   21e0 <DefaultScreen@plt>
mov    -0x108(%rbp),%rdi
mov    %eax,%esi
call   21a0 <BlackPixel@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x18(%rbp),%rdi
call   2080 <DefaultRootWindow@plt>
mov    -0x100(%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   2180 <XCreateSimpleWindow@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   2130 <XAllocWMHints@plt>
mov    %rax,-0x30(%rbp)
mov    0x2c30(%rip),%rax
mov    (%rax),%ecx
mov    0x2c47(%rip),%rax
or     (%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2be0(%rip),%rax
mov    (%rax),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    0x2b86(%rip),%rax
mov    (%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    $0x0,%al
call   2120 <XAllocSizeHints@plt>
mov    %rax,-0x38(%rbp)
mov    0x2b53(%rip),%rax
mov    (%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    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x38(%rbp),%r10
mov    -0x30(%rbp),%rax
lea    0xbef(%rip),%rdx
lea    0xc2b(%rip),%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   20f0 <Xutf8SetWMProperties@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2af5(%rip),%rax
mov    (%rax),%edx
call   2170 <XSelectInput@plt>
mov    -0x18(%rbp),%rdi
mov    0x2b3b(%rip),%rax
mov    (%rax),%rdx
lea    0xbaa(%rip),%rsi
call   2150 <XInternAtom@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2b1e(%rip),%rax
mov    (%rax),%rdx
lea    0xb9a(%rip),%rsi
call   2150 <XInternAtom@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    $0x1,%ecx
call   2110 <XSetWMProtocols@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   21b0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2a85(%rip),%rax
mov    (%rax),%edx
lea    -0x58(%rbp),%rcx
call   21c0 <XWindowEvent@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2ad4(%rip),%rax
mov    (%rax),%edx
call   2170 <XSelectInput@plt>
mov    0x2ad6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    0x2aa0(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
call   2060 <clock_gettime@plt>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movq   $0x0,-0xa0(%rbp)
movq   $0x0,-0xa8(%rbp)
movl   $0x14,-0xc4(%rbp)
movl   $0x0,-0xc8(%rbp)
mov    0x2a71(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0x60(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    2570 <main+0x290>
jmp    2bfb <main+0x91b>
mov    0x2a21(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
call   2060 <clock_gettime@plt>
lea    -0x80(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   21d0 <timespec_diff@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x18(%rbp),%rdi
call   2070 <XPending@plt>
cmp    $0x0,%rax
jle    2a61 <main+0x781>
mov    -0x18(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   2140 <XNextEvent@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x10c(%rbp)
sub    $0x80,%eax
je     2626 <main+0x346>
jmp    25dd <main+0x2fd>
mov    -0x10c(%rbp),%eax
sub    $0x81,%eax
jne    2a5c <main+0x77c>
jmp    25f3 <main+0x313>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    2621 <main+0x341>
mov    -0x50(%rbp),%rax
mov    (%rax),%eax
cmp    -0x40(%rbp),%eax
jne    261c <main+0x33c>
mov    0x298b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    2621 <main+0x341>
jmp    2a5c <main+0x77c>
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
lea    -0xc0(%rbp),%rsi
mov    -0xc4(%rbp),%edx
lea    -0x94(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   2040 <XLookupString@plt>
mov    %eax,-0xc8(%rbp)
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
xor    %esi,%esi
call   2160 <XLookupKeysym@plt>
mov    %eax,-0x8c(%rbp)
lea    -0x58(%rbp),%rdi
add    $0x4,%rdi
mov    $0x1,%esi
call   2160 <XLookupKeysym@plt>
mov    %eax,-0x90(%rbp)
mov    -0x8c(%rbp),%edi
call   2200 <XKeysymToString@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x90(%rbp),%edi
call   2200 <XKeysymToString@plt>
mov    %rax,-0xa8(%rbp)
mov    0x2876(%rip),%rax
mov    (%rax),%eax
cmp    -0x8c(%rbp),%eax
jne    270e <main+0x42e>
cmpq   $0x0,-0xd0(%rbp)
je     26ea <main+0x40a>
lea    0x96a(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    0x28e5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xd0(%rbp)
jmp    2709 <main+0x429>
lea    0x958(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    0x28a1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xd0(%rbp)
jmp    2799 <main+0x4b9>
mov    -0x8c(%rbp),%eax
mov    0x285d(%rip),%rcx
cmp    (%rcx),%eax
jne    2744 <main+0x464>
mov    0x2876(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
lea    0x91c(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
jmp    25a4 <main+0x2c4>
mov    0x285d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8c(%rbp),%eax
jne    278f <main+0x4af>
mov    -0x54(%rbp),%eax
mov    0x2865(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     278f <main+0x4af>
mov    0x282b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
lea    0x8ec(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
jmp    25a4 <main+0x2c4>
jmp    2794 <main+0x4b4>
jmp    2799 <main+0x4b9>
cmpq   $0x0,-0xd0(%rbp)
je     27c1 <main+0x4e1>
lea    -0xc0(%rbp),%rsi
lea    0x8e7(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
jmp    2a57 <main+0x777>
mov    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
lea    0x8b4(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x27e9(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2800 <main+0x520>
lea    0x8a6(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x2766(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2823 <main+0x543>
lea    0x88c(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x279b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2846 <main+0x566>
lea    0x871(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x2768(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2869 <main+0x589>
lea    0x856(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x26c5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     288c <main+0x5ac>
lea    0x83a(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x26fa(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     28af <main+0x5cf>
lea    0x823(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x272f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     28d2 <main+0x5f2>
lea    0x808(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x54(%rbp),%eax
mov    0x264c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     28f5 <main+0x615>
lea    0x7ed(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x8c(%rbp),%edi
call   2190 <IsCursorKey@plt>
cmp    $0x0,%eax
je     2917 <main+0x637>
lea    0x7d3(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x90(%rbp),%edi
call   2190 <IsCursorKey@plt>
cmp    $0x0,%eax
je     2939 <main+0x659>
lea    0x7c3(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x8c(%rbp),%edi
call   2050 <IsFunctionKey@plt>
cmp    $0x0,%eax
je     295b <main+0x67b>
lea    0x7b3(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x90(%rbp),%edi
call   2050 <IsFunctionKey@plt>
cmp    $0x0,%eax
je     297d <main+0x69d>
lea    0x7a5(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x8c(%rbp),%edi
call   20e0 <IsKeypadKey@plt>
cmp    $0x0,%eax
je     299f <main+0x6bf>
lea    0x797(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x90(%rbp),%edi
call   20e0 <IsKeypadKey@plt>
cmp    $0x0,%eax
je     29c1 <main+0x6e1>
lea    0x783(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x8c(%rbp),%edi
call   20c0 <IsMiscFunctionKey@plt>
cmp    $0x0,%eax
je     29e3 <main+0x703>
lea    0x76f(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x90(%rbp),%edi
call   20c0 <IsMiscFunctionKey@plt>
cmp    $0x0,%eax
je     2a05 <main+0x725>
lea    0x757(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x8c(%rbp),%edi
call   2030 <IsModifierKey@plt>
cmp    $0x0,%eax
je     2a27 <main+0x747>
lea    0x73f(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
mov    -0x90(%rbp),%edi
call   2030 <IsModifierKey@plt>
cmp    $0x0,%eax
je     2a49 <main+0x769>
lea    0x72d(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
lea    0x602(%rip),%rdi
mov    $0x0,%al
call   2090 <printf@plt>
jmp    2a5c <main+0x77c>
jmp    25a4 <main+0x2c4>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x58f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    2afb <main+0x81b>
cmpq   $0x0,-0x60(%rbp)
jne    2afb <main+0x81b>
jmp    2a8b <main+0x7ab>
movsd  -0x88(%rbp),%xmm0
ff
xor    %eax,%eax
movsd  0x563(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x10d(%rbp)
jbe    2abd <main+0x7dd>
cmpq   $0x0,-0x60(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x10d(%rbp)
mov    -0x10d(%rbp),%al
test   $0x1,%al
jne    2ad0 <main+0x7f0>
jmp    2af6 <main+0x816>
jmp    2ad5 <main+0x7f5>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x51b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    2a8b <main+0x7ab>
jmp    2afb <main+0x81b>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x68(%rbp)
movsd  0x4ed(%rip),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    2bf6 <main+0x916>
cmpq   $0x0,-0x60(%rbp)
jne    2bf6 <main+0x916>
movl   $0x0,-0xf4(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x4c2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
cvttsd2si -0x88(%rbp),%eax
ff
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0xf4240,%edx,%eax
mov    %eax,-0xe8(%rbp)
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0xe8(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    0x23ef(%rip),%rax
movq   $0x0,(%rax)
lea    -0xe0(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
call   20b0 <nanosleep@plt>
mov    %eax,-0xf4(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xf4(%rbp)
mov    %al,-0x10e(%rbp)
jne    2be3 <main+0x903>
mov    0x23b3(%rip),%rax
mov    (%rax),%rax
mov    0x2389(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x10e(%rbp)
mov    -0x10e(%rbp),%al
test   $0x1,%al
jne    2b6e <main+0x88e>
jmp    2bf6 <main+0x916>
jmp    2559 <main+0x279>
mov    -0x38(%rbp),%rdi
call   20a0 <XFree@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   20a0 <XFree@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   20d0 <XDestroyWindow@plt>
mov    -0x18(%rbp),%rdi
call   21f0 <XCloseDisplay@plt>
movq   $0x0,-0x18(%rbp)
mov    0x230f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
xor    %edi,%edi
call   2120 <XOpenDisplay@plt>
mov    %rax,(%rsp)
test   %rax,%rax
je     2503 <main+0x203>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   2200 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   21c0 <BlackPixel@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   20a0 <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   21a0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r15d
xor    %eax,%eax
call   2150 <XAllocWMHints@plt>
mov    0x2c5b(%rip),%rcx
mov    0x2c74(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %rax,%rbp
mov    %edx,(%rax)
mov    0x2c0c(%rip),%r12
mov    (%r12),%rax
mov    %rax,0x10(%rbp)
mov    0x2bb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rbp)
xor    %eax,%eax
call   2140 <XAllocSizeHints@plt>
mov    0x2b8a(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
movabs $0x12c00000190,%rcx
mov    %rcx,0x4(%rax)
sub    $0x8,%rsp
lea    0xc45(%rip),%rdx
lea    0xd97(%rip),%rcx
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
mov    %rbp,0x98(%rsp)
push   %rbp
mov    %rax,0x98(%rsp)
push   %rax
call   2110 <Xutf8SetWMProperties@plt>
add    $0x20,%rsp
mov    0x2b3e(%rip),%r14
mov    (%r14),%edx
mov    %rbx,%rdi
mov    %r15d,%esi
call   2190 <XSelectInput@plt>
mov    (%r12),%rdx
lea    0xbfe(%rip),%rsi
mov    %rbx,%rdi
call   2170 <XInternAtom@plt>
mov    %eax,0x3c(%rsp)
mov    (%r12),%rdx
lea    0xbf4(%rip),%rsi
mov    %rbx,%rdi
call   2170 <XInternAtom@plt>
mov    %eax,0x14(%rsp)
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x1,%ecx
call   2130 <XSetWMProtocols@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   21d0 <XMapWindow@plt>
mov    (%r14),%edx
lea    0x18(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15d,%esi
call   21e0 <XWindowEvent@plt>
mov    0x2b30(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r15d,0x38(%rsp)
mov    %r15d,%esi
call   2190 <XSelectInput@plt>
mov    0x2b27(%rip),%rax
mov    (%rax),%rbp
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
lea    0x60(%rsp),%rsi
call   2080 <clock_gettime@plt>
movsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
mov    0x68(%rsp),%eax
mov    %eax,0x78(%rsp)
test   %rbp,%rbp
je     251e <main+0x21e>
mov    0x80(%rsp),%rdi
call   20c0 <XFree@plt>
mov    0x88(%rsp),%rdi
call   20c0 <XFree@plt>
mov    (%rsp),%rbx
mov    %rbx,%rdi
mov    0x38(%rsp),%esi
call   20f0 <XDestroyWindow@plt>
mov    %rbx,%rdi
call   2210 <XCloseDisplay@plt>
mov    0x2a4f(%rip),%rax
jmp    250a <main+0x20a>
mov    0x2a5e(%rip),%rax
mov    (%rax),%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a9b(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
xorpd  %xmm1,%xmm1
jmp    254f <main+0x24f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x30(%rsp),%xmm1
test   %rbp,%rbp
jne    24c8 <main+0x1c8>
movsd  %xmm1,0x30(%rsp)
mov    0x2a3c(%rip),%rax
mov    (%rax),%edi
lea    0x60(%rsp),%rbx
mov    %rbx,%rsi
call   2080 <clock_gettime@plt>
mov    %rbx,%rdi
lea    0x70(%rsp),%rsi
call   21f0 <timespec_diff@plt>
mov    %rax,%rbx
mov    (%rsp),%rdi
call   2090 <XPending@plt>
test   %rax,%rax
mov    %rbx,0x90(%rsp)
jle    2940 <main+0x640>
xor    %ebp,%ebp
jmp    25c1 <main+0x2c1>
nopl   0x0(%rax)
mov    0x29f9(%rip),%rax
mov    (%rax),%rbp
call   2070 <puts@plt>
mov    (%rsp),%rdi
call   2090 <XPending@plt>
test   %rax,%rax
jle    2942 <main+0x642>
mov    (%rsp),%rdi
lea    0x18(%rsp),%rsi
call   2160 <XNextEvent@plt>
mov    0x18(%rsp),%eax
cmp    $0x80,%eax
jne    28a7 <main+0x5a7>
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
lea    0xa0(%rsp),%rsi
mov    $0x14,%edx
lea    0x9c(%rsp),%rcx
xor    %r8d,%r8d
call   2050 <XLookupString@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   2180 <XLookupKeysym@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    $0x1,%esi
call   2180 <XLookupKeysym@plt>
mov    %eax,%r15d
mov    %r13d,%edi
call   2220 <XKeysymToString@plt>
mov    %rax,%r12
mov    %r15d,%edi
call   2220 <XKeysymToString@plt>
mov    %rax,%r14
mov    0x28e3(%rip),%rax
cmp    %r13d,(%rax)
je     28e0 <main+0x5e0>
lea    0xb01(%rip),%rdi
mov    0x2924(%rip),%rax
cmp    (%rax),%r13d
je     25a0 <main+0x2a0>
mov    0x2944(%rip),%rax
cmp    %r13d,(%rax)
jne    2683 <main+0x383>
mov    0x2958(%rip),%rax
mov    (%rax),%eax
lea    0xabb(%rip),%rdi
test   %eax,0x1c(%rsp)
jne    25a0 <main+0x2a0>
mov    0x8(%rsp),%rax
test   %rax,%rax
jne    2918 <main+0x618>
lea    0x9a7(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x2920(%rip),%rcx
test   %eax,(%rcx)
je     26c6 <main+0x3c6>
lea    0x999(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x28a3(%rip),%rcx
test   %eax,(%rcx)
je     26e3 <main+0x3e3>
lea    0x985(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x28de(%rip),%rcx
test   %eax,(%rcx)
je     2700 <main+0x400>
lea    0x970(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x28b1(%rip),%rcx
test   %eax,(%rcx)
je     271d <main+0x41d>
lea    0x95b(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x2814(%rip),%rcx
test   %eax,(%rcx)
je     273a <main+0x43a>
lea    0x945(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x284f(%rip),%rcx
test   %eax,(%rcx)
je     2757 <main+0x457>
lea    0x934(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x288a(%rip),%rcx
test   %eax,(%rcx)
je     2774 <main+0x474>
lea    0x91f(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    0x1c(%rsp),%eax
mov    0x27ad(%rip),%rcx
test   %eax,(%rcx)
je     278d <main+0x48d>
lea    0x90a(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r13d,%edi
call   21b0 <IsCursorKey@plt>
test   %eax,%eax
je     27a7 <main+0x4a7>
lea    0x8f8(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r15d,%edi
call   21b0 <IsCursorKey@plt>
test   %eax,%eax
je     27c1 <main+0x4c1>
lea    0x8f0(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r13d,%edi
call   2060 <IsFunctionKey@plt>
test   %eax,%eax
je     27db <main+0x4db>
lea    0x8e8(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r15d,%edi
call   2060 <IsFunctionKey@plt>
test   %eax,%eax
je     27f5 <main+0x4f5>
lea    0x8e2(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r13d,%edi
call   2100 <IsKeypadKey@plt>
test   %eax,%eax
je     280f <main+0x50f>
lea    0x8dc(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r15d,%edi
call   2100 <IsKeypadKey@plt>
test   %eax,%eax
je     2829 <main+0x529>
lea    0x8d0(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r13d,%edi
call   20e0 <IsMiscFunctionKey@plt>
test   %eax,%eax
je     2843 <main+0x543>
lea    0x8c4(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r15d,%edi
call   20e0 <IsMiscFunctionKey@plt>
test   %eax,%eax
je     285d <main+0x55d>
lea    0x8b4(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r13d,%edi
call   2040 <IsModifierKey@plt>
test   %eax,%eax
je     2877 <main+0x577>
lea    0x8a4(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    %r15d,%edi
call   2040 <IsModifierKey@plt>
test   %eax,%eax
je     2891 <main+0x591>
lea    0x89a(%rip),%rdi
xor    %eax,%eax
call   20b0 <printf@plt>
mov    $0xa,%edi
call   2030 <putchar@plt>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    25af <main+0x2af>
cmp    $0x81,%eax
jne    25af <main+0x2af>
mov    0x3c(%rsp),%eax
cmp    %eax,0x28(%rsp)
jne    25af <main+0x2af>
mov    0x20(%rsp),%rax
mov    (%rax),%eax
cmp    0x14(%rsp),%eax
jne    25af <main+0x2af>
mov    0x26c8(%rip),%rax
mov    (%rax),%rbp
jmp    25af <main+0x2af>
cmpq   $0x0,0x8(%rsp)
lea    0x885(%rip),%rdi
lea    0x874(%rip),%rax
cmove  %rax,%rdi
mov    0x26c1(%rip),%rbx
cmove  0x2699(%rip),%rbx
call   2070 <puts@plt>
mov    (%rbx),%rax
test   %rax,%rax
je     2691 <main+0x391>
mov    %rax,0x8(%rsp)
lea    0x72d(%rip),%rdi
lea    0xa0(%rsp),%rsi
xor    %eax,%eax
call   20b0 <printf@plt>
jmp    25af <main+0x2af>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
xorps  %xmm0,%xmm0
cvtsi2sdq 0x90(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x69f(%rip),%xmm2
ucomisd %xmm2,%xmm1
jbe    2990 <main+0x690>
test   %rbp,%rbp
jne    2990 <main+0x690>
movsd  0x694(%rip),%xmm0
mov    0x2605(%rip),%rsi
nopl   0x0(%rax,%rax,1)
addsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
ja     2980 <main+0x680>
jmp    2997 <main+0x697>
nopl   0x0(%rax)
mov    0x25e9(%rip),%rsi
movsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
mov    0x68(%rsp),%eax
mov    %eax,0x78(%rsp)
ucomisd %xmm1,%xmm2
jbe    2546 <main+0x246>
test   %rbp,%rbp
jne    2546 <main+0x246>
movapd %xmm1,%xmm0
divsd  0x646(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  %xmm1,0x30(%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,0x48(%rsp)
movsd  %xmm0,0x50(%rsp)
mov    %eax,0x58(%rsp)
movq   $0x0,(%rsi)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x50(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   20d0 <nanosleep@plt>
mov    0x254a(%rip),%rcx
cmp    $0xffffffff,%eax
jne    2540 <main+0x240>
mov    0x251a(%rip),%rax
mov    (%rax),%rax
cmp    %rax,(%rcx)
jne    2540 <main+0x240>
movsd  0x40(%rsp),%xmm0
mov    0x48(%rsp),%eax
movsd  %xmm0,0x50(%rsp)
mov    %eax,0x58(%rsp)
movq   $0x0,(%rcx)
jmp    2a20 <main+0x720>

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

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