#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_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, unsigned int);
scalar_t__ ClientMessage;
int /*<<< orphan*/ DefaultGC(int /*<<< orphan*/ *, unsigned int);
unsigned int DefaultScreen(int /*<<< orphan*/ *);
scalar_t__ Expose;
int ExposureMask;
scalar_t__ KeyPress;
int KeyPressMask;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, unsigned int);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, unsigned int);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XDrawRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, unsigned int,
                                  unsigned int, int, int);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_1__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int);
int /*<<< orphan*/ XSetWMProtocols(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *, int);
int /*<<< orphan*/ draweatpoint(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                unsigned int, unsigned int *, unsigned int *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int rand();
int /*<<< orphan*/ read_KeyPress(TYPE_1__ *, unsigned int *, unsigned int *,
                                 unsigned int *, char *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/, unsigned int,
                                 unsigned int *, unsigned int *,
                                 unsigned int *);
int /*<<< orphan*/ redhead(int /*<<< orphan*/ *, int /*<<< orphan*/,
                           unsigned int, unsigned int *, unsigned int *);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ stderr;
scalar_t__ time(int /*<<< orphan*/ *);
int main(void) {
  srand((unsigned)time(NULL));
  unsigned int yrand = ((rand() % ((100) - 2 - 1 + 1)) + 1) * 8;
  unsigned int xrand = ((rand() % ((100) - 2 - 1 + 1)) + 1) * 8;
  unsigned int LENGTH = 3;
  unsigned int x[1000], y[1000];
  Display *d;
  Window w;
  Atom delWindow;
  unsigned int s;
  unsigned int mv;
  unsigned int count;
  char plusminus = 0;
  XEvent e;
  int exit_game = 0;
  d = XOpenDisplay(NULL);
  if (d == NULL) {
    fprintf(stderr, "Cannot open display\n");
    exit(1);
  }
  s = DefaultScreen(d);
  w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, ((100) * 8), ((100) * 8),
                          1, BlackPixel(d, s), WhitePixel(d, s));
  delWindow = XInternAtom(d, "WM_DELETE_WINDOW", 0);
  XSetWMProtocols(d, w, &delWindow, 1);
  XSelectInput(d, w, ExposureMask | KeyPressMask);
  XMapWindow(d, w);
  count = 2;
  do {
    x[count] = 8 + (50 * 8) - (count * 8);
    y[count] = (50 * 8);
    count++;
  } while (count != (LENGTH));
  do {
    x[count] = ((100) * 8);
    y[count] = ((100) * 8);
    count++;
  } while (count != 500);
  count = 2;
  mv = 1;
  x[0] = (50 * 8);
  y[0] = (50 * 8);
  x[1] = (50 * 8) - (LENGTH * 8) + 8;
  y[1] = (50 * 8);
  draweatpoint(d, w, s, &xrand, &yrand);
  while (!exit_game) {
    XNextEvent(d, &e);
    if (e.type == Expose) {
      redhead(d, w, s, x, y);
      count = 1;
      XSetForeground(d, DefaultGC(d, s), 0x000000);
      do {
        XDrawRectangle(d, w, DefaultGC(d, s), x[count], y[count], (8 - 1),
                       (8 - 1));
        count++;
      } while (count != (LENGTH));
      draweatpoint(d, w, s, &xrand, &yrand);
    }
    if (e.type == KeyPress) {
      read_KeyPress(&e, x, y, &mv, &plusminus, d, w, s, &LENGTH, &xrand,
                    &yrand);
    }
    if (e.type == ClientMessage) {
      exit_game = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x1fd0,%rsp
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    $0x0,%al
call   1180 <rand@plt>
mov    $0x62,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1180 <rand@plt>
mov    $0x62,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
movb   $0x0,-0x1f7d(%rbp)
movl   $0x0,-0x1f8c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <XOpenDisplay@plt>
mov    %rax,-0x1f68(%rbp)
cmpq   $0x0,-0x1f68(%rbp)
jne    130e <main+0xae>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
lea    0xd01(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>
mov    -0x1f68(%rbp),%rdi
call   1170 <DefaultScreen@plt>
mov    %eax,-0x1f74(%rbp)
mov    -0x1f68(%rbp),%rax
mov    %rax,-0x1fa0(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f74(%rbp),%esi
call   1100 <RootWindow@plt>
mov    %eax,-0x1f94(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f74(%rbp),%esi
call   1130 <BlackPixel@plt>
mov    %eax,-0x1f90(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f74(%rbp),%esi
call   1050 <WhitePixel@plt>
mov    -0x1fa0(%rbp),%rdi
mov    -0x1f94(%rbp),%esi
mov    -0x1f90(%rbp),%r10d
mov    $0xa,%ecx
mov    $0x320,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1120 <XCreateSimpleWindow@plt>
mov    %eax,-0x1f6c(%rbp)
mov    -0x1f68(%rbp),%rdi
lea    0xc58(%rip),%rsi
xor    %edx,%edx
call   10f0 <XInternAtom@plt>
mov    %eax,-0x1f70(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
lea    -0x1f70(%rbp),%rdx
mov    $0x1,%ecx
call   10b0 <XSetWMProtocols@plt>
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
mov    0x2bbc(%rip),%rax
mov    (%rax),%edx
mov    0x2bdb(%rip),%rax
or     (%rax),%edx
call   1110 <XSelectInput@plt>
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
call   1150 <XMapWindow@plt>
movl   $0x2,-0x1f7c(%rbp)
mov    -0x1f7c(%rbp),%eax
shl    $0x3,%eax
mov    $0x198,%ecx
sub    %eax,%ecx
mov    -0x1f7c(%rbp),%eax
mov    %ecx,-0xfc0(%rbp,%rax,4)
mov    -0x1f7c(%rbp),%eax
movl   $0x190,-0x1f60(%rbp,%rax,4)
mov    -0x1f7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f7c(%rbp)
mov    -0x1f7c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1428 <main+0x1c8>
jmp    1479 <main+0x219>
mov    -0x1f7c(%rbp),%eax
movl   $0x320,-0xfc0(%rbp,%rax,4)
mov    -0x1f7c(%rbp),%eax
movl   $0x320,-0x1f60(%rbp,%rax,4)
mov    -0x1f7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f7c(%rbp)
cmpl   $0x1f4,-0x1f7c(%rbp)
jne    1479 <main+0x219>
movl   $0x2,-0x1f7c(%rbp)
movl   $0x1,-0x1f78(%rbp)
movl   $0x190,-0xfc0(%rbp)
movl   $0x190,-0x1f60(%rbp)
mov    -0x20(%rbp),%ecx
shl    $0x3,%ecx
mov    $0x190,%eax
sub    %ecx,%eax
add    $0x8,%eax
mov    %eax,-0xfbc(%rbp)
movl   $0x190,-0x1f5c(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
mov    -0x1f74(%rbp),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1060 <draweatpoint@plt>
cmpl   $0x0,-0x1f8c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    153b <main+0x2db>
jmp    1707 <main+0x4a7>
mov    -0x1f68(%rbp),%rdi
lea    -0x1f88(%rbp),%rsi
call   10e0 <XNextEvent@plt>
mov    -0x1f88(%rbp),%rax
mov    0x2a8c(%rip),%rcx
cmp    (%rcx),%rax
jne    166b <main+0x40b>
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
mov    -0x1f74(%rbp),%edx
lea    -0xfc0(%rbp),%rcx
lea    -0x1f60(%rbp),%r8
call   1070 <redhead@plt>
movl   $0x1,-0x1f7c(%rbp)
mov    -0x1f68(%rbp),%rax
mov    %rax,-0x1fa8(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f74(%rbp),%esi
call   1040 <DefaultGC@plt>
mov    -0x1fa8(%rbp),%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1140 <XSetForeground@plt>
mov    -0x1f68(%rbp),%rax
mov    %rax,-0x1fb8(%rbp)
mov    -0x1f6c(%rbp),%eax
mov    %eax,-0x1fac(%rbp)
mov    -0x1f68(%rbp),%rdi
mov    -0x1f74(%rbp),%esi
call   1040 <DefaultGC@plt>
mov    -0x1fb8(%rbp),%rdi
mov    -0x1fac(%rbp),%esi
mov    %eax,%edx
mov    -0x1f7c(%rbp),%eax
mov    -0xfc0(%rbp,%rax,4),%ecx
mov    -0x1f7c(%rbp),%eax
mov    -0x1f60(%rbp,%rax,4),%r8d
ff
mov    $0x7,%r9d
movl   $0x7,(%rsp)
call   1030 <XDrawRectangle@plt>
mov    -0x1f7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f7c(%rbp)
mov    -0x1f7c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    15c5 <main+0x365>
mov    -0x1f68(%rbp),%rdi
mov    -0x1f6c(%rbp),%esi
mov    -0x1f74(%rbp),%edx
lea    -0x1c(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1060 <draweatpoint@plt>
mov    -0x1f88(%rbp),%rax
mov    0x2957(%rip),%rcx
cmp    (%rcx),%rax
jne    16e1 <main+0x481>
lea    -0xfc0(%rbp),%rsi
lea    -0x1f60(%rbp),%rdx
mov    -0x1f68(%rbp),%r9
mov    -0x1f6c(%rbp),%r14d
mov    -0x1f74(%rbp),%ebx
lea    -0x1f88(%rbp),%rdi
lea    -0x1f78(%rbp),%rcx
lea    -0x1f7d(%rbp),%r8
lea    -0x20(%rbp),%r11
lea    -0x1c(%rbp),%r10
lea    -0x18(%rbp),%rax
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   10c0 <read_KeyPress@plt>
mov    -0x1f88(%rbp),%rax
mov    0x28e9(%rip),%rcx
cmp    (%rcx),%rax
jne    1702 <main+0x4a2>
movl   $0x1,-0x1f8c(%rbp)
jmp    1522 <main+0x2c2>
xor    %eax,%eax
add    $0x1fd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f68,%rsp
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
xor    %eax,%eax
call   1180 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x62,%ecx,%ecx
sub    %ecx,%eax
lea    0x8(,%rax,8),%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
call   1180 <rand@plt>
cltq
imul   $0x5397829d,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x62,%ecx,%ecx
sub    %ecx,%eax
lea    0x8(,%rax,8),%eax
mov    %eax,0x18(%rsp)
movl   $0x3,0x4(%rsp)
movb   $0x0,0x3(%rsp)
xor    %edi,%edi
call   1090 <XOpenDisplay@plt>
test   %rax,%rax
je     15b9 <main+0x359>
mov    %rax,%rbx
mov    %rax,%rdi
call   1170 <DefaultScreen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %eax,%esi
call   1100 <RootWindow@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1130 <BlackPixel@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
mov    $0x320,%r8d
mov    $0x320,%r9d
push   %rax
push   %r15
push   $0x1
call   1120 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r15d
lea    0xcc5(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   10f0 <XInternAtom@plt>
mov    %eax,0x14(%rsp)
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x1,%ecx
call   10b0 <XSetWMProtocols@plt>
mov    0x2c2e(%rip),%rax
mov    0x2c4f(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
mov    %r15d,%esi
call   1110 <XSelectInput@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1150 <XMapWindow@plt>
movl   $0x188,0xfc8(%rsp)
movl   $0x190,0x28(%rsp)
mov    $0xf,%eax
movaps 0xc36(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movups %xmm0,0xf90(%rsp,%rax,4)
movups %xmm0,0xfa0(%rsp,%rax,4)
movups %xmm0,-0x10(%rsp,%rax,4)
movups %xmm0,(%rsp,%rax,4)
movups %xmm0,0xfb0(%rsp,%rax,4)
movups %xmm0,0xfc0(%rsp,%rax,4)
movups %xmm0,0x10(%rsp,%rax,4)
movups %xmm0,0x20(%rsp,%rax,4)
add    $0x10,%rax
cmp    $0x1ff,%eax
jne    13d0 <main+0x170>
movl   $0x320,0x178c(%rsp)
movl   $0x320,0x7ec(%rsp)
movl   $0x1,0x10(%rsp)
movabs $0x18000000190,%rax
mov    %rax,0xfc0(%rsp)
movabs $0x19000000190,%rax
mov    %rax,0x20(%rsp)
lea    0x18(%rsp),%r12
lea    0x1c(%rsp),%r13
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12,%rcx
mov    %r13,%r8
call   1060 <draweatpoint@plt>
lea    0x8(%rsp),%rbp
jmp    1490 <main+0x230>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2b51(%rip),%rcx
cmp    (%rcx),%rax
je     15a5 <main+0x345>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10e0 <XNextEvent@plt>
mov    0x8(%rsp),%rax
mov    0x2b41(%rip),%rcx
cmp    (%rcx),%rax
jne    1553 <main+0x2f3>
mov    %r12,%rbp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
lea    0xfc0(%rsp),%rcx
lea    0x20(%rsp),%r8
call   1070 <redhead@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <DefaultGC@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1140 <XSetForeground@plt>
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <DefaultGC@plt>
mov    %r12d,%edx
mov    0xfc0(%rsp,%rdx,4),%ecx
mov    0x20(%rsp,%rdx,4),%r8d
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
mov    $0x7,%r9d
push   $0x7
call   1030 <XDrawRectangle@plt>
add    $0x10,%rsp
add    $0x1,%r12d
cmp    0x4(%rsp),%r12d
jne    14f0 <main+0x290>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %rbp,%r12
mov    %rbp,%rcx
mov    %r13,%r8
call   1060 <draweatpoint@plt>
mov    0x8(%rsp),%rax
lea    0x8(%rsp),%rbp
mov    0x2a76(%rip),%rcx
cmp    (%rcx),%rax
jne    1480 <main+0x220>
sub    $0x8,%rsp
mov    %rbp,%rdi
lea    0xfc8(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0xb(%rsp),%r8
mov    %rbx,%r9
push   %r13
push   %r12
lea    0x1c(%rsp),%rax
push   %rax
push   %r14
push   %r15
call   10c0 <read_KeyPress@plt>
add    $0x30,%rsp
mov    0x8(%rsp),%rax
jmp    1480 <main+0x220>
xor    %eax,%eax
add    $0x1f68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a00(%rip),%rax
mov    (%rax),%edi
lea    0xa47(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64 }
@stderr = global i32 0
@.str = [21 x i8] c"Cannot open display\0A\00"
@.str.1 = [17 x i8] c"WM_DELETE_WINDOW\00"
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@Expose = global i64 0
@KeyPress = global i64 0
@ClientMessage = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 x i32]
%6 = alloca [1000 x i32]
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca %struct.TYPE_4__
%15 = alloca i32
store i32 0, i32* %1
%16 = call i64 @time(i32* null)
%17 = trunc i64 %16 to i32
%18 = call i32 @srand(i32 %17)
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 98
%21 = add nsw i32 %20, 1
%22 = mul nsw i32 %21, 8
store i32 %22, i32* %2
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 98
%25 = add nsw i32 %24, 1
%26 = mul nsw i32 %25, 8
store i32 %26, i32* %3
store i32 3, i32* %4
store i8 0, i8* %13
store i32 0, i32* %15
%27 = call i32* @XOpenDisplay(i32* null)
store i32* %27, i32** %7
%28 = load i32*, i32** %7
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %34
30: ; preds = %0
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %0
%35 = load i32*, i32** %7
%36 = call i32 @DefaultScreen(i32* %35)
store i32 %36, i32* %10
%37 = load i32*, i32** %7
%38 = load i32*, i32** %7
%39 = load i32, i32* %10
%40 = call i32 @RootWindow(i32* %38, i32 %39)
%41 = load i32*, i32** %7
%42 = load i32, i32* %10
%43 = call i32 @BlackPixel(i32* %41, i32 %42)
%44 = load i32*, i32** %7
%45 = load i32, i32* %10
%46 = call i32 @WhitePixel(i32* %44, i32 %45)
%47 = call i32 @XCreateSimpleWindow(i32* %37, i32 %40, i32 10, i32 10, i32 800, i32 800, i32 1, i32 %43, i32 %46)
store i32 %47, i32* %8
%48 = load i32*, i32** %7
%49 = call i32 @XInternAtom(i32* %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %49, i32* %9
%50 = load i32*, i32** %7
%51 = load i32, i32* %8
%52 = call i32 @XSetWMProtocols(i32* %50, i32 %51, i32* %9, i32 1)
%53 = load i32*, i32** %7
%54 = load i32, i32* %8
%55 = load i32, i32* @ExposureMask
%56 = load i32, i32* @KeyPressMask
%57 = or i32 %55, %56
%58 = call i32 @XSelectInput(i32* %53, i32 %54, i32 %57)
%59 = load i32*, i32** %7
%60 = load i32, i32* %8
%61 = call i32 @XMapWindow(i32* %59, i32 %60)
store i32 2, i32* %12
br label %62
62: ; preds = %74, %34
%63 = load i32, i32* %12
%64 = mul i32 %63, 8
%65 = sub i32 408, %64
%66 = load i32, i32* %12
%67 = zext i32 %66 to i64
%68 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %67
store i32 %65, i32* %68
%69 = load i32, i32* %12
%70 = zext i32 %69 to i64
%71 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 %70
store i32 400, i32* %71
%72 = load i32, i32* %12
%73 = add i32 %72, 1
store i32 %73, i32* %12
br label %74
74: ; preds = %62
%75 = load i32, i32* %12
%76 = load i32, i32* %4
%77 = icmp ne i32 %75, %76
br i1 %77, label %62, label %78
78: ; preds = %74
br label %79
79: ; preds = %88, %78
%80 = load i32, i32* %12
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %81
store i32 800, i32* %82
%83 = load i32, i32* %12
%84 = zext i32 %83 to i64
%85 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 %84
store i32 800, i32* %85
%86 = load i32, i32* %12
%87 = add i32 %86, 1
store i32 %87, i32* %12
br label %88
88: ; preds = %79
%89 = load i32, i32* %12
%90 = icmp ne i32 %89, 500
br i1 %90, label %79, label %91
91: ; preds = %88
store i32 2, i32* %12
store i32 1, i32* %11
%92 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 0
store i32 400, i32* %92
%93 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
store i32 400, i32* %93
%94 = load i32, i32* %4
%95 = mul i32 %94, 8
%96 = sub i32 400, %95
%97 = add i32 %96, 8
%98 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 1
store i32 %97, i32* %98
%99 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 1
store i32 400, i32* %99
%100 = load i32*, i32** %7
%101 = load i32, i32* %8
%102 = load i32, i32* %10
%103 = call i32 @draweatpoint(i32* %100, i32 %101, i32 %102, i32* %3, i32* %2)
br label %104
104: ; preds = %171, %91
%105 = load i32, i32* %15
%106 = icmp ne i32 %105, 0
%107 = xor i1 %106, true
br i1 %107, label %108, label %172
108: ; preds = %104
%109 = load i32*, i32** %7
%110 = call i32 @XNextEvent(i32* %109, %struct.TYPE_4__* %14)
%111 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%112 = load i64, i64* %111
%113 = load i64, i64* @Expose
%114 = icmp eq i64 %112, %113
br i1 %114, label %115, label %153
115: ; preds = %108
%116 = load i32*, i32** %7
%117 = load i32, i32* %8
%118 = load i32, i32* %10
%119 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 0
%120 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%121 = call i32 @redhead(i32* %116, i32 %117, i32 %118, i32* %119, i32* %120)
store i32 1, i32* %12
%122 = load i32*, i32** %7
%123 = load i32*, i32** %7
%124 = load i32, i32* %10
%125 = call i32 @DefaultGC(i32* %123, i32 %124)
%126 = call i32 @XSetForeground(i32* %122, i32 %125, i32 0)
br label %127
127: ; preds = %144, %115
%128 = load i32*, i32** %7
%129 = load i32, i32* %8
%130 = load i32*, i32** %7
%131 = load i32, i32* %10
%132 = call i32 @DefaultGC(i32* %130, i32 %131)
%133 = load i32, i32* %12
%134 = zext i32 %133 to i64
%135 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = load i32, i32* %12
%138 = zext i32 %137 to i64
%139 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = call i32 @XDrawRectangle(i32* %128, i32 %129, i32 %132, i32 %136, i32 %140, i32 7, i32 7)
%142 = load i32, i32* %12
%143 = add i32 %142, 1
store i32 %143, i32* %12
br label %144
144: ; preds = %127
%145 = load i32, i32* %12
%146 = load i32, i32* %4
%147 = icmp ne i32 %145, %146
br i1 %147, label %127, label %148
148: ; preds = %144
%149 = load i32*, i32** %7
%150 = load i32, i32* %8
%151 = load i32, i32* %10
%152 = call i32 @draweatpoint(i32* %149, i32 %150, i32 %151, i32* %3, i32* %2)
br label %153
153: ; preds = %148, %108
%154 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%155 = load i64, i64* %154
%156 = load i64, i64* @KeyPress
%157 = icmp eq i64 %155, %156
br i1 %157, label %158, label %165
158: ; preds = %153
%159 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 0
%160 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%161 = load i32*, i32** %7
%162 = load i32, i32* %8
%163 = load i32, i32* %10
%164 = call i32 @read_KeyPress(%struct.TYPE_4__* %14, i32* %159, i32* %160, i32* %11, i8* %13, i32* %161, i32 %162, i32 %163, i32* %4, i32* %3, i32* %2)
br label %165
165: ; preds = %158, %153
%166 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%167 = load i64, i64* %166
%168 = load i64, i64* @ClientMessage
%169 = icmp eq i64 %167, %168
br i1 %169, label %170, label %171
170: ; preds = %165
store i32 1, i32* %15
br label %171
171: ; preds = %170, %165
br label %104
172: ; preds = %104
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64 }
@stderr = global i32 0
@.str = [21 x i8] c"Cannot open display\0A\00"
@.str.1 = [17 x i8] c"WM_DELETE_WINDOW\00"
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@Expose = global i64 0
@KeyPress = global i64 0
@ClientMessage = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i32]
%5 = alloca [1000 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca %struct.TYPE_4__
%10 = tail call i64 @time(i32* null)
%11 = trunc i64 %10 to i32
%12 = tail call i32 @srand(i32 %11)
%13 = bitcast i32* %1 to i8*
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 98
%16 = shl nsw i32 %15, 3
%17 = add nsw i32 %16, 8
store i32 %17, i32* %1
%18 = bitcast i32* %2 to i8*
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 98
%21 = shl nsw i32 %20, 3
%22 = add nsw i32 %21, 8
store i32 %22, i32* %2
%23 = bitcast i32* %3 to i8*
store i32 3, i32* %3
%24 = bitcast [1000 x i32]* %4 to i8*
%25 = bitcast [1000 x i32]* %5 to i8*
%26 = bitcast i32* %6 to i8*
%27 = bitcast i32* %7 to i8*
store i8 0, i8* %8
%28 = bitcast %struct.TYPE_4__* %9 to i8*
%29 = tail call i32* @XOpenDisplay(i32* null)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %35
31: ; preds = %0
%32 = load i32, i32* @stderr
%33 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %0
%36 = tail call i32 @DefaultScreen(i32* %29)
%37 = tail call i32 @RootWindow(i32* %29, i32 %36)
%38 = tail call i32 @BlackPixel(i32* %29, i32 %36)
%39 = tail call i32 @WhitePixel(i32* %29, i32 %36)
%40 = tail call i32 @XCreateSimpleWindow(i32* %29, i32 %37, i32 10, i32 10, i32 800, i32 800, i32 1, i32 %38, i32 %39)
%41 = tail call i32 @XInternAtom(i32* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %41, i32* %6
%42 = call i32 @XSetWMProtocols(i32* %29, i32 %40, i32* %6, i32 1)
%43 = load i32, i32* @ExposureMask
%44 = load i32, i32* @KeyPressMask
%45 = or i32 %44, %43
%46 = call i32 @XSelectInput(i32* %29, i32 %40, i32 %45)
%47 = call i32 @XMapWindow(i32* %29, i32 %40)
%48 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 2
store i32 392, i32* %48
%49 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 2
store i32 400, i32* %49
br label %50
50: ; preds = %50, %35
%51 = phi i32 [ 0, %35 ], [ %72, %50 ]
%52 = or i32 %51, 3
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %53
%55 = bitcast i32* %54 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %55
%56 = getelementptr inbounds i32, i32* %54, i64 4
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %57
%58 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %53
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %59
%60 = getelementptr inbounds i32, i32* %58, i64 4
%61 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %61
%62 = or i32 %51, 11
%63 = zext i32 %62 to i64
%64 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %63
%65 = bitcast i32* %64 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %65
%66 = getelementptr inbounds i32, i32* %64, i64 4
%67 = bitcast i32* %66 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %67
%68 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %63
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %69
%70 = getelementptr inbounds i32, i32* %68, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> <i32 800, i32 800, i32 800, i32 800>, <4 x i32>* %71
%72 = add nuw nsw i32 %51, 16
%73 = icmp eq i32 %72, 496
br i1 %73, label %74, label %50
74: ; preds = %50
%75 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 499
store i32 800, i32* %75
%76 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 499
store i32 800, i32* %76
store i32 1, i32* %7
%77 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 0
store i32 400, i32* %77
%78 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 0
store i32 400, i32* %78
%79 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 1
store i32 384, i32* %79
%80 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 1
store i32 400, i32* %80
%81 = call i32 @draweatpoint(i32* %29, i32 %40, i32 %36, i32* %2, i32* %1)
%82 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i64 0, i32 0
br label %83
83: ; preds = %74, %114
%84 = call i32 @XNextEvent(i32* %29, %struct.TYPE_4__* %9)
%85 = load i64, i64* %82
%86 = load i64, i64* @Expose
%87 = icmp eq i64 %85, %86
br i1 %87, label %88, label %107
88: ; preds = %83
%89 = call i32 @redhead(i32* %29, i32 %40, i32 %36, i32* %77, i32* %78)
%90 = call i32 @DefaultGC(i32* %29, i32 %36)
%91 = call i32 @XSetForeground(i32* %29, i32 %90, i32 0)
br label %92
92: ; preds = %92, %88
%93 = phi i32 [ 1, %88 ], [ %101, %92 ]
%94 = call i32 @DefaultGC(i32* %29, i32 %36)
%95 = zext i32 %93 to i64
%96 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %95
%99 = load i32, i32* %98
%100 = call i32 @XDrawRectangle(i32* %29, i32 %40, i32 %94, i32 %97, i32 %99, i32 7, i32 7)
%101 = add i32 %93, 1
%102 = load i32, i32* %3
%103 = icmp eq i32 %101, %102
br i1 %103, label %104, label %92
104: ; preds = %92
%105 = call i32 @draweatpoint(i32* %29, i32 %40, i32 %36, i32* %2, i32* %1)
%106 = load i64, i64* %82
br label %107
107: ; preds = %104, %83
%108 = phi i64 [ %106, %104 ], [ %85, %83 ]
%109 = load i64, i64* @KeyPress
%110 = icmp eq i64 %108, %109
br i1 %110, label %111, label %114
111: ; preds = %107
%112 = call i32 @read_KeyPress(%struct.TYPE_4__* %9, i32* %77, i32* %78, i32* %7, i8* %8, i32* %29, i32 %40, i32 %36, i32* %3, i32* %2, i32* %1)
%113 = load i64, i64* %82
br label %114
114: ; preds = %111, %107
%115 = phi i64 [ %113, %111 ], [ %108, %107 ]
%116 = load i64, i64* @ClientMessage
%117 = icmp eq i64 %115, %116
br i1 %117, label %118, label %83
118: ; preds = %114
ret i32 0
}