#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 /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvaddstr(int, int, char *);
int mvgetnstr(int, int, char *, int);
int /*<<< orphan*/ mvprintw(int, int, char *, char *);
int /*<<< orphan*/ refresh();
int main() {
  char name[9];
  int r;
  initscr();
  mvaddstr(4, 10, "user : [        ]");
  r = mvgetnstr(4, 18, name, 8);
  mvprintw(7, 10, "-->%s", name);
  refresh();
  getch();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
mov    $0x4,%edi
mov    $0xa,%esi
lea    0xe69(%rip),%rdx
call   1070 <mvaddstr@plt>
lea    -0xd(%rbp),%rdx
mov    $0x4,%edi
mov    $0x12,%esi
mov    $0x8,%ecx
call   1090 <mvgetnstr@plt>
mov    %eax,-0x14(%rbp)
lea    -0xd(%rbp),%rcx
mov    $0x7,%edi
mov    $0xa,%esi
lea    0xe46(%rip),%rdx
call   1080 <mvprintw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <initscr@plt>
lea    0xe7d(%rip),%rdx
mov    $0x4,%edi
mov    $0xa,%esi
call   1070 <mvaddstr@plt>
lea    0x7(%rsp),%rbx
mov    $0x4,%edi
mov    $0x12,%esi
mov    %rbx,%rdx
mov    $0x8,%ecx
call   1090 <mvgetnstr@plt>
lea    0xe5d(%rip),%rdx
mov    $0x7,%edi
mov    $0xa,%esi
mov    %rbx,%rcx
call   1080 <mvprintw@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"user : [ ]\00"
@.str.1 = [6 x i8] c"-->%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @initscr()
%5 = call i32 @mvaddstr(i32 4, i32 10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%7 = call i32 @mvgetnstr(i32 4, i32 18, i8* %6, i32 8)
store i32 %7, i32* %3
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%9 = call i32 @mvprintw(i32 7, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 (...) @refresh()
%11 = call i32 (...) @getch()
%12 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"user : [ ]\00"
@.str.1 = [6 x i8] c"-->%s\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 @mvaddstr(i32 4, i32 10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @mvgetnstr(i32 4, i32 18, i8* %2, i32 8)
%6 = call i32 @mvprintw(i32 7, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = call i32 (...) @refresh()
%8 = call i32 (...) @getch()
%9 = call i32 (...) @endwin()
ret i32 0
}