#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 */

/* Variables and functions */
int LINES;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ getstr(char *);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvprintw(int, int, char *, char *);
int /*<<< orphan*/ stdscr;
int strlen(char *);
int main() {
  char mesg[] = "Enter a string: ";
  char str[80];
  int row, col;
  initscr();
  getmaxyx(stdscr, row, col);
  mvprintw(row / 2, (col - strlen(mesg)) / 2, "%s", mesg);
  getstr(str);
  mvprintw(LINES - 2, 0, "You Entered: %s", str);
  getch();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe72(%rip),%al
mov    %al,-0x10(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    -0x74(%rbp),%esi
mov    -0x78(%rbp),%edx
call   1060 <getmaxyx@plt>
mov    -0x74(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%edi
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x20(%rbp),%rcx
lea    0xe26(%rip),%rdx
call   1090 <mvprintw@plt>
lea    -0x70(%rbp),%rdi
call   1050 <getstr@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
sub    $0x2,%edi
lea    -0x70(%rbp),%rcx
xor    %esi,%esi
lea    0xdf2(%rip),%rdx
call   1090 <mvprintw@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
movaps 0xe84(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1060 <getmaxyx@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xe72(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
mov    %rbx,%rcx
call   1090 <mvprintw@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <getstr@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
add    $0xfffffffe,%edi
lea    0xe39(%rip),%rdx
xor    %esi,%esi
mov    %rbx,%rcx
call   1090 <mvprintw@plt>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.mesg = [17 x i8] c"Enter a string: \00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@LINES = global i32 0
@.str.1 = [16 x i8] c"You Entered: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca [80 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [17 x i8]* %2 to i8*
%7 = call i32 (...) @initscr()
%8 = load i32, i32* @stdscr
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @getmaxyx(i32 %8, i32 %9, i32 %10)
%12 = load i32, i32* %4
%13 = sdiv i32 %12, 2
%14 = load i32, i32* %5
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = sub nsw i32 %14, %16
%18 = sdiv i32 %17, 2
%19 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%20 = call i32 @mvprintw(i32 %13, i32 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%22 = call i32 @getstr(i8* %21)
%23 = load i32, i32* @LINES
%24 = sub nsw i32 %23, 2
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%26 = call i32 @mvprintw(i32 %24, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = call i32 (...) @getch()
%28 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@__const.main.mesg = [17 x i8] c"Enter a string: \00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@LINES = global i32 0
@.str.1 = [16 x i8] c"You Entered: %s\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = load i32, i32* @stdscr
%7 = tail call i32 @getmaxyx(i32 %6, i32 undef, i32 undef)
%8 = call i32 @strlen(i8* %3)
%9 = call i32 @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%10 = call i32 @getstr(i8* %4)
%11 = load i32, i32* @LINES
%12 = add nsw i32 %11, -2
%13 = call i32 @mvprintw(i32 %12, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%14 = call i32 (...) @getch()
%15 = call i32 (...) @endwin()
ret i32 0
}