#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*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdscr;
void CheckScreenSize() {
  int h, w;
  getmaxyx(stdscr, h, w);
  if ((h < 32) || (w < 29)) {
    endwin();
    fprintf(stderr, "\nSorry.\n");
    fprintf(stderr, "To play Pacman for Console, your console window must be "
                    "at least 32x29\n");
    fprintf(stderr,
            "Please resize your window/resolution and re-run the game.\n\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<CheckScreenSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <getmaxyx@plt>
cmpl   $0x20,-0x4(%rbp)
jl     1170 <CheckScreenSize+0x30>
cmpl   $0x1d,-0x8(%rbp)
jge    11bd <CheckScreenSize+0x7d>
mov    $0x0,%al
call   1050 <endwin@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckScreenSize>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getmaxyx@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"\0ASorry.\0A\00"
@.str.1 = [72 x i8] c"To play Pacman for Console, your console window must be at least 32x29\0A\00"
@.str.2 = [60 x i8] c"Please resize your window/resolution and re-run the game.\0A\0A\00"
define void @CheckScreenSize() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @stdscr
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @getmaxyx(i32 %3, i32 %4, i32 %5)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 32
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 29
br i1 %11, label %12, label %21
12: ; preds = %9, %0
%13 = call i32 (...) @endwin()
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %9
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@stderr = global i32 0
define void @CheckScreenSize() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @getmaxyx(i32 %1, i32 undef, i32 undef)
ret void
}