#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 A_BOLD;
int A_NORMAL;
int COLOR_PAIR(int /*<<< orphan*/);
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ attrset(int);
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvprintw(scalar_t__, int, char *, char *);
int strlen(char *);
int wait_for_input();
int msgbox(char *message) {
  int len = strlen(message);
  int x;
  attrset(COLOR_PAIR(COLOR_WHITE) | A_BOLD);
  for (x = -5; x < len + 5; x++) {
    mvaddch(23 / 2 - 2, (80 / 2) - (len / 2) + x, '+');
    mvaddch(23 / 2 - 1, (80 / 2) - (len / 2) + x, '+');
    mvaddch(23 / 2 + 0, (80 / 2) - (len / 2) + x, '+');
    mvaddch(23 / 2 + 1, (80 / 2) - (len / 2) + x, '+');
    mvaddch(23 / 2 + 2, (80 / 2) - (len / 2) + x, '+');
  }
  for (x = -3; x < len + 3; x++) {
    mvaddch(23 / 2 - 1, (80 / 2) - (len / 2) + x, ' ');
    mvaddch(23 / 2 + 0, (80 / 2) - (len / 2) + x, ' ');
    mvaddch(23 / 2 + 1, (80 / 2) - (len / 2) + x, ' ');
  }
  attrset(COLOR_PAIR(COLOR_WHITE) | A_NORMAL);
  mvprintw(23 / 2 + 0, (80 / 2) - (len / 2), "%s", message);
  attrset(A_NORMAL);
  return wait_for_input();
}


x86 assembly (clang, -O0):
<msgbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
mov    0x2e41(%rip),%rax
or     (%rax),%edi
call   1060 <attrset@plt>
movl   $0xfffffffb,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x5,%ecx
cmp    %ecx,%eax
jge    1270 <msgbox+0x110>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0x9,%edi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xa,%edi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xb,%edi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xc,%edi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xd,%edi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119d <msgbox+0x3d>
movl   $0xfffffffd,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
jge    1302 <msgbox+0x1a2>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xa,%edi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xb,%edi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
add    -0x10(%rbp),%esi
mov    $0xc,%edi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1277 <msgbox+0x117>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
call   1050 <COLOR_PAIR@plt>
mov    %eax,%edi
mov    0x2ccf(%rip),%rax
or     (%rax),%edi
call   1060 <attrset@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x28,%esi
sub    %eax,%esi
mov    -0x8(%rbp),%rcx
mov    $0xb,%edi
lea    0xcbe(%rip),%rdx
call   1080 <mvprintw@plt>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
call   1060 <attrset@plt>
mov    $0x0,%al
call   1030 <wait_for_input@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgbox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    0x2e5b(%rip),%r15
mov    (%r15),%edi
call   1050 <COLOR_PAIR@plt>
mov    0x2e44(%rip),%rcx
or     (%rcx),%eax
mov    %eax,%edi
call   1060 <attrset@plt>
cmp    $0xfffffff7,%r13d
jl     12a5 <msgbox+0x145>
mov    %r13d,%r12d
shr    $0x1f,%r12d
add    %r13d,%r12d
sar    %r12d
lea    0x4(%r13),%eax
cmp    $0xfffffffc,%eax
mov    $0xfffffffb,%ebx
cmovge %eax,%ebx
add    $0x6,%ebx
mov    $0x23,%ebp
sub    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x9,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    $0xa,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    $0xb,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    $0xc,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
mov    $0xd,%edi
mov    %ebp,%esi
mov    $0x2b,%edx
call   1070 <mvaddch@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
jne    11d0 <msgbox+0x70>
cmp    $0xfffffffa,%r13d
jle    12a5 <msgbox+0x145>
mov    $0x28,%ebp
sub    %r12d,%ebp
add    $0x2,%r13d
cmp    $0xfffffffe,%r13d
mov    $0xfffffffd,%r15d
cmovge %r13d,%r15d
add    $0x4,%r15d
mov    $0x25,%ebx
sub    %r12d,%ebx
nopl   0x0(%rax)
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
mov    $0xb,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
mov    $0xc,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1070 <mvaddch@plt>
add    $0x1,%ebx
add    $0xffffffff,%r15d
jne    1260 <msgbox+0x100>
mov    0x2d35(%rip),%r15
jmp    12b2 <msgbox+0x152>
neg    %r13d
shr    %r13d
add    $0x28,%r13d
mov    %r13d,%ebp
mov    (%r15),%edi
call   1050 <COLOR_PAIR@plt>
mov    0x2d27(%rip),%rbx
or     (%rbx),%eax
mov    %eax,%edi
call   1060 <attrset@plt>
lea    0xd2f(%rip),%rdx
mov    $0xb,%edi
mov    %ebp,%esi
mov    %r14,%rcx
call   1080 <mvprintw@plt>
mov    (%rbx),%edi
call   1060 <attrset@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <wait_for_input@plt>

