#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(int argc, char const *argv[]) {
  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    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe6d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe6b(%rip),%al
mov    %al,-0x20(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0x84(%rbp),%esi
mov    -0x88(%rbp),%edx
call   1060 <getmaxyx@plt>
mov    -0x84(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x90(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x8c(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x90(%rbp),%edi
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x30(%rbp),%rcx
lea    0xe07(%rip),%rdx
call   1090 <mvprintw@plt>
lea    -0x80(%rbp),%rdi
call   1050 <getstr@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
sub    $0x2,%edi
lea    -0x80(%rbp),%rcx
xor    %esi,%esi
lea    0xdd3(%rip),%rdx
call   1090 <mvprintw@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x90,%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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [17 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [17 x i8]* %6 to i8*
%11 = call i32 (...) @initscr()
%12 = load i32, i32* @stdscr
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call i32 @getmaxyx(i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %8
%17 = sdiv i32 %16, 2
%18 = load i32, i32* %9
%19 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %18, %20
%22 = sdiv i32 %21, 2
%23 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%24 = call i32 @mvprintw(i32 %17, i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%26 = call i32 @getstr(i8* %25)
%27 = load i32, i32* @LINES
%28 = sub nsw i32 %27, 2
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%30 = call i32 @mvprintw(i32 %28, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = call i32 (...) @getch()
%32 = 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(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [17 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = tail call i32 (...) @initscr()
%8 = load i32, i32* @stdscr
%9 = tail call i32 @getmaxyx(i32 %8, i32 undef, i32 undef)
%10 = call i32 @strlen(i8* %5)
%11 = call i32 @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%12 = call i32 @getstr(i8* %6)
%13 = load i32, i32* @LINES
%14 = add nsw i32 %13, -2
%15 = call i32 @mvprintw(i32 %14, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%16 = call i32 (...) @getch()
%17 = call i32 (...) @endwin()
ret i32 0
}