#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 A_BLINK;
int A_BOLD;
int A_UNDERLINE;
int /*<<< orphan*/ attroff(int);
int /*<<< orphan*/ attron(int);
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int const, int const,
                             char *);
int /*<<< orphan*/ *newwin(int const, int const, int, int);
int /*<<< orphan*/ print_center(char *, int);
int /*<<< orphan*/ wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void disp_help(int ymax, int xmax) {
  WINDOW *help_win;
  const int w_help_y = 14;
  const int w_help_x = 40;
  if ((ymax < w_help_y) || (xmax < w_help_x)) {
    print_center("terminal window too small", A_BOLD | A_BLINK | A_UNDERLINE);
    getch();
    endwin();
  }
  help_win =
      newwin(w_help_y, w_help_x, (ymax - w_help_y) / 2, (xmax - w_help_x) / 2);
  box(help_win, 0, 0);
  attron(A_BOLD);
  mvwprintw(help_win, 1, w_help_x / 2 - 2, "Help");
  attroff(A_BOLD);
  mvwprintw(help_win, 2, 2, "q: quit");
  mvwprintw(help_win, 3, 2, "escape: quit");
  mvwprintw(help_win, 4, 2, "r: restart");
  mvwprintw(help_win, 5, 2, "R: restart and reset speed");
  mvwprintw(help_win, 6, 2, "h: show this help");
  mvwprintw(help_win, 7, 2, "+: increase speed");
  mvwprintw(help_win, 8, 2, "-: decrease speed");
  mvwprintw(help_win, 9, 2, "i: toggle information display");
  mvwprintw(help_win, 10, 2, "a: toggle auto reset");
  mvwprintw(help_win, w_help_y - 2, 3, "press any key to close this window");
  wrefresh(help_win);
  wgetch(help_win);
  delwin(help_win);
}


