#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;
typedef int /*<<< orphan*/ PANEL;

/* Variables and functions */
int /*<<< orphan*/ COLOR_BLACK;
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
int COLS;
int LINES;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ *derwin(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ doupdate();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ fill_win(int /*<<< orphan*/ *, int);
int getch();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ init_wins(int /*<<< orphan*/ **, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvprintw(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ *new_panel(int /*<<< orphan*/ *);
int /*<<< orphan*/ noecho();
scalar_t__ panel_userptr(int /*<<< orphan*/ *);
int /*<<< orphan*/ set_panel_userptr(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ *stdscr;
int /*<<< orphan*/ top_panel(int /*<<< orphan*/ *);
int /*<<< orphan*/ touchwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ update_panels();
int main() {
  WINDOW *my_wins[3];
  WINDOW *dwin;
  WINDOW *upper, *lower;
  PANEL *my_panels[3];
  PANEL *top;
  int ch;
  int i, j;
  initscr();
  start_color();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(3, COLOR_BLUE, COLOR_BLACK);
  init_pair(4, COLOR_CYAN, COLOR_BLACK);
  for (i = 0; i < LINES; i++)
    for (j = 0; j < COLS; j++)
      mvaddch(i, j, '+');
  doupdate();
  upper = derwin(stdscr, 8, COLS, 0, 0);
  lower = derwin(stdscr, LINES - 8, COLS, 8, 0);
  init_wins(my_wins, 3);
  my_panels[0] = new_panel(my_wins[0]);
  my_panels[1] = new_panel(my_wins[1]);
  my_panels[2] = new_panel(my_wins[2]);
  set_panel_userptr(my_panels[0], my_panels[1]);
  set_panel_userptr(my_panels[1], my_panels[2]);
  set_panel_userptr(my_panels[2], my_panels[0]);
  dwin = derwin(my_wins[1], 10 - 4, 40 - 10, 3, 3);
  update_panels();
  attron(COLOR_PAIR(4));
  mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
  attroff(COLOR_PAIR(4));
  doupdate();
  top = my_panels[2];
  i = 0;
  while ((ch = getch()) != 'q') {
    switch (ch) {
    case 9:
      top = (PANEL *)panel_userptr(top);
      top_panel(top);
      break;
    }
    fill_win(dwin, 0x62 + (i % 13));
    fill_win(upper, 0x41 + (i % 16));
    fill_win(lower, 0x51 + (i % 9));
    i++;
    touchwin(stdscr);
    update_panels();
    doupdate();
  }
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10b0 <initscr@plt>
mov    $0x0,%al
call   10c0 <start_color@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    $0x0,%al
call   1140 <noecho@plt>
mov    0x2d3e(%rip),%rax
mov    (%rax),%rdi
mov    0x2d2c(%rip),%rax
mov    (%rax),%esi
call   10a0 <keypad@plt>
mov    0x2ce6(%rip),%rax
mov    (%rax),%esi
mov    0x2d0d(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1080 <init_pair@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%esi
mov    0x2cf1(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1080 <init_pair@plt>
mov    0x2cb6(%rip),%rax
mov    (%rax),%esi
mov    0x2cd5(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1080 <init_pair@plt>
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    0x2cb9(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%edi
call   1080 <init_pair@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    0x2cb4(%rip),%rcx
cmp    (%rcx),%eax
jge    1386 <main+0x116>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    0x2c6b(%rip),%rcx
cmp    (%rcx),%eax
jge    1373 <main+0x103>
mov    -0x60(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    $0x2b,%edx
call   1150 <mvaddch@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1343 <main+0xd3>
jmp    1378 <main+0x108>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    132a <main+0xba>
mov    $0x0,%al
call   1170 <doupdate@plt>
mov    0x2c4c(%rip),%rax
mov    (%rax),%rdi
mov    0x2c1a(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%esi
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1190 <derwin@plt>
mov    %rax,-0x30(%rbp)
mov    0x2c25(%rip),%rax
mov    (%rax),%rdi
mov    0x2c23(%rip),%rax
mov    (%rax),%esi
sub    $0x8,%esi
mov    0x2be7(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1190 <derwin@plt>
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1060 <init_wins@plt>
mov    -0x20(%rbp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,-0x40(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1160 <set_panel_userptr@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1160 <set_panel_userptr@plt>
mov    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1160 <set_panel_userptr@plt>
mov    -0x18(%rbp),%rdi
mov    $0x6,%esi
mov    $0x1e,%edx
mov    $0x3,%r8d
mov    %r8d,%ecx
call   1190 <derwin@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1090 <update_panels@plt>
mov    $0x4,%edi
call   10f0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10d0 <attron@plt>
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
sub    $0x2,%edi
xor    %esi,%esi
lea    0xb73(%rip),%rdx
call   1180 <mvprintw@plt>
mov    $0x4,%edi
call   10f0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   1170 <doupdate@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x60(%rbp)
mov    $0x0,%al
call   1110 <getch@plt>
mov    %eax,-0x5c(%rbp)
cmp    $0x71,%eax
je     1569 <main+0x2f9>
mov    -0x5c(%rbp),%eax
sub    $0x9,%eax
jne    14f3 <main+0x283>
jmp    14dd <main+0x26d>
mov    -0x58(%rbp),%rdi
call   1040 <panel_userptr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   1130 <top_panel@plt>
mov    -0x28(%rbp),%rdi
mov    -0x60(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x62,%esi
call   1100 <fill_win@plt>
mov    -0x30(%rbp),%rdi
mov    -0x60(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x41,%esi
call   1100 <fill_win@plt>
mov    -0x38(%rbp),%rdi
mov    -0x60(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x51,%esi
call   1100 <fill_win@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    0x2a92(%rip),%rax
mov    (%rax),%rdi
call   1070 <touchwin@plt>
mov    $0x0,%al
call   1090 <update_panels@plt>
mov    $0x0,%al
call   1170 <doupdate@plt>
jmp    14b9 <main+0x249>
mov    $0x0,%al
call   1120 <endwin@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   10b0 <initscr@plt>
xor    %eax,%eax
call   10c0 <start_color@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
xor    %eax,%eax
call   1140 <noecho@plt>
mov    0x2d3f(%rip),%rax
mov    (%rax),%rdi
mov    0x2d2d(%rip),%rax
mov    (%rax),%esi
call   10a0 <keypad@plt>
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
mov    0x2d0e(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
call   1080 <init_pair@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   1080 <init_pair@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1080 <init_pair@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x4,%edi
call   1080 <init_pair@plt>
mov    0x2cd4(%rip),%r13
mov    0x0(%r13),%eax
test   %eax,%eax
jle    135e <main+0xee>
mov    0x2c95(%rip),%r14
mov    (%r14),%ecx
xor    %ebx,%ebx
jmp    1337 <main+0xc7>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %eax,%ebx
jge    135e <main+0xee>
test   %ecx,%ecx
jle    1330 <main+0xc0>
xor    %ebp,%ebp
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1150 <mvaddch@plt>
add    $0x1,%ebp
mov    (%r14),%ecx
cmp    %ecx,%ebp
jl     1340 <main+0xd0>
mov    0x0(%r13),%eax
jmp    1330 <main+0xc0>
xor    %eax,%eax
call   1170 <doupdate@plt>
mov    0x2c74(%rip),%rbp
mov    0x0(%rbp),%rdi
mov    0x2c41(%rip),%rbx
mov    (%rbx),%edx
mov    $0x8,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1190 <derwin@plt>
mov    %rax,0x8(%rsp)
mov    0x0(%rbp),%rdi
mov    0x0(%r13),%esi
add    $0xfffffff8,%esi
mov    (%rbx),%edx
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1190 <derwin@plt>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
call   1060 <init_wins@plt>
mov    0x10(%rsp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,%r12
mov    0x18(%rsp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,%rbp
mov    0x20(%rsp),%rdi
call   10e0 <new_panel@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rbp,%rsi
call   1160 <set_panel_userptr@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1160 <set_panel_userptr@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1160 <set_panel_userptr@plt>
mov    0x18(%rsp),%rdi
mov    $0x6,%esi
mov    $0x1e,%edx
mov    $0x3,%ecx
mov    $0x3,%r8d
call   1190 <derwin@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1090 <update_panels@plt>
mov    $0x4,%edi
call   10f0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   10d0 <attron@plt>
mov    0x0(%r13),%edi
add    $0xfffffffe,%edi
lea    0xbb7(%rip),%rdx
xor    %esi,%esi
call   1180 <mvprintw@plt>
mov    $0x4,%edi
call   10f0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x51,%r13d
xor    %r14d,%r14d
jmp    14f7 <main+0x287>
nop
mov    %rbx,%rdi
call   1040 <panel_userptr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1130 <top_panel@plt>
mov    %r14d,%eax
imul   $0x38e38e39,%rax,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,8),%ecx
mov    %r13d,%ebp
sub    %ecx,%ebp
imul   $0x4ec4ec4f,%rax,%rax
shr    $0x22,%rax
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%eax
mov    $0x62,%esi
sub    %eax,%esi
add    %r14d,%esi
mov    %r12,%rdi
call   1100 <fill_win@plt>
mov    %r14d,%esi
and    $0xf,%esi
add    $0x41,%esi
mov    0x8(%rsp),%rdi
call   1100 <fill_win@plt>
mov    %r15,%rdi
mov    %ebp,%esi
call   1100 <fill_win@plt>
add    $0x1,%r14d
mov    0x2afc(%rip),%rax
mov    (%rax),%rdi
call   1070 <touchwin@plt>
xor    %eax,%eax
call   1090 <update_panels@plt>
add    $0x1,%r13d
xor    %eax,%eax
call   1170 <doupdate@plt>
xor    %eax,%eax
call   1110 <getch@plt>
cmp    $0x9,%eax
je     1470 <main+0x200>
cmp    $0x71,%eax
jne    1483 <main+0x213>
xor    %eax,%eax
call   1120 <endwin@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32* null
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_CYAN = global i32 0
@LINES = global i32 0
@COLS = global i32 0
@.str = [51 x i8] c"Use tab to browse through the windows (F1 to Exit)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32*]
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [3 x i32*]
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (...) @initscr()
%12 = call i32 (...) @start_color()
%13 = call i32 (...) @cbreak()
%14 = call i32 (...) @noecho()
%15 = load i32*, i32** @stdscr
%16 = load i32, i32* @TRUE
%17 = call i32 @keypad(i32* %15, i32 %16)
%18 = load i32, i32* @COLOR_RED
%19 = load i32, i32* @COLOR_BLACK
%20 = call i32 @init_pair(i32 1, i32 %18, i32 %19)
%21 = load i32, i32* @COLOR_GREEN
%22 = load i32, i32* @COLOR_BLACK
%23 = call i32 @init_pair(i32 2, i32 %21, i32 %22)
%24 = load i32, i32* @COLOR_BLUE
%25 = load i32, i32* @COLOR_BLACK
%26 = call i32 @init_pair(i32 3, i32 %24, i32 %25)
%27 = load i32, i32* @COLOR_CYAN
%28 = load i32, i32* @COLOR_BLACK
%29 = call i32 @init_pair(i32 4, i32 %27, i32 %28)
store i32 0, i32* %9
br label %30
30: ; preds = %47, %0
%31 = load i32, i32* %9
%32 = load i32, i32* @LINES
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %50
34: ; preds = %30
store i32 0, i32* %10
br label %35
35: ; preds = %43, %34
%36 = load i32, i32* %10
%37 = load i32, i32* @COLS
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = call i32 @mvaddch(i32 %40, i32 %41, i8 signext 43)
br label %43
43: ; preds = %39
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
store i32 %45, i32* %10
br label %35
46: ; preds = %35
br label %47
47: ; preds = %46
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %30
50: ; preds = %30
%51 = call i32 (...) @doupdate()
%52 = load i32*, i32** @stdscr
%53 = load i32, i32* @COLS
%54 = call i32* @derwin(i32* %52, i32 8, i32 %53, i32 0, i32 0)
store i32* %54, i32** %4
%55 = load i32*, i32** @stdscr
%56 = load i32, i32* @LINES
%57 = sub nsw i32 %56, 8
%58 = load i32, i32* @COLS
%59 = call i32* @derwin(i32* %55, i32 %57, i32 %58, i32 8, i32 0)
store i32* %59, i32** %5
%60 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%61 = call i32 @init_wins(i32** %60, i32 3)
%62 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 0
%63 = load i32*, i32** %62
%64 = call i32* @new_panel(i32* %63)
%65 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
store i32* %64, i32** %65
%66 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
%67 = load i32*, i32** %66
%68 = call i32* @new_panel(i32* %67)
%69 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 1
store i32* %68, i32** %69
%70 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 2
%71 = load i32*, i32** %70
%72 = call i32* @new_panel(i32* %71)
%73 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
store i32* %72, i32** %73
%74 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
%75 = load i32*, i32** %74
%76 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 1
%77 = load i32*, i32** %76
%78 = call i32 @set_panel_userptr(i32* %75, i32* %77)
%79 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 1
%80 = load i32*, i32** %79
%81 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%82 = load i32*, i32** %81
%83 = call i32 @set_panel_userptr(i32* %80, i32* %82)
%84 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%85 = load i32*, i32** %84
%86 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
%87 = load i32*, i32** %86
%88 = call i32 @set_panel_userptr(i32* %85, i32* %87)
%89 = getelementptr inbounds [3 x i32*], [3 x i32*]* %2, i64 0, i64 1
%90 = load i32*, i32** %89
%91 = call i32* @derwin(i32* %90, i32 6, i32 30, i32 3, i32 3)
store i32* %91, i32** %3
%92 = call i32 (...) @update_panels()
%93 = call i32 @COLOR_PAIR(i32 4)
%94 = call i32 @attron(i32 %93)
%95 = load i32, i32* @LINES
%96 = sub nsw i32 %95, 2
%97 = call i32 @mvprintw(i32 %96, i32 0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%98 = call i32 @COLOR_PAIR(i32 4)
%99 = call i32 @attroff(i32 %98)
%100 = call i32 (...) @doupdate()
%101 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%102 = load i32*, i32** %101
store i32* %102, i32** %7
store i32 0, i32* %9
br label %103
103: ; preds = %114, %50
%104 = call i32 (...) @getch()
store i32 %104, i32* %8
%105 = icmp ne i32 %104, 113
br i1 %105, label %106, label %136
106: ; preds = %103
%107 = load i32, i32* %8
switch i32 %107, label %114 [
i32 9, label %108
]
108: ; preds = %106
%109 = load i32*, i32** %7
%110 = call i64 @panel_userptr(i32* %109)
%111 = inttoptr i64 %110 to i32*
store i32* %111, i32** %7
%112 = load i32*, i32** %7
%113 = call i32 @top_panel(i32* %112)
br label %114
114: ; preds = %106, %108
%115 = load i32*, i32** %3
%116 = load i32, i32* %9
%117 = srem i32 %116, 13
%118 = add nsw i32 98, %117
%119 = call i32 @fill_win(i32* %115, i32 %118)
%120 = load i32*, i32** %4
%121 = load i32, i32* %9
%122 = srem i32 %121, 16
%123 = add nsw i32 65, %122
%124 = call i32 @fill_win(i32* %120, i32 %123)
%125 = load i32*, i32** %5
%126 = load i32, i32* %9
%127 = srem i32 %126, 9
%128 = add nsw i32 81, %127
%129 = call i32 @fill_win(i32* %125, i32 %128)
%130 = load i32, i32* %9
%131 = add nsw i32 %130, 1
store i32 %131, i32* %9
%132 = load i32*, i32** @stdscr
%133 = call i32 @touchwin(i32* %132)
%134 = call i32 (...) @update_panels()
%135 = call i32 (...) @doupdate()
br label %103
136: ; preds = %103
%137 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32* null
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_CYAN = global i32 0
@LINES = global i32 0
@COLS = global i32 0
@.str = [51 x i8] c"Use tab to browse through the windows (F1 to Exit)\00"
define i32 @main() {
%1 = alloca [3 x i32*]
%2 = bitcast [3 x i32*]* %1 to i8*
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 (...) @start_color()
%5 = tail call i32 (...) @cbreak()
%6 = tail call i32 (...) @noecho()
%7 = load i32*, i32** @stdscr
%8 = load i32, i32* @TRUE
%9 = tail call i32 @keypad(i32* %7, i32 %8)
%10 = load i32, i32* @COLOR_RED
%11 = load i32, i32* @COLOR_BLACK
%12 = tail call i32 @init_pair(i32 1, i32 %10, i32 %11)
%13 = load i32, i32* @COLOR_GREEN
%14 = load i32, i32* @COLOR_BLACK
%15 = tail call i32 @init_pair(i32 2, i32 %13, i32 %14)
%16 = load i32, i32* @COLOR_BLUE
%17 = load i32, i32* @COLOR_BLACK
%18 = tail call i32 @init_pair(i32 3, i32 %16, i32 %17)
%19 = load i32, i32* @COLOR_CYAN
%20 = load i32, i32* @COLOR_BLACK
%21 = tail call i32 @init_pair(i32 4, i32 %19, i32 %20)
%22 = load i32, i32* @LINES
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %44
24: ; preds = %0
%25 = load i32, i32* @COLS
br label %26
26: ; preds = %24, %39
%27 = phi i32 [ %40, %39 ], [ %22, %24 ]
%28 = phi i32 [ %41, %39 ], [ %25, %24 ]
%29 = phi i32 [ %42, %39 ], [ 0, %24 ]
%30 = icmp sgt i32 %28, 0
br i1 %30, label %31, label %39
31: ; preds = %26, %31
%32 = phi i32 [ %34, %31 ], [ 0, %26 ]
%33 = tail call i32 @mvaddch(i32 %29, i32 %32, i8 signext 43)
%34 = add nuw nsw i32 %32, 1
%35 = load i32, i32* @COLS
%36 = icmp slt i32 %34, %35
br i1 %36, label %31, label %37
37: ; preds = %31
%38 = load i32, i32* @LINES
br label %39
39: ; preds = %37, %26
%40 = phi i32 [ %38, %37 ], [ %27, %26 ]
%41 = phi i32 [ %35, %37 ], [ %28, %26 ]
%42 = add nuw nsw i32 %29, 1
%43 = icmp slt i32 %42, %40
br i1 %43, label %26, label %44
44: ; preds = %39, %0
%45 = tail call i32 (...) @doupdate()
%46 = load i32*, i32** @stdscr
%47 = load i32, i32* @COLS
%48 = tail call i32* @derwin(i32* %46, i32 8, i32 %47, i32 0, i32 0)
%49 = load i32*, i32** @stdscr
%50 = load i32, i32* @LINES
%51 = add nsw i32 %50, -8
%52 = load i32, i32* @COLS
%53 = tail call i32* @derwin(i32* %49, i32 %51, i32 %52, i32 8, i32 0)
%54 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%55 = call i32 @init_wins(i32** %54, i32 3)
%56 = load i32*, i32** %54
%57 = call i32* @new_panel(i32* %56)
%58 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 1
%59 = load i32*, i32** %58
%60 = call i32* @new_panel(i32* %59)
%61 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 2
%62 = load i32*, i32** %61
%63 = call i32* @new_panel(i32* %62)
%64 = call i32 @set_panel_userptr(i32* %57, i32* %60)
%65 = call i32 @set_panel_userptr(i32* %60, i32* %63)
%66 = call i32 @set_panel_userptr(i32* %63, i32* %57)
%67 = load i32*, i32** %58
%68 = call i32* @derwin(i32* %67, i32 6, i32 30, i32 3, i32 3)
%69 = call i32 (...) @update_panels()
%70 = call i32 @COLOR_PAIR(i32 4)
%71 = call i32 @attron(i32 %70)
%72 = load i32, i32* @LINES
%73 = add nsw i32 %72, -2
%74 = call i32 @mvprintw(i32 %73, i32 0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%75 = call i32 @COLOR_PAIR(i32 4)
%76 = call i32 @attroff(i32 %75)
br label %77
77: ; preds = %86, %44
%78 = phi i32* [ %63, %44 ], [ %87, %86 ]
%79 = phi i32 [ 0, %44 ], [ %97, %86 ]
%80 = call i32 (...) @doupdate()
%81 = call i32 (...) @getch()
switch i32 %81, label %86 [
i32 113, label %101
i32 9, label %82
]
82: ; preds = %77
%83 = call i64 @panel_userptr(i32* %78)
%84 = inttoptr i64 %83 to i32*
%85 = call i32 @top_panel(i32* %84)
br label %86
86: ; preds = %77, %82
%87 = phi i32* [ %84, %82 ], [ %78, %77 ]
%88 = urem i32 %79, 13
%89 = add nuw nsw i32 %88, 98
%90 = call i32 @fill_win(i32* %68, i32 %89)
%91 = and i32 %79, 15
%92 = add nuw nsw i32 %91, 65
%93 = call i32 @fill_win(i32* %48, i32 %92)
%94 = urem i32 %79, 9
%95 = add nuw nsw i32 %94, 81
%96 = call i32 @fill_win(i32* %53, i32 %95)
%97 = add nuw nsw i32 %79, 1
%98 = load i32*, i32** @stdscr
%99 = call i32 @touchwin(i32* %98)
%100 = call i32 (...) @update_panels()
br label %77
101: ; preds = %77
%102 = call i32 (...) @endwin()
ret i32 0
}