#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 /*<<< orphan*/ ACS_HLINE;
int /*<<< orphan*/ ACS_LTEE;
int /*<<< orphan*/ ACS_RTEE;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ getbegyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mvwhline(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/,
                            int);
int /*<<< orphan*/ print_in_middle(int /*<<< orphan*/ *, int,
                                   int /*<<< orphan*/, int, char *,
                                   int /*<<< orphan*/);
void win_show(WINDOW *win, char *label, int label_color) {
  int startx, starty, height, width;
  getbegyx(win, starty, startx);
  getmaxyx(win, height, width);
  box(win, 0, 0);
  mvwaddch(win, 2, 0, ACS_LTEE);
  mvwhline(win, 2, 1, ACS_HLINE, width - 2);
  mvwaddch(win, 2, width - 1, ACS_RTEE);
  print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
}


x86 assembly (clang, -O0):
<win_show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <getbegyx@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <getmaxyx@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <box@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e2f(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
xor    %edx,%edx
call   1080 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e06(%rip),%rax
mov    (%rax),%ecx
mov    -0x24(%rbp),%r8d
sub    $0x2,%r8d
mov    $0x2,%esi
mov    $0x1,%edx
call   1070 <mvwhline@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
mov    0x2dd4(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
call   1080 <mvwaddch@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <COLOR_PAIR@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    %eax,%r9d
mov    $0x1,%esi
xor    %edx,%edx
call   1090 <print_in_middle@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<win_show>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <getbegyx@plt>
mov    %rbx,%rdi
call   1030 <getmaxyx@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <box@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1080 <mvwaddch@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1070 <mvwhline@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <mvwaddch@plt>
mov    %ebp,%edi
call   1060 <COLOR_PAIR@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    %r14,%r8
mov    %eax,%r9d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1090 <print_in_middle@plt>

LLVM IR (-O0):
@ACS_LTEE = global i32 0
@ACS_HLINE = global i32 0
@ACS_RTEE = global i32 0
define void @win_show(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
%11 = load i32*, i32** %4
%12 = load i32, i32* %8
%13 = load i32, i32* %7
%14 = call i32 @getbegyx(i32* %11, i32 %12, i32 %13)
%15 = load i32*, i32** %4
%16 = load i32, i32* %9
%17 = load i32, i32* %10
%18 = call i32 @getmaxyx(i32* %15, i32 %16, i32 %17)
%19 = load i32*, i32** %4
%20 = call i32 @box(i32* %19, i32 0, i32 0)
%21 = load i32*, i32** %4
%22 = load i32, i32* @ACS_LTEE
%23 = call i32 @mvwaddch(i32* %21, i32 2, i32 0, i32 %22)
%24 = load i32*, i32** %4
%25 = load i32, i32* @ACS_HLINE
%26 = load i32, i32* %10
%27 = sub nsw i32 %26, 2
%28 = call i32 @mvwhline(i32* %24, i32 2, i32 1, i32 %25, i32 %27)
%29 = load i32*, i32** %4
%30 = load i32, i32* %10
%31 = sub nsw i32 %30, 1
%32 = load i32, i32* @ACS_RTEE
%33 = call i32 @mvwaddch(i32* %29, i32 2, i32 %31, i32 %32)
%34 = load i32*, i32** %4
%35 = load i32, i32* %10
%36 = load i8*, i8** %5
%37 = load i32, i32* %6
%38 = call i32 @COLOR_PAIR(i32 %37)
%39 = call i32 @print_in_middle(i32* %34, i32 1, i32 0, i32 %35, i8* %36, i32 %38)
ret void
}

LLVM IR (-O2):
@ACS_LTEE = global i32 0
@ACS_HLINE = global i32 0
@ACS_RTEE = global i32 0
define void @win_show(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @getbegyx(i32* %0, i32 undef, i32 undef)
%5 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%6 = tail call i32 @box(i32* %0, i32 0, i32 0)
%7 = load i32, i32* @ACS_LTEE
%8 = tail call i32 @mvwaddch(i32* %0, i32 2, i32 0, i32 %7)
%9 = load i32, i32* @ACS_HLINE
%10 = tail call i32 @mvwhline(i32* %0, i32 2, i32 1, i32 %9, i32 undef)
%11 = load i32, i32* @ACS_RTEE
%12 = tail call i32 @mvwaddch(i32* %0, i32 2, i32 undef, i32 %11)
%13 = tail call i32 @COLOR_PAIR(i32 %2)
%14 = tail call i32 @print_in_middle(i32* %0, i32 1, i32 0, i32 undef, i8* %1, i32 %13)
ret void
}