#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;

/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ derwin(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ post_menu(int /*<<< orphan*/ *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ set_menu_format(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ set_menu_mark(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ set_menu_sub(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ set_menu_win(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *construct_menu_win(MENU *menu, int nlines, int ncols, int begin_y,
                           int begin_x) {
  WINDOW *menu_win = newwin(nlines, ncols, begin_y, begin_x);
  keypad(menu_win, TRUE);
  set_menu_win(menu, menu_win);
  set_menu_format(menu, nlines - 2, 1);
  set_menu_sub(menu, derwin(menu_win, nlines - 2, ncols - 4, 1, 1));
  set_menu_mark(menu, " * ");
  box(menu_win, 0, 0);
  refresh();
  post_menu(menu);
  wrefresh(menu_win);
  return (menu_win);
}


x86 assembly (clang, -O0):
<construct_menu_win>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1070 <newwin@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
call   1060 <keypad@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <set_menu_win@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
mov    $0x1,%edx
call   10c0 <set_menu_format@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
mov    -0x10(%rbp),%edx
sub    $0x4,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   10d0 <derwin@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1080 <set_menu_sub@plt>
mov    -0x8(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1090 <set_menu_mark@plt>
mov    -0x20(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10a0 <box@plt>
mov    $0x0,%al
call   10b0 <refresh@plt>
mov    -0x8(%rbp),%rdi
call   1040 <post_menu@plt>
mov    -0x20(%rbp),%rdi
call   1050 <wrefresh@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<construct_menu_win>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
mov    %r8d,%ecx
call   1070 <newwin@plt>
mov    %rax,%r15
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1060 <keypad@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <set_menu_win@plt>
add    $0xfffffffe,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   10c0 <set_menu_format@plt>
add    $0xfffffffc,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   10d0 <derwin@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1080 <set_menu_sub@plt>
lea    0xdd8(%rip),%rsi
mov    %r14,%rdi
call   1090 <set_menu_mark@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <box@plt>
xor    %eax,%eax
call   10b0 <refresh@plt>
mov    %r14,%rdi
call   1040 <post_menu@plt>
mov    %r15,%rdi
call   1050 <wrefresh@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@TRUE = global i32 0
@.str = [4 x i8] c" * \00"
define i32* @construct_menu_win(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32* @newwin(i32 %12, i32 %13, i32 %14, i32 %15)
store i32* %16, i32** %11
%17 = load i32*, i32** %11
%18 = load i32, i32* @TRUE
%19 = call i32 @keypad(i32* %17, i32 %18)
%20 = load i32*, i32** %6
%21 = load i32*, i32** %11
%22 = call i32 @set_menu_win(i32* %20, i32* %21)
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 2
%26 = call i32 @set_menu_format(i32* %23, i32 %25, i32 1)
%27 = load i32*, i32** %6
%28 = load i32*, i32** %11
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 2
%31 = load i32, i32* %8
%32 = sub nsw i32 %31, 4
%33 = call i32 @derwin(i32* %28, i32 %30, i32 %32, i32 1, i32 1)
%34 = call i32 @set_menu_sub(i32* %27, i32 %33)
%35 = load i32*, i32** %6
%36 = call i32 @set_menu_mark(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%37 = load i32*, i32** %11
%38 = call i32 @box(i32* %37, i32 0, i32 0)
%39 = call i32 (...) @refresh()
%40 = load i32*, i32** %6
%41 = call i32 @post_menu(i32* %40)
%42 = load i32*, i32** %11
%43 = call i32 @wrefresh(i32* %42)
%44 = load i32*, i32** %11
ret i32* %44
}

LLVM IR (-O2):
@TRUE = global i32 0
@.str = [4 x i8] c" * \00"
define i32* @construct_menu_win(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32* @newwin(i32 %1, i32 %2, i32 %3, i32 %4)
%7 = load i32, i32* @TRUE
%8 = tail call i32 @keypad(i32* %6, i32 %7)
%9 = tail call i32 @set_menu_win(i32* %0, i32* %6)
%10 = add nsw i32 %1, -2
%11 = tail call i32 @set_menu_format(i32* %0, i32 %10, i32 1)
%12 = add nsw i32 %2, -4
%13 = tail call i32 @derwin(i32* %6, i32 %10, i32 %12, i32 1, i32 1)
%14 = tail call i32 @set_menu_sub(i32* %0, i32 %13)
%15 = tail call i32 @set_menu_mark(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @box(i32* %6, i32 0, i32 0)
%17 = tail call i32 (...) @refresh()
%18 = tail call i32 @post_menu(i32* %0)
%19 = tail call i32 @wrefresh(i32* %6)
ret i32* %6
}