#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*/ initscr();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printw(char *, ...);
int /*<<< orphan*/ refresh();
int main() {
  initscr();
  char test = '1';
  printw("Enter Character: ");
  while (1) {
    noecho();
    test = getch();
    printw("-%c-\n", test);
    refresh();
    if (test == 'q')
      return 0;
  }
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
movb   $0x31,-0x5(%rbp)
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    11b7 <main+0x67>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1178 <main+0x28>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <initscr@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1040 <printw@plt>
lea    0xea3(%rip),%rbx
nop
xor    %eax,%eax
call   1070 <noecho@plt>
xor    %eax,%eax
call   1060 <getch@plt>
movsbl %al,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
cmp    $0x71,%bpl
jne    1170 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter Character: \00"
@.str.1 = [6 x i8] c"-%c-\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @initscr()
store i8 49, i8* %2
%4 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %16
%6 = call i32 (...) @noecho()
%7 = call signext i8 (...) @getch()
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @refresh()
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 113
br i1 %14, label %15, label %16
15: ; preds = %5
ret i32 0
16: ; preds = %5
br label %5
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter Character: \00"
@.str.1 = [6 x i8] c"-%c-\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = tail call i32 (...) @noecho()
%5 = tail call signext i8 (...) @getch()
%6 = sext i8 %5 to i32
%7 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @refresh()
%9 = icmp eq i8 %5, 113
br i1 %9, label %10, label %3
10: ; preds = %3
ret i32 0
}