#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 /*<<< orphan*/ ACS_HLINE;
int /*<<< orphan*/ ACS_VLINE;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ touchwin(int /*<<< orphan*/);
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void npause(int ntype) {
  WINDOW *info;
  int i;
  int b;
  int maxrow;
  int maxcol;
  getmaxyx(stdscr, maxrow, maxcol);
  info = newwin(7, 50, (maxrow - 7) / 2, (maxcol - 50) / 2);
  wattrset(info, COLOR_PAIR(4));
  box(info, ACS_VLINE, ACS_HLINE);
  for (i = 1; i < 6; i++) {
    for (b = 1; b < 49; b++) {
      mvwaddch(info, i, b, ' ');
    }
  }
  if (ntype == 0)
    mvwprintw(info, 3, 9, "Paused - Hit any key to continue.");
  if (ntype == 1)
    mvwprintw(info, 3, 9, "Paused and Marked: Any Key Resumes");
  wrefresh(info);
  while (getch() == -1) {
    sleep(1);
  }
  delwin(info);
  touchwin(stdscr);
  refresh();
}


x86 assembly (clang, -O0):
<npause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1070 <getmaxyx@plt>
mov    -0x1c(%rbp),%eax
sub    $0x7,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x32,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
mov    $0x7,%edi
mov    $0x32,%esi
call   1060 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
call   10a0 <COLOR_PAIR@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1040 <wattrset@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
mov    0x2d81(%rip),%rax
mov    (%rax),%edx
call   1080 <box@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    12b5 <npause+0xe5>
movl   $0x1,-0x18(%rbp)
cmpl   $0x31,-0x18(%rbp)
jge    12a2 <npause+0xd2>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1276 <npause+0xa6>
jmp    12a7 <npause+0xd7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1265 <npause+0x95>
cmpl   $0x0,-0x4(%rbp)
jne    12d9 <npause+0x109>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x9,%edx
lea    0xd2c(%rip),%rcx
call   10d0 <mvwprintw@plt>
cmpl   $0x1,-0x4(%rbp)
jne    12fd <npause+0x12d>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x9,%edx
lea    0xd2a(%rip),%rcx
call   10d0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1050 <wrefresh@plt>
mov    $0x0,%al
call   10c0 <getch@plt>
cmp    $0xffffffff,%eax
jne    1325 <npause+0x155>
mov    $0x1,%edi
call   10f0 <sleep@plt>
jmp    1306 <npause+0x136>
mov    -0x10(%rbp),%rdi
call   1090 <delwin@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
call   1030 <touchwin@plt>
mov    $0x0,%al
call   10b0 <refresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<npause>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
mov    0x2e07(%rip),%r15
mov    (%r15),%edi
call   1070 <getmaxyx@plt>
mov    $0x7,%edi
mov    $0x32,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1060 <newwin@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <wattrset@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
mov    0x2db5(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1080 <box@plt>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
add    $0x1,%ebp
cmp    $0x31,%ebp
jne    1240 <npause+0x70>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
add    $0x1,%ebp
cmp    $0x31,%ebp
jne    1270 <npause+0xa0>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %ebp,%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
add    $0x1,%ebp
cmp    $0x31,%ebp
jne    12a0 <npause+0xd0>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %ebp,%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
add    $0x1,%ebp
cmp    $0x31,%ebp
jne    12d0 <npause+0x100>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %ebp,%edx
mov    $0x20,%ecx
call   10e0 <mvwaddch@plt>
add    $0x1,%ebp
cmp    $0x31,%ebp
jne    1300 <npause+0x130>
test   %r14d,%r14d
je     1330 <npause+0x160>
cmp    $0x1,%r14d
jne    1349 <npause+0x179>
lea    0xcf4(%rip),%rcx
jmp    1337 <npause+0x167>
lea    0xcc9(%rip),%rcx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x9,%edx
call   10d0 <mvwprintw@plt>
mov    %rbx,%rdi
call   1050 <wrefresh@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <getch@plt>
cmp    $0xffffffff,%eax
jne    1378 <npause+0x1a8>
mov    $0x1,%edi
call   10f0 <sleep@plt>
jmp    1360 <npause+0x190>
mov    %rbx,%rdi
call   1090 <delwin@plt>
mov    (%r15),%edi
call   1030 <touchwin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <refresh@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@ACS_VLINE = global i32 0
@ACS_HLINE = global i32 0
@.str = [34 x i8] c"Paused - Hit any key to continue.\00"
@.str.1 = [35 x i8] c"Paused and Marked: Any Key Resumes\00"
define void @npause(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* @stdscr
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @getmaxyx(i32 %8, i32 %9, i32 %10)
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, 7
%14 = sdiv i32 %13, 2
%15 = load i32, i32* %7
%16 = sub nsw i32 %15, 50
%17 = sdiv i32 %16, 2
%18 = call i32* @newwin(i32 7, i32 50, i32 %14, i32 %17)
store i32* %18, i32** %3
%19 = load i32*, i32** %3
%20 = call i32 @COLOR_PAIR(i32 4)
%21 = call i32 @wattrset(i32* %19, i32 %20)
%22 = load i32*, i32** %3
%23 = load i32, i32* @ACS_VLINE
%24 = load i32, i32* @ACS_HLINE
%25 = call i32 @box(i32* %22, i32 %23, i32 %24)
store i32 1, i32* %4
br label %26
26: ; preds = %42, %1
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 6
br i1 %28, label %29, label %45
29: ; preds = %26
store i32 1, i32* %5
br label %30
30: ; preds = %38, %29
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 49
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i32*, i32** %3
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = call i32 @mvwaddch(i32* %34, i32 %35, i32 %36, i8 signext 32)
br label %38
38: ; preds = %33
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %30
41: ; preds = %30
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %26
45: ; preds = %26
%46 = load i32, i32* %2
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32*, i32** %3
%50 = call i32 @mvwprintw(i32* %49, i32 3, i32 9, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %51
51: ; preds = %48, %45
%52 = load i32, i32* %2
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32*, i32** %3
%56 = call i32 @mvwprintw(i32* %55, i32 3, i32 9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %57
57: ; preds = %54, %51
%58 = load i32*, i32** %3
%59 = call i32 @wrefresh(i32* %58)
br label %60
60: ; preds = %63, %57
%61 = call i32 (...) @getch()
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @sleep(i32 1)
br label %60
65: ; preds = %60
%66 = load i32*, i32** %3
%67 = call i32 @delwin(i32* %66)
%68 = load i32, i32* @stdscr
%69 = call i32 @touchwin(i32 %68)
%70 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@ACS_VLINE = global i32 0
@ACS_HLINE = global i32 0
@.str = [34 x i8] c"Paused - Hit any key to continue.\00"
@.str.1 = [35 x i8] c"Paused and Marked: Any Key Resumes\00"
define void @npause(i32 %0) {
%2 = load i32, i32* @stdscr
%3 = tail call i32 @getmaxyx(i32 %2, i32 undef, i32 undef)
%4 = tail call i32* @newwin(i32 7, i32 50, i32 0, i32 0)
%5 = tail call i32 @COLOR_PAIR(i32 4)
%6 = tail call i32 @wattrset(i32* %4, i32 %5)
%7 = load i32, i32* @ACS_VLINE
%8 = load i32, i32* @ACS_HLINE
%9 = tail call i32 @box(i32* %4, i32 %7, i32 %8)
br label %10
10: ; preds = %1, %10
%11 = phi i32 [ 1, %1 ], [ %13, %10 ]
%12 = tail call i32 @mvwaddch(i32* %4, i32 1, i32 %11, i8 signext 32)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, 49
br i1 %14, label %15, label %10
15: ; preds = %10, %15
%16 = phi i32 [ %18, %15 ], [ 1, %10 ]
%17 = tail call i32 @mvwaddch(i32* %4, i32 2, i32 %16, i8 signext 32)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, 49
br i1 %19, label %20, label %15
20: ; preds = %15, %20
%21 = phi i32 [ %23, %20 ], [ 1, %15 ]
%22 = tail call i32 @mvwaddch(i32* %4, i32 3, i32 %21, i8 signext 32)
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %23, 49
br i1 %24, label %25, label %20
25: ; preds = %20, %25
%26 = phi i32 [ %28, %25 ], [ 1, %20 ]
%27 = tail call i32 @mvwaddch(i32* %4, i32 4, i32 %26, i8 signext 32)
%28 = add nuw nsw i32 %26, 1
%29 = icmp eq i32 %28, 49
br i1 %29, label %30, label %25
30: ; preds = %25, %30
%31 = phi i32 [ %33, %30 ], [ 1, %25 ]
%32 = tail call i32 @mvwaddch(i32* %4, i32 5, i32 %31, i8 signext 32)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %33, 49
br i1 %34, label %35, label %30
35: ; preds = %30
switch i32 %0, label %40 [
i32 0, label %37
i32 1, label %36
]
36: ; preds = %35
br label %37
37: ; preds = %35, %36
%38 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %36 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), %35 ]
%39 = tail call i32 @mvwprintw(i32* %4, i32 3, i32 9, i8* %38)
br label %40
40: ; preds = %37, %35
%41 = tail call i32 @wrefresh(i32* %4)
%42 = tail call i32 (...) @getch()
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %48
44: ; preds = %40, %44
%45 = tail call i32 @sleep(i32 1)
%46 = tail call i32 (...) @getch()
%47 = icmp eq i32 %46, -1
br i1 %47, label %44, label %48
48: ; preds = %44, %40
%49 = tail call i32 @delwin(i32* %4)
%50 = load i32, i32* @stdscr
%51 = tail call i32 @touchwin(i32 %50)
%52 = tail call i32 (...) @refresh()
ret void
}