#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 */

/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int COLS;
#define KEY_DOWN 131
#define KEY_LEFT 130
#define KEY_RIGHT 129
#define KEY_UP 128
int LINES;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int getch();
int /*<<< orphan*/ getyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ nonl();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ touchwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ waddch(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  int ch, y, x, i;
  WINDOW *win[2], *curwin, *helpwin;
  int nowwin;
  initscr();
  cbreak();
  noecho();
  nonl();
  win[0] = newwin(LINES / 2 - 1, COLS - 1, 0, 0);
  win[1] = newwin(LINES / 2 - 1, COLS - 1, LINES / 2, 0);
  helpwin = newwin(3, 30, 2, COLS / 2 - 15);
  box(helpwin, 0, 0);
  mvwaddstr(helpwin, 0, 10, "online help");
  mvwaddstr(helpwin, 1, 4, "Hit any key to continue");
  for (i = 0; i < COLS; i++) {
    mvaddch(LINES / 2 - 1, i, '-');
    nowwin = 0;
    curwin = win[nowwin];
    getyx(curwin, y, x);
    move(0, 0);
    refresh();
    do {
      ch = getch();
      switch (ch) {
      case KEY_UP:
        --y;
        break;
      case KEY_DOWN:
        ++y;
        break;
      case KEY_RIGHT:
        ++x;
        break;
      case KEY_LEFT:
        --x;
        break;
      case '\r':
        ++y;
        x = 0;
        break;
      case '\t':
        touchwin(helpwin);
        wrefresh(helpwin);
        getch();
        touchwin(win[1 - nowwin]);
        wrefresh(win[1 - nowwin]);
        touchwin(curwin);
        wrefresh(curwin);
        break;
      case 127:
        wmove(curwin, y, (--x));
        waddch(curwin, ' ');
        break;
      case 27:
        nowwin = 1 - nowwin;
        curwin = win[nowwin];
        getyx(curwin, y, x);
        break;
      default:
        waddch(curwin, ch);
        x++;
        break;
      }
      wmove(curwin, y, x);
      wrefresh(curwin);
    } while (1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x0,%al
call   1040 <cbreak@plt>
mov    $0x0,%al
call   10e0 <noecho@plt>
mov    $0x0,%al
call   10b0 <nonl@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x1,%edi
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1090 <newwin@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x1,%edi
mov    0x2d62(%rip),%rax
mov    (%rax),%esi
sub    $0x1,%esi
mov    0x2d5e(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <newwin@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d38(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
sub    $0xf,%ecx
mov    $0x3,%edi
mov    $0x1e,%esi
mov    $0x2,%edx
call   1090 <newwin@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10a0 <box@plt>
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
lea    0xd12(%rip),%rcx
call   1110 <mvwaddstr@plt>
mov    -0x40(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
lea    0xd04(%rip),%rcx
call   1110 <mvwaddstr@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    0x2cc2(%rip),%rcx
cmp    (%rcx),%eax
jge    1561 <main+0x361>
mov    0x2cbb(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x1,%edi
mov    -0x20(%rbp),%esi
mov    $0x2d,%edx
call   10f0 <mvaddch@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <getyx@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1120 <move@plt>
mov    $0x0,%al
call   10c0 <refresh@plt>
xor    %eax,%eax
call   10d0 <getch@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x9,%eax
je     1466 <main+0x266>
jmp    139a <main+0x19a>
mov    -0x48(%rbp),%eax
sub    $0xd,%eax
je     1451 <main+0x251>
jmp    13ab <main+0x1ab>
mov    -0x48(%rbp),%eax
sub    $0x1b,%eax
je     14e6 <main+0x2e6>
jmp    13bc <main+0x1bc>
mov    -0x48(%rbp),%eax
sub    $0x7f,%eax
je     14be <main+0x2be>
jmp    13cd <main+0x1cd>
mov    -0x48(%rbp),%eax
sub    $0x80,%eax
je     1419 <main+0x219>
jmp    13e0 <main+0x1e0>
mov    -0x48(%rbp),%eax
sub    $0x81,%eax
je     1435 <main+0x235>
jmp    13f3 <main+0x1f3>
mov    -0x48(%rbp),%eax
sub    $0x82,%eax
je     1443 <main+0x243>
jmp    1406 <main+0x206>
mov    -0x48(%rbp),%eax
sub    $0x83,%eax
je     1427 <main+0x227>
jmp    1512 <main+0x312>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1527 <main+0x327>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1527 <main+0x327>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1527 <main+0x327>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1527 <main+0x327>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
jmp    1527 <main+0x327>
mov    -0x40(%rbp),%rdi
call   1050 <touchwin@plt>
mov    -0x40(%rbp),%rdi
call   1070 <wrefresh@plt>
mov    $0x0,%al
call   10d0 <getch@plt>
mov    $0x1,%eax
sub    -0x44(%rbp),%eax
cltq
mov    -0x30(%rbp,%rax,8),%rdi
call   1050 <touchwin@plt>
mov    $0x1,%eax
sub    -0x44(%rbp),%eax
cltq
mov    -0x30(%rbp,%rax,8),%rdi
call   1070 <wrefresh@plt>
mov    -0x38(%rbp),%rdi
call   1050 <touchwin@plt>
mov    -0x38(%rbp),%rdi
call   1070 <wrefresh@plt>
jmp    1527 <main+0x327>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
add    $0xffffffff,%edx
mov    %edx,-0x1c(%rbp)
call   1100 <wmove@plt>
mov    -0x38(%rbp),%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
jmp    1527 <main+0x327>
mov    $0x1,%eax
sub    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <getyx@plt>
jmp    1527 <main+0x327>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <waddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1100 <wmove@plt>
mov    -0x38(%rbp),%rdi
call   1070 <wrefresh@plt>
mov    $0x1,%al
test   $0x1,%al
jne    137c <main+0x17c>
jmp    154e <main+0x34e>
jmp    1553 <main+0x353>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1314 <main+0x114>
xor    %eax,%eax
add    $0x50,%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   1040 <cbreak@plt>
xor    %eax,%eax
call   10e0 <noecho@plt>
xor    %eax,%eax
call   10b0 <nonl@plt>
mov    0x2db7(%rip),%r14
mov    (%r14),%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
add    $0xffffffff,%edi
mov    0x2d99(%rip),%rbp
mov    0x0(%rbp),%esi
add    $0xffffffff,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <newwin@plt>
mov    %rax,%r15
mov    %rax,(%rsp)
mov    (%r14),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
lea    -0x1(%rdx),%edi
mov    0x0(%rbp),%esi
add    $0xffffffff,%esi
xor    %ecx,%ecx
call   1090 <newwin@plt>
mov    %rax,0x8(%rsp)
mov    0x0(%rbp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xfffffff1,%ecx
mov    $0x3,%edi
mov    $0x1e,%esi
mov    $0x2,%edx
call   1090 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <box@plt>
lea    0xd5d(%rip),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1110 <mvwaddstr@plt>
lea    0xd53(%rip),%rcx
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1110 <mvwaddstr@plt>
cmpl   $0x0,0x0(%rbp)
jle    1436 <main+0x236>
mov    (%r14),%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
add    $0xffffffff,%edi
xor    %esi,%esi
mov    $0x2d,%edx
call   10f0 <mvaddch@plt>
mov    %r15,%rdi
call   1060 <getyx@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1120 <move@plt>
xor    %eax,%eax
call   10c0 <refresh@plt>
lea    0xcd8(%rip),%r13
xor    %r14d,%r14d
jmp    134f <main+0x14f>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <waddch@plt>
add    $0x1,%ebx
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
call   1100 <wmove@plt>
mov    %r15,%rdi
call   1070 <wrefresh@plt>
xor    %eax,%eax
call   10d0 <getch@plt>
cmp    $0x7e,%eax
jle    1390 <main+0x190>
lea    -0x7f(%rax),%ecx
cmp    $0x4,%ecx
ja     132d <main+0x12d>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
add    $0xffffffff,%ebx
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
call   1100 <wmove@plt>
mov    %r15,%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
jmp    133a <main+0x13a>
nopl   0x0(%rax)
cmp    $0x9,%eax
je     13de <main+0x1de>
cmp    $0xd,%eax
je     142b <main+0x22b>
cmp    $0x1b,%eax
jne    132d <main+0x12d>
mov    $0x1,%ebp
sub    %r14d,%ebp
mov    (%rsp,%rbp,8),%r15
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <getyx@plt>
mov    %ebp,%r14d
jmp    133a <main+0x13a>
add    $0xffffffff,%r12d
jmp    133a <main+0x13a>
add    $0xffffffff,%ebx
jmp    133a <main+0x13a>
add    $0x1,%r12d
jmp    133a <main+0x13a>
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <touchwin@plt>
mov    %rbp,%rdi
call   1070 <wrefresh@plt>
xor    %eax,%eax
call   10d0 <getch@plt>
mov    $0x1,%eax
sub    %r14d,%eax
mov    (%rsp,%rax,8),%rbp
mov    %rbp,%rdi
call   1050 <touchwin@plt>
mov    %rbp,%rdi
call   1070 <wrefresh@plt>
mov    %r15,%rdi
call   1050 <touchwin@plt>
mov    %r15,%rdi
call   1070 <wrefresh@plt>
jmp    133a <main+0x13a>
add    $0x1,%r12d
xor    %ebx,%ebx
jmp    133a <main+0x13a>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
@.str = [12 x i8] c"online help\00"
@.str.1 = [24 x i8] c"Hit any key to continue\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x i32*]
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 (...) @initscr()
%15 = call i32 (...) @cbreak()
%16 = call i32 (...) @noecho()
%17 = call i32 (...) @nonl()
%18 = load i32, i32* @LINES
%19 = sdiv i32 %18, 2
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* @COLS
%22 = sub nsw i32 %21, 1
%23 = call i32* @newwin(i32 %20, i32 %22, i32 0, i32 0)
%24 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 0
store i32* %23, i32** %24
%25 = load i32, i32* @LINES
%26 = sdiv i32 %25, 2
%27 = sub nsw i32 %26, 1
%28 = load i32, i32* @COLS
%29 = sub nsw i32 %28, 1
%30 = load i32, i32* @LINES
%31 = sdiv i32 %30, 2
%32 = call i32* @newwin(i32 %27, i32 %29, i32 %31, i32 0)
%33 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 1
store i32* %32, i32** %33
%34 = load i32, i32* @COLS
%35 = sdiv i32 %34, 2
%36 = sub nsw i32 %35, 15
%37 = call i32* @newwin(i32 3, i32 30, i32 2, i32 %36)
store i32* %37, i32** %12
%38 = load i32*, i32** %12
%39 = call i32 @box(i32* %38, i32 0, i32 0)
%40 = load i32*, i32** %12
%41 = call i32 @mvwaddstr(i32* %40, i32 0, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%42 = load i32*, i32** %12
%43 = call i32 @mvwaddstr(i32* %42, i32 1, i32 4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %44
44: ; preds = %138, %2
%45 = load i32, i32* %9
%46 = load i32, i32* @COLS
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %141
48: ; preds = %44
%49 = load i32, i32* @LINES
%50 = sdiv i32 %49, 2
%51 = sub nsw i32 %50, 1
%52 = load i32, i32* %9
%53 = call i32 @mvaddch(i32 %51, i32 %52, i8 signext 45)
store i32 0, i32* %13
%54 = load i32, i32* %13
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 %55
%57 = load i32*, i32** %56
store i32* %57, i32** %11
%58 = load i32*, i32** %11
%59 = load i32, i32* %7
%60 = load i32, i32* %8
%61 = call i32 @getyx(i32* %58, i32 %59, i32 %60)
%62 = call i32 @move(i32 0, i32 0)
%63 = call i32 (...) @refresh()
br label %64
64: ; preds = %136, %48
%65 = call i32 (...) @getch()
store i32 %65, i32* %6
%66 = load i32, i32* %6
switch i32 %66, label %123 [
i32 128, label %67
i32 131, label %70
i32 129, label %73
i32 130, label %76
i32 13, label %79
i32 9, label %82
i32 127, label %104
i32 27, label %112
]
67: ; preds = %64
%68 = load i32, i32* %7
%69 = add nsw i32 %68, -1
store i32 %69, i32* %7
br label %129
70: ; preds = %64
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %129
73: ; preds = %64
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %129
76: ; preds = %64
%77 = load i32, i32* %8
%78 = add nsw i32 %77, -1
store i32 %78, i32* %8
br label %129
79: ; preds = %64
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
store i32 %81, i32* %7
store i32 0, i32* %8
br label %129
82: ; preds = %64
%83 = load i32*, i32** %12
%84 = call i32 @touchwin(i32* %83)
%85 = load i32*, i32** %12
%86 = call i32 @wrefresh(i32* %85)
%87 = call i32 (...) @getch()
%88 = load i32, i32* %13
%89 = sub nsw i32 1, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 %90
%92 = load i32*, i32** %91
%93 = call i32 @touchwin(i32* %92)
%94 = load i32, i32* %13
%95 = sub nsw i32 1, %94
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 %96
%98 = load i32*, i32** %97
%99 = call i32 @wrefresh(i32* %98)
%100 = load i32*, i32** %11
%101 = call i32 @touchwin(i32* %100)
%102 = load i32*, i32** %11
%103 = call i32 @wrefresh(i32* %102)
br label %129
104: ; preds = %64
%105 = load i32*, i32** %11
%106 = load i32, i32* %7
%107 = load i32, i32* %8
%108 = add nsw i32 %107, -1
store i32 %108, i32* %8
%109 = call i32 @wmove(i32* %105, i32 %106, i32 %108)
%110 = load i32*, i32** %11
%111 = call i32 @waddch(i32* %110, i32 32)
br label %129
112: ; preds = %64
%113 = load i32, i32* %13
%114 = sub nsw i32 1, %113
store i32 %114, i32* %13
%115 = load i32, i32* %13
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [2 x i32*], [2 x i32*]* %10, i64 0, i64 %116
%118 = load i32*, i32** %117
store i32* %118, i32** %11
%119 = load i32*, i32** %11
%120 = load i32, i32* %7
%121 = load i32, i32* %8
%122 = call i32 @getyx(i32* %119, i32 %120, i32 %121)
br label %129
123: ; preds = %64
%124 = load i32*, i32** %11
%125 = load i32, i32* %6
%126 = call i32 @waddch(i32* %124, i32 %125)
%127 = load i32, i32* %8
%128 = add nsw i32 %127, 1
store i32 %128, i32* %8
br label %129
129: ; preds = %123, %112, %104, %82, %79, %76, %73, %70, %67
%130 = load i32*, i32** %11
%131 = load i32, i32* %7
%132 = load i32, i32* %8
%133 = call i32 @wmove(i32* %130, i32 %131, i32 %132)
%134 = load i32*, i32** %11
%135 = call i32 @wrefresh(i32* %134)
br label %136
136: ; preds = %129
br i1 true, label %64, label %137
137: ; preds = %136
br label %138
138: ; preds = %137
%139 = load i32, i32* %9
%140 = add nsw i32 %139, 1
store i32 %140, i32* %9
br label %44
141: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
@.str = [12 x i8] c"online help\00"
@.str.1 = [24 x i8] c"Hit any key to continue\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32*]
%4 = bitcast [2 x i32*]* %3 to i8*
%5 = tail call i32 (...) @initscr()
%6 = tail call i32 (...) @cbreak()
%7 = tail call i32 (...) @noecho()
%8 = tail call i32 (...) @nonl()
%9 = load i32, i32* @LINES
%10 = sdiv i32 %9, 2
%11 = add nsw i32 %10, -1
%12 = load i32, i32* @COLS
%13 = add nsw i32 %12, -1
%14 = tail call i32* @newwin(i32 %11, i32 %13, i32 0, i32 0)
%15 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 0
store i32* %14, i32** %15
%16 = load i32, i32* @LINES
%17 = sdiv i32 %16, 2
%18 = add nsw i32 %17, -1
%19 = load i32, i32* @COLS
%20 = add nsw i32 %19, -1
%21 = tail call i32* @newwin(i32 %18, i32 %20, i32 %17, i32 0)
%22 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 1
store i32* %21, i32** %22
%23 = load i32, i32* @COLS
%24 = sdiv i32 %23, 2
%25 = add nsw i32 %24, -15
%26 = tail call i32* @newwin(i32 3, i32 30, i32 2, i32 %25)
%27 = tail call i32 @box(i32* %26, i32 0, i32 0)
%28 = tail call i32 @mvwaddstr(i32* %26, i32 0, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%29 = tail call i32 @mvwaddstr(i32* %26, i32 1, i32 4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* @COLS
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %88
32: ; preds = %2
%33 = load i32, i32* @LINES
%34 = sdiv i32 %33, 2
%35 = add nsw i32 %34, -1
%36 = tail call i32 @mvaddch(i32 %35, i32 0, i8 signext 45)
%37 = tail call i32 @getyx(i32* %14, i32 undef, i32 undef)
%38 = tail call i32 @move(i32 0, i32 0)
%39 = tail call i32 (...) @refresh()
br label %40
40: ; preds = %81, %32
%41 = phi i32 [ undef, %32 ], [ %82, %81 ]
%42 = phi i32* [ %14, %32 ], [ %83, %81 ]
%43 = phi i32 [ undef, %32 ], [ %84, %81 ]
%44 = phi i32 [ 0, %32 ], [ %85, %81 ]
%45 = tail call i32 (...) @getch()
switch i32 %45, label %78 [
i32 128, label %46
i32 131, label %48
i32 129, label %50
i32 130, label %52
i32 13, label %54
i32 9, label %56
i32 127, label %68
i32 27, label %72
]
46: ; preds = %40
%47 = add nsw i32 %43, -1
br label %81
48: ; preds = %40
%49 = add nsw i32 %43, 1
br label %81
50: ; preds = %40
%51 = add nsw i32 %41, 1
br label %81
52: ; preds = %40
%53 = add nsw i32 %41, -1
br label %81
54: ; preds = %40
%55 = add nsw i32 %43, 1
br label %81
56: ; preds = %40
%57 = tail call i32 @touchwin(i32* %26)
%58 = tail call i32 @wrefresh(i32* %26)
%59 = tail call i32 (...) @getch()
%60 = sub nsw i32 1, %44
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 %61
%63 = load i32*, i32** %62
%64 = tail call i32 @touchwin(i32* %63)
%65 = tail call i32 @wrefresh(i32* %63)
%66 = tail call i32 @touchwin(i32* %42)
%67 = tail call i32 @wrefresh(i32* %42)
br label %81
68: ; preds = %40
%69 = add nsw i32 %41, -1
%70 = tail call i32 @wmove(i32* %42, i32 %43, i32 %69)
%71 = tail call i32 @waddch(i32* %42, i32 32)
br label %81
72: ; preds = %40
%73 = sub nsw i32 1, %44
%74 = zext i32 %73 to i64
%75 = getelementptr inbounds [2 x i32*], [2 x i32*]* %3, i64 0, i64 %74
%76 = load i32*, i32** %75
%77 = tail call i32 @getyx(i32* %76, i32 %43, i32 %41)
br label %81
78: ; preds = %40
%79 = tail call i32 @waddch(i32* %42, i32 %45)
%80 = add nsw i32 %41, 1
br label %81
81: ; preds = %78, %72, %68, %56, %54, %52, %50, %48, %46
%82 = phi i32 [ %80, %78 ], [ %41, %72 ], [ %69, %68 ], [ %41, %56 ], [ 0, %54 ], [ %53, %52 ], [ %51, %50 ], [ %41, %48 ], [ %41, %46 ]
%83 = phi i32* [ %42, %78 ], [ %76, %72 ], [ %42, %68 ], [ %42, %56 ], [ %42, %54 ], [ %42, %52 ], [ %42, %50 ], [ %42, %48 ], [ %42, %46 ]
%84 = phi i32 [ %43, %78 ], [ %43, %72 ], [ %43, %68 ], [ %43, %56 ], [ %55, %54 ], [ %43, %52 ], [ %43, %50 ], [ %49, %48 ], [ %47, %46 ]
%85 = phi i32 [ %44, %78 ], [ %73, %72 ], [ %44, %68 ], [ %44, %56 ], [ %44, %54 ], [ %44, %52 ], [ %44, %50 ], [ %44, %48 ], [ %44, %46 ]
%86 = tail call i32 @wmove(i32* %83, i32 %84, i32 %82)
%87 = tail call i32 @wrefresh(i32* %83)
br label %40
88: ; preds = %2
ret i32 0
}