#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*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ printw(char *, ...);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scanw(char *, char *);
int main(void) {
  char firstname[20];
  char lastname[20];
  initscr();
  printw("Firstname: ");
  scanw("%s", firstname);
  printw("Lastname: ");
  scanw("%s", 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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
lea    -0x20(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1090 <scanw@plt>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
lea    -0x40(%rbp),%rsi
lea    0xe4f(%rip),%rdi
call   1090 <scanw@plt>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    $0x0,%al
call   1070 <endwin@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
xor    %eax,%eax
call   1030 <initscr@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printw@plt>
lea    0xe77(%rip),%r15
lea    0x20(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1090 <scanw@plt>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1040 <printw@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <scanw@plt>
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
call   1070 <endwin@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

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

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