#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;
int LINES;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int getch();
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void showHelp() {
  int c;
  WINDOW *bwin = newwin(20, 70, LINES / 2 - 10, COLS / 2 - 35);
  WINDOW *hwin = newwin(18, 68, LINES / 2 - 10 + 1, COLS / 2 - 35 + 1);
  box(bwin, 0, 0);
  mvwprintw(
      hwin, 0, 0,
      "%s v%s\n"
      "Lots of keys do things:\n"
      "  ?            This help.\n"
      "  h            Split current window horizontally.\n"
      "  v            Split current window vertically.\n"
      "  c            Close current window.\n"
      "  Tab          Move to next window in order of creation.\n"
      "  Arrow Keys   Move to next window on screen in direction pressed.\n"
      "  Numbers 0-9  Set data source to CPU #. '0' means give a summary.\n"
      "  m            Set data source to Ram.\n"
      "  s            Set data source to Swap.\n"
      "  g            Toggle grid for selected window.\n"
      "  e            Toggle value display in current window's title.\n"
      "  t            Toggle display of current window's title bar.\n"
      "  o            Toggle display of current window's label sidebar.\n"
      "  q            Quit this program.\n"
      "\n"
      "Press Enter to dismiss this help.",
      "ttysys", "0.8");
  wrefresh(bwin);
  wrefresh(hwin);
  while ((c = getch())) {
    if (c == '\n')
      break;
  }
  delwin(hwin);
  delwin(bwin);
}


