#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 */

/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvprintw(int, int, char *, ...);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int strlen(char *);
void initscreen(void) {
  char msg0[] =
      "For this program, the screen must be at least 100 x 35 characters.";
  char msg1[] = "Please increase the size of the screen.";
  char msg2[] = "Press any key when complete.";
  int row = 0, col = 0;
  initscr();
  getmaxyx(stdscr, row, col);
  while (col < 100 || row < 35) {
    clear();
    getmaxyx(stdscr, row, col);
    mvprintw(row / 2 - 1, (col - strlen(msg0)) / 2, "%s", msg0);
    mvprintw(row / 2 - 5, col / 2 - 15, "Current Window Size: %d x %d", col,
             row);
    mvprintw(row / 2 + 1, (col - strlen(msg1)) / 2, "%s", msg1);
    mvprintw(row / 2 + 2, (col - strlen(msg2)) / 2, "%s", msg2);
    refresh();
    getch();
  }
  endwin();
}


x86 assembly (clang, -O0):
<initscreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    -0x50(%rbp),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x43,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xe95(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
mov    0xeb4(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xea3(%rip),%eax
mov    %eax,-0x88(%rbp)
mov    0xe9b(%rip),%al
mov    %al,-0x84(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%esi
mov    -0xa8(%rbp),%edx
call   1050 <getmaxyx@plt>
mov    $0x1,%al
cmpl   $0x64,-0xa8(%rbp)
mov    %al,-0xa9(%rbp)
jl     1261 <initscreen+0xd1>
cmpl   $0x23,-0xa4(%rbp)
setl   %al
mov    %al,-0xa9(%rbp)
mov    -0xa9(%rbp),%al
test   $0x1,%al
jne    1274 <initscreen+0xe4>
jmp    13f7 <initscreen+0x267>
mov    $0x0,%al
call   10a0 <clear@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%esi
mov    -0xa8(%rbp),%edx
call   1050 <getmaxyx@plt>
mov    -0xa4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0xc4(%rbp)
mov    -0xa8(%rbp),%eax
mov    %eax,-0xc0(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xc4(%rbp),%edi
mov    %eax,%ecx
mov    -0xc0(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x50(%rbp),%rcx
lea    0xdb7(%rip),%rdx
mov    $0x0,%al
call   10b0 <mvprintw@plt>
mov    -0xa4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x5,%edi
mov    -0xa8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0xf,%esi
mov    -0xa8(%rbp),%ecx
mov    -0xa4(%rbp),%r8d
lea    0xd79(%rip),%rdx
mov    $0x0,%al
call   10b0 <mvprintw@plt>
mov    -0xa4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
mov    -0xa8(%rbp),%eax
mov    %eax,-0xb8(%rbp)
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xbc(%rbp),%edi
mov    %eax,%ecx
mov    -0xb8(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x80(%rbp),%rcx
lea    0xd1e(%rip),%rdx
mov    $0x0,%al
call   10b0 <mvprintw@plt>
mov    -0xa4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x2,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xa8(%rbp),%eax
mov    %eax,-0xb0(%rbp)
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xb4(%rbp),%edi
mov    %eax,%ecx
mov    -0xb0(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0xa0(%rbp),%rcx
lea    0xcc0(%rip),%rdx
mov    $0x0,%al
call   10b0 <mvprintw@plt>
mov    $0x0,%al
call   1070 <refresh@plt>
mov    $0x0,%al
call   1080 <getch@plt>
jmp    123c <initscreen+0xac>
mov    $0x0,%al
call   1090 <endwin@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initscreen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe89(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe6d(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe51(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movl   $0x2e7372,0x8f(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0x2e6e6565726373,%rax
mov    %rax,0x40(%rsp)
movups 0xea0(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xe87(%rip),%xmm0
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2ddd(%rip),%rbp
mov    0x0(%rbp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <getmaxyx@plt>
lea    0x50(%rsp),%r14
lea    0xe7a(%rip),%rbx
lea    0xe76(%rip),%r15
lea    0x20(%rsp),%r12
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <clear@plt>
mov    0x0(%rbp),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <getmaxyx@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
neg    %esi
mov    $0xffffffff,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    $0xfffffffb,%edi
mov    $0xfffffff1,%esi
mov    %r15,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
neg    %esi
mov    $0x1,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
neg    %esi
mov    $0x2,%edi
mov    %rbx,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
jmp    1240 <initscreen+0xd0>

LLVM IR (-O0):
@__const.initscreen.msg0 = [67 x i8] c"For this program, the screen must be at least 100 x 35 characters.\00"
@__const.initscreen.msg1 = [40 x i8] c"Please increase the size of the screen.\00"
@__const.initscreen.msg2 = [29 x i8] c"Press any key when complete.\00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [29 x i8] c"Current Window Size: %d x %d\00"
define void @initscreen() {
%1 = alloca [67 x i8]
%2 = alloca [40 x i8]
%3 = alloca [29 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [67 x i8]* %1 to i8*
%7 = bitcast [40 x i8]* %2 to i8*
%8 = bitcast [29 x i8]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
%9 = call i32 (...) @initscr()
%10 = load i32, i32* @stdscr
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @getmaxyx(i32 %10, i32 %11, i32 %12)
br label %14
14: ; preds = %22, %0
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 100
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 35
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ true, %14 ], [ %19, %17 ]
br i1 %21, label %22, label %69
22: ; preds = %20
%23 = call i32 (...) @clear()
%24 = load i32, i32* @stdscr
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @getmaxyx(i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %4
%29 = sdiv i32 %28, 2
%30 = sub nsw i32 %29, 1
%31 = load i32, i32* %5
%32 = getelementptr inbounds [67 x i8], [67 x i8]* %1, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
%34 = sub nsw i32 %31, %33
%35 = sdiv i32 %34, 2
%36 = getelementptr inbounds [67 x i8], [67 x i8]* %1, i64 0, i64 0
%37 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %30, i32 %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = load i32, i32* %4
%39 = sdiv i32 %38, 2
%40 = sub nsw i32 %39, 5
%41 = load i32, i32* %5
%42 = sdiv i32 %41, 2
%43 = sub nsw i32 %42, 15
%44 = load i32, i32* %5
%45 = load i32, i32* %4
%46 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %40, i32 %43, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %44, i32 %45)
%47 = load i32, i32* %4
%48 = sdiv i32 %47, 2
%49 = add nsw i32 %48, 1
%50 = load i32, i32* %5
%51 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = sub nsw i32 %50, %52
%54 = sdiv i32 %53, 2
%55 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%56 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %49, i32 %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %55)
%57 = load i32, i32* %4
%58 = sdiv i32 %57, 2
%59 = add nsw i32 %58, 2
%60 = load i32, i32* %5
%61 = getelementptr inbounds [29 x i8], [29 x i8]* %3, i64 0, i64 0
%62 = call i32 @strlen(i8* %61)
%63 = sub nsw i32 %60, %62
%64 = sdiv i32 %63, 2
%65 = getelementptr inbounds [29 x i8], [29 x i8]* %3, i64 0, i64 0
%66 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %59, i32 %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %65)
%67 = call i32 (...) @refresh()
%68 = call i32 (...) @getch()
br label %14
69: ; preds = %20
%70 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
@__const.initscreen.msg0 = [67 x i8] c"For this program, the screen must be at least 100 x 35 characters.\00"
@__const.initscreen.msg1 = [40 x i8] c"Please increase the size of the screen.\00"
@__const.initscreen.msg2 = [29 x i8] c"Press any key when complete.\00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [29 x i8] c"Current Window Size: %d x %d\00"
define void @initscreen() {
%1 = alloca [67 x i8]
%2 = alloca [40 x i8]
%3 = alloca [29 x i8]
%4 = getelementptr inbounds [67 x i8], [67 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [29 x i8], [29 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (...) @initscr()
%8 = load i32, i32* @stdscr
%9 = tail call i32 @getmaxyx(i32 %8, i32 0, i32 0)
br label %10
10: ; preds = %10, %0
%11 = call i32 (...) @clear()
%12 = load i32, i32* @stdscr
%13 = call i32 @getmaxyx(i32 %12, i32 0, i32 0)
%14 = call i32 @strlen(i8* %4)
%15 = sdiv i32 %14, -2
%16 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 -1, i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%17 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 -5, i32 -15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
%18 = call i32 @strlen(i8* %5)
%19 = sdiv i32 %18, -2
%20 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 1, i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%21 = call i32 @strlen(i8* %6)
%22 = sdiv i32 %21, -2
%23 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 2, i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%24 = call i32 (...) @refresh()
%25 = call i32 (...) @getch()
br label %10
}