#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*/ FALSE;
int /*<<< orphan*/ TRUE;
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*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ nonl();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scrollok(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ use_default_colors();
int gui_init() {
  static int init = 0;
  if (!init) {
    init = 1;
    initscr();
    noecho();
    cbreak();
    raw();
    scrollok(stdscr, TRUE);
    nonl();
    intrflush(stdscr, FALSE);
    keypad(stdscr, TRUE);
    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);
    }
  }
  refresh();
  return 0;
}


x86 assembly (clang, -O0):
<gui_init>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2eb1(%rip)
jne    1467 <gui_init+0x297>
movl   $0x1,0x2ea1(%rip)
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x0,%al
call   10f0 <noecho@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    $0x0,%al
call   1090 <raw@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
call   10e0 <scrollok@plt>
mov    $0x0,%al
call   10c0 <nonl@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    0x2d63(%rip),%rax
mov    (%rax),%esi
call   10a0 <intrflush@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
mov    0x2d94(%rip),%rax
mov    (%rax),%esi
call   1070 <keypad@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
cmp    $0x0,%rax
je     1462 <gui_init+0x292>
mov    $0x0,%al
call   10b0 <start_color@plt>
mov    $0x0,%al
call   1030 <use_default_colors@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2ced(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2cae(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2ccf(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2c5b(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2c2c(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2bf5(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2bc2(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2bb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2be3(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2bd7(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2ba0(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2b75(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2b69(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
add    $0x9,%edi
mov    0x2b52(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
jmp    1467 <gui_init+0x297>
mov    $0x0,%al
call   10d0 <refresh@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,0x2eaa(%rip)
jne    13a6 <gui_init+0x1d6>
movb   $0x1,0x2e9d(%rip)
xor    %eax,%eax
call   1080 <initscr@plt>
xor    %eax,%eax
call   10f0 <noecho@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
xor    %eax,%eax
call   1090 <raw@plt>
mov    0x2dd6(%rip),%rbx
mov    (%rbx),%edi
mov    0x2dc5(%rip),%rbp
mov    0x0(%rbp),%esi
call   10e0 <scrollok@plt>
xor    %eax,%eax
call   10c0 <nonl@plt>
mov    (%rbx),%edi
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
call   10a0 <intrflush@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%esi
call   1070 <keypad@plt>
xor    %eax,%eax
call   1040 <has_colors@plt>
test   %rax,%rax
je     13a6 <gui_init+0x1d6>
xor    %eax,%eax
call   10b0 <start_color@plt>
xor    %eax,%eax
call   1030 <use_default_colors@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2d1b(%rip),%r12
mov    (%r12),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2ce3(%rip),%r13
mov    0x0(%r13),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2d0b(%rip),%rbx
mov    (%rbx),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cdd(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cae(%rip),%r14
mov    (%r14),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2c9f(%rip),%r15
mov    (%r15),%esi
lea    0x1(%rsi),%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x2c92(%rip),%rax
mov    (%rax),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    (%r12),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x0(%r13),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    (%rbx),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    0x0(%rbp),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    (%r14),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
mov    (%r15),%edx
lea    0x9(%rdx),%edi
mov    $0xffffffff,%esi
call   1060 <init_pair@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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