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

/* Type definitions */
struct TYPE_2__ {
  int keycode;
};
typedef TYPE_1__ XKeyEvent;
typedef int /*<<< orphan*/ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ blacktohead(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               unsigned int, unsigned int *, unsigned int *);
int /*<<< orphan*/ draweatpoint(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                unsigned int, unsigned int *, unsigned int *);
int rand();
int /*<<< orphan*/ rebuildchain(unsigned int *, unsigned int *, unsigned int *,
                                unsigned int *);
int /*<<< orphan*/ redhead(int /*<<< orphan*/ *, int /*<<< orphan*/,
                           unsigned int, unsigned int *, unsigned int *);
scalar_t__ selfeat(unsigned int *, unsigned int *, unsigned int, unsigned int,
                   unsigned int);
int /*<<< orphan*/ step(unsigned int *, unsigned int *, unsigned int *);
int /*<<< orphan*/ whitetoass(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              unsigned int, unsigned int *, unsigned int *,
                              unsigned int *);
void read_KeyPress(XEvent *eventp, unsigned int *x, unsigned int *y,
                   unsigned int *mv, char *plusminus, Display *d, Window w,
                   unsigned int s, unsigned int *LENGTH, unsigned int *xrand,
                   unsigned int *yrand) {
  unsigned int Xnw = 0, Ynw = 0;
  XKeyEvent *e = (XKeyEvent *)eventp;
  switch (e->keycode) {
  case 111:
    Ynw = y[0] - 8;
    Xnw = x[0];
    break;
  case 116:
    Ynw = y[0] + 8;
    Xnw = x[0];
    break;
  case 113:
    Ynw = y[0];
    Xnw = x[0] - 8;
    break;
  case 114:
    Ynw = y[0];
    Xnw = x[0] + 8;
    break;
  default:
    return;
  }
  if (((Xnw != x[0]) ^ (Ynw != y[0])) && ((Xnw) != (((100) * 8) - 8)) &&
      ((Ynw) != (((100) * 8) - 8)) && (selfeat(x, y, Xnw, Ynw, *LENGTH)) &&
      ((Xnw) != 0) && ((Ynw) != 0)) {
    blacktohead(d, w, s, x, y);
    whitetoass(d, w, s, x, y, mv);
    step(x, y, mv);
    x[0] = Xnw;
    y[0] = Ynw;
    if ((*mv) == (*LENGTH)) {
      *mv = 1;
      *plusminus = 1;
    } else if ((*mv) == 1) {
      *mv = *LENGTH;
      *plusminus = -1;
    }
    *mv = *mv + *plusminus;
    if ((*x == *xrand) & (*y == *yrand)) {
      rebuildchain(x, y, LENGTH, mv);
      *LENGTH = *LENGTH + 10;
      *yrand = ((rand() % ((100) - 2 - 1 + 1)) + 1) * 8;
      *xrand = ((rand() % ((100) - 2 - 1 + 1)) + 1) * 8;
      draweatpoint(d, w, s, xrand, yrand);
    }
  }
  redhead(d, w, s, x, y);
}