x86 assembly (clang, -O0):
<disp_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xe,-0x14(%rbp)
movl   $0x28,-0x18(%rbp)
cmpl   $0xe,-0x4(%rbp)
jl     11e0 <disp_help+0x30>
cmpl   $0x28,-0x8(%rbp)
jge    1215 <disp_help+0x65>
mov    0x2df1(%rip),%rax
mov    (%rax),%esi
mov    0x2df8(%rip),%rax
or     (%rax),%esi
mov    0x2dd7(%rip),%rax
or     (%rax),%esi
lea    0xdfe(%rip),%rdi
call   1090 <print_center@plt>
mov    $0x0,%al
call   10a0 <getch@plt>
mov    $0x0,%al
call   10b0 <endwin@plt>
mov    -0x4(%rbp),%eax
sub    $0xe,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x28,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    $0xe,%edi
mov    $0x28,%esi
call   1050 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <box@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
call   1060 <attron@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x12,%edx
lea    0xd9e(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%edx
lea    0xd80(%rip),%rcx
mov    %edx,%esi
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
lea    0xd6c(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
lea    0xd5f(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x2,%edx
lea    0xd50(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
mov    $0x2,%edx
lea    0xd51(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%esi
mov    $0x2,%edx
lea    0xd49(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x8,%esi
mov    $0x2,%edx
lea    0xd41(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
mov    $0x2,%edx
lea    0xd39(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x2,%edx
lea    0xd3d(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
mov    $0xc,%esi
mov    $0x3,%edx
lea    0xd38(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <wgetch@plt>
mov    -0x10(%rbp),%rdi
call   1080 <delwin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_help>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
cmp    $0xe,%edi
jl     11c4 <disp_help+0x14>
cmp    $0x27,%r14d
jg     11f9 <disp_help+0x49>
mov    0x2e0d(%rip),%rax
mov    0x2e16(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2df3(%rip),%rax
or     (%rax),%esi
lea    0xe1a(%rip),%rdi
call   1090 <print_center@plt>
xor    %eax,%eax
call   10a0 <getch@plt>
xor    %eax,%eax
call   10b0 <endwin@plt>
mov    %ebx,%eax
add    $0xfffffff2,%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%edx
add    $0xfffffff2,%edx
sar    %edx
mov    %r14d,%eax
add    $0xffffffd8,%eax
shr    $0x1f,%eax
lea    (%r14,%rax,1),%ecx
add    $0xffffffd8,%ecx
sar    %ecx
mov    $0xe,%edi
mov    $0x28,%esi
call   1050 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <box@plt>
mov    0x2d98(%rip),%r14
mov    (%r14),%edi
call   1060 <attron@plt>
lea    0xdcb(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x12,%edx
call   10d0 <mvwprintw@plt>
mov    (%r14),%edi
call   1030 <attroff@plt>
lea    0xdaf(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd9e(%rip),%rcx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd92(%rip),%rcx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd84(%rip),%rcx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd86(%rip),%rcx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd7f(%rip),%rcx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd78(%rip),%rcx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd71(%rip),%rcx
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd76(%rip),%rcx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   10d0 <mvwprintw@plt>
lea    0xd72(%rip),%rcx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x3,%edx
call   10d0 <mvwprintw@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rdi
call   10c0 <wgetch@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <delwin@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"terminal window too small\00"
@A_BOLD = global i32 0
@A_BLINK = global i32 0
@A_UNDERLINE = global i32 0
@.str.1 = [5 x i8] c"Help\00"
@.str.2 = [8 x i8] c"q: quit\00"
@.str.3 = [13 x i8] c"escape: quit\00"
@.str.4 = [11 x i8] c"r: restart\00"
@.str.5 = [27 x i8] c"R: restart and reset speed\00"
@.str.6 = [18 x i8] c"h: show this help\00"
@.str.7 = [18 x i8] c"+: increase speed\00"
@.str.8 = [18 x i8] c"-: decrease speed\00"
@.str.9 = [30 x i8] c"i: toggle information display\00"
@.str.10 = [21 x i8] c"a: toggle auto reset\00"
@.str.11 = [35 x i8] c"press any key to close this window\00"
define void @disp_help(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 14, i32* %6
store i32 40, i32* %7
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 14
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 40
br i1 %12, label %13, label %22
13: ; preds = %10, %2
%14 = load i32, i32* @A_BOLD
%15 = load i32, i32* @A_BLINK
%16 = or i32 %14, %15
%17 = load i32, i32* @A_UNDERLINE
%18 = or i32 %16, %17
%19 = call i32 @print_center(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @getch()
%21 = call i32 (...) @endwin()
br label %22
22: ; preds = %13, %10
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 14
%25 = sdiv i32 %24, 2
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 40
%28 = sdiv i32 %27, 2
%29 = call i32* @newwin(i32 14, i32 40, i32 %25, i32 %28)
store i32* %29, i32** %5
%30 = load i32*, i32** %5
%31 = call i32 @box(i32* %30, i32 0, i32 0)
%32 = load i32, i32* @A_BOLD
%33 = call i32 @attron(i32 %32)
%34 = load i32*, i32** %5
%35 = call i32 @mvwprintw(i32* %34, i32 1, i32 18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* @A_BOLD
%37 = call i32 @attroff(i32 %36)
%38 = load i32*, i32** %5
%39 = call i32 @mvwprintw(i32* %38, i32 2, i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%40 = load i32*, i32** %5
%41 = call i32 @mvwprintw(i32* %40, i32 3, i32 2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32*, i32** %5
%43 = call i32 @mvwprintw(i32* %42, i32 4, i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32*, i32** %5
%45 = call i32 @mvwprintw(i32* %44, i32 5, i32 2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%46 = load i32*, i32** %5
%47 = call i32 @mvwprintw(i32* %46, i32 6, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%48 = load i32*, i32** %5
%49 = call i32 @mvwprintw(i32* %48, i32 7, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%50 = load i32*, i32** %5
%51 = call i32 @mvwprintw(i32* %50, i32 8, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%52 = load i32*, i32** %5
%53 = call i32 @mvwprintw(i32* %52, i32 9, i32 2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%54 = load i32*, i32** %5
%55 = call i32 @mvwprintw(i32* %54, i32 10, i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%56 = load i32*, i32** %5
%57 = call i32 @mvwprintw(i32* %56, i32 12, i32 3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%58 = load i32*, i32** %5
%59 = call i32 @wrefresh(i32* %58)
%60 = load i32*, i32** %5
%61 = call i32 @wgetch(i32* %60)
%62 = load i32*, i32** %5
%63 = call i32 @delwin(i32* %62)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"terminal window too small\00"
@A_BOLD = global i32 0
@A_BLINK = global i32 0
@A_UNDERLINE = global i32 0
@.str.1 = [5 x i8] c"Help\00"
@.str.2 = [8 x i8] c"q: quit\00"
@.str.3 = [13 x i8] c"escape: quit\00"
@.str.4 = [11 x i8] c"r: restart\00"
@.str.5 = [27 x i8] c"R: restart and reset speed\00"
@.str.6 = [18 x i8] c"h: show this help\00"
@.str.7 = [18 x i8] c"+: increase speed\00"
@.str.8 = [18 x i8] c"-: decrease speed\00"
@.str.9 = [30 x i8] c"i: toggle information display\00"
@.str.10 = [21 x i8] c"a: toggle auto reset\00"
@.str.11 = [35 x i8] c"press any key to close this window\00"
define void @disp_help(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 14
%4 = icmp slt i32 %1, 40
%5 = or i1 %3, %4
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = load i32, i32* @A_BOLD
%8 = load i32, i32* @A_BLINK
%9 = or i32 %8, %7
%10 = load i32, i32* @A_UNDERLINE
%11 = or i32 %9, %10
%12 = tail call i32 @print_center(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 (...) @getch()
%14 = tail call i32 (...) @endwin()
br label %15
15: ; preds = %2, %6
%16 = add nsw i32 %0, -14
%17 = sdiv i32 %16, 2
%18 = add nsw i32 %1, -40
%19 = sdiv i32 %18, 2
%20 = tail call i32* @newwin(i32 14, i32 40, i32 %17, i32 %19)
%21 = tail call i32 @box(i32* %20, i32 0, i32 0)
%22 = load i32, i32* @A_BOLD
%23 = tail call i32 @attron(i32 %22)
%24 = tail call i32 @mvwprintw(i32* %20, i32 1, i32 18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @A_BOLD
%26 = tail call i32 @attroff(i32 %25)
%27 = tail call i32 @mvwprintw(i32* %20, i32 2, i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i32 @mvwprintw(i32* %20, i32 3, i32 2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%29 = tail call i32 @mvwprintw(i32* %20, i32 4, i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%30 = tail call i32 @mvwprintw(i32* %20, i32 5, i32 2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%31 = tail call i32 @mvwprintw(i32* %20, i32 6, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%32 = tail call i32 @mvwprintw(i32* %20, i32 7, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%33 = tail call i32 @mvwprintw(i32* %20, i32 8, i32 2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%34 = tail call i32 @mvwprintw(i32* %20, i32 9, i32 2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%35 = tail call i32 @mvwprintw(i32* %20, i32 10, i32 2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%36 = tail call i32 @mvwprintw(i32* %20, i32 12, i32 3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%37 = tail call i32 @wrefresh(i32* %20)
%38 = tail call i32 @wgetch(i32* %20)
%39 = tail call i32 @delwin(i32* %20)
ret void
}