#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 */
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  int _begy;
  int _begx;
};
typedef TYPE_1__ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ colorbox(TYPE_1__ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ getyx(TYPE_1__ *, int, int);
TYPE_1__ *newwin(int, int, int, int);
WINDOW *winputbox(WINDOW *win, int nlines, int ncols) {
  int cury, curx, begy, begx;
  WINDOW *winp;
  getyx(win, cury, curx);
  (begy = (win)->_begy, begx = (win)->_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    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <getyx@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x1c(%rbp),%edx
add    -0x14(%rbp),%edx
mov    -0x20(%rbp),%ecx
add    -0x18(%rbp),%ecx
call   1050 <newwin@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <colorbox@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

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

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

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