x86 assembly (clang, -O0):
<showHelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0xa,%eax
mov    %eax,-0x20(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%edx
mov    %eax,%ecx
sub    $0x23,%ecx
mov    $0x14,%edi
mov    $0x46,%esi
call   1040 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0xa,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
sub    $0x23,%ecx
add    $0x1,%ecx
mov    $0x12,%edi
mov    $0x44,%esi
call   1040 <newwin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <box@plt>
mov    -0x18(%rbp),%rdi
xor    %edx,%edx
lea    0xdf2(%rip),%rcx
lea    0x10eb(%rip),%r8
lea    0x10eb(%rip),%r9
mov    %edx,%esi
call   1080 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x18(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     125c <showHelp+0xfc>
cmpl   $0xa,-0x4(%rbp)
jne    1257 <showHelp+0xf7>
jmp    125c <showHelp+0xfc>
jmp    1235 <showHelp+0xd5>
mov    -0x18(%rbp),%rdi
call   1060 <delwin@plt>
mov    -0x10(%rbp),%rdi
call   1060 <delwin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showHelp>:
push   %r15
push   %r14
push   %rbx
mov    0x2e7c(%rip),%r15
mov    (%r15),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
add    $0xfffffff6,%edx
mov    0x2e5e(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xffffffdd,%ecx
mov    $0x14,%edi
mov    $0x46,%esi
call   1040 <newwin@plt>
mov    %rax,%r14
mov    (%r15),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
add    $0xfffffff7,%edx
mov    (%rbx),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xffffffde,%ecx
mov    $0x12,%edi
mov    $0x44,%esi
call   1040 <newwin@plt>
mov    %rax,%rbx
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <box@plt>
lea    0xe1c(%rip),%rcx
lea    0x1115(%rip),%r8
lea    0x1115(%rip),%r9
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <mvwprintw@plt>
mov    %r14,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0xa,%eax
je     1220 <showHelp+0xc0>
test   %eax,%eax
jne    1210 <showHelp+0xb0>
mov    %rbx,%rdi
call   1060 <delwin@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <delwin@plt>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
@.str = [768 x i8] c"%s v%s\0ALots of keys do things:\0A ? This help.\0A h Split current window horizontally.\0A v Split current window vertically.\0A c Close current window.\0A Tab Move to next window in order of creation.\0A Arrow Keys Move to next window on screen in direction pressed.\0A Numbers 0-9 Set data source to CPU #. '0' means give a summary.\0A m Set data source to Ram.\0A s Set data source to Swap.\0A g Toggle grid for selected window.\0A e Toggle value display in current window's title.\0A t Toggle display of current window's title bar.\0A o Toggle display of current window's label sidebar.\0A q Quit this program.\0A\0APress Enter to dismiss this help.\00"
@.str.1 = [7 x i8] c"ttysys\00"
@.str.2 = [4 x i8] c"0.8\00"
define void @showHelp() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = load i32, i32* @LINES
%5 = sdiv i32 %4, 2
%6 = sub nsw i32 %5, 10
%7 = load i32, i32* @COLS
%8 = sdiv i32 %7, 2
%9 = sub nsw i32 %8, 35
%10 = call i32* @newwin(i32 20, i32 70, i32 %6, i32 %9)
store i32* %10, i32** %2
%11 = load i32, i32* @LINES
%12 = sdiv i32 %11, 2
%13 = sub nsw i32 %12, 10
%14 = add nsw i32 %13, 1
%15 = load i32, i32* @COLS
%16 = sdiv i32 %15, 2
%17 = sub nsw i32 %16, 35
%18 = add nsw i32 %17, 1
%19 = call i32* @newwin(i32 18, i32 68, i32 %14, i32 %18)
store i32* %19, i32** %3
%20 = load i32*, i32** %2
%21 = call i32 @box(i32* %20, i32 0, i32 0)
%22 = load i32*, i32** %3
%23 = call i32 @mvwprintw(i32* %22, i32 0, i32 0, i8* getelementptr inbounds ([768 x i8], [768 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32*, i32** %2
%25 = call i32 @wrefresh(i32* %24)
%26 = load i32*, i32** %3
%27 = call i32 @wrefresh(i32* %26)
br label %28
28: ; preds = %35, %0
%29 = call i32 (...) @getch()
store i32 %29, i32* %1
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %1
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %31
br label %36
35: ; preds = %31
br label %28
36: ; preds = %34, %28
%37 = load i32*, i32** %3
%38 = call i32 @delwin(i32* %37)
%39 = load i32*, i32** %2
%40 = call i32 @delwin(i32* %39)
ret void
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
@.str = [768 x i8] c"%s v%s\0ALots of keys do things:\0A ? This help.\0A h Split current window horizontally.\0A v Split current window vertically.\0A c Close current window.\0A Tab Move to next window in order of creation.\0A Arrow Keys Move to next window on screen in direction pressed.\0A Numbers 0-9 Set data source to CPU #. '0' means give a summary.\0A m Set data source to Ram.\0A s Set data source to Swap.\0A g Toggle grid for selected window.\0A e Toggle value display in current window's title.\0A t Toggle display of current window's title bar.\0A o Toggle display of current window's label sidebar.\0A q Quit this program.\0A\0APress Enter to dismiss this help.\00"
@.str.1 = [7 x i8] c"ttysys\00"
@.str.2 = [4 x i8] c"0.8\00"
define void @showHelp() {
%1 = load i32, i32* @LINES
%2 = sdiv i32 %1, 2
%3 = add nsw i32 %2, -10
%4 = load i32, i32* @COLS
%5 = sdiv i32 %4, 2
%6 = add nsw i32 %5, -35
%7 = tail call i32* @newwin(i32 20, i32 70, i32 %3, i32 %6)
%8 = load i32, i32* @LINES
%9 = sdiv i32 %8, 2
%10 = add nsw i32 %9, -9
%11 = load i32, i32* @COLS
%12 = sdiv i32 %11, 2
%13 = add nsw i32 %12, -34
%14 = tail call i32* @newwin(i32 18, i32 68, i32 %10, i32 %13)
%15 = tail call i32 @box(i32* %7, i32 0, i32 0)
%16 = tail call i32 @mvwprintw(i32* %14, i32 0, i32 0, i8* getelementptr inbounds ([768 x i8], [768 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @wrefresh(i32* %7)
%18 = tail call i32 @wrefresh(i32* %14)
br label %19
19: ; preds = %19, %0
%20 = tail call i32 (...) @getch()
switch i32 %20, label %19 [
i32 10, label %21
i32 0, label %21
]
21: ; preds = %19, %19
%22 = tail call i32 @delwin(i32* %14)
%23 = tail call i32 @delwin(i32* %7)
ret void
}