LLVM IR (-O0):
@COLOR_WHITE = global i32 0
@A_BOLD = global i32 0
@A_NORMAL = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @msgbox(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @COLOR_WHITE
%8 = call i32 @COLOR_PAIR(i32 %7)
%9 = load i32, i32* @A_BOLD
%10 = or i32 %8, %9
%11 = call i32 @attrset(i32 %10)
store i32 -5, i32* %4
br label %12
12: ; preds = %48, %1
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 5
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %51
17: ; preds = %12
%18 = load i32, i32* %3
%19 = sdiv i32 %18, 2
%20 = sub nsw i32 40, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
%23 = call i32 @mvaddch(i32 9, i32 %22, i8 signext 43)
%24 = load i32, i32* %3
%25 = sdiv i32 %24, 2
%26 = sub nsw i32 40, %25
%27 = load i32, i32* %4
%28 = add nsw i32 %26, %27
%29 = call i32 @mvaddch(i32 10, i32 %28, i8 signext 43)
%30 = load i32, i32* %3
%31 = sdiv i32 %30, 2
%32 = sub nsw i32 40, %31
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
%35 = call i32 @mvaddch(i32 11, i32 %34, i8 signext 43)
%36 = load i32, i32* %3
%37 = sdiv i32 %36, 2
%38 = sub nsw i32 40, %37
%39 = load i32, i32* %4
%40 = add nsw i32 %38, %39
%41 = call i32 @mvaddch(i32 12, i32 %40, i8 signext 43)
%42 = load i32, i32* %3
%43 = sdiv i32 %42, 2
%44 = sub nsw i32 40, %43
%45 = load i32, i32* %4
%46 = add nsw i32 %44, %45
%47 = call i32 @mvaddch(i32 13, i32 %46, i8 signext 43)
br label %48
48: ; preds = %17
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %12
51: ; preds = %12
store i32 -3, i32* %4
br label %52
52: ; preds = %76, %51
%53 = load i32, i32* %4
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 3
%56 = icmp slt i32 %53, %55
br i1 %56, label %57, label %79
57: ; preds = %52
%58 = load i32, i32* %3
%59 = sdiv i32 %58, 2
%60 = sub nsw i32 40, %59
%61 = load i32, i32* %4
%62 = add nsw i32 %60, %61
%63 = call i32 @mvaddch(i32 10, i32 %62, i8 signext 32)
%64 = load i32, i32* %3
%65 = sdiv i32 %64, 2
%66 = sub nsw i32 40, %65
%67 = load i32, i32* %4
%68 = add nsw i32 %66, %67
%69 = call i32 @mvaddch(i32 11, i32 %68, i8 signext 32)
%70 = load i32, i32* %3
%71 = sdiv i32 %70, 2
%72 = sub nsw i32 40, %71
%73 = load i32, i32* %4
%74 = add nsw i32 %72, %73
%75 = call i32 @mvaddch(i32 12, i32 %74, i8 signext 32)
br label %76
76: ; preds = %57
%77 = load i32, i32* %4
%78 = add nsw i32 %77, 1
store i32 %78, i32* %4
br label %52
79: ; preds = %52
%80 = load i32, i32* @COLOR_WHITE
%81 = call i32 @COLOR_PAIR(i32 %80)
%82 = load i32, i32* @A_NORMAL
%83 = or i32 %81, %82
%84 = call i32 @attrset(i32 %83)
%85 = load i32, i32* %3
%86 = sdiv i32 %85, 2
%87 = sub nsw i32 40, %86
%88 = load i8*, i8** %2
%89 = call i32 @mvprintw(i64 11, i32 %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %88)
%90 = load i32, i32* @A_NORMAL
%91 = call i32 @attrset(i32 %90)
%92 = call i32 (...) @wait_for_input()
ret i32 %92
}

