#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*/ getyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ sleep(int);
int strlen(char *);
int /*<<< orphan*/ touchwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void ScDisplayErr(WINDOW *back_win, char *str) {
  int old_y, old_x, win_len;
  WINDOW *err_win;
  getyx(back_win, old_y, old_x);
  wmove(back_win, 0, 0);
  wrefresh(back_win);
  win_len = strlen(str) + 2;
  err_win = newwin(3, win_len, LINES / 2 - 2, (COLS - win_len - 2) / 2);
  box(err_win, 0, 0);
  mvwaddstr(err_win, 1, 1, str);
  wrefresh(err_win);
  sleep(3);
  delwin(err_win);
  wmove(back_win, old_y, old_x);
  touchwin(back_win);
  wrefresh(back_win);
}


x86 assembly (clang, -O0):
<ScDisplayErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <getyx@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10a0 <wmove@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    0x2dfa(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x2,%eax
mov    %eax,-0x2c(%rbp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%eax
sub    -0x1c(%rbp),%eax
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
mov    $0x3,%edi
call   1070 <newwin@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <box@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   10b0 <mvwaddstr@plt>
mov    -0x28(%rbp),%rdi
call   1060 <wrefresh@plt>
mov    $0x3,%edi
call   10c0 <sleep@plt>
mov    -0x28(%rbp),%rdi
call   1090 <delwin@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10a0 <wmove@plt>
mov    -0x8(%rbp),%rdi
call   1030 <touchwin@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScDisplayErr>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1050 <getyx@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <wmove@plt>
mov    %r15,%rdi
call   1060 <wrefresh@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    0x2e15(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
add    $0xfffffffe,%edx
mov    0x2df8(%rip),%rcx
mov    (%rcx),%ecx
sub    %eax,%ecx
lea    0x2(%rax),%esi
mov    %ecx,%eax
add    $0xfffffffc,%eax
shr    $0x1f,%eax
add    %eax,%ecx
add    $0xfffffffc,%ecx
sar    %ecx
mov    $0x3,%edi
call   1070 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <box@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <mvwaddstr@plt>
mov    %rbx,%rdi
call   1060 <wrefresh@plt>
mov    $0x3,%edi
call   10c0 <sleep@plt>
mov    %rbx,%rdi
call   1090 <delwin@plt>
mov    %r15,%rdi
call   10a0 <wmove@plt>
mov    %r15,%rdi
call   1030 <touchwin@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <wrefresh@plt>

LLVM IR (-O0):
@LINES = global i32 0
@COLS = global i32 0
define void @ScDisplayErr(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32* %0, i32** %3
store i8* %1, i8** %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @getyx(i32* %9, i32 %10, i32 %11)
%13 = load i32*, i32** %3
%14 = call i32 @wmove(i32* %13, i32 0, i32 0)
%15 = load i32*, i32** %3
%16 = call i32 @wrefresh(i32* %15)
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = add nsw i32 %18, 2
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = load i32, i32* @LINES
%22 = sdiv i32 %21, 2
%23 = sub nsw i32 %22, 2
%24 = load i32, i32* @COLS
%25 = load i32, i32* %7
%26 = sub nsw i32 %24, %25
%27 = sub nsw i32 %26, 2
%28 = sdiv i32 %27, 2
%29 = call i32* @newwin(i32 3, i32 %20, i32 %23, i32 %28)
store i32* %29, i32** %8
%30 = load i32*, i32** %8
%31 = call i32 @box(i32* %30, i32 0, i32 0)
%32 = load i32*, i32** %8
%33 = load i8*, i8** %4
%34 = call i32 @mvwaddstr(i32* %32, i32 1, i32 1, i8* %33)
%35 = load i32*, i32** %8
%36 = call i32 @wrefresh(i32* %35)
%37 = call i32 @sleep(i32 3)
%38 = load i32*, i32** %8
%39 = call i32 @delwin(i32* %38)
%40 = load i32*, i32** %3
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = call i32 @wmove(i32* %40, i32 %41, i32 %42)
%44 = load i32*, i32** %3
%45 = call i32 @touchwin(i32* %44)
%46 = load i32*, i32** %3
%47 = call i32 @wrefresh(i32* %46)
ret void
}

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