x86 assembly (clang, -O0):
<read_KeyPress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff91,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x5,%eax
ja     125c <read_KeyPress+0xdc>
mov    -0x48(%rbp),%rax
lea    0xe15(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x8,%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1261 <read_KeyPress+0xe1>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x8,%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1261 <read_KeyPress+0xe1>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x8,%eax
mov    %eax,-0x34(%rbp)
jmp    1261 <read_KeyPress+0xe1>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x8,%eax
mov    %eax,-0x34(%rbp)
jmp    1261 <read_KeyPress+0xe1>
jmp    145d <read_KeyPress+0x2dd>
mov    -0x34(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x38(%rbp),%ecx
mov    -0x18(%rbp),%rdx
cmp    (%rdx),%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    %ecx,%eax
cmp    $0x0,%eax
je     1446 <read_KeyPress+0x2c6>
cmpl   $0x318,-0x34(%rbp)
je     1446 <read_KeyPress+0x2c6>
cmpl   $0x318,-0x38(%rbp)
je     1446 <read_KeyPress+0x2c6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    0x20(%rbp),%rax
mov    (%rax),%r8d
call   1030 <selfeat@plt>
cmp    $0x0,%rax
je     1446 <read_KeyPress+0x2c6>
cmpl   $0x0,-0x34(%rbp)
je     1446 <read_KeyPress+0x2c6>
cmpl   $0x0,-0x38(%rbp)
je     1446 <read_KeyPress+0x2c6>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   10a0 <blacktohead@plt>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1050 <whitetoass@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <step@plt>
mov    -0x34(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    0x20(%rbp),%rcx
cmp    (%rcx),%eax
jne    135e <read_KeyPress+0x1de>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x1,(%rax)
jmp    1383 <read_KeyPress+0x203>
mov    -0x20(%rbp),%rax
cmpl   $0x1,(%rax)
jne    137e <read_KeyPress+0x1fe>
mov    0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
movb   $0xff,(%rax)
jmp    1383 <read_KeyPress+0x203>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
add    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x28(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    0x30(%rbp),%rdx
cmp    (%rdx),%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1441 <read_KeyPress+0x2c1>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <rebuildchain@plt>
mov    0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0xa,%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x62,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
add    $0x1,%ecx
shl    $0x3,%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x62,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
add    $0x1,%ecx
shl    $0x3,%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
mov    0x28(%rbp),%rcx
mov    0x30(%rbp),%r8
call   1060 <draweatpoint@plt>
jmp    1446 <read_KeyPress+0x2c6>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1070 <redhead@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_KeyPress>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    (%rdi),%eax
add    $0xffffff91,%eax
cmp    $0x5,%eax
ja     1203 <read_KeyPress+0x83>
mov    %rcx,%rbp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    0x90(%rsp),%rcx
mov    %rcx,0x28(%rsp)
mov    0x88(%rsp),%rcx
mov    %rcx,0x30(%rsp)
mov    0x80(%rsp),%rcx
mov    %rcx,0x18(%rsp)
mov    0x78(%rsp),%ecx
mov    %ecx,0x4(%rsp)
mov    0x70(%rsp),%r13d
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r8,0x8(%rsp)
mov    (%r15),%eax
lea    -0x8(%rax),%r12d
jmp    1231 <read_KeyPress+0xb1>
mov    %r8,0x8(%rsp)
mov    (%r15),%eax
mov    (%rbx),%ecx
lea    0x8(%rcx),%r14d
jmp    1220 <read_KeyPress+0xa0>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8,0x8(%rsp)
mov    (%r15),%eax
mov    (%rbx),%ecx
lea    -0x8(%rcx),%r14d
mov    %eax,%r12d
jmp    1236 <read_KeyPress+0xb6>
mov    %r8,0x8(%rsp)
mov    (%r15),%eax
lea    0x8(%rax),%r12d
mov    (%rbx),%ecx
mov    %ecx,%r14d
cmp    %ecx,%r14d
setne  %cl
cmp    %eax,%r12d
setne  %al
cmp    $0x318,%r14d
je     13ee <read_KeyPress+0x26e>
xor    %al,%cl
je     13ee <read_KeyPress+0x26e>
cmp    $0x318,%r12d
je     13ee <read_KeyPress+0x26e>
mov    0x18(%rsp),%rax
mov    (%rax),%r8d
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %r12d,%ecx
mov    %r9,0x10(%rsp)
call   1030 <selfeat@plt>
mov    0x10(%rsp),%r9
test   %rax,%rax
je     13ee <read_KeyPress+0x26e>
test   %r14d,%r14d
je     13ee <read_KeyPress+0x26e>
test   %r12d,%r12d
je     13ee <read_KeyPress+0x26e>
mov    %r9,%rdi
mov    %r13d,%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %r13d,0x24(%rsp)
mov    %r9,%r13
call   10a0 <blacktohead@plt>
mov    %r13,%rdi
mov    0x24(%rsp),%r13d
mov    %r13d,%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %rbp,%r9
call   1050 <whitetoass@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1080 <step@plt>
mov    %r14d,(%rbx)
mov    %r12d,(%r15)
mov    0x0(%rbp),%ecx
mov    0x18(%rsp),%rax
mov    (%rax),%eax
cmp    %eax,%ecx
jne    1319 <read_KeyPress+0x199>
movl   $0x1,0x0(%rbp)
mov    0x8(%rsp),%rax
movb   $0x1,(%rax)
mov    $0x1,%eax
mov    0x10(%rsp),%r9
jmp    1338 <read_KeyPress+0x1b8>
cmp    $0x1,%ecx
mov    0x10(%rsp),%r9
mov    0x8(%rsp),%rcx
jne    1335 <read_KeyPress+0x1b5>
mov    %eax,0x0(%rbp)
movb   $0xff,(%rcx)
mov    $0xffffffff,%eax
jmp    1338 <read_KeyPress+0x1b8>
movsbl (%rcx),%eax
add    %eax,0x0(%rbp)
mov    (%rbx),%eax
mov    0x30(%rsp),%rcx
cmp    (%rcx),%eax
jne    13ee <read_KeyPress+0x26e>
mov    0x28(%rsp),%rax
mov    (%rax),%eax
cmp    %eax,(%r15)
jne    13ee <read_KeyPress+0x26e>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    0x18(%rsp),%r14
mov    %r14,%rdx
mov    %rbp,%rcx
call   1040 <rebuildchain@plt>
addl   $0xa,(%r14)
xor    %eax,%eax
call   1090 <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    0x28(%rsp),%r14
mov    %eax,(%r14)
xor    %eax,%eax
call   1090 <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    0x30(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x10(%rsp),%rdi
mov    %r13d,%esi
mov    0x4(%rsp),%edx
mov    %r14,%r8
call   1060 <draweatpoint@plt>
mov    0x10(%rsp),%r9
mov    %r9,%rdi
mov    %r13d,%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rcx
mov    %r15,%r8
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <redhead@plt>

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @read_KeyPress(i32* %0, i32* %1, i32* %2, i32* %3, i8* %4, i32* %5, i32 %6, i32 %7, i32* %8, i32* %9, i32* %10) {
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32
%24 = alloca i32
%25 = alloca %struct.TYPE_2__*
store i32* %0, i32** %12
store i32* %1, i32** %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store i8* %4, i8** %16
store i32* %5, i32** %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32* %8, i32** %20
store i32* %9, i32** %21
store i32* %10, i32** %22
store i32 0, i32* %23
store i32 0, i32* %24
%26 = load i32*, i32** %12
%27 = bitcast i32* %26 to %struct.TYPE_2__*
store %struct.TYPE_2__* %27, %struct.TYPE_2__** %25
%28 = load %struct.TYPE_2__*, %struct.TYPE_2__** %25
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
%30 = load i32, i32* %29
switch i32 %30, label %63 [
i32 111, label %31
i32 116, label %39
i32 113, label %47
i32 114, label %55
]
31: ; preds = %11
%32 = load i32*, i32** %14
%33 = getelementptr inbounds i32, i32* %32, i64 0
%34 = load i32, i32* %33
%35 = sub i32 %34, 8
store i32 %35, i32* %24
%36 = load i32*, i32** %13
%37 = getelementptr inbounds i32, i32* %36, i64 0
%38 = load i32, i32* %37
store i32 %38, i32* %23
br label %64
39: ; preds = %11
%40 = load i32*, i32** %14
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = load i32, i32* %41
%43 = add i32 %42, 8
store i32 %43, i32* %24
%44 = load i32*, i32** %13
%45 = getelementptr inbounds i32, i32* %44, i64 0
%46 = load i32, i32* %45
store i32 %46, i32* %23
br label %64
47: ; preds = %11
%48 = load i32*, i32** %14
%49 = getelementptr inbounds i32, i32* %48, i64 0
%50 = load i32, i32* %49
store i32 %50, i32* %24
%51 = load i32*, i32** %13
%52 = getelementptr inbounds i32, i32* %51, i64 0
%53 = load i32, i32* %52
%54 = sub i32 %53, 8
store i32 %54, i32* %23
br label %64
55: ; preds = %11
%56 = load i32*, i32** %14
%57 = getelementptr inbounds i32, i32* %56, i64 0
%58 = load i32, i32* %57
store i32 %58, i32* %24
%59 = load i32*, i32** %13
%60 = getelementptr inbounds i32, i32* %59, i64 0
%61 = load i32, i32* %60
%62 = add i32 %61, 8
store i32 %62, i32* %23
br label %64
63: ; preds = %11
br label %198
64: ; preds = %55, %47, %39, %31
%65 = load i32, i32* %23
%66 = load i32*, i32** %13
%67 = getelementptr inbounds i32, i32* %66, i64 0
%68 = load i32, i32* %67
%69 = icmp ne i32 %65, %68
%70 = zext i1 %69 to i32
%71 = load i32, i32* %24
%72 = load i32*, i32** %14
%73 = getelementptr inbounds i32, i32* %72, i64 0
%74 = load i32, i32* %73
%75 = icmp ne i32 %71, %74
%76 = zext i1 %75 to i32
%77 = xor i32 %70, %76
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %191
79: ; preds = %64
%80 = load i32, i32* %23
%81 = icmp ne i32 %80, 792
br i1 %81, label %82, label %191
82: ; preds = %79
%83 = load i32, i32* %24
%84 = icmp ne i32 %83, 792
br i1 %84, label %85, label %191
85: ; preds = %82
%86 = load i32*, i32** %13
%87 = load i32*, i32** %14
%88 = load i32, i32* %23
%89 = load i32, i32* %24
%90 = load i32*, i32** %20
%91 = load i32, i32* %90
%92 = call i64 @selfeat(i32* %86, i32* %87, i32 %88, i32 %89, i32 %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %191
94: ; preds = %85
%95 = load i32, i32* %23
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %191
97: ; preds = %94
%98 = load i32, i32* %24
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %191
100: ; preds = %97
%101 = load i32*, i32** %17
%102 = load i32, i32* %18
%103 = load i32, i32* %19
%104 = load i32*, i32** %13
%105 = load i32*, i32** %14
%106 = call i32 @blacktohead(i32* %101, i32 %102, i32 %103, i32* %104, i32* %105)
%107 = load i32*, i32** %17
%108 = load i32, i32* %18
%109 = load i32, i32* %19
%110 = load i32*, i32** %13
%111 = load i32*, i32** %14
%112 = load i32*, i32** %15
%113 = call i32 @whitetoass(i32* %107, i32 %108, i32 %109, i32* %110, i32* %111, i32* %112)
%114 = load i32*, i32** %13
%115 = load i32*, i32** %14
%116 = load i32*, i32** %15
%117 = call i32 @step(i32* %114, i32* %115, i32* %116)
%118 = load i32, i32* %23
%119 = load i32*, i32** %13
%120 = getelementptr inbounds i32, i32* %119, i64 0
store i32 %118, i32* %120
%121 = load i32, i32* %24
%122 = load i32*, i32** %14
%123 = getelementptr inbounds i32, i32* %122, i64 0
store i32 %121, i32* %123
%124 = load i32*, i32** %15
%125 = load i32, i32* %124
%126 = load i32*, i32** %20
%127 = load i32, i32* %126
%128 = icmp eq i32 %125, %127
br i1 %128, label %129, label %132
129: ; preds = %100
%130 = load i32*, i32** %15
store i32 1, i32* %130
%131 = load i8*, i8** %16
store i8 1, i8* %131
br label %142
132: ; preds = %100
%133 = load i32*, i32** %15
%134 = load i32, i32* %133
%135 = icmp eq i32 %134, 1
br i1 %135, label %136, label %141
136: ; preds = %132
%137 = load i32*, i32** %20
%138 = load i32, i32* %137
%139 = load i32*, i32** %15
store i32 %138, i32* %139
%140 = load i8*, i8** %16
store i8 -1, i8* %140
br label %141
141: ; preds = %136, %132
br label %142
142: ; preds = %141, %129
%143 = load i32*, i32** %15
%144 = load i32, i32* %143
%145 = load i8*, i8** %16
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = add i32 %144, %147
%149 = load i32*, i32** %15
store i32 %148, i32* %149
%150 = load i32*, i32** %13
%151 = load i32, i32* %150
%152 = load i32*, i32** %21
%153 = load i32, i32* %152
%154 = icmp eq i32 %151, %153
%155 = zext i1 %154 to i32
%156 = load i32*, i32** %14
%157 = load i32, i32* %156
%158 = load i32*, i32** %22
%159 = load i32, i32* %158
%160 = icmp eq i32 %157, %159
%161 = zext i1 %160 to i32
%162 = and i32 %155, %161
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %190
164: ; preds = %142
%165 = load i32*, i32** %13
%166 = load i32*, i32** %14
%167 = load i32*, i32** %20
%168 = load i32*, i32** %15
%169 = call i32 @rebuildchain(i32* %165, i32* %166, i32* %167, i32* %168)
%170 = load i32*, i32** %20
%171 = load i32, i32* %170
%172 = add i32 %171, 10
%173 = load i32*, i32** %20
store i32 %172, i32* %173
%174 = call i32 (...) @rand()
%175 = srem i32 %174, 98
%176 = add nsw i32 %175, 1
%177 = mul nsw i32 %176, 8
%178 = load i32*, i32** %22
store i32 %177, i32* %178
%179 = call i32 (...) @rand()
%180 = srem i32 %179, 98
%181 = add nsw i32 %180, 1
%182 = mul nsw i32 %181, 8
%183 = load i32*, i32** %21
store i32 %182, i32* %183
%184 = load i32*, i32** %17
%185 = load i32, i32* %18
%186 = load i32, i32* %19
%187 = load i32*, i32** %21
%188 = load i32*, i32** %22
%189 = call i32 @draweatpoint(i32* %184, i32 %185, i32 %186, i32* %187, i32* %188)
br label %190
190: ; preds = %164, %142
br label %191
191: ; preds = %190, %97, %94, %85, %82, %79, %64
%192 = load i32*, i32** %17
%193 = load i32, i32* %18
%194 = load i32, i32* %19
%195 = load i32*, i32** %13
%196 = load i32*, i32** %14
%197 = call i32 @redhead(i32* %192, i32 %193, i32 %194, i32* %195, i32* %196)
br label %198
198: ; preds = %191, %63
ret void
}

LLVM IR (-O2):
define void @read_KeyPress(i32* nocapture %0, i32* %1, i32* %2, i32* %3, i8* nocapture %4, i32* %5, i32 %6, i32 %7, i32* %8, i32* %9, i32* %10) {
%12 = load i32, i32* %0
switch i32 %12, label %89 [
i32 111, label %13
i32 116, label %17
i32 113, label %21
i32 114, label %25
]
13: ; preds = %11
%14 = load i32, i32* %2
%15 = add i32 %14, -8
%16 = load i32, i32* %1
br label %29
17: ; preds = %11
%18 = load i32, i32* %2
%19 = add i32 %18, 8
%20 = load i32, i32* %1
br label %29
21: ; preds = %11
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = add i32 %23, -8
br label %29
25: ; preds = %11
%26 = load i32, i32* %2
%27 = load i32, i32* %1
%28 = add i32 %27, 8
br label %29
29: ; preds = %25, %21, %17, %13
%30 = phi i32 [ %26, %25 ], [ %22, %21 ], [ %18, %17 ], [ %14, %13 ]
%31 = phi i32 [ %27, %25 ], [ %23, %21 ], [ %20, %17 ], [ %16, %13 ]
%32 = phi i32 [ %26, %25 ], [ %22, %21 ], [ %19, %17 ], [ %15, %13 ]
%33 = phi i32 [ %28, %25 ], [ %24, %21 ], [ %20, %17 ], [ %16, %13 ]
%34 = icmp ne i32 %33, %31
%35 = icmp ne i32 %32, %30
%36 = xor i1 %34, %35
%37 = icmp ne i32 %33, 792
%38 = and i1 %37, %36
%39 = icmp ne i32 %32, 792
%40 = select i1 %38, i1 %39, i1 false
br i1 %40, label %41, label %87
41: ; preds = %29
%42 = load i32, i32* %8
%43 = tail call i64 @selfeat(i32* %1, i32* %2, i32 %33, i32 %32, i32 %42)
%44 = icmp ne i64 %43, 0
%45 = icmp ne i32 %33, 0
%46 = select i1 %44, i1 %45, i1 false
%47 = icmp ne i32 %32, 0
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %49, label %87
49: ; preds = %41
%50 = tail call i32 @blacktohead(i32* %5, i32 %6, i32 %7, i32* %1, i32* %2)
%51 = tail call i32 @whitetoass(i32* %5, i32 %6, i32 %7, i32* %1, i32* %2, i32* %3)
%52 = tail call i32 @step(i32* %1, i32* %2, i32* %3)
store i32 %33, i32* %1
store i32 %32, i32* %2
%53 = load i32, i32* %3
%54 = load i32, i32* %8
%55 = icmp eq i32 %53, %54
br i1 %55, label %56, label %57
56: ; preds = %49
store i32 1, i32* %3
store i8 1, i8* %4
br label %63
57: ; preds = %49
%58 = icmp eq i32 %53, 1
br i1 %58, label %62, label %59
59: ; preds = %57
%60 = load i8, i8* %4
%61 = sext i8 %60 to i32
br label %63
62: ; preds = %57
store i32 %54, i32* %3
store i8 -1, i8* %4
br label %63
63: ; preds = %59, %62, %56
%64 = phi i32 [ %61, %59 ], [ -1, %62 ], [ 1, %56 ]
%65 = load i32, i32* %3
%66 = add i32 %65, %64
store i32 %66, i32* %3
%67 = load i32, i32* %1
%68 = load i32, i32* %9
%69 = icmp eq i32 %67, %68
%70 = load i32, i32* %2
%71 = load i32, i32* %10
%72 = icmp eq i32 %70, %71
%73 = and i1 %69, %72
br i1 %73, label %74, label %87
74: ; preds = %63
%75 = tail call i32 @rebuildchain(i32* %1, i32* %2, i32* %8, i32* %3)
%76 = load i32, i32* %8
%77 = add i32 %76, 10
store i32 %77, i32* %8
%78 = tail call i32 (...) @rand()
%79 = srem i32 %78, 98
%80 = shl nsw i32 %79, 3
%81 = add nsw i32 %80, 8
store i32 %81, i32* %10
%82 = tail call i32 (...) @rand()
%83 = srem i32 %82, 98
%84 = shl nsw i32 %83, 3
%85 = add nsw i32 %84, 8
store i32 %85, i32* %9
%86 = tail call i32 @draweatpoint(i32* %5, i32 %6, i32 %7, i32* %9, i32* %10)
br label %87
87: ; preds = %63, %74, %41, %29
%88 = tail call i32 @redhead(i32* %5, i32 %6, i32 %7, i32* %1, i32* %2)
br label %89
89: ; preds = %11, %87
ret void
}