#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 */
char ACS_PI;
char A_BLINK;
char A_BOLD;
char A_DIM;
char A_REVERSE;
char A_UNDERLINE;
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_GREEN;
char COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLS;
int /*<<< orphan*/ LINES;
scalar_t__ TRUE;
int /*<<< orphan*/ attroff(char);
int /*<<< orphan*/ attron(char);
int /*<<< orphan*/ bkgd(char);
int /*<<< orphan*/ box(int /*<<< orphan*/, char, char);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvaddch(int, int, char);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ mvprintw(int, int, char *, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int main() {
  initscr();
  if (has_colors() == TRUE) {
    start_color();
    init_pair(1, COLOR_RED, COLOR_WHITE);
    init_pair(2, COLOR_BLUE, COLOR_GREEN);
    init_pair(3, COLOR_WHITE, COLOR_BLUE);
    bkgd(COLOR_PAIR(3));
  }
  box(stdscr, '|', '-');
  mvaddch(1, 10, 'A' | A_BOLD);
  mvaddch(3, 10, 'A' | A_BLINK | A_UNDERLINE | COLOR_PAIR(2));
  mvaddch(5, 10, 'A' | A_REVERSE | COLOR_PAIR(1));
  mvaddch(7, 10, 'A' | A_DIM);
  mvaddch(8, 10, ACS_PI);
  attron(COLOR_PAIR(1));
  mvaddstr(6, 20, "Hello 純!");
  attroff(COLOR_PAIR(1));
  attron(COLOR_PAIR(2) | A_BLINK);
  mvaddstr(10, 20, "塔尼!");
  attroff(COLOR_PAIR(2) | A_BLINK);
  mvprintw(9, 10, "line:%d,v:%d", LINES, COLS);
  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   1060 <initscr@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
mov    0x2dcc(%rip),%rcx
cmp    (%rcx),%rax
jne    127a <main+0x9a>
mov    $0x0,%al
call   1070 <start_color@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
mov    0x2d7c(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
mov    0x2d80(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%esi
mov    0x2d34(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    $0x3,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   10d0 <bkgd@plt>
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1090 <box@plt>
mov    0x2cef(%rip),%rax
movsbl (%rax),%eax
or     $0x41,%eax
mov    $0x1,%edi
mov    $0xa,%esi
movsbl %al,%edx
call   10e0 <mvaddch@plt>
mov    0x2d10(%rip),%rax
movsbl (%rax),%eax
or     $0x41,%eax
mov    0x2cb3(%rip),%rcx
movsbl (%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %al,%cl
mov    -0xc(%rbp),%eax
movsbl %cl,%ecx
or     %ecx,%eax
mov    $0x3,%edi
mov    $0xa,%esi
movsbl %al,%edx
call   10e0 <mvaddch@plt>
mov    0x2cae(%rip),%rax
movsbl (%rax),%eax
or     $0x41,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %al,%cl
mov    -0x8(%rbp),%eax
movsbl %cl,%ecx
or     %ecx,%eax
mov    $0x5,%edi
mov    $0xa,%esi
movsbl %al,%edx
call   10e0 <mvaddch@plt>
mov    0x2c68(%rip),%rax
movsbl (%rax),%eax
or     $0x41,%eax
mov    $0x7,%edi
mov    $0xa,%esi
movsbl %al,%edx
call   10e0 <mvaddch@plt>
mov    $0x8,%edi
mov    $0xa,%esi
mov    0x2c87(%rip),%rax
movsbl (%rax),%edx
call   10e0 <mvaddch@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   1080 <attron@plt>
mov    $0x6,%edi
mov    $0x14,%esi
lea    0xc7c(%rip),%rdx
call   10f0 <mvaddstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   1030 <attroff@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%eax
mov    0x2c19(%rip),%rcx
movsbl (%rcx),%ecx
or     %ecx,%eax
movsbl %al,%edi
call   1080 <attron@plt>
mov    $0xa,%edi
mov    $0x14,%esi
lea    0xc3e(%rip),%rdx
call   10f0 <mvaddstr@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%eax
mov    0x2be2(%rip),%rcx
movsbl (%rcx),%ecx
or     %ecx,%eax
movsbl %al,%edi
call   1030 <attroff@plt>
mov    0x2bee(%rip),%rax
mov    (%rax),%ecx
mov    0x2bb5(%rip),%rax
mov    (%rax),%r8d
mov    $0x9,%edi
mov    $0xa,%esi
lea    0xbfc(%rip),%rdx
call   1100 <mvprintw@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   1060 <initscr@plt>
xor    %eax,%eax
call   1040 <has_colors@plt>
mov    0x2dd7(%rip),%rcx
cmp    (%rcx),%rax
jne    125f <main+0x7f>
xor    %eax,%eax
call   1070 <start_color@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%esi
mov    0x2d8b(%rip),%r14
mov    (%r14),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d67(%rip),%rbx
mov    (%rbx),%esi
mov    0x2d8e(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    (%r14),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    $0x3,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   10d0 <bkgd@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1090 <box@plt>
mov    0x2d0a(%rip),%rax
movsbl (%rax),%edx
or     $0x41,%edx
mov    $0x1,%edi
mov    $0xa,%esi
call   10e0 <mvaddch@plt>
mov    0x2d2e(%rip),%r14
mov    (%r14),%bl
mov    0x2cd4(%rip),%rax
or     (%rax),%bl
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
or     %bl,%al
or     $0x41,%al
movsbl %al,%edx
mov    $0x3,%edi
mov    $0xa,%esi
call   10e0 <mvaddch@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%bl
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
or     %bl,%al
or     $0x41,%al
movsbl %al,%edx
mov    $0x5,%edi
mov    $0xa,%esi
call   10e0 <mvaddch@plt>
mov    0x2ca2(%rip),%rax
movsbl (%rax),%edx
or     $0x41,%edx
mov    $0x7,%edi
mov    $0xa,%esi
call   10e0 <mvaddch@plt>
mov    0x2cce(%rip),%rax
movsbl (%rax),%edx
mov    $0x8,%edi
mov    $0xa,%esi
call   10e0 <mvaddch@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   1080 <attron@plt>
lea    0xcc3(%rip),%rdx
mov    $0x6,%edi
mov    $0x14,%esi
call   10f0 <mvaddstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
movsbl %al,%edi
call   1030 <attroff@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
or     (%r14),%al
movsbl %al,%edi
call   1080 <attron@plt>
lea    0xc91(%rip),%rdx
mov    $0xa,%edi
mov    $0x14,%esi
call   10f0 <mvaddstr@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
or     (%r14),%al
movsbl %al,%edi
call   1030 <attroff@plt>
mov    0x2c43(%rip),%rax
mov    (%rax),%ecx
mov    0x2c0a(%rip),%rax
mov    (%rax),%r8d
lea    0xc5b(%rip),%rdx
mov    $0x9,%edi
mov    $0xa,%esi
call   1100 <mvprintw@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):
@TRUE = global i64 0
@COLOR_RED = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_GREEN = global i32 0
@stdscr = global i32 0
@A_BOLD = global i8 0
@A_BLINK = global i8 0
@A_UNDERLINE = global i8 0
@A_REVERSE = global i8 0
@A_DIM = global i8 0
@ACS_PI = global i8 0
@.str = [11 x i8] c"Hello \E7\B4\94!\00"
@.str.1 = [8 x i8] c"\E5\A1\94\E5\B0\BC!\00"
@.str.2 = [13 x i8] c"line:%d,v:%d\00"
@LINES = global i32 0
@COLS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i64 (...) @has_colors()
%4 = load i64, i64* @TRUE
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %19
6: ; preds = %0
%7 = call i32 (...) @start_color()
%8 = load i32, i32* @COLOR_RED
%9 = load i32, i32* @COLOR_WHITE
%10 = call i32 @init_pair(i32 1, i32 %8, i32 %9)
%11 = load i32, i32* @COLOR_BLUE
%12 = load i32, i32* @COLOR_GREEN
%13 = call i32 @init_pair(i32 2, i32 %11, i32 %12)
%14 = load i32, i32* @COLOR_WHITE
%15 = load i32, i32* @COLOR_BLUE
%16 = call i32 @init_pair(i32 3, i32 %14, i32 %15)
%17 = call signext i8 @COLOR_PAIR(i32 3)
%18 = call i32 @bkgd(i8 signext %17)
br label %19
19: ; preds = %6, %0
%20 = load i32, i32* @stdscr
%21 = call i32 @box(i32 %20, i8 signext 124, i8 signext 45)
%22 = load i8, i8* @A_BOLD
%23 = sext i8 %22 to i32
%24 = or i32 65, %23
%25 = trunc i32 %24 to i8
%26 = call i32 @mvaddch(i32 1, i32 10, i8 signext %25)
%27 = load i8, i8* @A_BLINK
%28 = sext i8 %27 to i32
%29 = or i32 65, %28
%30 = load i8, i8* @A_UNDERLINE
%31 = sext i8 %30 to i32
%32 = or i32 %29, %31
%33 = call signext i8 @COLOR_PAIR(i32 2)
%34 = sext i8 %33 to i32
%35 = or i32 %32, %34
%36 = trunc i32 %35 to i8
%37 = call i32 @mvaddch(i32 3, i32 10, i8 signext %36)
%38 = load i8, i8* @A_REVERSE
%39 = sext i8 %38 to i32
%40 = or i32 65, %39
%41 = call signext i8 @COLOR_PAIR(i32 1)
%42 = sext i8 %41 to i32
%43 = or i32 %40, %42
%44 = trunc i32 %43 to i8
%45 = call i32 @mvaddch(i32 5, i32 10, i8 signext %44)
%46 = load i8, i8* @A_DIM
%47 = sext i8 %46 to i32
%48 = or i32 65, %47
%49 = trunc i32 %48 to i8
%50 = call i32 @mvaddch(i32 7, i32 10, i8 signext %49)
%51 = load i8, i8* @ACS_PI
%52 = call i32 @mvaddch(i32 8, i32 10, i8 signext %51)
%53 = call signext i8 @COLOR_PAIR(i32 1)
%54 = call i32 @attron(i8 signext %53)
%55 = call i32 @mvaddstr(i32 6, i32 20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%56 = call signext i8 @COLOR_PAIR(i32 1)
%57 = call i32 @attroff(i8 signext %56)
%58 = call signext i8 @COLOR_PAIR(i32 2)
%59 = sext i8 %58 to i32
%60 = load i8, i8* @A_BLINK
%61 = sext i8 %60 to i32
%62 = or i32 %59, %61
%63 = trunc i32 %62 to i8
%64 = call i32 @attron(i8 signext %63)
%65 = call i32 @mvaddstr(i32 10, i32 20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%66 = call signext i8 @COLOR_PAIR(i32 2)
%67 = sext i8 %66 to i32
%68 = load i8, i8* @A_BLINK
%69 = sext i8 %68 to i32
%70 = or i32 %67, %69
%71 = trunc i32 %70 to i8
%72 = call i32 @attroff(i8 signext %71)
%73 = load i32, i32* @LINES
%74 = load i32, i32* @COLS
%75 = call i32 @mvprintw(i32 9, i32 10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %73, i32 %74)
%76 = call i32 (...) @getch()
%77 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@TRUE = global i64 0
@COLOR_RED = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_GREEN = global i32 0
@stdscr = global i32 0
@A_BOLD = global i8 0
@A_BLINK = global i8 0
@A_UNDERLINE = global i8 0
@A_REVERSE = global i8 0
@A_DIM = global i8 0
@ACS_PI = global i8 0
@.str = [11 x i8] c"Hello \E7\B4\94!\00"
@.str.1 = [8 x i8] c"\E5\A1\94\E5\B0\BC!\00"
@.str.2 = [13 x i8] c"line:%d,v:%d\00"
@LINES = global i32 0
@COLS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i64 (...) @has_colors()
%3 = load i64, i64* @TRUE
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %18
5: ; preds = %0
%6 = tail call i32 (...) @start_color()
%7 = load i32, i32* @COLOR_RED
%8 = load i32, i32* @COLOR_WHITE
%9 = tail call i32 @init_pair(i32 1, i32 %7, i32 %8)
%10 = load i32, i32* @COLOR_BLUE
%11 = load i32, i32* @COLOR_GREEN
%12 = tail call i32 @init_pair(i32 2, i32 %10, i32 %11)
%13 = load i32, i32* @COLOR_WHITE
%14 = load i32, i32* @COLOR_BLUE
%15 = tail call i32 @init_pair(i32 3, i32 %13, i32 %14)
%16 = tail call signext i8 @COLOR_PAIR(i32 3)
%17 = tail call i32 @bkgd(i8 signext %16)
br label %18
18: ; preds = %5, %0
%19 = load i32, i32* @stdscr
%20 = tail call i32 @box(i32 %19, i8 signext 124, i8 signext 45)
%21 = load i8, i8* @A_BOLD
%22 = or i8 %21, 65
%23 = tail call i32 @mvaddch(i32 1, i32 10, i8 signext %22)
%24 = load i8, i8* @A_BLINK
%25 = load i8, i8* @A_UNDERLINE
%26 = tail call signext i8 @COLOR_PAIR(i32 2)
%27 = or i8 %24, %25
%28 = or i8 %27, %26
%29 = or i8 %28, 65
%30 = tail call i32 @mvaddch(i32 3, i32 10, i8 signext %29)
%31 = load i8, i8* @A_REVERSE
%32 = tail call signext i8 @COLOR_PAIR(i32 1)
%33 = or i8 %31, %32
%34 = or i8 %33, 65
%35 = tail call i32 @mvaddch(i32 5, i32 10, i8 signext %34)
%36 = load i8, i8* @A_DIM
%37 = or i8 %36, 65
%38 = tail call i32 @mvaddch(i32 7, i32 10, i8 signext %37)
%39 = load i8, i8* @ACS_PI
%40 = tail call i32 @mvaddch(i32 8, i32 10, i8 signext %39)
%41 = tail call signext i8 @COLOR_PAIR(i32 1)
%42 = tail call i32 @attron(i8 signext %41)
%43 = tail call i32 @mvaddstr(i32 6, i32 20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%44 = tail call signext i8 @COLOR_PAIR(i32 1)
%45 = tail call i32 @attroff(i8 signext %44)
%46 = tail call signext i8 @COLOR_PAIR(i32 2)
%47 = load i8, i8* @A_BLINK
%48 = or i8 %47, %46
%49 = tail call i32 @attron(i8 signext %48)
%50 = tail call i32 @mvaddstr(i32 10, i32 20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%51 = tail call signext i8 @COLOR_PAIR(i32 2)
%52 = load i8, i8* @A_BLINK
%53 = or i8 %52, %51
%54 = tail call i32 @attroff(i8 signext %53)
%55 = load i32, i32* @LINES
%56 = load i32, i32* @COLS
%57 = tail call i32 @mvprintw(i32 9, i32 10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %55, i32 %56)
%58 = tail call i32 (...) @getch()
%59 = tail call i32 (...) @endwin()
ret i32 0
}