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

/* Type definitions */
struct TYPE_3__ {
  int bstate;
  int /*<<< orphan*/ x;
  int /*<<< orphan*/ y;
};
typedef TYPE_1__ MEVENT;

/* Variables and functions */
int ALL_MOUSE_EVENTS;
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ A_REVERSE;
int BUTTON1_PRESSED;
int BUTTON1_RELEASED;
int BUTTON2_PRESSED;
int BUTTON2_RELEASED;
int /*<<< orphan*/ COLOR_BLACK;
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
int KEY_MOUSE;
scalar_t__ OK;
int REPORT_MOUSE_POSITION;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ endwin();
int getch();
scalar_t__ getmouse(TYPE_1__ *);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mousemask(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ mvprintw(int /*<<< orphan*/, int, char *, ...);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int main() {
  MEVENT event;
  int ch;
  unsigned char buttons = 0;
INIT:
  initscr();
  noecho();
  cbreak();
  keypad(stdscr, TRUE);
  start_color();
  mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
  init_pair(8, COLOR_BLACK, COLOR_BLACK);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(3, COLOR_YELLOW, COLOR_BLACK);
  init_pair(4, COLOR_BLUE, COLOR_BLACK);
  init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(6, COLOR_CYAN, COLOR_BLACK);
  init_pair(7, COLOR_WHITE, COLOR_BLACK);
  attron(COLOR_PAIR(7));
TOP:
  ch = getch();
  if (ch == 27)
    goto END;
  if (ch == KEY_MOUSE)
    goto MOUSE;
  0
      ?: ch == 'k' ? attron(COLOR_PAIR(8))
     : ch == 'r'   ? attron(COLOR_PAIR(1))
     : ch == 'g'   ? attron(COLOR_PAIR(2))
     : ch == 'y'   ? attron(COLOR_PAIR(3))
     : ch == 'b'   ? attron(COLOR_PAIR(4))
     : ch == 'm'   ? attron(COLOR_PAIR(5))
     : ch == 'c'   ? attron(COLOR_PAIR(6))
     : ch == 'w'   ? attron(COLOR_PAIR(7))
                   : ch == 'K'
         ? attron(COLOR_PAIR(8)),
      attron(A_BOLD) : ch == 'R' ? attron(COLOR_PAIR(1)),
      attron(A_BOLD) : ch == 'G' ? attron(COLOR_PAIR(2)),
      attron(A_BOLD) : ch == 'Y' ? attron(COLOR_PAIR(3)),
      attron(A_BOLD) : ch == 'B' ? attron(COLOR_PAIR(4)),
      attron(A_BOLD) : ch == 'M' ? attron(COLOR_PAIR(5)),
      attron(A_BOLD) : ch == 'C' ? attron(COLOR_PAIR(6)),
      attron(A_BOLD) : ch == 'W' ? attron(COLOR_PAIR(7)), attron(A_BOLD) : 0;
  goto TOP;
MOUSE:
  if (getmouse(&event) != OK)
    goto TOP;
  attron(A_REVERSE);
  mvprintw(0, 0, "(%2i,%2i) %x", event.x, event.y, event.bstate);
  attroff(A_REVERSE);
  if (event.bstate & BUTTON1_PRESSED)
    buttons |= 1;
  if (event.bstate & BUTTON1_RELEASED)
    buttons ^= 1;
  if (event.bstate & BUTTON2_PRESSED)
    buttons |= 2;
  if (event.bstate & BUTTON2_RELEASED)
    buttons ^= 2;
  if (event.bstate & REPORT_MOUSE_POSITION)
    goto MOVED;
  mvprintw(0, 50, "         [%i]    ", buttons);
  goto REFRESH;
MOVED:
  mvprintw(0, 50, "MOVED.   [%i]    ", buttons);
  if (buttons & 1)
    goto DRAW;
  if (buttons & 2)
    goto ERASE;
  goto REFRESH;
DRAW:
  mvprintw(0, 50, "DRAW    [%i]     ", buttons);
  mvprintw(event.y, event.x, "%s", "#");
  goto REFRESH;
ERASE:
  mvprintw(0, 50, "ERASE   [%i]     ", buttons);
  mvprintw(event.y, event.x, "%s", " ");
  goto REFRESH;
REFRESH:
  refresh();
  goto TOP;
END:
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x15(%rbp)
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x0,%al
call   1100 <noecho@plt>
mov    $0x0,%al
call   1040 <cbreak@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
call   1070 <keypad@plt>
mov    $0x0,%al
call   1090 <start_color@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x2d22(%rip),%rax
or     (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <mousemask@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%esi
mov    0x2d4f(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%edi
call   1060 <init_pair@plt>
mov    0x2cd4(%rip),%rax
mov    (%rax),%esi
mov    0x2d33(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
mov    0x2d17(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    0x2cc4(%rip),%rax
mov    (%rax),%esi
mov    0x2cfb(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2c90(%rip),%rax
mov    (%rax),%esi
mov    0x2cdf(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%edi
call   1060 <init_pair@plt>
mov    0x2cac(%rip),%rax
mov    (%rax),%esi
mov    0x2cc3(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%edi
call   1060 <init_pair@plt>
mov    0x2ca8(%rip),%rax
mov    (%rax),%esi
mov    0x2ca7(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%edi
call   1060 <init_pair@plt>
mov    0x2c64(%rip),%rax
mov    (%rax),%esi
mov    0x2c8b(%rip),%rax
mov    (%rax),%edx
mov    $0x7,%edi
call   1060 <init_pair@plt>
mov    $0x7,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    $0x0,%al
call   10e0 <getch@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1b,-0x14(%rbp)
jne    135b <main+0x16b>
jmp    1841 <main+0x651>
mov    -0x14(%rbp),%eax
mov    0x2c63(%rip),%rcx
cmp    (%rcx),%eax
jne    1372 <main+0x182>
jmp    1675 <main+0x485>
cmpl   $0x6b,-0x14(%rbp)
jne    1392 <main+0x1a2>
mov    $0x8,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
jmp    1670 <main+0x480>
cmpl   $0x72,-0x14(%rbp)
jne    13b5 <main+0x1c5>
mov    $0x1,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x1c(%rbp)
jmp    166d <main+0x47d>
cmpl   $0x67,-0x14(%rbp)
jne    13d8 <main+0x1e8>
mov    $0x2,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x20(%rbp)
jmp    1667 <main+0x477>
cmpl   $0x79,-0x14(%rbp)
jne    13fb <main+0x20b>
mov    $0x3,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x24(%rbp)
jmp    1661 <main+0x471>
cmpl   $0x62,-0x14(%rbp)
jne    141e <main+0x22e>
mov    $0x4,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x28(%rbp)
jmp    165b <main+0x46b>
cmpl   $0x6d,-0x14(%rbp)
jne    1441 <main+0x251>
mov    $0x5,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x2c(%rbp)
jmp    1655 <main+0x465>
cmpl   $0x63,-0x14(%rbp)
jne    1464 <main+0x274>
mov    $0x6,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x30(%rbp)
jmp    164f <main+0x45f>
cmpl   $0x77,-0x14(%rbp)
jne    1487 <main+0x297>
mov    $0x7,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    %eax,-0x34(%rbp)
jmp    1649 <main+0x459>
cmpl   $0x4b,-0x14(%rbp)
jne    14b8 <main+0x2c8>
mov    $0x8,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2aa7(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x38(%rbp)
jmp    1643 <main+0x453>
cmpl   $0x52,-0x14(%rbp)
jne    14e9 <main+0x2f9>
mov    $0x1,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2a76(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x3c(%rbp)
jmp    163d <main+0x44d>
cmpl   $0x47,-0x14(%rbp)
jne    151a <main+0x32a>
mov    $0x2,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2a45(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x40(%rbp)
jmp    1637 <main+0x447>
cmpl   $0x59,-0x14(%rbp)
jne    154b <main+0x35b>
mov    $0x3,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2a14(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x44(%rbp)
jmp    1631 <main+0x441>
cmpl   $0x42,-0x14(%rbp)
jne    157c <main+0x38c>
mov    $0x4,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x29e3(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x48(%rbp)
jmp    162b <main+0x43b>
cmpl   $0x4d,-0x14(%rbp)
jne    15ad <main+0x3bd>
mov    $0x5,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x29b2(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x4c(%rbp)
jmp    1625 <main+0x435>
cmpl   $0x43,-0x14(%rbp)
jne    15de <main+0x3ee>
mov    $0x6,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2981(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x50(%rbp)
jmp    161f <main+0x42f>
cmpl   $0x57,-0x14(%rbp)
jne    160f <main+0x41f>
mov    $0x7,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2950(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    %eax,-0x54(%rbp)
jmp    1619 <main+0x429>
xor    %eax,%eax
mov    %eax,-0x54(%rbp)
jmp    1619 <main+0x429>
mov    -0x54(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
jmp    1342 <main+0x152>
lea    -0x10(%rbp),%rdi
call   10b0 <getmouse@plt>
mov    0x28db(%rip),%rcx
cmp    (%rcx),%rax
je     1693 <main+0x4a3>
jmp    1342 <main+0x152>
mov    0x28ee(%rip),%rax
mov    (%rax),%edi
call   10a0 <attron@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0x10(%rbp),%r9d
xor    %esi,%esi
lea    0x94b(%rip),%rdx
mov    %esi,%edi
mov    $0x0,%al
call   1110 <mvprintw@plt>
mov    0x28c3(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    -0x10(%rbp),%eax
mov    0x28a2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     16eb <main+0x4fb>
movzbl -0x15(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%eax
mov    0x28e3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     170a <main+0x51a>
movzbl -0x15(%rbp),%eax
xor    $0x1,%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%eax
mov    0x28d4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1729 <main+0x539>
movzbl -0x15(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%eax
mov    0x28bd(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1748 <main+0x558>
movzbl -0x15(%rbp),%eax
xor    $0x2,%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2816(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1762 <main+0x572>
jmp    1780 <main+0x590>
movzbl -0x15(%rbp),%ecx
xor    %edi,%edi
mov    $0x32,%esi
lea    0x899(%rip),%rdx
mov    $0x0,%al
call   1110 <mvprintw@plt>
jmp    1835 <main+0x645>
movzbl -0x15(%rbp),%ecx
xor    %edi,%edi
mov    $0x32,%esi
lea    0x88d(%rip),%rdx
mov    $0x0,%al
call   1110 <mvprintw@plt>
movzbl -0x15(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     17ae <main+0x5be>
jmp    17c8 <main+0x5d8>
movzbl -0x15(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     17c3 <main+0x5d3>
jmp    1801 <main+0x611>
jmp    1835 <main+0x645>
movzbl -0x15(%rbp),%ecx
xor    %edi,%edi
mov    $0x32,%esi
lea    0x857(%rip),%rdx
mov    $0x0,%al
call   1110 <mvprintw@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    0x855(%rip),%rdx
lea    0x851(%rip),%rcx
mov    $0x0,%al
call   1110 <mvprintw@plt>
jmp    1835 <main+0x645>
movzbl -0x15(%rbp),%ecx
xor    %edi,%edi
mov    $0x32,%esi
lea    0x835(%rip),%rdx
mov    $0x0,%al
call   1110 <mvprintw@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    0x81c(%rip),%rdx
lea    0x813(%rip),%rcx
mov    $0x0,%al
call   1110 <mvprintw@plt>
mov    $0x0,%al
call   10d0 <refresh@plt>
jmp    1342 <main+0x152>
mov    $0x0,%al
call   10f0 <endwin@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1080 <initscr@plt>
xor    %eax,%eax
call   1100 <noecho@plt>
xor    %eax,%eax
call   1040 <cbreak@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
call   1070 <keypad@plt>
xor    %eax,%eax
call   1090 <start_color@plt>
mov    0x2d98(%rip),%rax
mov    0x2d29(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
xor    %esi,%esi
call   1050 <mousemask@plt>
mov    0x2d5f(%rip),%rbx
mov    (%rbx),%edx
mov    $0x8,%edi
mov    %edx,%esi
call   1060 <init_pair@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x4,%edi
call   1060 <init_pair@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x5,%edi
call   1060 <init_pair@plt>
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x6,%edi
call   1060 <init_pair@plt>
mov    0x2c9c(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x7,%edi
call   1060 <init_pair@plt>
mov    $0x7,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
xor    %eax,%eax
call   10e0 <getch@plt>
cmp    $0x1b,%eax
jne    1327 <main+0x137>
xor    %eax,%eax
call   10f0 <endwin@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c9a(%rip),%rbp
lea    0x8(%rsp),%rbx
mov    0x2c26(%rip),%r12
mov    0x2c37(%rip),%r15
lea    0xcb8(%rip),%r14
movl   $0x0,0x4(%rsp)
jmp    137e <main+0x18e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10b0 <getmouse@plt>
cmp    (%r12),%rax
je     1431 <main+0x241>
xor    %eax,%eax
call   10e0 <getch@plt>
cmp    $0x1b,%eax
je     130f <main+0x11f>
cmp    0x0(%rbp),%eax
je     1360 <main+0x170>
add    $0xffffffbe,%eax
cmp    $0x37,%eax
ja     1372 <main+0x182>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    $0x4,%edi
jmp    13d0 <main+0x1e0>
mov    $0x6,%edi
jmp    13d0 <main+0x1e0>
mov    $0x2,%edi
jmp    13d0 <main+0x1e0>
mov    $0x8,%edi
jmp    13d0 <main+0x1e0>
mov    $0x5,%edi
jmp    13d0 <main+0x1e0>
mov    $0x1,%edi
jmp    13d0 <main+0x1e0>
mov    $0x7,%edi
jmp    13d0 <main+0x1e0>
mov    $0x3,%edi
nopw   0x0(%rax,%rax,1)
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
jmp    1427 <main+0x237>
mov    $0x4,%edi
jmp    1420 <main+0x230>
mov    $0x6,%edi
jmp    1420 <main+0x230>
mov    $0x2,%edi
jmp    1420 <main+0x230>
mov    $0x8,%edi
jmp    1420 <main+0x230>
mov    $0x5,%edi
jmp    1420 <main+0x230>
mov    $0x1,%edi
jmp    1420 <main+0x230>
mov    $0x7,%edi
jmp    1420 <main+0x230>
mov    $0x3,%edi
nopl   (%rax)
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10a0 <attron@plt>
jmp    1372 <main+0x182>
mov    0x2b50(%rip),%r13
mov    0x0(%r13),%edi
call   10a0 <attron@plt>
mov    0x8(%rsp),%r9d
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%r8d
xor    %edi,%edi
xor    %esi,%esi
lea    0xc86(%rip),%rdx
xor    %eax,%eax
call   1110 <mvprintw@plt>
mov    0x0(%r13),%edi
call   1030 <attroff@plt>
mov    0x8(%rsp),%eax
test   %eax,(%r15)
setne  %cl
mov    0x4(%rsp),%edx
or     %cl,%dl
mov    0x2b57(%rip),%rcx
test   %eax,(%rcx)
setne  %cl
xor    %dl,%cl
movzbl %cl,%edx
or     $0x2,%cl
mov    0x2b53(%rip),%rsi
test   %eax,(%rsi)
movzbl %cl,%ecx
cmove  %edx,%ecx
mov    %ecx,%edx
xor    $0x2,%dl
mov    0x2b47(%rip),%rsi
test   %eax,(%rsi)
movzbl %dl,%edx
cmove  %ecx,%edx
mov    %edx,0x4(%rsp)
movzbl %dl,%r13d
mov    0x2aa8(%rip),%rcx
test   %eax,(%rcx)
je     1519 <main+0x329>
xor    %edi,%edi
mov    $0x32,%esi
lea    0xc2d(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1110 <mvprintw@plt>
test   $0x1,%r13b
jne    1533 <main+0x343>
testb  $0x2,0x4(%rsp)
je     1568 <main+0x378>
xor    %edi,%edi
mov    $0x32,%esi
lea    0xc31(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1110 <mvprintw@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edi
lea    0xc13(%rip),%rdx
lea    0xc0a(%rip),%rcx
jmp    1561 <main+0x371>
xor    %edi,%edi
mov    $0x32,%esi
lea    0xbc6(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1110 <mvprintw@plt>
jmp    1568 <main+0x378>
xor    %edi,%edi
mov    $0x32,%esi
lea    0xbd0(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1110 <mvprintw@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edi
lea    0xbc9(%rip),%rdx
lea    0xbc5(%rip),%rcx
xor    %eax,%eax
call   1110 <mvprintw@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
jmp    1372 <main+0x182>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32 }
@stdscr = global i32 0
@TRUE = global i32 0
@ALL_MOUSE_EVENTS = global i32 0
@REPORT_MOUSE_POSITION = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_WHITE = global i32 0
@KEY_MOUSE = global i32 0
@A_BOLD = global i32 0
@OK = global i64 0
@A_REVERSE = global i32 0
@.str = [13 x i8] c"(%2i,%2i) %x\00"
@BUTTON1_PRESSED = global i32 0
@BUTTON1_RELEASED = global i32 0
@BUTTON2_PRESSED = global i32 0
@BUTTON2_RELEASED = global i32 0
@.str.1 = [18 x i8] c" [%i] \00"
@.str.2 = [18 x i8] c"MOVED. [%i] \00"
@.str.3 = [18 x i8] c"DRAW [%i] \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c"#\00"
@.str.6 = [18 x i8] c"ERASE [%i] \00"
@.str.7 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.TYPE_3__
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %4
br label %5
5: ; preds = %0
%6 = call i32 (...) @initscr()
%7 = call i32 (...) @noecho()
%8 = call i32 (...) @cbreak()
%9 = load i32, i32* @stdscr
%10 = load i32, i32* @TRUE
%11 = call i32 @keypad(i32 %9, i32 %10)
%12 = call i32 (...) @start_color()
%13 = load i32, i32* @ALL_MOUSE_EVENTS
%14 = load i32, i32* @REPORT_MOUSE_POSITION
%15 = or i32 %13, %14
%16 = call i32 @mousemask(i32 %15, i32* null)
%17 = load i32, i32* @COLOR_BLACK
%18 = load i32, i32* @COLOR_BLACK
%19 = call i32 @init_pair(i32 8, i32 %17, i32 %18)
%20 = load i32, i32* @COLOR_RED
%21 = load i32, i32* @COLOR_BLACK
%22 = call i32 @init_pair(i32 1, i32 %20, i32 %21)
%23 = load i32, i32* @COLOR_GREEN
%24 = load i32, i32* @COLOR_BLACK
%25 = call i32 @init_pair(i32 2, i32 %23, i32 %24)
%26 = load i32, i32* @COLOR_YELLOW
%27 = load i32, i32* @COLOR_BLACK
%28 = call i32 @init_pair(i32 3, i32 %26, i32 %27)
%29 = load i32, i32* @COLOR_BLUE
%30 = load i32, i32* @COLOR_BLACK
%31 = call i32 @init_pair(i32 4, i32 %29, i32 %30)
%32 = load i32, i32* @COLOR_MAGENTA
%33 = load i32, i32* @COLOR_BLACK
%34 = call i32 @init_pair(i32 5, i32 %32, i32 %33)
%35 = load i32, i32* @COLOR_CYAN
%36 = load i32, i32* @COLOR_BLACK
%37 = call i32 @init_pair(i32 6, i32 %35, i32 %36)
%38 = load i32, i32* @COLOR_WHITE
%39 = load i32, i32* @COLOR_BLACK
%40 = call i32 @init_pair(i32 7, i32 %38, i32 %39)
%41 = call i32 @COLOR_PAIR(i32 7)
%42 = call i32 @attron(i32 %41)
br label %43
43: ; preds = %303, %202, %196, %5
%44 = call i32 (...) @getch()
store i32 %44, i32* %3
%45 = load i32, i32* %3
%46 = icmp eq i32 %45, 27
br i1 %46, label %47, label %48
47: ; preds = %43
br label %305
48: ; preds = %43
%49 = load i32, i32* %3
%50 = load i32, i32* @KEY_MOUSE
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %48
br label %198
53: ; preds = %48
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 107
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 @COLOR_PAIR(i32 8)
%58 = call i32 @attron(i32 %57)
br label %196
59: ; preds = %53
%60 = load i32, i32* %3
%61 = icmp eq i32 %60, 114
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = call i32 @COLOR_PAIR(i32 1)
%64 = call i32 @attron(i32 %63)
br label %194
65: ; preds = %59
%66 = load i32, i32* %3
%67 = icmp eq i32 %66, 103
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = call i32 @COLOR_PAIR(i32 2)
%70 = call i32 @attron(i32 %69)
br label %192
71: ; preds = %65
%72 = load i32, i32* %3
%73 = icmp eq i32 %72, 121
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = call i32 @COLOR_PAIR(i32 3)
%76 = call i32 @attron(i32 %75)
br label %190
77: ; preds = %71
%78 = load i32, i32* %3
%79 = icmp eq i32 %78, 98
br i1 %79, label %80, label %83
80: ; preds = %77
%81 = call i32 @COLOR_PAIR(i32 4)
%82 = call i32 @attron(i32 %81)
br label %188
83: ; preds = %77
%84 = load i32, i32* %3
%85 = icmp eq i32 %84, 109
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = call i32 @COLOR_PAIR(i32 5)
%88 = call i32 @attron(i32 %87)
br label %186
89: ; preds = %83
%90 = load i32, i32* %3
%91 = icmp eq i32 %90, 99
br i1 %91, label %92, label %95
92: ; preds = %89
%93 = call i32 @COLOR_PAIR(i32 6)
%94 = call i32 @attron(i32 %93)
br label %184
95: ; preds = %89
%96 = load i32, i32* %3
%97 = icmp eq i32 %96, 119
br i1 %97, label %98, label %101
98: ; preds = %95
%99 = call i32 @COLOR_PAIR(i32 7)
%100 = call i32 @attron(i32 %99)
br label %182
101: ; preds = %95
%102 = load i32, i32* %3
%103 = icmp eq i32 %102, 75
br i1 %103, label %104, label %109
104: ; preds = %101
%105 = call i32 @COLOR_PAIR(i32 8)
%106 = call i32 @attron(i32 %105)
%107 = load i32, i32* @A_BOLD
%108 = call i32 @attron(i32 %107)
br label %180
109: ; preds = %101
%110 = load i32, i32* %3
%111 = icmp eq i32 %110, 82
br i1 %111, label %112, label %117
112: ; preds = %109
%113 = call i32 @COLOR_PAIR(i32 1)
%114 = call i32 @attron(i32 %113)
%115 = load i32, i32* @A_BOLD
%116 = call i32 @attron(i32 %115)
br label %178
117: ; preds = %109
%118 = load i32, i32* %3
%119 = icmp eq i32 %118, 71
br i1 %119, label %120, label %125
120: ; preds = %117
%121 = call i32 @COLOR_PAIR(i32 2)
%122 = call i32 @attron(i32 %121)
%123 = load i32, i32* @A_BOLD
%124 = call i32 @attron(i32 %123)
br label %176
125: ; preds = %117
%126 = load i32, i32* %3
%127 = icmp eq i32 %126, 89
br i1 %127, label %128, label %133
128: ; preds = %125
%129 = call i32 @COLOR_PAIR(i32 3)
%130 = call i32 @attron(i32 %129)
%131 = load i32, i32* @A_BOLD
%132 = call i32 @attron(i32 %131)
br label %174
133: ; preds = %125
%134 = load i32, i32* %3
%135 = icmp eq i32 %134, 66
br i1 %135, label %136, label %141
136: ; preds = %133
%137 = call i32 @COLOR_PAIR(i32 4)
%138 = call i32 @attron(i32 %137)
%139 = load i32, i32* @A_BOLD
%140 = call i32 @attron(i32 %139)
br label %172
141: ; preds = %133
%142 = load i32, i32* %3
%143 = icmp eq i32 %142, 77
br i1 %143, label %144, label %149
144: ; preds = %141
%145 = call i32 @COLOR_PAIR(i32 5)
%146 = call i32 @attron(i32 %145)
%147 = load i32, i32* @A_BOLD
%148 = call i32 @attron(i32 %147)
br label %170
149: ; preds = %141
%150 = load i32, i32* %3
%151 = icmp eq i32 %150, 67
br i1 %151, label %152, label %157
152: ; preds = %149
%153 = call i32 @COLOR_PAIR(i32 6)
%154 = call i32 @attron(i32 %153)
%155 = load i32, i32* @A_BOLD
%156 = call i32 @attron(i32 %155)
br label %168
157: ; preds = %149
%158 = load i32, i32* %3
%159 = icmp eq i32 %158, 87
br i1 %159, label %160, label %165
160: ; preds = %157
%161 = call i32 @COLOR_PAIR(i32 7)
%162 = call i32 @attron(i32 %161)
%163 = load i32, i32* @A_BOLD
%164 = call i32 @attron(i32 %163)
br label %166
165: ; preds = %157
br label %166
166: ; preds = %165, %160
%167 = phi i32 [ %164, %160 ], [ 0, %165 ]
br label %168
168: ; preds = %166, %152
%169 = phi i32 [ %156, %152 ], [ %167, %166 ]
br label %170
170: ; preds = %168, %144
%171 = phi i32 [ %148, %144 ], [ %169, %168 ]
br label %172
172: ; preds = %170, %136
%173 = phi i32 [ %140, %136 ], [ %171, %170 ]
br label %174
174: ; preds = %172, %128
%175 = phi i32 [ %132, %128 ], [ %173, %172 ]
br label %176
176: ; preds = %174, %120
%177 = phi i32 [ %124, %120 ], [ %175, %174 ]
br label %178
178: ; preds = %176, %112
%179 = phi i32 [ %116, %112 ], [ %177, %176 ]
br label %180
180: ; preds = %178, %104
%181 = phi i32 [ %108, %104 ], [ %179, %178 ]
br label %182
182: ; preds = %180, %98
%183 = phi i32 [ %100, %98 ], [ %181, %180 ]
br label %184
184: ; preds = %182, %92
%185 = phi i32 [ %94, %92 ], [ %183, %182 ]
br label %186
186: ; preds = %184, %86
%187 = phi i32 [ %88, %86 ], [ %185, %184 ]
br label %188
188: ; preds = %186, %80
%189 = phi i32 [ %82, %80 ], [ %187, %186 ]
br label %190
190: ; preds = %188, %74
%191 = phi i32 [ %76, %74 ], [ %189, %188 ]
br label %192
192: ; preds = %190, %68
%193 = phi i32 [ %70, %68 ], [ %191, %190 ]
br label %194
194: ; preds = %192, %62
%195 = phi i32 [ %64, %62 ], [ %193, %192 ]
br label %196
196: ; preds = %194, %56
%197 = phi i32 [ %58, %56 ], [ %195, %194 ]
br label %43
198: ; preds = %52
%199 = call i64 @getmouse(%struct.TYPE_3__* %2)
%200 = load i64, i64* @OK
%201 = icmp ne i64 %199, %200
br i1 %201, label %202, label %203
202: ; preds = %198
br label %43
203: ; preds = %198
%204 = load i32, i32* @A_REVERSE
%205 = call i32 @attron(i32 %204)
%206 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
%207 = load i32, i32* %206
%208 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 2
%209 = load i32, i32* %208
%210 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%211 = load i32, i32* %210
%212 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %207, i32 %209, i32 %211)
%213 = load i32, i32* @A_REVERSE
%214 = call i32 @attroff(i32 %213)
%215 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%216 = load i32, i32* %215
%217 = load i32, i32* @BUTTON1_PRESSED
%218 = and i32 %216, %217
%219 = icmp ne i32 %218, 0
br i1 %219, label %220, label %225
220: ; preds = %203
%221 = load i8, i8* %4
%222 = zext i8 %221 to i32
%223 = or i32 %222, 1
%224 = trunc i32 %223 to i8
store i8 %224, i8* %4
br label %225
225: ; preds = %220, %203
%226 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%227 = load i32, i32* %226
%228 = load i32, i32* @BUTTON1_RELEASED
%229 = and i32 %227, %228
%230 = icmp ne i32 %229, 0
br i1 %230, label %231, label %236
231: ; preds = %225
%232 = load i8, i8* %4
%233 = zext i8 %232 to i32
%234 = xor i32 %233, 1
%235 = trunc i32 %234 to i8
store i8 %235, i8* %4
br label %236
236: ; preds = %231, %225
%237 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%238 = load i32, i32* %237
%239 = load i32, i32* @BUTTON2_PRESSED
%240 = and i32 %238, %239
%241 = icmp ne i32 %240, 0
br i1 %241, label %242, label %247
242: ; preds = %236
%243 = load i8, i8* %4
%244 = zext i8 %243 to i32
%245 = or i32 %244, 2
%246 = trunc i32 %245 to i8
store i8 %246, i8* %4
br label %247
247: ; preds = %242, %236
%248 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%249 = load i32, i32* %248
%250 = load i32, i32* @BUTTON2_RELEASED
%251 = and i32 %249, %250
%252 = icmp ne i32 %251, 0
br i1 %252, label %253, label %258
253: ; preds = %247
%254 = load i8, i8* %4
%255 = zext i8 %254 to i32
%256 = xor i32 %255, 2
%257 = trunc i32 %256 to i8
store i8 %257, i8* %4
br label %258
258: ; preds = %253, %247
%259 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%260 = load i32, i32* %259
%261 = load i32, i32* @REPORT_MOUSE_POSITION
%262 = and i32 %260, %261
%263 = icmp ne i32 %262, 0
br i1 %263, label %264, label %265
264: ; preds = %258
br label %269
265: ; preds = %258
%266 = load i8, i8* %4
%267 = zext i8 %266 to i32
%268 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %267)
br label %303
269: ; preds = %264
%270 = load i8, i8* %4
%271 = zext i8 %270 to i32
%272 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %271)
%273 = load i8, i8* %4
%274 = zext i8 %273 to i32
%275 = and i32 %274, 1
%276 = icmp ne i32 %275, 0
br i1 %276, label %277, label %278
277: ; preds = %269
br label %285
278: ; preds = %269
%279 = load i8, i8* %4
%280 = zext i8 %279 to i32
%281 = and i32 %280, 2
%282 = icmp ne i32 %281, 0
br i1 %282, label %283, label %284
283: ; preds = %278
br label %294
284: ; preds = %278
br label %303
285: ; preds = %277
%286 = load i8, i8* %4
%287 = zext i8 %286 to i32
%288 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %287)
%289 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 2
%290 = load i32, i32* %289
%291 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
%292 = load i32, i32* %291
%293 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %290, i32 %292, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %303
294: ; preds = %283
%295 = load i8, i8* %4
%296 = zext i8 %295 to i32
%297 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %296)
%298 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 2
%299 = load i32, i32* %298
%300 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
%301 = load i32, i32* %300
%302 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %299, i32 %301, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %303
303: ; preds = %294, %285, %284, %265
%304 = call i32 (...) @refresh()
br label %43
305: ; preds = %47
%306 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32 }
@stdscr = global i32 0
@TRUE = global i32 0
@ALL_MOUSE_EVENTS = global i32 0
@REPORT_MOUSE_POSITION = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_WHITE = global i32 0
@KEY_MOUSE = global i32 0
@A_BOLD = global i32 0
@OK = global i64 0
@A_REVERSE = global i32 0
@.str = [13 x i8] c"(%2i,%2i) %x\00"
@BUTTON1_PRESSED = global i32 0
@BUTTON1_RELEASED = global i32 0
@BUTTON2_PRESSED = global i32 0
@BUTTON2_RELEASED = global i32 0
@.str.1 = [18 x i8] c" [%i] \00"
@.str.2 = [18 x i8] c"MOVED. [%i] \00"
@.str.3 = [18 x i8] c"DRAW [%i] \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c"#\00"
@.str.6 = [18 x i8] c"ERASE [%i] \00"
@.str.7 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca %struct.TYPE_3__
%2 = bitcast %struct.TYPE_3__* %1 to i8*
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 (...) @noecho()
%5 = tail call i32 (...) @cbreak()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = tail call i32 @keypad(i32 %6, i32 %7)
%9 = tail call i32 (...) @start_color()
%10 = load i32, i32* @ALL_MOUSE_EVENTS
%11 = load i32, i32* @REPORT_MOUSE_POSITION
%12 = or i32 %11, %10
%13 = tail call i32 @mousemask(i32 %12, i32* null)
%14 = load i32, i32* @COLOR_BLACK
%15 = tail call i32 @init_pair(i32 8, i32 %14, i32 %14)
%16 = load i32, i32* @COLOR_RED
%17 = load i32, i32* @COLOR_BLACK
%18 = tail call i32 @init_pair(i32 1, i32 %16, i32 %17)
%19 = load i32, i32* @COLOR_GREEN
%20 = load i32, i32* @COLOR_BLACK
%21 = tail call i32 @init_pair(i32 2, i32 %19, i32 %20)
%22 = load i32, i32* @COLOR_YELLOW
%23 = load i32, i32* @COLOR_BLACK
%24 = tail call i32 @init_pair(i32 3, i32 %22, i32 %23)
%25 = load i32, i32* @COLOR_BLUE
%26 = load i32, i32* @COLOR_BLACK
%27 = tail call i32 @init_pair(i32 4, i32 %25, i32 %26)
%28 = load i32, i32* @COLOR_MAGENTA
%29 = load i32, i32* @COLOR_BLACK
%30 = tail call i32 @init_pair(i32 5, i32 %28, i32 %29)
%31 = load i32, i32* @COLOR_CYAN
%32 = load i32, i32* @COLOR_BLACK
%33 = tail call i32 @init_pair(i32 6, i32 %31, i32 %32)
%34 = load i32, i32* @COLOR_WHITE
%35 = load i32, i32* @COLOR_BLACK
%36 = tail call i32 @init_pair(i32 7, i32 %34, i32 %35)
%37 = tail call i32 @COLOR_PAIR(i32 7)
%38 = tail call i32 @attron(i32 %37)
%39 = call i32 (...) @getch()
%40 = icmp eq i32 %39, 27
br i1 %40, label %168, label %41
41: ; preds = %0
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%43 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
br label %45
45: ; preds = %41, %164
%46 = phi i32 [ %39, %41 ], [ %166, %164 ]
%47 = phi i8 [ 0, %41 ], [ %140, %164 ]
br label %48
48: ; preds = %45, %104
%49 = phi i32 [ %46, %45 ], [ %105, %104 ]
%50 = load i32, i32* @KEY_MOUSE
%51 = icmp eq i32 %49, %50
br i1 %51, label %107, label %52
52: ; preds = %48
switch i32 %49, label %104 [
i32 107, label %53
i32 114, label %55
i32 103, label %57
i32 121, label %59
i32 98, label %61
i32 109, label %63
i32 99, label %65
i32 119, label %67
i32 75, label %69
i32 82, label %73
i32 71, label %77
i32 89, label %81
i32 66, label %85
i32 77, label %89
i32 67, label %93
i32 87, label %97
]
53: ; preds = %52
%54 = call i32 @COLOR_PAIR(i32 8)
br label %101
55: ; preds = %52
%56 = call i32 @COLOR_PAIR(i32 1)
br label %101
57: ; preds = %52
%58 = call i32 @COLOR_PAIR(i32 2)
br label %101
59: ; preds = %52
%60 = call i32 @COLOR_PAIR(i32 3)
br label %101
61: ; preds = %52
%62 = call i32 @COLOR_PAIR(i32 4)
br label %101
63: ; preds = %52
%64 = call i32 @COLOR_PAIR(i32 5)
br label %101
65: ; preds = %52
%66 = call i32 @COLOR_PAIR(i32 6)
br label %101
67: ; preds = %52
%68 = call i32 @COLOR_PAIR(i32 7)
br label %101
69: ; preds = %52
%70 = call i32 @COLOR_PAIR(i32 8)
%71 = call i32 @attron(i32 %70)
%72 = load i32, i32* @A_BOLD
br label %101
73: ; preds = %52
%74 = call i32 @COLOR_PAIR(i32 1)
%75 = call i32 @attron(i32 %74)
%76 = load i32, i32* @A_BOLD
br label %101
77: ; preds = %52
%78 = call i32 @COLOR_PAIR(i32 2)
%79 = call i32 @attron(i32 %78)
%80 = load i32, i32* @A_BOLD
br label %101
81: ; preds = %52
%82 = call i32 @COLOR_PAIR(i32 3)
%83 = call i32 @attron(i32 %82)
%84 = load i32, i32* @A_BOLD
br label %101
85: ; preds = %52
%86 = call i32 @COLOR_PAIR(i32 4)
%87 = call i32 @attron(i32 %86)
%88 = load i32, i32* @A_BOLD
br label %101
89: ; preds = %52
%90 = call i32 @COLOR_PAIR(i32 5)
%91 = call i32 @attron(i32 %90)
%92 = load i32, i32* @A_BOLD
br label %101
93: ; preds = %52
%94 = call i32 @COLOR_PAIR(i32 6)
%95 = call i32 @attron(i32 %94)
%96 = load i32, i32* @A_BOLD
br label %101
97: ; preds = %52
%98 = call i32 @COLOR_PAIR(i32 7)
%99 = call i32 @attron(i32 %98)
%100 = load i32, i32* @A_BOLD
br label %101
101: ; preds = %55, %59, %63, %67, %73, %81, %89, %97, %93, %85, %77, %69, %65, %61, %57, %53
%102 = phi i32 [ %54, %53 ], [ %58, %57 ], [ %62, %61 ], [ %66, %65 ], [ %72, %69 ], [ %80, %77 ], [ %88, %85 ], [ %96, %93 ], [ %100, %97 ], [ %92, %89 ], [ %84, %81 ], [ %76, %73 ], [ %68, %67 ], [ %64, %63 ], [ %60, %59 ], [ %56, %55 ]
%103 = call i32 @attron(i32 %102)
br label %104
104: ; preds = %101, %52, %107
%105 = call i32 (...) @getch()
%106 = icmp eq i32 %105, 27
br i1 %106, label %168, label %48
107: ; preds = %48
%108 = call i64 @getmouse(%struct.TYPE_3__* %1)
%109 = load i64, i64* @OK
%110 = icmp eq i64 %108, %109
br i1 %110, label %111, label %104
111: ; preds = %107
%112 = load i32, i32* @A_REVERSE
%113 = call i32 @attron(i32 %112)
%114 = load i32, i32* %42
%115 = load i32, i32* %43
%116 = load i32, i32* %44
%117 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %114, i32 %115, i32 %116)
%118 = load i32, i32* @A_REVERSE
%119 = call i32 @attroff(i32 %118)
%120 = load i32, i32* %44
%121 = load i32, i32* @BUTTON1_PRESSED
%122 = and i32 %121, %120
%123 = icmp ne i32 %122, 0
%124 = zext i1 %123 to i8
%125 = or i8 %47, %124
%126 = load i32, i32* @BUTTON1_RELEASED
%127 = and i32 %126, %120
%128 = icmp ne i32 %127, 0
%129 = zext i1 %128 to i8
%130 = xor i8 %125, %129
%131 = load i32, i32* @BUTTON2_PRESSED
%132 = and i32 %131, %120
%133 = icmp eq i32 %132, 0
%134 = or i8 %130, 2
%135 = select i1 %133, i8 %130, i8 %134
%136 = load i32, i32* @BUTTON2_RELEASED
%137 = and i32 %136, %120
%138 = icmp eq i32 %137, 0
%139 = xor i8 %135, 2
%140 = select i1 %138, i8 %135, i8 %139
%141 = load i32, i32* @REPORT_MOUSE_POSITION
%142 = and i32 %141, %120
%143 = icmp eq i32 %142, 0
%144 = zext i8 %140 to i32
br i1 %143, label %145, label %147
145: ; preds = %111
%146 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %144)
br label %164
147: ; preds = %111
%148 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %144)
%149 = and i32 %144, 1
%150 = icmp eq i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %147
%152 = and i32 %144, 2
%153 = icmp eq i32 %152, 0
br i1 %153, label %164, label %159
154: ; preds = %147
%155 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %144)
%156 = load i32, i32* %43
%157 = load i32, i32* %42
%158 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %156, i32 %157, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %164
159: ; preds = %151
%160 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %144)
%161 = load i32, i32* %43
%162 = load i32, i32* %42
%163 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %161, i32 %162, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %164
164: ; preds = %151, %159, %154, %145
%165 = call i32 (...) @refresh()
%166 = call i32 (...) @getch()
%167 = icmp eq i32 %166, 27
br i1 %167, label %168, label %45
168: ; preds = %164, %104, %0
%169 = call i32 (...) @endwin()
ret i32 0
}