#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ getnstr(char *, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ printw(char *, char *, char *);
int /*<<< orphan*/ refresh();
int main(void) {
  char firstname[10];
  char lastname[10];
  initscr();
  addstr("Firstname: ");
  refresh();
  getnstr(firstname, 10 - 1);
  addstr("Lastname: ");
  refresh();
  getnstr(lastname, 10 - 1);
  printw("Hi, %s, %s\n", firstname, lastname);
  refresh();
  getch();
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
lea    0xe63(%rip),%rdi
call   10a0 <addstr@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
lea    -0xe(%rbp),%rdi
mov    $0x9,%esi
call   1030 <getnstr@plt>
lea    0xe4e(%rip),%rdi
call   10a0 <addstr@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
lea    -0x18(%rbp),%rdi
mov    $0x9,%esi
call   1030 <getnstr@plt>
lea    -0xe(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    0xe30(%rip),%rdi
call   1050 <printw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <initscr@plt>
lea    0xe6b(%rip),%rdi
call   10a0 <addstr@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
lea    0xe(%rsp),%r14
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <getnstr@plt>
lea    0xe52(%rip),%rdi
call   10a0 <addstr@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <getnstr@plt>
lea    0xe38(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <printw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Firstname: \00"
@.str.1 = [11 x i8] c"Lastname: \00"
@.str.2 = [12 x i8] c"Hi, %s, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = call i32 (...) @initscr()
%5 = call i32 @addstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @refresh()
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @getnstr(i8* %7, i32 9)
%9 = call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @refresh()
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = call i32 @getnstr(i8* %11, i32 9)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %14)
%16 = call i32 (...) @refresh()
%17 = call i32 (...) @getch()
%18 = call i32 (...) @endwin()
%19 = load i32, i32* @EXIT_SUCCESS
%20 = call i32 @exit(i32 %19)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"Firstname: \00"
@.str.1 = [11 x i8] c"Lastname: \00"
@.str.2 = [12 x i8] c"Hi, %s, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = tail call i32 @addstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @refresh()
%8 = call i32 @getnstr(i8* %3, i32 9)
%9 = call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @refresh()
%11 = call i32 @getnstr(i8* %4, i32 9)
%12 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* %4)
%13 = call i32 (...) @refresh()
%14 = call i32 (...) @getch()
%15 = call i32 (...) @endwin()
%16 = load i32, i32* @EXIT_SUCCESS
%17 = call i32 @exit(i32 %16)
unreachable
}