#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*/ 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 height, width;
  (void)(height);
  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    -0x18(%rbp),%esi
mov    -0x1c(%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    0x2e4e(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
xor    %edx,%edx
call   1070 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e25(%rip),%rax
mov    (%rax),%ecx
mov    -0x1c(%rbp),%r8d
sub    $0x2,%r8d
mov    $0x2,%esi
mov    $0x1,%edx
call   1060 <mvwhline@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    0x2df3(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%esi
call   1070 <mvwaddch@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <COLOR_PAIR@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    %eax,%r9d
mov    $0x1,%esi
xor    %edx,%edx
call   1080 <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   1030 <getmaxyx@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <box@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1070 <mvwaddch@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1060 <mvwhline@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1070 <mvwaddch@plt>
mov    %ebp,%edi
call   1050 <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    1080 <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
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %7
%10 = load i32*, i32** %4
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @getmaxyx(i32* %10, i32 %11, i32 %12)
%14 = load i32*, i32** %4
%15 = call i32 @box(i32* %14, i32 0, i32 0)
%16 = load i32*, i32** %4
%17 = load i32, i32* @ACS_LTEE
%18 = call i32 @mvwaddch(i32* %16, i32 2, i32 0, i32 %17)
%19 = load i32*, i32** %4
%20 = load i32, i32* @ACS_HLINE
%21 = load i32, i32* %8
%22 = sub nsw i32 %21, 2
%23 = call i32 @mvwhline(i32* %19, i32 2, i32 1, i32 %20, i32 %22)
%24 = load i32*, i32** %4
%25 = load i32, i32* %8
%26 = sub nsw i32 %25, 1
%27 = load i32, i32* @ACS_RTEE
%28 = call i32 @mvwaddch(i32* %24, i32 2, i32 %26, i32 %27)
%29 = load i32*, i32** %4
%30 = load i32, i32* %8
%31 = load i8*, i8** %5
%32 = load i32, i32* %6
%33 = call i32 @COLOR_PAIR(i32 %32)
%34 = call i32 @print_in_middle(i32* %29, i32 1, i32 0, i32 %30, i8* %31, i32 %33)
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 @getmaxyx(i32* %0, i32 undef, i32 undef)
%5 = tail call i32 @box(i32* %0, i32 0, i32 0)
%6 = load i32, i32* @ACS_LTEE
%7 = tail call i32 @mvwaddch(i32* %0, i32 2, i32 0, i32 %6)
%8 = load i32, i32* @ACS_HLINE
%9 = tail call i32 @mvwhline(i32* %0, i32 2, i32 1, i32 %8, i32 undef)
%10 = load i32, i32* @ACS_RTEE
%11 = tail call i32 @mvwaddch(i32* %0, i32 2, i32 undef, i32 %10)
%12 = tail call i32 @COLOR_PAIR(i32 %2)
%13 = tail call i32 @print_in_middle(i32* %0, i32 1, i32 0, i32 undef, i8* %1, i32 %12)
ret void
}