#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*/ colorbox(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ getbegyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ getyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ *newwin(int, int, int, int);
WINDOW *winputbox(WINDOW *win, int nlines, int ncols) {
  WINDOW *winp;
  int cury, curx, begy, begx;
  getyx(win, cury, curx);
  getbegyx(win, begy, begx);
  winp = newwin(nlines, ncols, begy + cury, begx + curx);
  colorbox(winp, 0, 1);
  return winp;
}


x86 assembly (clang, -O0):
<winputbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <getyx@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1060 <getbegyx@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x24(%rbp),%edx
add    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%ecx
add    -0x20(%rbp),%ecx
call   1050 <newwin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <colorbox@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<winputbox>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <getyx@plt>
mov    %rbx,%rdi
call   1060 <getbegyx@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1050 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <colorbox@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @winputbox(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load i32*, i32** %4
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call i32 @getyx(i32* %12, i32 %13, i32 %14)
%16 = load i32*, i32** %4
%17 = load i32, i32* %10
%18 = load i32, i32* %11
%19 = call i32 @getbegyx(i32* %16, i32 %17, i32 %18)
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = load i32, i32* %10
%23 = load i32, i32* %8
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %11
%26 = load i32, i32* %9
%27 = add nsw i32 %25, %26
%28 = call i32* @newwin(i32 %20, i32 %21, i32 %24, i32 %27)
store i32* %28, i32** %7
%29 = load i32*, i32** %7
%30 = call i32 @colorbox(i32* %29, i32 0, i32 1)
%31 = load i32*, i32** %7
ret i32* %31
}

LLVM IR (-O2):
define i32* @winputbox(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @getyx(i32* %0, i32 undef, i32 undef)
%5 = tail call i32 @getbegyx(i32* %0, i32 undef, i32 undef)
%6 = tail call i32* @newwin(i32 %1, i32 %2, i32 undef, i32 undef)
%7 = tail call i32 @colorbox(i32* %6, i32 0, i32 1)
ret i32* %6
}