LLVM IR (-O2):
@COLOR_WHITE = global i32 0
@A_BOLD = global i32 0
@A_NORMAL = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @msgbox(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i32, i32* @COLOR_WHITE
%4 = tail call i32 @COLOR_PAIR(i32 %3)
%5 = load i32, i32* @A_BOLD
%6 = or i32 %5, %4
%7 = tail call i32 @attrset(i32 %6)
%8 = icmp sgt i32 %2, -10
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = sdiv i32 %2, -2
%11 = add nsw i32 %10, 40
%12 = add i32 %2, 4
%13 = call i32 @llvm.smax.i32(i32 %12, i32 -5)
br label %25
14: ; preds = %25
%15 = icmp sgt i32 %2, -6
br i1 %15, label %20, label %16
16: ; preds = %1, %14
%17 = sub i32 0, %2
%18 = lshr i32 %17, 1
%19 = add nuw nsw i32 %18, 40
br label %43
20: ; preds = %14
%21 = sdiv i32 %2, -2
%22 = add nsw i32 %21, 40
%23 = add i32 %2, 2
%24 = call i32 @llvm.smax.i32(i32 %23, i32 -3)
br label %35
25: ; preds = %9, %25
%26 = phi i32 [ -5, %9 ], [ %33, %25 ]
%27 = add nsw i32 %11, %26
%28 = tail call i32 @mvaddch(i32 9, i32 %27, i8 signext 43)
%29 = tail call i32 @mvaddch(i32 10, i32 %27, i8 signext 43)
%30 = tail call i32 @mvaddch(i32 11, i32 %27, i8 signext 43)
%31 = tail call i32 @mvaddch(i32 12, i32 %27, i8 signext 43)
%32 = tail call i32 @mvaddch(i32 13, i32 %27, i8 signext 43)
%33 = add i32 %26, 1
%34 = icmp eq i32 %26, %13
br i1 %34, label %14, label %25
35: ; preds = %20, %35
%36 = phi i32 [ -3, %20 ], [ %41, %35 ]
%37 = add nsw i32 %22, %36
%38 = tail call i32 @mvaddch(i32 10, i32 %37, i8 signext 32)
%39 = tail call i32 @mvaddch(i32 11, i32 %37, i8 signext 32)
%40 = tail call i32 @mvaddch(i32 12, i32 %37, i8 signext 32)
%41 = add i32 %36, 1
%42 = icmp eq i32 %36, %24
br i1 %42, label %43, label %35
43: ; preds = %35, %16
%44 = phi i32 [ %19, %16 ], [ %22, %35 ]
%45 = load i32, i32* @COLOR_WHITE
%46 = tail call i32 @COLOR_PAIR(i32 %45)
%47 = load i32, i32* @A_NORMAL
%48 = or i32 %47, %46
%49 = tail call i32 @attrset(i32 %48)
%50 = tail call i32 @mvprintw(i64 11, i32 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%51 = load i32, i32* @A_NORMAL
%52 = tail call i32 @attrset(i32 %51)
%53 = tail call i32 (...) @wait_for_input()
ret i32 %53
}