#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*/ TRUE;
int /*<<< orphan*/ endwin();
char getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(int, int, char *);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int main() {
  initscr();
  raw();
  keypad(stdscr, TRUE);
  noecho();
  while (1) {
    mvprintw(10, 10, "HAPPY HACKTOBERFEST!");
    char ch = getch();
    if (ch == 'q') {
      break;
    }
  }
  refresh();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1050 <raw@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
mov    $0x0,%al
call   1090 <noecho@plt>
mov    $0xa,%esi
lea    0xe39(%rip),%rdx
mov    %esi,%edi
call   10a0 <mvprintw@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    11ea <main+0x6a>
jmp    11ef <main+0x6f>
jmp    11bb <main+0x3b>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1050 <raw@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    0x2e41(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
xor    %eax,%eax
call   1090 <noecho@plt>
lea    0xe4c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   10a0 <mvprintw@plt>
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0x71,%al
jne    11c0 <main+0x40>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [21 x i8] c"HAPPY HACKTOBERFEST!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @initscr()
%4 = call i32 (...) @raw()
%5 = load i32, i32* @stdscr
%6 = load i32, i32* @TRUE
%7 = call i32 @keypad(i32 %5, i32 %6)
%8 = call i32 (...) @noecho()
br label %9
9: ; preds = %0, %16
%10 = call i32 @mvprintw(i32 10, i32 10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 (...) @getch()
store i8 %11, i8* %2
%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 = %9
br label %17
16: ; preds = %9
br label %9
17: ; preds = %15
%18 = call i32 (...) @refresh()
%19 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [21 x i8] c"HAPPY HACKTOBERFEST!\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @raw()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = tail call i32 @keypad(i32 %3, i32 %4)
%6 = tail call i32 (...) @noecho()
br label %7
7: ; preds = %7, %0
%8 = tail call i32 @mvprintw(i32 10, i32 10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = tail call signext i8 (...) @getch()
%10 = icmp eq i8 %9, 113
br i1 %10, label %11, label %7
11: ; preds = %7
%12 = tail call i32 (...) @refresh()
%13 = tail call i32 (...) @endwin()
ret i32 0
}