#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 */
scalar_t__ OK;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ doupdate();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ *new_panel(int /*<<< orphan*/ *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ putp(char *);
scalar_t__ setupterm(int /*<<< orphan*/, int, int /*<<< orphan*/);
char *tigetstr(char *);
int /*<<< orphan*/ update_panels();
int main() {
  if (setupterm(0, 1, 0) == OK) {
    char *p = tigetstr("clear");
    if (p)
      putp(p);
  }
  WINDOW *my_wins[3];
  PANEL *my_panels[3];
  int lines = 10, cols = 40, y = 2, x = 4, i;
  initscr();
  cbreak();
  noecho();
  my_wins[0] = newwin(lines, cols, y, x);
  my_wins[1] = newwin(lines, cols, y + 1, x + 5);
  my_wins[2] = newwin(lines, cols, y + 2, x + 10);
  for (i = 0; i < 3; ++i)
    box(my_wins[i], 0, 0);
  my_panels[0] = new_panel(my_wins[0]);
  my_panels[1] = new_panel(my_wins[1]);
  my_panels[2] = new_panel(my_wins[2]);
  update_panels();
  doupdate();
  getch();
  endwin();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <setupterm@plt>
mov    0x2dec(%rip),%rcx
cmp    (%rcx),%rax
jne    1226 <main+0x56>
lea    0xdfc(%rip),%rdi
call   10f0 <tigetstr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1221 <main+0x51>
mov    -0x10(%rbp),%rdi
call   1040 <putp@plt>
jmp    1226 <main+0x56>
movl   $0xa,-0x54(%rbp)
movl   $0x28,-0x58(%rbp)
movl   $0x2,-0x5c(%rbp)
movl   $0x4,-0x60(%rbp)
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    $0x0,%al
call   10d0 <noecho@plt>
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
call   1080 <newwin@plt>
mov    %rax,-0x30(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%ecx
add    $0x5,%ecx
call   1080 <newwin@plt>
mov    %rax,-0x28(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    -0x5c(%rbp),%edx
add    $0x2,%edx
mov    -0x60(%rbp),%ecx
add    $0xa,%ecx
call   1080 <newwin@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    12d3 <main+0x103>
movslq -0x64(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <box@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12a9 <main+0xd9>
mov    -0x30(%rbp),%rdi
call   10a0 <new_panel@plt>
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
call   10a0 <new_panel@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <new_panel@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1060 <update_panels@plt>
mov    $0x0,%al
call   10e0 <doupdate@plt>
mov    $0x0,%al
call   10b0 <getch@plt>
mov    $0x0,%al
call   10c0 <endwin@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <setupterm@plt>
mov    0x2df6(%rip),%rcx
cmp    (%rcx),%rax
jne    1208 <main+0x38>
lea    0xe0a(%rip),%rdi
call   10f0 <tigetstr@plt>
test   %rax,%rax
je     1208 <main+0x38>
mov    %rax,%rdi
call   1040 <putp@plt>
xor    %eax,%eax
call   1070 <initscr@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
xor    %eax,%eax
call   10d0 <noecho@plt>
mov    $0xa,%edi
mov    $0x28,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
call   1080 <newwin@plt>
mov    %rax,%r14
mov    $0xa,%edi
mov    $0x28,%esi
mov    $0x3,%edx
mov    $0x9,%ecx
call   1080 <newwin@plt>
mov    %rax,%r15
mov    $0xa,%edi
mov    $0x28,%esi
mov    $0x4,%edx
mov    $0xe,%ecx
call   1080 <newwin@plt>
mov    %rax,%rbx
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <box@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <box@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <box@plt>
mov    %r14,%rdi
call   10a0 <new_panel@plt>
mov    %r15,%rdi
call   10a0 <new_panel@plt>
mov    %rbx,%rdi
call   10a0 <new_panel@plt>
xor    %eax,%eax
call   1060 <update_panels@plt>
xor    %eax,%eax
call   10e0 <doupdate@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
xor    %eax,%eax
call   10c0 <endwin@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@OK = global i64 0
@.str = [6 x i8] c"clear\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [3 x i32*]
%4 = alloca [3 x i32*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i64 @setupterm(i32 0, i32 1, i32 0)
%11 = load i64, i64* @OK
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %0
%14 = call i8* @tigetstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %2
%15 = load i8*, i8** %2
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %2
%19 = call i32 @putp(i8* %18)
br label %20
20: ; preds = %17, %13
br label %21
21: ; preds = %20, %0
store i32 10, i32* %5
store i32 40, i32* %6
store i32 2, i32* %7
store i32 4, i32* %8
%22 = call i32 (...) @initscr()
%23 = call i32 (...) @cbreak()
%24 = call i32 (...) @noecho()
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = call i32* @newwin(i32 %25, i32 %26, i32 %27, i32 %28)
%30 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 0
store i32* %29, i32** %30
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 5
%37 = call i32* @newwin(i32 %31, i32 %32, i32 %34, i32 %36)
%38 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 1
store i32* %37, i32** %38
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 2
%43 = load i32, i32* %8
%44 = add nsw i32 %43, 10
%45 = call i32* @newwin(i32 %39, i32 %40, i32 %42, i32 %44)
%46 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 2
store i32* %45, i32** %46
store i32 0, i32* %9
br label %47
47: ; preds = %56, %21
%48 = load i32, i32* %9
%49 = icmp slt i32 %48, 3
br i1 %49, label %50, label %59
50: ; preds = %47
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 %52
%54 = load i32*, i32** %53
%55 = call i32 @box(i32* %54, i32 0, i32 0)
br label %56
56: ; preds = %50
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %47
59: ; preds = %47
%60 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 0
%61 = load i32*, i32** %60
%62 = call i32* @new_panel(i32* %61)
%63 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 0
store i32* %62, i32** %63
%64 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 1
%65 = load i32*, i32** %64
%66 = call i32* @new_panel(i32* %65)
%67 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 1
store i32* %66, i32** %67
%68 = getelementptr inbounds [3 x i32*], [3 x i32*]* %3, i64 0, i64 2
%69 = load i32*, i32** %68
%70 = call i32* @new_panel(i32* %69)
%71 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 2
store i32* %70, i32** %71
%72 = call i32 (...) @update_panels()
%73 = call i32 (...) @doupdate()
%74 = call i32 (...) @getch()
%75 = call i32 (...) @endwin()
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@OK = global i64 0
@.str = [6 x i8] c"clear\00"
define i32 @main() {
%1 = tail call i64 @setupterm(i32 0, i32 1, i32 0)
%2 = load i64, i64* @OK
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = tail call i8* @tigetstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @putp(i8* %5)
br label %9
9: ; preds = %4, %7, %0
%10 = tail call i32 (...) @initscr()
%11 = tail call i32 (...) @cbreak()
%12 = tail call i32 (...) @noecho()
%13 = tail call i32* @newwin(i32 10, i32 40, i32 2, i32 4)
%14 = tail call i32* @newwin(i32 10, i32 40, i32 3, i32 9)
%15 = tail call i32* @newwin(i32 10, i32 40, i32 4, i32 14)
%16 = tail call i32 @box(i32* %13, i32 0, i32 0)
%17 = tail call i32 @box(i32* %14, i32 0, i32 0)
%18 = tail call i32 @box(i32* %15, i32 0, i32 0)
%19 = tail call i32* @new_panel(i32* %13)
%20 = tail call i32* @new_panel(i32* %14)
%21 = tail call i32* @new_panel(i32* %15)
%22 = tail call i32 (...) @update_panels()
%23 = tail call i32 (...) @doupdate()
%24 = tail call i32 (...) @getch()
%25 = tail call i32 (...) @endwin()
ret i32 0
}