#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 askToReplay(char *);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ echo();
int /*<<< orphan*/ erase();
int /*<<< orphan*/ getnstr(char *, int);
int /*<<< orphan*/ nocbreak();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ timeout(int);
int enterYourName() {
  static char name[256];
  erase();
  printw("Enter your name :)\n");
  echo();
  nocbreak();
  timeout(-1);
  getnstr(name, 256);
  timeout(0);
  noecho();
  cbreak();
  return askToReplay(name);
}


x86 assembly (clang, -O0):
<enterYourName>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <erase@plt>
lea    0xe5e(%rip),%rdi
call   1090 <printw@plt>
mov    $0x0,%al
call   1030 <echo@plt>
mov    $0x0,%al
call   10a0 <nocbreak@plt>
mov    $0xffffffff,%edi
call   1070 <timeout@plt>
lea    0x2eba(%rip),%rdi
mov    $0x100,%esi
call   1040 <getnstr@plt>
xor    %edi,%edi
call   1070 <timeout@plt>
mov    $0x0,%al
call   10b0 <noecho@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
lea    0x2e94(%rip),%rdi
call   1080 <askToReplay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<enterYourName>:
push   %rbx
xor    %eax,%eax
call   1060 <erase@plt>
lea    0xe61(%rip),%rdi
call   1090 <printw@plt>
xor    %eax,%eax
call   1030 <echo@plt>
xor    %eax,%eax
call   10a0 <nocbreak@plt>
mov    $0xffffffff,%edi
call   1070 <timeout@plt>
lea    0x2ebd(%rip),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <getnstr@plt>
xor    %edi,%edi
call   1070 <timeout@plt>
xor    %eax,%eax
call   10b0 <noecho@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1080 <askToReplay@plt>

LLVM IR (-O0):
@enterYourName.name = internal global [256 x i8] zeroinitializer
@.str = [20 x i8] c"Enter your name :)\0A\00"
define i32 @enterYourName() {
%1 = call i32 (...) @erase()
%2 = call i32 @printw(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @echo()
%4 = call i32 (...) @nocbreak()
%5 = call i32 @timeout(i32 -1)
%6 = call i32 @getnstr(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @enterYourName.name, i64 0, i64 0), i32 256)
%7 = call i32 @timeout(i32 0)
%8 = call i32 (...) @noecho()
%9 = call i32 (...) @cbreak()
%10 = call i32 @askToReplay(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @enterYourName.name, i64 0, i64 0))
ret i32 %10
}

LLVM IR (-O2):
@enterYourName.name = internal global [256 x i8] zeroinitializer
@.str = [20 x i8] c"Enter your name :)\0A\00"
define i32 @enterYourName() {
%1 = tail call i32 (...) @erase()
%2 = tail call i32 @printw(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @echo()
%4 = tail call i32 (...) @nocbreak()
%5 = tail call i32 @timeout(i32 -1)
%6 = tail call i32 @getnstr(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @enterYourName.name, i64 0, i64 0), i32 256)
%7 = tail call i32 @timeout(i32 0)
%8 = tail call i32 (...) @noecho()
%9 = tail call i32 (...) @cbreak()
%10 = tail call i32 @askToReplay(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @enterYourName.name, i64 0, i64 0))
ret i32 %10
}