#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 COLOR_BLACK;
int COLOR_BLUE;
int COLOR_CYAN;
int COLOR_GREEN;
int COLOR_MAGENTA;
int COLOR_RED;
int COLOR_WHITE;
int COLOR_YELLOW;
int /*<<< orphan*/ cbreak();
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ intrflush(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ nonl();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scrollok(int /*<<< orphan*/, int);
int /*<<< orphan*/ set_escdelay(int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ use_default_colors();
void nc_init() {
  static int init = 0;
  if (!init) {
    init = 1;
    initscr();
    noecho();
    cbreak();
    raw();
    scrollok(stdscr, 1);
    nonl();
    intrflush(stdscr, 0);
    set_escdelay(0);
    if (has_colors()) {
      start_color();
      use_default_colors();
      init_pair(1 + COLOR_BLACK, COLOR_BLACK, -1);
      init_pair(1 + COLOR_GREEN, COLOR_GREEN, -1);
      init_pair(1 + COLOR_WHITE, COLOR_WHITE, -1);
      init_pair(1 + COLOR_RED, COLOR_RED, -1);
      init_pair(1 + COLOR_CYAN, COLOR_CYAN, -1);
      init_pair(1 + COLOR_MAGENTA, COLOR_MAGENTA, -1);
      init_pair(1 + COLOR_BLUE, COLOR_BLUE, -1);
      init_pair(1 + COLOR_YELLOW, COLOR_YELLOW, -1);
      init_pair(9 + COLOR_BLACK, -1, COLOR_BLACK);
      init_pair(9 + COLOR_GREEN, -1, COLOR_GREEN);
      init_pair(9 + COLOR_WHITE, -1, COLOR_WHITE);
      init_pair(9 + COLOR_RED, -1, COLOR_RED);
      init_pair(9 + COLOR_CYAN, -1, COLOR_CYAN);
      init_pair(9 + COLOR_MAGENTA, -1, COLOR_MAGENTA);
      init_pair(9 + COLOR_BLUE, -1, COLOR_BLUE);
      init_pair(9 + COLOR_YELLOW, -1, COLOR_YELLOW);
    }
  } else {
    refresh();
  }
}


x86 assembly (clang, -O0):
<nc_init>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2eb1(%rip)
jne    144c <nc_init+0x27c>
movl   $0x1,0x2ea1(%rip)
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x0,%al
call   10f0 <noecho@plt>
mov    $0x0,%al
call   1060 <cbreak@plt>
mov    $0x0,%al
call   1090 <raw@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   10e0 <scrollok@plt>
mov    $0x0,%al
call   10c0 <nonl@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   10a0 <intrflush@plt>
xor    %edi,%edi
call   1030 <set_escdelay@plt>
mov    $0x0,%al
call   1050 <has_colors@plt>
cmp    $0x0,%rax
je     1447 <nc_init+0x277>
mov    $0x0,%al
call   10b0 <start_color@plt>
mov    $0x0,%al
call   1040 <use_default_colors@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d47(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2cc7(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2cbb(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2c90(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c84(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c6d(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2c7e(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2c4f(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2c24(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2c18(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2be1(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2c06(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2bfa(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2bcf(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2bc3(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2b8c(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2b81(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2b75(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
jmp    1453 <nc_init+0x283>
mov    $0x0,%al
call   10d0 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,0x2eaa(%rip)
je     11f9 <nc_init+0x29>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <refresh@plt>
movb   $0x1,0x2e8c(%rip)
xor    %eax,%eax
call   1080 <initscr@plt>
xor    %eax,%eax
call   10f0 <noecho@plt>
xor    %eax,%eax
call   1060 <cbreak@plt>
xor    %eax,%eax
call   1090 <raw@plt>
mov    0x2dc5(%rip),%rbx
mov    (%rbx),%edi
mov    $0x1,%esi
call   10e0 <scrollok@plt>
xor    %eax,%eax
call   10c0 <nonl@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   10a0 <intrflush@plt>
xor    %edi,%edi
call   1030 <set_escdelay@plt>
xor    %eax,%eax
call   1050 <has_colors@plt>
test   %rax,%rax
je     13b6 <nc_init+0x1e6>
xor    %eax,%eax
call   10b0 <start_color@plt>
xor    %eax,%eax
call   1040 <use_default_colors@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2d21(%rip),%r12
mov    (%r12),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2cf1(%rip),%r13
mov    0x0(%r13),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2d11(%rip),%rbx
mov    (%rbx),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2ce3(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2cb4(%rip),%r14
mov    (%r14),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2ca5(%rip),%r15
mov    (%r15),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1070 <init_pair@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    (%r12),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x0(%r13),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    (%rbx),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    0x0(%rbp),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    (%r14),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1070 <init_pair@plt>
mov    (%r15),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <init_pair@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@nc_init.init = internal global i32 0
@stdscr = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_RED = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
define void @nc_init() {
%1 = load i32, i32* @nc_init.init
%2 = icmp ne i32 %1, 0
br i1 %2, label %84, label %3
3: ; preds = %0
store i32 1, i32* @nc_init.init
%4 = call i32 (...) @initscr()
%5 = call i32 (...) @noecho()
%6 = call i32 (...) @cbreak()
%7 = call i32 (...) @raw()
%8 = load i32, i32* @stdscr
%9 = call i32 @scrollok(i32 %8, i32 1)
%10 = call i32 (...) @nonl()
%11 = load i32, i32* @stdscr
%12 = call i32 @intrflush(i32 %11, i32 0)
%13 = call i32 @set_escdelay(i32 0)
%14 = call i64 (...) @has_colors()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %83
16: ; preds = %3
%17 = call i32 (...) @start_color()
%18 = call i32 (...) @use_default_colors()
%19 = load i32, i32* @COLOR_BLACK
%20 = add nsw i32 1, %19
%21 = load i32, i32* @COLOR_BLACK
%22 = call i32 @init_pair(i32 %20, i32 %21, i32 -1)
%23 = load i32, i32* @COLOR_GREEN
%24 = add nsw i32 1, %23
%25 = load i32, i32* @COLOR_GREEN
%26 = call i32 @init_pair(i32 %24, i32 %25, i32 -1)
%27 = load i32, i32* @COLOR_WHITE
%28 = add nsw i32 1, %27
%29 = load i32, i32* @COLOR_WHITE
%30 = call i32 @init_pair(i32 %28, i32 %29, i32 -1)
%31 = load i32, i32* @COLOR_RED
%32 = add nsw i32 1, %31
%33 = load i32, i32* @COLOR_RED
%34 = call i32 @init_pair(i32 %32, i32 %33, i32 -1)
%35 = load i32, i32* @COLOR_CYAN
%36 = add nsw i32 1, %35
%37 = load i32, i32* @COLOR_CYAN
%38 = call i32 @init_pair(i32 %36, i32 %37, i32 -1)
%39 = load i32, i32* @COLOR_MAGENTA
%40 = add nsw i32 1, %39
%41 = load i32, i32* @COLOR_MAGENTA
%42 = call i32 @init_pair(i32 %40, i32 %41, i32 -1)
%43 = load i32, i32* @COLOR_BLUE
%44 = add nsw i32 1, %43
%45 = load i32, i32* @COLOR_BLUE
%46 = call i32 @init_pair(i32 %44, i32 %45, i32 -1)
%47 = load i32, i32* @COLOR_YELLOW
%48 = add nsw i32 1, %47
%49 = load i32, i32* @COLOR_YELLOW
%50 = call i32 @init_pair(i32 %48, i32 %49, i32 -1)
%51 = load i32, i32* @COLOR_BLACK
%52 = add nsw i32 9, %51
%53 = load i32, i32* @COLOR_BLACK
%54 = call i32 @init_pair(i32 %52, i32 -1, i32 %53)
%55 = load i32, i32* @COLOR_GREEN
%56 = add nsw i32 9, %55
%57 = load i32, i32* @COLOR_GREEN
%58 = call i32 @init_pair(i32 %56, i32 -1, i32 %57)
%59 = load i32, i32* @COLOR_WHITE
%60 = add nsw i32 9, %59
%61 = load i32, i32* @COLOR_WHITE
%62 = call i32 @init_pair(i32 %60, i32 -1, i32 %61)
%63 = load i32, i32* @COLOR_RED
%64 = add nsw i32 9, %63
%65 = load i32, i32* @COLOR_RED
%66 = call i32 @init_pair(i32 %64, i32 -1, i32 %65)
%67 = load i32, i32* @COLOR_CYAN
%68 = add nsw i32 9, %67
%69 = load i32, i32* @COLOR_CYAN
%70 = call i32 @init_pair(i32 %68, i32 -1, i32 %69)
%71 = load i32, i32* @COLOR_MAGENTA
%72 = add nsw i32 9, %71
%73 = load i32, i32* @COLOR_MAGENTA
%74 = call i32 @init_pair(i32 %72, i32 -1, i32 %73)
%75 = load i32, i32* @COLOR_BLUE
%76 = add nsw i32 9, %75
%77 = load i32, i32* @COLOR_BLUE
%78 = call i32 @init_pair(i32 %76, i32 -1, i32 %77)
%79 = load i32, i32* @COLOR_YELLOW
%80 = add nsw i32 9, %79
%81 = load i32, i32* @COLOR_YELLOW
%82 = call i32 @init_pair(i32 %80, i32 -1, i32 %81)
br label %83
83: ; preds = %16, %3
br label %86
84: ; preds = %0
%85 = call i32 (...) @refresh()
br label %86
86: ; preds = %84, %83
ret void
}

LLVM IR (-O2):
@nc_init.init = internal unnamed_addr global i1 false
@stdscr = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_RED = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
define void @nc_init() {
%1 = load i1, i1* @nc_init.init
br i1 %1, label %66, label %2
2: ; preds = %0
store i1 true, i1* @nc_init.init
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 (...) @noecho()
%5 = tail call i32 (...) @cbreak()
%6 = tail call i32 (...) @raw()
%7 = load i32, i32* @stdscr
%8 = tail call i32 @scrollok(i32 %7, i32 1)
%9 = tail call i32 (...) @nonl()
%10 = load i32, i32* @stdscr
%11 = tail call i32 @intrflush(i32 %10, i32 0)
%12 = tail call i32 @set_escdelay(i32 0)
%13 = tail call i64 (...) @has_colors()
%14 = icmp eq i64 %13, 0
br i1 %14, label %68, label %15
15: ; preds = %2
%16 = tail call i32 (...) @start_color()
%17 = tail call i32 (...) @use_default_colors()
%18 = load i32, i32* @COLOR_BLACK
%19 = add nsw i32 %18, 1
%20 = tail call i32 @init_pair(i32 %19, i32 %18, i32 -1)
%21 = load i32, i32* @COLOR_GREEN
%22 = add nsw i32 %21, 1
%23 = tail call i32 @init_pair(i32 %22, i32 %21, i32 -1)
%24 = load i32, i32* @COLOR_WHITE
%25 = add nsw i32 %24, 1
%26 = tail call i32 @init_pair(i32 %25, i32 %24, i32 -1)
%27 = load i32, i32* @COLOR_RED
%28 = add nsw i32 %27, 1
%29 = tail call i32 @init_pair(i32 %28, i32 %27, i32 -1)
%30 = load i32, i32* @COLOR_CYAN
%31 = add nsw i32 %30, 1
%32 = tail call i32 @init_pair(i32 %31, i32 %30, i32 -1)
%33 = load i32, i32* @COLOR_MAGENTA
%34 = add nsw i32 %33, 1
%35 = tail call i32 @init_pair(i32 %34, i32 %33, i32 -1)
%36 = load i32, i32* @COLOR_BLUE
%37 = add nsw i32 %36, 1
%38 = tail call i32 @init_pair(i32 %37, i32 %36, i32 -1)
%39 = load i32, i32* @COLOR_YELLOW
%40 = add nsw i32 %39, 1
%41 = tail call i32 @init_pair(i32 %40, i32 %39, i32 -1)
%42 = load i32, i32* @COLOR_BLACK
%43 = add nsw i32 %42, 9
%44 = tail call i32 @init_pair(i32 %43, i32 -1, i32 %42)
%45 = load i32, i32* @COLOR_GREEN
%46 = add nsw i32 %45, 9
%47 = tail call i32 @init_pair(i32 %46, i32 -1, i32 %45)
%48 = load i32, i32* @COLOR_WHITE
%49 = add nsw i32 %48, 9
%50 = tail call i32 @init_pair(i32 %49, i32 -1, i32 %48)
%51 = load i32, i32* @COLOR_RED
%52 = add nsw i32 %51, 9
%53 = tail call i32 @init_pair(i32 %52, i32 -1, i32 %51)
%54 = load i32, i32* @COLOR_CYAN
%55 = add nsw i32 %54, 9
%56 = tail call i32 @init_pair(i32 %55, i32 -1, i32 %54)
%57 = load i32, i32* @COLOR_MAGENTA
%58 = add nsw i32 %57, 9
%59 = tail call i32 @init_pair(i32 %58, i32 -1, i32 %57)
%60 = load i32, i32* @COLOR_BLUE
%61 = add nsw i32 %60, 9
%62 = tail call i32 @init_pair(i32 %61, i32 -1, i32 %60)
%63 = load i32, i32* @COLOR_YELLOW
%64 = add nsw i32 %63, 9
%65 = tail call i32 @init_pair(i32 %64, i32 -1, i32 %63)
br label %68
66: ; preds = %0
%67 = tail call i32 (...) @refresh()
br label %68
68: ; preds = %2, %15, %66
ret void
}