#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;
typedef int /*<<< orphan*/ MENU;
typedef int /*<<< orphan*/ ITEM;

/* Variables and functions */
scalar_t__ COLS;
scalar_t__ LINES;
int /*<<< orphan*/ derwin(int /*<<< orphan*/ *, scalar_t__, scalar_t__, int,
                          int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(scalar_t__, int /*<<< orphan*/, char *);
int /*<<< orphan*/ *new_menu(int /*<<< orphan*/ **);
int /*<<< orphan*/ post_menu(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_title(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ set_menu_format(int /*<<< orphan*/ *, scalar_t__,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ set_menu_sub(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ set_menu_win(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
MENU *init_menu(ITEM **items, WINDOW *win) {
  MENU *menu = new_menu((ITEM **)items);
  set_menu_format(menu, LINES - 4, 0);
  set_menu_win(menu, win);
  set_menu_sub(menu, derwin(win, LINES - 4, COLS - 2, 1, 0));
  mvprintw(LINES - 1, 0, "q to exit");
  char title[] = "SteamCurses";
  print_title(win, title);
  refresh();
  post_menu(menu);
  wrefresh(win);
  return menu;
}


x86 assembly (clang, -O0):
<init_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <new_menu@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%rsi
sub    $0x4,%rsi
xor    %edx,%edx
call   10a0 <set_menu_format@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <set_menu_win@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2df2(%rip),%rax
mov    (%rax),%rsi
sub    $0x4,%rsi
mov    0x2ddc(%rip),%rax
mov    (%rax),%rdx
sub    $0x2,%rdx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   10c0 <derwin@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1060 <set_menu_sub@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
lea    0xdc6(%rip),%rdx
call   10b0 <mvprintw@plt>
mov    0xdc4(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xdc2(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1090 <print_title@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    -0x18(%rbp),%rdi
call   1040 <post_menu@plt>
mov    -0x10(%rbp),%rdi
call   1050 <wrefresh@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_menu>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
call   1070 <new_menu@plt>
mov    %rax,%rbx
mov    0x2e2d(%rip),%r15
mov    (%r15),%rsi
add    $0xfffffffffffffffc,%rsi
mov    %rax,%rdi
xor    %edx,%edx
call   10a0 <set_menu_format@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <set_menu_win@plt>
mov    (%r15),%rsi
add    $0xfffffffffffffffc,%rsi
mov    0x2dfb(%rip),%rax
mov    (%rax),%rdx
add    $0xfffffffffffffffe,%rdx
mov    %r14,%rdi
mov    $0x1,%ecx
xor    %r8d,%r8d
call   10c0 <derwin@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <set_menu_sub@plt>
mov    (%r15),%rdi
add    $0xffffffffffffffff,%rdi
lea    0xdec(%rip),%rdx
xor    %esi,%esi
call   10b0 <mvprintw@plt>
movabs $0x7275436d61657453,%rax
43 75 72
mov    %rax,(%rsp)
movl   $0x736573,0x8(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
call   1090 <print_title@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
mov    %rbx,%rdi
call   1040 <post_menu@plt>
mov    %r14,%rdi
call   1050 <wrefresh@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@LINES = global i64 0
@COLS = global i64 0
@.str = [10 x i8] c"q to exit\00"
@__const.init_menu.title = [12 x i8] c"SteamCurses\00"
define i32* @init_menu(i32** %0, i32* %1) {
%3 = alloca i32**
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [12 x i8]
store i32** %0, i32*** %3
store i32* %1, i32** %4
%7 = load i32**, i32*** %3
%8 = call i32* @new_menu(i32** %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = load i64, i64* @LINES
%11 = sub nsw i64 %10, 4
%12 = call i32 @set_menu_format(i32* %9, i64 %11, i32 0)
%13 = load i32*, i32** %5
%14 = load i32*, i32** %4
%15 = call i32 @set_menu_win(i32* %13, i32* %14)
%16 = load i32*, i32** %5
%17 = load i32*, i32** %4
%18 = load i64, i64* @LINES
%19 = sub nsw i64 %18, 4
%20 = load i64, i64* @COLS
%21 = sub nsw i64 %20, 2
%22 = call i32 @derwin(i32* %17, i64 %19, i64 %21, i32 1, i32 0)
%23 = call i32 @set_menu_sub(i32* %16, i32 %22)
%24 = load i64, i64* @LINES
%25 = sub nsw i64 %24, 1
%26 = call i32 @mvprintw(i64 %25, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%27 = bitcast [12 x i8]* %6 to i8*
%28 = load i32*, i32** %4
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%30 = call i32 @print_title(i32* %28, i8* %29)
%31 = call i32 (...) @refresh()
%32 = load i32*, i32** %5
%33 = call i32 @post_menu(i32* %32)
%34 = load i32*, i32** %4
%35 = call i32 @wrefresh(i32* %34)
%36 = load i32*, i32** %5
ret i32* %36
}

LLVM IR (-O2):
@LINES = global i64 0
@COLS = global i64 0
@.str = [10 x i8] c"q to exit\00"
@__const.init_menu.title = [12 x i8] c"SteamCurses\00"
define i32* @init_menu(i32** %0, i32* %1) {
%3 = alloca [12 x i8]
%4 = tail call i32* @new_menu(i32** %0)
%5 = load i64, i64* @LINES
%6 = add nsw i64 %5, -4
%7 = tail call i32 @set_menu_format(i32* %4, i64 %6, i32 0)
%8 = tail call i32 @set_menu_win(i32* %4, i32* %1)
%9 = load i64, i64* @LINES
%10 = add nsw i64 %9, -4
%11 = load i64, i64* @COLS
%12 = add nsw i64 %11, -2
%13 = tail call i32 @derwin(i32* %1, i64 %10, i64 %12, i32 1, i32 0)
%14 = tail call i32 @set_menu_sub(i32* %4, i32 %13)
%15 = load i64, i64* @LINES
%16 = add nsw i64 %15, -1
%17 = tail call i32 @mvprintw(i64 %16, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%19 = call i32 @print_title(i32* %1, i8* %18)
%20 = call i32 (...) @refresh()
%21 = call i32 @post_menu(i32* %4)
%22 = call i32 @wrefresh(i32* %1)
ret i32* %4
}