#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*/ draw_box_XY(int, int, int, int, char, char, char);
int /*<<< orphan*/ fill_area_XY(int, int, int, int, char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ put_picture(int, int, int, int, char *, int);
void draw_message(int width, char *message) {
  int height = 6;
  int x1 = (80 - width) / 2 - 3;
  int y1 = (24 - height) / 2 - 2;
  printf("\033[%dm", 7);
  fill_area_XY(x1 + 1, y1 + 1, x1 + 1 + width + 2 * 3 - 1,
               y1 + 1 + height + 2 * 2 - 1, ' ');
  draw_box_XY(x1 + 1, y1 + 1, x1 + 1 + width + 2 * 3 - 1,
              y1 + 1 + height + 2 * 2 - 1, '-', '|', '+');
  put_picture(x1 + 3 + 1, y1 + 2 + 1, width, height, message, 2);
  printf("\033[%dm", 0);
}


x86 assembly (clang, -O0):
<draw_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x6,-0x14(%rbp)
mov    $0x50,%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    $0x18,%eax
sub    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
add    $0x1,%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
add    -0x4(%rbp),%edx
add    $0x6,%edx
sub    $0x1,%edx
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
add    -0x14(%rbp),%ecx
add    $0x4,%ecx
sub    $0x1,%ecx
mov    $0x20,%r8d
call   1050 <fill_area_XY@plt>
mov    -0x18(%rbp),%edi
add    $0x1,%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
add    -0x4(%rbp),%edx
add    $0x6,%edx
sub    $0x1,%edx
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
add    -0x14(%rbp),%ecx
add    $0x4,%ecx
sub    $0x1,%ecx
mov    $0x2d,%r8d
mov    $0x7c,%r9d
movl   $0x2b,(%rsp)
call   1040 <draw_box_XY@plt>
mov    -0x18(%rbp),%edi
add    $0x3,%edi
add    $0x1,%edi
mov    -0x1c(%rbp),%esi
add    $0x2,%esi
add    $0x1,%esi
mov    -0x4(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0x2,%r9d
call   1060 <put_picture@plt>
lea    0xdc8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_message>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r12d
mov    $0x50,%eax
sub    %edi,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
lea    0xe98(%rip),%r15
mov    %r15,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    -0x2(%rbx),%r13d
lea    (%r12,%rbx,1),%ebp
add    $0x3,%ebp
mov    %r13d,%edi
mov    $0x8,%esi
mov    %ebp,%edx
mov    $0x11,%ecx
mov    $0x20,%r8d
call   1050 <fill_area_XY@plt>
movl   $0x2b,(%rsp)
mov    %r13d,%edi
mov    $0x8,%esi
mov    %ebp,%edx
mov    $0x11,%ecx
mov    $0x2d,%r8d
mov    $0x7c,%r9d
call   1040 <draw_box_XY@plt>
add    $0x1,%ebx
mov    %ebx,%edi
mov    $0xa,%esi
mov    %r12d,%edx
mov    $0x6,%ecx
mov    %r14,%r8
mov    $0x2,%r9d
call   1060 <put_picture@plt>
mov    %r15,%rdi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dm\00"
define void @draw_message(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 6, i32* %5
%8 = load i32, i32* %3
%9 = sub nsw i32 80, %8
%10 = sdiv i32 %9, 2
%11 = sub nsw i32 %10, 3
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = sub nsw i32 24, %12
%14 = sdiv i32 %13, 2
%15 = sub nsw i32 %14, 2
store i32 %15, i32* %7
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 7)
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
%25 = add nsw i32 %24, 6
%26 = sub nsw i32 %25, 1
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %5
%30 = add nsw i32 %28, %29
%31 = add nsw i32 %30, 4
%32 = sub nsw i32 %31, 1
%33 = call i32 @fill_area_XY(i32 %18, i32 %20, i32 %26, i32 %32, i8 signext 32)
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
%40 = load i32, i32* %3
%41 = add nsw i32 %39, %40
%42 = add nsw i32 %41, 6
%43 = sub nsw i32 %42, 1
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
%46 = load i32, i32* %5
%47 = add nsw i32 %45, %46
%48 = add nsw i32 %47, 4
%49 = sub nsw i32 %48, 1
%50 = call i32 @draw_box_XY(i32 %35, i32 %37, i32 %43, i32 %49, i8 signext 45, i8 signext 124, i8 signext 43)
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 3
%53 = add nsw i32 %52, 1
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 2
%56 = add nsw i32 %55, 1
%57 = load i32, i32* %3
%58 = load i32, i32* %5
%59 = load i8*, i8** %4
%60 = call i32 @put_picture(i32 %53, i32 %56, i32 %57, i32 %58, i8* %59, i32 2)
%61 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dm\00"
define void @draw_message(i32 %0, i8* %1) {
%3 = sub nsw i32 80, %0
%4 = sdiv i32 %3, 2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 7)
%6 = add nsw i32 %4, -2
%7 = add i32 %0, 5
%8 = add i32 %7, %6
%9 = tail call i32 @fill_area_XY(i32 %6, i32 8, i32 %8, i32 17, i8 signext 32)
%10 = tail call i32 @draw_box_XY(i32 %6, i32 8, i32 %8, i32 17, i8 signext 45, i8 signext 124, i8 signext 43)
%11 = add nsw i32 %4, 1
%12 = tail call i32 @put_picture(i32 %11, i32 10, i32 %0, i32 6, i8* %1, i32 2)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}