#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 COLS;
int LINES;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int strlen(char *);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
int /*<<< orphan*/ wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void putwinmsg(char *msgptr) {
  WINDOW *mw;
  mw = newwin(3, strlen(msgptr) + 2, LINES / 2 - 1,
              COLS / 2 - strlen(msgptr) / 2 - 1);
  box(mw, 0, 0);
  mvwaddstr(mw, 1, 1, msgptr);
  wrefresh(mw);
  wgetch(mw);
  werase(mw);
  wrefresh(mw);
  delwin(mw);
}


x86 assembly (clang, -O0):
<putwinmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%esi
mov    $0x2,%edi
cltd
idiv   %edi
mov    -0x14(%rbp),%edx
sub    %eax,%ecx
sub    $0x1,%ecx
mov    $0x3,%edi
call   1050 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1060 <box@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1090 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1080 <wgetch@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <werase@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1070 <delwin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putwinmsg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <strlen@plt>
lea    0x2(%rax),%r14d
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
add    $0xffffffff,%ebp
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
not    %ecx
add    %ebx,%ecx
mov    $0x3,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1050 <newwin@plt>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <box@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1090 <mvwaddstr@plt>
mov    %rbp,%rdi
call   1040 <wrefresh@plt>
mov    %rbp,%rdi
call   1080 <wgetch@plt>
mov    %rbp,%rdi
call   10a0 <werase@plt>
mov    %rbp,%rdi
call   1040 <wrefresh@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <delwin@plt>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
define void @putwinmsg(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 2
%7 = load i32, i32* @LINES
%8 = sdiv i32 %7, 2
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* @COLS
%11 = sdiv i32 %10, 2
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = sdiv i32 %13, 2
%15 = sub nsw i32 %11, %14
%16 = sub nsw i32 %15, 1
%17 = call i32* @newwin(i32 3, i32 %6, i32 %9, i32 %16)
store i32* %17, i32** %3
%18 = load i32*, i32** %3
%19 = call i32 @box(i32* %18, i32 0, i32 0)
%20 = load i32*, i32** %3
%21 = load i8*, i8** %2
%22 = call i32 @mvwaddstr(i32* %20, i32 1, i32 1, i8* %21)
%23 = load i32*, i32** %3
%24 = call i32 @wrefresh(i32* %23)
%25 = load i32*, i32** %3
%26 = call i32 @wgetch(i32* %25)
%27 = load i32*, i32** %3
%28 = call i32 @werase(i32* %27)
%29 = load i32*, i32** %3
%30 = call i32 @wrefresh(i32* %29)
%31 = load i32*, i32** %3
%32 = call i32 @delwin(i32* %31)
ret void
}

LLVM IR (-O2):
@LINES = global i32 0
@COLS = global i32 0
define void @putwinmsg(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 2
%4 = load i32, i32* @LINES
%5 = sdiv i32 %4, 2
%6 = add nsw i32 %5, -1
%7 = load i32, i32* @COLS
%8 = sdiv i32 %7, 2
%9 = tail call i32 @strlen(i8* %0)
%10 = sdiv i32 %9, -2
%11 = add nsw i32 %8, -1
%12 = add nsw i32 %11, %10
%13 = tail call i32* @newwin(i32 3, i32 %3, i32 %6, i32 %12)
%14 = tail call i32 @box(i32* %13, i32 0, i32 0)
%15 = tail call i32 @mvwaddstr(i32* %13, i32 1, i32 1, i8* %0)
%16 = tail call i32 @wrefresh(i32* %13)
%17 = tail call i32 @wgetch(i32* %13)
%18 = tail call i32 @werase(i32* %13)
%19 = tail call i32 @wrefresh(i32* %13)
%20 = tail call i32 @delwin(i32* %13)
ret void
}