#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*/ chtype;
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ print_xcenter_w_pad(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void draw_msg(WINDOW *msg_win, const char **message, chtype color) {
  int msg_win_h, msg_win_w, msg_y = 1, msg_lines = 0;
  box(msg_win, 0, 0);
  getmaxyx(msg_win, msg_win_h, msg_win_w);
  while (**(message + msg_lines++) != '\0')
    if (msg_lines == (msg_win_h - 1))
      break;
  while (msg_y != (msg_win_h - msg_lines) / 2)
    print_xcenter_w_pad(msg_win, msg_y++, "", color, msg_win_w - 2);
  while (**message)
    print_xcenter_w_pad(msg_win, msg_y++, *message++, color, msg_win_w - 2);
  while (msg_y != (msg_win_h - 1))
    print_xcenter_w_pad(msg_win, msg_y++, "", color, msg_win_w - 2);
  move(0, 0);
  wrefresh(msg_win);
}


x86 assembly (clang, -O0):
<draw_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1060 <box@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <getmaxyx@plt>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ca <draw_msg+0x7a>
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11c5 <draw_msg+0x75>
jmp    11ca <draw_msg+0x7a>
jmp    118d <draw_msg+0x3d>
jmp    11cf <draw_msg+0x7f>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
je     121b <draw_msg+0xcb>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
sub    $0x2,%r8d
lea    0xdef(%rip),%rdx
call   1030 <print_xcenter_w_pad@plt>
jmp    11cf <draw_msg+0x7f>
jmp    1220 <draw_msg+0xd0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     1266 <draw_msg+0x116>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
sub    $0x2,%r8d
call   1030 <print_xcenter_w_pad@plt>
jmp    1220 <draw_msg+0xd0>
jmp    126b <draw_msg+0x11b>
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12a7 <draw_msg+0x157>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
sub    $0x2,%r8d
lea    0xd63(%rip),%rdx
call   1030 <print_xcenter_w_pad@plt>
jmp    126b <draw_msg+0x11b>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <move@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_msg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
xor    %edx,%edx
call   1050 <box@plt>
mov    %rbx,%rdi
call   1040 <getmaxyx@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rax
add    $0x8,%r14
cmpb   $0x0,(%rax)
jne    1160 <draw_msg+0x30>
mov    $0x1,%esi
lea    0xe88(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    0x1(%rsi),%ebp
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1030 <print_xcenter_w_pad@plt>
mov    %ebp,%esi
jmp    1180 <draw_msg+0x50>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @draw_msg(i32* %0, i8** %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
store i32 1, i32* %9
store i32 0, i32* %10
%11 = load i32*, i32** %4
%12 = call i32 @box(i32* %11, i32 0, i32 0)
%13 = load i32*, i32** %4
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @getmaxyx(i32* %13, i32 %14, i32 %15)
br label %17
17: ; preds = %33, %3
%18 = load i8**, i8*** %5
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
store i32 %20, i32* %10
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %17
%28 = load i32, i32* %10
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 1
%31 = icmp eq i32 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %27
br label %34
33: ; preds = %27
br label %17
34: ; preds = %32, %17
br label %35
35: ; preds = %42, %34
%36 = load i32, i32* %9
%37 = load i32, i32* %7
%38 = load i32, i32* %10
%39 = sub nsw i32 %37, %38
%40 = sdiv i32 %39, 2
%41 = icmp ne i32 %36, %40
br i1 %41, label %42, label %50
42: ; preds = %35
%43 = load i32*, i32** %4
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
%46 = load i32, i32* %6
%47 = load i32, i32* %8
%48 = sub nsw i32 %47, 2
%49 = call i32 @print_xcenter_w_pad(i32* %43, i32 %44, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %46, i32 %48)
br label %35
50: ; preds = %35
br label %51
51: ; preds = %56, %50
%52 = load i8**, i8*** %5
%53 = load i8*, i8** %52
%54 = load i8, i8* %53
%55 = icmp ne i8 %54, 0
br i1 %55, label %56, label %67
56: ; preds = %51
%57 = load i32*, i32** %4
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i32 1
store i8** %61, i8*** %5
%62 = load i8*, i8** %60
%63 = load i32, i32* %6
%64 = load i32, i32* %8
%65 = sub nsw i32 %64, 2
%66 = call i32 @print_xcenter_w_pad(i32* %57, i32 %58, i8* %62, i32 %63, i32 %65)
br label %51
67: ; preds = %51
br label %68
68: ; preds = %73, %67
%69 = load i32, i32* %9
%70 = load i32, i32* %7
%71 = sub nsw i32 %70, 1
%72 = icmp ne i32 %69, %71
br i1 %72, label %73, label %81
73: ; preds = %68
%74 = load i32*, i32** %4
%75 = load i32, i32* %9
%76 = add nsw i32 %75, 1
store i32 %76, i32* %9
%77 = load i32, i32* %6
%78 = load i32, i32* %8
%79 = sub nsw i32 %78, 2
%80 = call i32 @print_xcenter_w_pad(i32* %74, i32 %75, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %77, i32 %79)
br label %68
81: ; preds = %68
%82 = call i32 @move(i32 0, i32 0)
%83 = load i32*, i32** %4
%84 = call i32 @wrefresh(i32* %83)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @draw_msg(i32* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i32 @box(i32* %0, i32 0, i32 0)
%5 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
br label %6
6: ; preds = %6, %3
%7 = phi i64 [ %12, %6 ], [ 0, %3 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
%12 = add nuw i64 %7, 1
br i1 %11, label %13, label %6
13: ; preds = %6, %13
%14 = phi i32 [ %15, %13 ], [ 1, %6 ]
%15 = add nuw nsw i32 %14, 1
%16 = tail call i32 @print_xcenter_w_pad(i32* %0, i32 %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %2, i32 undef)
br label %13
}