#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 */
scalar_t__ KEY_RESIZE;
int /*<<< orphan*/ clear();
scalar_t__ getch();
int getmaxy(int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *, int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ timeout(int);
void nc_minsize(void) {
  int y_max;
  timeout(-1);
inf:
  y_max = getmaxy(stdscr);
  if (y_max >= 2)
    return;
  clear();
  printw("terminal is %d rows tall, but at least %d are required", y_max, 2);
  refresh();
  while (getch() != KEY_RESIZE)
    ;
  goto inf;
}


x86 assembly (clang, -O0):
<nc_minsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xffffffff,%edi
call   1040 <timeout@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1030 <getmaxy@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     1193 <nc_minsize+0x33>
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1080 <clear@plt>
mov    -0x4(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x2,%edx
call   1050 <printw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    0x2e2d(%rip),%rcx
cmp    (%rcx),%rax
je     11d1 <nc_minsize+0x71>
jmp    11b5 <nc_minsize+0x55>
jmp    1172 <nc_minsize+0x12>

x86 assembly (clang, -O2):
<nc_minsize>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%edi
call   1040 <timeout@plt>
mov    0x2e68(%rip),%r14
mov    (%r14),%edi
call   1030 <getmaxy@plt>
cmp    $0x1,%eax
jg     11db <nc_minsize+0x7b>
mov    %eax,%ebp
lea    0xe72(%rip),%r15
mov    0x2e5b(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <clear@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
call   1050 <printw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
nopl   (%rax)
xor    %eax,%eax
call   1070 <getch@plt>
cmp    (%rbx),%rax
jne    11c0 <nc_minsize+0x60>
mov    (%r14),%edi
call   1030 <getmaxy@plt>
mov    %eax,%ebp
cmp    $0x2,%eax
jl     11a0 <nc_minsize+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32 0
@.str = [55 x i8] c"terminal is %d rows tall, but at least %d are required\00"
@KEY_RESIZE = global i64 0
define void @nc_minsize() {
%1 = alloca i32
%2 = call i32 @timeout(i32 -1)
br label %3
3: ; preds = %19, %0
%4 = load i32, i32* @stdscr
%5 = call i32 @getmaxy(i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp sge i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %3
ret void
9: ; preds = %3
%10 = call i32 (...) @clear()
%11 = load i32, i32* %1
%12 = call i32 @printw(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %11, i32 2)
%13 = call i32 (...) @refresh()
br label %14
14: ; preds = %18, %9
%15 = call i64 (...) @getch()
%16 = load i64, i64* @KEY_RESIZE
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %14
br label %14
19: ; preds = %14
br label %3
}

LLVM IR (-O2):
@stdscr = global i32 0
@.str = [55 x i8] c"terminal is %d rows tall, but at least %d are required\00"
@KEY_RESIZE = global i64 0
define void @nc_minsize() {
%1 = tail call i32 @timeout(i32 -1)
%2 = load i32, i32* @stdscr
%3 = tail call i32 @getmaxy(i32 %2)
%4 = icmp sgt i32 %3, 1
br i1 %4, label %9, label %10
5: ; preds = %15
%6 = load i32, i32* @stdscr
%7 = tail call i32 @getmaxy(i32 %6)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %5, %0
ret void
10: ; preds = %0, %5
%11 = phi i32 [ %7, %5 ], [ %3, %0 ]
%12 = tail call i32 (...) @clear()
%13 = tail call i32 @printw(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %11, i32 2)
%14 = tail call i32 (...) @refresh()
br label %15
15: ; preds = %15, %10
%16 = tail call i64 (...) @getch()
%17 = load i64, i64* @KEY_RESIZE
%18 = icmp eq i64 %16, %17
br i1 %18, label %5, label %15
}