#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 */
typedef int /*<<< orphan*/ MEVENT;

/* Variables and functions */
int /*<<< orphan*/ ALL_MOUSE_EVENTS;
int /*<<< orphan*/ A_ALTCHARSET;
int /*<<< orphan*/ A_BLINK;
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ A_CHARTEXT;
int /*<<< orphan*/ A_DIM;
int /*<<< orphan*/ A_INVIS;
int /*<<< orphan*/ A_NORMAL;
int /*<<< orphan*/ A_PROTECT;
int /*<<< orphan*/ A_STANDOUT;
int /*<<< orphan*/ A_UNDERLINE;
int /*<<< orphan*/ COLOR_CYAN;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
int KEY_F(int);
int KEY_MOUSE;
scalar_t__ OK;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ attrset(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int getch();
scalar_t__ getmouse(int /*<<< orphan*/ *);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mousemask(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ mvprintw(int, int, char *);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int main() {
  MEVENT event;
  initscr();
  start_color();
  raw();
  keypad(stdscr, TRUE);
  noecho();
  attrset(A_NORMAL);
  printw("A_NORMAL\n");
  attrset(A_STANDOUT);
  printw("A_STANDOUT\n");
  attrset(A_UNDERLINE);
  printw("A_UNDERLINE\n");
  attrset(A_BLINK);
  printw("A_BLINK\n");
  attrset(A_DIM);
  printw("A_DIM\n");
  attrset(A_BOLD);
  printw("A_BOLD\n");
  attrset(A_PROTECT);
  printw("A_PROTECT\n");
  attrset(A_INVIS);
  printw("A_INVIS\n");
  attrset(A_ALTCHARSET);
  printw("A_ALTCHARSET\n");
  attrset(A_CHARTEXT);
  printw("A_CHARTEXT\n");
  init_pair(1, COLOR_CYAN, COLOR_RED);
  attrset(COLOR_PAIR(1));
  printw("COLOR_PAIR\n");
  mousemask(ALL_MOUSE_EVENTS, NULL);
  attrset(A_NORMAL);
  mvprintw(23, 1, "Press F10 to end");
  refresh();
  int ch;
  while ((ch = getch()) != KEY_F(10)) {
    if (ch == KEY_MOUSE)
      if (getmouse(&event) == OK)
        break;
  }
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <initscr@plt>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    $0x0,%al
call   1070 <raw@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
mov    0x2d7c(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1110 <noecho@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xda9(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd99(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2ce3(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd8b(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd7e(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd6d(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd5a(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd48(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd39(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd28(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd1c(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2c5b(%rip),%rax
mov    (%rax),%esi
mov    0x2c12(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    $0x1,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1100 <attrset@plt>
lea    0xcef(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <mousemask@plt>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
mov    $0x17,%edi
mov    $0x1,%esi
lea    0xcc5(%rip),%rdx
call   1120 <mvprintw@plt>
mov    $0x0,%al
call   10d0 <refresh@plt>
mov    $0x0,%al
call   10e0 <getch@plt>
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
mov    $0xa,%edi
call   1090 <KEY_F@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
je     141a <main+0x21a>
mov    -0xc(%rbp),%eax
mov    0x2bd6(%rip),%rcx
cmp    (%rcx),%eax
jne    1415 <main+0x215>
lea    -0x8(%rbp),%rdi
call   10a0 <getmouse@plt>
mov    0x2b76(%rip),%rcx
cmp    (%rcx),%rax
jne    1410 <main+0x210>
jmp    141a <main+0x21a>
jmp    1415 <main+0x215>
jmp    13bc <main+0x1bc>
mov    $0x0,%al
call   10f0 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <initscr@plt>
xor    %eax,%eax
call   1080 <start_color@plt>
xor    %eax,%eax
call   1070 <raw@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1110 <noecho@plt>
mov    0x2da7(%rip),%rbx
mov    (%rbx),%edi
call   1100 <attrset@plt>
lea    0xdb1(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xda1(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd93(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd86(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd75(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd62(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd50(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd41(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd30(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
call   1100 <attrset@plt>
lea    0xd24(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2c63(%rip),%rax
mov    (%rax),%esi
mov    0x2c1a(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    $0x1,%edi
call   10c0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1100 <attrset@plt>
lea    0xcf7(%rip),%rdi
call   10b0 <printw@plt>
mov    0x2c5a(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <mousemask@plt>
mov    (%rbx),%edi
call   1100 <attrset@plt>
lea    0xce0(%rip),%rdx
mov    $0x17,%edi
mov    $0x1,%esi
call   1120 <mvprintw@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
xor    %eax,%eax
call   10e0 <getch@plt>
mov    %eax,%ebp
mov    $0xa,%edi
call   1090 <KEY_F@plt>
cmp    %eax,%ebp
je     1408 <main+0x208>
mov    0x2bf7(%rip),%rbx
lea    0x4(%rsp),%r14
mov    0x2ba3(%rip),%r15
jmp    13f7 <main+0x1f7>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <getch@plt>
mov    %eax,%ebp
mov    $0xa,%edi
call   1090 <KEY_F@plt>
cmp    %eax,%ebp
je     1408 <main+0x208>
cmp    (%rbx),%ebp
jne    13e0 <main+0x1e0>
mov    %r14,%rdi
call   10a0 <getmouse@plt>
cmp    (%r15),%rax
jne    13e0 <main+0x1e0>
xor    %eax,%eax
call   10f0 <endwin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@A_NORMAL = global i32 0
@.str = [10 x i8] c"A_NORMAL\0A\00"
@A_STANDOUT = global i32 0
@.str.1 = [12 x i8] c"A_STANDOUT\0A\00"
@A_UNDERLINE = global i32 0
@.str.2 = [13 x i8] c"A_UNDERLINE\0A\00"
@A_BLINK = global i32 0
@.str.3 = [9 x i8] c"A_BLINK\0A\00"
@A_DIM = global i32 0
@.str.4 = [7 x i8] c"A_DIM\0A\00"
@A_BOLD = global i32 0
@.str.5 = [8 x i8] c"A_BOLD\0A\00"
@A_PROTECT = global i32 0
@.str.6 = [11 x i8] c"A_PROTECT\0A\00"
@A_INVIS = global i32 0
@.str.7 = [9 x i8] c"A_INVIS\0A\00"
@A_ALTCHARSET = global i32 0
@.str.8 = [14 x i8] c"A_ALTCHARSET\0A\00"
@A_CHARTEXT = global i32 0
@.str.9 = [12 x i8] c"A_CHARTEXT\0A\00"
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
@.str.10 = [12 x i8] c"COLOR_PAIR\0A\00"
@ALL_MOUSE_EVENTS = global i32 0
@.str.11 = [17 x i8] c"Press F10 to end\00"
@KEY_MOUSE = global i32 0
@OK = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @initscr()
%5 = call i32 (...) @start_color()
%6 = call i32 (...) @raw()
%7 = load i32, i32* @stdscr
%8 = load i32, i32* @TRUE
%9 = call i32 @keypad(i32 %7, i32 %8)
%10 = call i32 (...) @noecho()
%11 = load i32, i32* @A_NORMAL
%12 = call i32 @attrset(i32 %11)
%13 = call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @A_STANDOUT
%15 = call i32 @attrset(i32 %14)
%16 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @A_UNDERLINE
%18 = call i32 @attrset(i32 %17)
%19 = call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @A_BLINK
%21 = call i32 @attrset(i32 %20)
%22 = call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @A_DIM
%24 = call i32 @attrset(i32 %23)
%25 = call i32 @printw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%26 = load i32, i32* @A_BOLD
%27 = call i32 @attrset(i32 %26)
%28 = call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%29 = load i32, i32* @A_PROTECT
%30 = call i32 @attrset(i32 %29)
%31 = call i32 @printw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* @A_INVIS
%33 = call i32 @attrset(i32 %32)
%34 = call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%35 = load i32, i32* @A_ALTCHARSET
%36 = call i32 @attrset(i32 %35)
%37 = call i32 @printw(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%38 = load i32, i32* @A_CHARTEXT
%39 = call i32 @attrset(i32 %38)
%40 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%41 = load i32, i32* @COLOR_CYAN
%42 = load i32, i32* @COLOR_RED
%43 = call i32 @init_pair(i32 1, i32 %41, i32 %42)
%44 = call i32 @COLOR_PAIR(i32 1)
%45 = call i32 @attrset(i32 %44)
%46 = call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%47 = load i32, i32* @ALL_MOUSE_EVENTS
%48 = call i32 @mousemask(i32 %47, i32* null)
%49 = load i32, i32* @A_NORMAL
%50 = call i32 @attrset(i32 %49)
%51 = call i32 @mvprintw(i32 23, i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%52 = call i32 (...) @refresh()
br label %53
53: ; preds = %67, %0
%54 = call i32 (...) @getch()
store i32 %54, i32* %3
%55 = call i32 @KEY_F(i32 10)
%56 = icmp ne i32 %54, %55
br i1 %56, label %57, label %68
57: ; preds = %53
%58 = load i32, i32* %3
%59 = load i32, i32* @KEY_MOUSE
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %67
61: ; preds = %57
%62 = call i64 @getmouse(i32* %2)
%63 = load i64, i64* @OK
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %66
65: ; preds = %61
br label %68
66: ; preds = %61
br label %67
67: ; preds = %66, %57
br label %53
68: ; preds = %65, %53
%69 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@A_NORMAL = global i32 0
@.str = [10 x i8] c"A_NORMAL\0A\00"
@A_STANDOUT = global i32 0
@.str.1 = [12 x i8] c"A_STANDOUT\0A\00"
@A_UNDERLINE = global i32 0
@.str.2 = [13 x i8] c"A_UNDERLINE\0A\00"
@A_BLINK = global i32 0
@.str.3 = [9 x i8] c"A_BLINK\0A\00"
@A_DIM = global i32 0
@.str.4 = [7 x i8] c"A_DIM\0A\00"
@A_BOLD = global i32 0
@.str.5 = [8 x i8] c"A_BOLD\0A\00"
@A_PROTECT = global i32 0
@.str.6 = [11 x i8] c"A_PROTECT\0A\00"
@A_INVIS = global i32 0
@.str.7 = [9 x i8] c"A_INVIS\0A\00"
@A_ALTCHARSET = global i32 0
@.str.8 = [14 x i8] c"A_ALTCHARSET\0A\00"
@A_CHARTEXT = global i32 0
@.str.9 = [12 x i8] c"A_CHARTEXT\0A\00"
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
@.str.10 = [12 x i8] c"COLOR_PAIR\0A\00"
@ALL_MOUSE_EVENTS = global i32 0
@.str.11 = [17 x i8] c"Press F10 to end\00"
@KEY_MOUSE = global i32 0
@OK = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 (...) @start_color()
%5 = tail call i32 (...) @raw()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = tail call i32 @keypad(i32 %6, i32 %7)
%9 = tail call i32 (...) @noecho()
%10 = load i32, i32* @A_NORMAL
%11 = tail call i32 @attrset(i32 %10)
%12 = tail call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @A_STANDOUT
%14 = tail call i32 @attrset(i32 %13)
%15 = tail call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @A_UNDERLINE
%17 = tail call i32 @attrset(i32 %16)
%18 = tail call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @A_BLINK
%20 = tail call i32 @attrset(i32 %19)
%21 = tail call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @A_DIM
%23 = tail call i32 @attrset(i32 %22)
%24 = tail call i32 @printw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%25 = load i32, i32* @A_BOLD
%26 = tail call i32 @attrset(i32 %25)
%27 = tail call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* @A_PROTECT
%29 = tail call i32 @attrset(i32 %28)
%30 = tail call i32 @printw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%31 = load i32, i32* @A_INVIS
%32 = tail call i32 @attrset(i32 %31)
%33 = tail call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%34 = load i32, i32* @A_ALTCHARSET
%35 = tail call i32 @attrset(i32 %34)
%36 = tail call i32 @printw(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%37 = load i32, i32* @A_CHARTEXT
%38 = tail call i32 @attrset(i32 %37)
%39 = tail call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%40 = load i32, i32* @COLOR_CYAN
%41 = load i32, i32* @COLOR_RED
%42 = tail call i32 @init_pair(i32 1, i32 %40, i32 %41)
%43 = tail call i32 @COLOR_PAIR(i32 1)
%44 = tail call i32 @attrset(i32 %43)
%45 = tail call i32 @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%46 = load i32, i32* @ALL_MOUSE_EVENTS
%47 = tail call i32 @mousemask(i32 %46, i32* null)
%48 = load i32, i32* @A_NORMAL
%49 = tail call i32 @attrset(i32 %48)
%50 = tail call i32 @mvprintw(i32 23, i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%51 = tail call i32 (...) @refresh()
%52 = call i32 (...) @getch()
%53 = call i32 @KEY_F(i32 10)
%54 = icmp eq i32 %52, %53
br i1 %54, label %67, label %55
55: ; preds = %0, %63
%56 = phi i32 [ %64, %63 ], [ %52, %0 ]
%57 = load i32, i32* @KEY_MOUSE
%58 = icmp eq i32 %56, %57
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = call i64 @getmouse(i32* %1)
%61 = load i64, i64* @OK
%62 = icmp eq i64 %60, %61
br i1 %62, label %67, label %63
63: ; preds = %59, %55
%64 = call i32 (...) @getch()
%65 = call i32 @KEY_F(i32 10)
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %55
67: ; preds = %63, %59, %0
%68 = call i32 (...) @endwin()
ret i32 0
}