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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
lea    0xe63(%rip),%rdi
call   10a0 <addstr@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
lea    -0x30(%rbp),%rdi
call   1040 <getstr@plt>
lea    0xe53(%rip),%rdi
call   10a0 <addstr@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
lea    -0x50(%rbp),%rdi
call   1040 <getstr@plt>
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe3a(%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    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
xor    %eax,%eax
call   1030 <initscr@plt>
lea    0xe6b(%rip),%rdi
call   10a0 <addstr@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1040 <getstr@plt>
lea    0xe57(%rip),%rdi
call   10a0 <addstr@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <getstr@plt>
lea    0xe44(%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    0x2de6(%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 [30 x i8]
%3 = alloca [30 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 [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = call i32 @getstr(i8* %7)
%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 [30 x i8], [30 x i8]* %3, i64 0, i64 0
%12 = call i32 @getstr(i8* %11)
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [30 x i8], [30 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 [30 x i8]
%2 = alloca [30 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [30 x i8], [30 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 @getstr(i8* %3)
%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 @getstr(i8* %4)
%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
}