#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*/ A_BOLD;
int KEY_F(int);
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printw(char *, ...);
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int main() {
  int ch;
  initscr();
  raw();
  noecho();
  keypad(stdscr, TRUE);
  printw("Type any character to see it nice 'n' thick...\n");
  ch = getch();
  if (ch == KEY_F(2))
    printw("F2 Key was pressed, dawg.");
  else {
    printw("You pressed: ");
    attron(A_BOLD);
    printw("%c", ch);
    attroff(A_BOLD);
  }
  refresh();
  getch();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1060 <raw@plt>
mov    $0x0,%al
call   10d0 <noecho@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
mov    0x2dfc(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1090 <printw@plt>
mov    $0x0,%al
call   10b0 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x2,%edi
call   1070 <KEY_F@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jne    1233 <main+0x83>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1090 <printw@plt>
jmp    126e <main+0xbe>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1090 <printw@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
call   1080 <attron@plt>
mov    -0x8(%rbp),%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1090 <printw@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   10a0 <refresh@plt>
mov    $0x0,%al
call   10b0 <getch@plt>
mov    $0x0,%al
call   10c0 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1060 <raw@plt>
xor    %eax,%eax
call   10d0 <noecho@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
lea    0xe19(%rip),%rdi
xor    %eax,%eax
call   1090 <printw@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1070 <KEY_F@plt>
cmp    %eax,%ebx
jne    1215 <main+0x65>
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1090 <printw@plt>
jmp    124a <main+0x9a>
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1090 <printw@plt>
mov    0x2da6(%rip),%r14
mov    (%r14),%edi
call   1080 <attron@plt>
lea    0xe1f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1090 <printw@plt>
mov    (%r14),%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   10a0 <refresh@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
xor    %eax,%eax
call   10c0 <endwin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [48 x i8] c"Type any character to see it nice 'n' thick...\0A\00"
@.str.1 = [26 x i8] c"F2 Key was pressed, dawg.\00"
@.str.2 = [14 x i8] c"You pressed: \00"
@A_BOLD = global i32 0
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @initscr()
%4 = call i32 (...) @raw()
%5 = call i32 (...) @noecho()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = call i32 @keypad(i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @getch()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @KEY_F(i32 2)
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %24
16: ; preds = %0
%17 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @A_BOLD
%19 = call i32 @attron(i32 %18)
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* @A_BOLD
%23 = call i32 @attroff(i32 %22)
br label %24
24: ; preds = %16, %14
%25 = call i32 (...) @refresh()
%26 = call i32 (...) @getch()
%27 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [48 x i8] c"Type any character to see it nice 'n' thick...\0A\00"
@.str.1 = [26 x i8] c"F2 Key was pressed, dawg.\00"
@.str.2 = [14 x i8] c"You pressed: \00"
@A_BOLD = global i32 0
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @raw()
%3 = tail call i32 (...) @noecho()
%4 = load i32, i32* @stdscr
%5 = load i32, i32* @TRUE
%6 = tail call i32 @keypad(i32 %4, i32 %5)
%7 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @getch()
%9 = tail call i32 @KEY_F(i32 2)
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %20
13: ; preds = %0
%14 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @A_BOLD
%16 = tail call i32 @attron(i32 %15)
%17 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%18 = load i32, i32* @A_BOLD
%19 = tail call i32 @attroff(i32 %18)
br label %20
20: ; preds = %13, %11
%21 = tail call i32 (...) @refresh()
%22 = tail call i32 (...) @getch()
%23 = tail call i32 (...) @endwin()
ret i32 0
}