#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 COLS;
int LINES;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ scrollok(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ waddstr(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int /*<<< orphan*/ wsetscrreg(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/);
WINDOW *inputwin() {
  WINDOW *temp;
  int height = 1;
  int width = COLS;
  int starty = (LINES - height);
  int startx = (COLS - width);
  temp = newwin(height, width, starty, startx);
  scrollok(temp, TRUE);
  wsetscrreg(temp, 0, 0);
  keypad(temp, TRUE);
  waddstr(temp, "Chat: ");
  wrefresh(temp);
  return temp;
}


x86 assembly (clang, -O0):
<inputwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0xc(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1060 <newwin@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
call   1080 <scrollok@plt>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <wsetscrreg@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1030 <waddstr@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputwin>:
push   %r14
push   %rbx
push   %rax
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    0x2e74(%rip),%rax
mov    (%rax),%edx
add    $0xffffffff,%edx
mov    $0x1,%edi
xor    %ecx,%ecx
call   1060 <newwin@plt>
mov    %rax,%rbx
mov    0x2e51(%rip),%r14
mov    (%r14),%esi
mov    %rax,%rdi
call   1080 <scrollok@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <wsetscrreg@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1050 <keypad@plt>
lea    0xe48(%rip),%rsi
mov    %rbx,%rdi
call   1030 <waddstr@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@COLS = global i32 0
@LINES = global i32 0
@TRUE = global i32 0
@.str = [7 x i8] c"Chat: \00"
define i32* @inputwin() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %2
%6 = load i32, i32* @COLS
store i32 %6, i32* %3
%7 = load i32, i32* @LINES
%8 = load i32, i32* %2
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %4
%10 = load i32, i32* @COLS
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32* @newwin(i32 %13, i32 %14, i32 %15, i32 %16)
store i32* %17, i32** %1
%18 = load i32*, i32** %1
%19 = load i32, i32* @TRUE
%20 = call i32 @scrollok(i32* %18, i32 %19)
%21 = load i32*, i32** %1
%22 = call i32 @wsetscrreg(i32* %21, i32 0, i32 0)
%23 = load i32*, i32** %1
%24 = load i32, i32* @TRUE
%25 = call i32 @keypad(i32* %23, i32 %24)
%26 = load i32*, i32** %1
%27 = call i32 @waddstr(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%28 = load i32*, i32** %1
%29 = call i32 @wrefresh(i32* %28)
%30 = load i32*, i32** %1
ret i32* %30
}

LLVM IR (-O2):
@COLS = global i32 0
@LINES = global i32 0
@TRUE = global i32 0
@.str = [7 x i8] c"Chat: \00"
define i32* @inputwin() {
%1 = load i32, i32* @COLS
%2 = load i32, i32* @LINES
%3 = add nsw i32 %2, -1
%4 = tail call i32* @newwin(i32 1, i32 %1, i32 %3, i32 0)
%5 = load i32, i32* @TRUE
%6 = tail call i32 @scrollok(i32* %4, i32 %5)
%7 = tail call i32 @wsetscrreg(i32* %4, i32 0, i32 0)
%8 = load i32, i32* @TRUE
%9 = tail call i32 @keypad(i32* %4, i32 %8)
%10 = tail call i32 @waddstr(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @wrefresh(i32* %4)
ret i32* %4
}