#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*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ mvprintw(int, int, char const *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int strlen(char const *);
void print_too_small(void) {
  static const char *msg = "TERMINAL TOO SMALL";
  static int mlen = 0;
  if (!mlen)
    mlen = strlen(msg);
  int width, height;
  getmaxyx(stdscr, height, width);
  int x = (width - mlen) / 2;
  x = x >= 0 ? x : 0;
  int y = height / 2;
  mvprintw(y, x, msg);
  refresh();
}


x86 assembly (clang, -O0):
<print_too_small>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2efd(%rip)
jne    1167 <print_too_small+0x27>
mov    0x2ee4(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,0x2ee5(%rip)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1040 <getmaxyx@plt>
mov    -0x4(%rbp),%eax
sub    0x2ec8(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11a4 <print_too_small+0x64>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <print_too_small+0x6e>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <print_too_small+0x6e>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e71(%rip),%rdx
call   1060 <mvprintw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_too_small>:
push   %rax
cmpl   $0x0,0x2efc(%rip)
jne    115c <print_too_small+0x1c>
lea    0xeaf(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,0x2ee8(%rip)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <getmaxyx@plt>
lea    0xe8f(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <mvprintw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <refresh@plt>

LLVM IR (-O0):
@print_too_small.msg = internal global i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i32 0, i32 0)
@.str = [19 x i8] c"TERMINAL TOO SMALL\00"
@print_too_small.mlen = internal global i32 0
@stdscr = global i32 0
define void @print_too_small() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = load i32, i32* @print_too_small.mlen
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i8*, i8** @print_too_small.msg
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* @print_too_small.mlen
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* @stdscr
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = call i32 @getmaxyx(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %1
%16 = load i32, i32* @print_too_small.mlen
%17 = sub nsw i32 %15, %16
%18 = sdiv i32 %17, 2
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %10
%22 = load i32, i32* %3
br label %24
23: ; preds = %10
br label %24
24: ; preds = %23, %21
%25 = phi i32 [ %22, %21 ], [ 0, %23 ]
store i32 %25, i32* %3
%26 = load i32, i32* %2
%27 = sdiv i32 %26, 2
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = load i8*, i8** @print_too_small.msg
%31 = call i32 @mvprintw(i32 %28, i32 %29, i8* %30)
%32 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"TERMINAL TOO SMALL\00"
@print_too_small.mlen = internal unnamed_addr global i32 0
@stdscr = global i32 0
define void @print_too_small() {
%1 = load i32, i32* @print_too_small.mlen
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @print_too_small.mlen
br label %5
5: ; preds = %3, %0
%6 = load i32, i32* @stdscr
%7 = tail call i32 @getmaxyx(i32 %6, i32 undef, i32 undef)
%8 = tail call i32 @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (...) @refresh()
ret void
}