#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();
char getch();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ getstr(char *);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvprintw(int, int, char *, ...);
int /*<<< orphan*/ stdscr;
int strlen(char *);
int main() {
  char mesg[] = "Enter a string: ";
  char str[80];
  int maxrow, maxcol, row, col;
  initscr();
  getmaxyx(stdscr, maxrow, maxcol);
  col = maxcol;
  row = maxrow;
  do {
    mvprintw(row / 2, (col - strlen(mesg)) / 2, "%s", mesg);
    getstr(str);
    mvprintw(0, 0, "You Entered: %s", str);
    mvprintw(2, 0, "Do you wish to continue? (y or n)");
  } while (getch() != 'n');
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe72(%rip),%al
mov    %al,-0x10(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x74(%rbp),%esi
mov    -0x78(%rbp),%edx
call   1060 <getmaxyx@plt>
mov    -0x78(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x84(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x88(%rbp),%edi
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    -0x20(%rbp),%rcx
lea    0xe0e(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
lea    -0x70(%rbp),%rdi
call   1050 <getstr@plt>
lea    -0x70(%rbp),%rcx
xor    %esi,%esi
lea    0xde4(%rip),%rdx
mov    %esi,%edi
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0x2,%edi
xor    %esi,%esi
lea    0xddd(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0x0,%al
call   1070 <getch@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
jne    11c8 <main+0x58>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1060 <getmaxyx@plt>
mov    %rsp,%r15
lea    0xe72(%rip),%r14
lea    0x20(%rsp),%rbx
lea    0xe59(%rip),%r12
lea    0xe62(%rip),%r13
nop
mov    %r15,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    %rbx,%rdi
call   1050 <getstr@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0x6e,%al
jne    11c0 <main+0x50>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.mesg = [17 x i8] c"Enter a string: \00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"You Entered: %s\00"
@.str.2 = [34 x i8] c"Do you wish to continue? (y or n)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca [80 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [17 x i8]* %2 to i8*
%9 = call i32 (...) @initscr()
%10 = load i32, i32* @stdscr
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @getmaxyx(i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %5
store i32 %14, i32* %7
%15 = load i32, i32* %4
store i32 %15, i32* %6
br label %16
16: ; preds = %31, %0
%17 = load i32, i32* %6
%18 = sdiv i32 %17, 2
%19 = load i32, i32* %7
%20 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %19, %21
%23 = sdiv i32 %22, 2
%24 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%25 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %18, i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%27 = call i32 @getstr(i8* %26)
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%29 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 2, i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %16
%32 = call signext i8 (...) @getch()
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 110
br i1 %34, label %16, label %35
35: ; preds = %31
%36 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@__const.main.mesg = [17 x i8] c"Enter a string: \00"
@stdscr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"You Entered: %s\00"
@.str.2 = [34 x i8] c"Do you wish to continue? (y or n)\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = load i32, i32* @stdscr
%7 = tail call i32 @getmaxyx(i32 %6, i32 undef, i32 undef)
br label %8
8: ; preds = %8, %0
%9 = call i32 @strlen(i8* %3)
%10 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = call i32 @getstr(i8* %4)
%12 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 2, i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%14 = call signext i8 (...) @getch()
%15 = icmp eq i8 %14, 110
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = call i32 (...) @endwin()
ret i32 0
}