#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 COLORS;
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 ERR;
int /*<<< orphan*/ assume_default_colors(int, int);
int /*<<< orphan*/ init_pair(int, int, int);
int start_color();
int init_pairs() {
  int c = start_color();
  assume_default_colors(-1, -1);
  if (c == ERR)
    return 1;
  init_pair(1, COLOR_GREEN, -1);
  init_pair(2, COLOR_CYAN, -1);
  init_pair(3, COLOR_BLUE, -1);
  init_pair(4, COLOR_YELLOW, -1);
  init_pair(5, COLOR_MAGENTA, -1);
  init_pair(6, COLOR_RED, -1);
  init_pair(7, (COLORS >= 256) ? 231 : COLOR_WHITE, -1);
  init_pair(8, (COLORS >= 256) ? 238 : COLOR_BLUE, -1);
  init_pair(9, (COLORS >= 256) ? 243 : COLOR_BLACK, -1);
  init_pair(10, (COLORS >= 256) ? 248 : 7, -1);
  return 0;
}


x86 assembly (clang, -O0):
<init_pairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <start_color@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1030 <assume_default_colors@plt>
mov    -0x8(%rbp),%eax
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%eax
jne    116c <init_pairs+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    12e8 <init_pairs+0x1b8>
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%esi
mov    $0x3,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2db5(%rip),%rax
cmpl   $0x100,(%rax)
jl     121c <init_pairs+0xec>
mov    $0xe7,%eax
mov    %eax,-0xc(%rbp)
jmp    1228 <init_pairs+0xf8>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x7,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2d77(%rip),%rax
cmpl   $0x100,(%rax)
jl     125a <init_pairs+0x12a>
mov    $0xee,%eax
mov    %eax,-0x10(%rbp)
jmp    1266 <init_pairs+0x136>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    $0x8,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2d39(%rip),%rax
cmpl   $0x100,(%rax)
jl     1298 <init_pairs+0x168>
mov    $0xf3,%eax
mov    %eax,-0x14(%rbp)
jmp    12a4 <init_pairs+0x174>
mov    0x2d41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x9,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%ecx
mov    $0x7,%esi
mov    $0xf8,%eax
cmp    $0x100,%ecx
cmovge %eax,%esi
mov    $0xa,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pairs>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <start_color@plt>
mov    %eax,%ebx
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1030 <assume_default_colors@plt>
mov    0x2e94(%rip),%rcx
mov    $0x1,%eax
cmp    (%rcx),%ebx
je     128c <init_pairs+0x15c>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2e08(%rip),%r14
mov    (%r14),%esi
mov    $0x3,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
mov    0x2dbf(%rip),%r15
cmpl   $0x100,(%r15)
mov    $0xe7,%esi
jge    1210 <init_pairs+0xe0>
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%ebx
mov    $0x7,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
cmpl   $0x100,(%r15)
mov    $0xee,%esi
jge    1235 <init_pairs+0x105>
mov    (%r14),%esi
mov    $0x8,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
cmpl   $0x100,(%r15)
mov    $0xf3,%esi
jge    125b <init_pairs+0x12b>
mov    0x2d87(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
cmpl   $0x100,(%r15)
mov    $0xf8,%eax
cmovge %eax,%ebx
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0xffffffff,%edx
call   1040 <init_pair@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@ERR = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_RED = global i32 0
@COLORS = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_BLACK = global i32 0
define i32 @init_pairs() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @start_color()
store i32 %3, i32* %2
%4 = call i32 @assume_default_colors(i32 -1, i32 -1)
%5 = load i32, i32* %2
%6 = load i32, i32* @ERR
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %51
9: ; preds = %0
%10 = load i32, i32* @COLOR_GREEN
%11 = call i32 @init_pair(i32 1, i32 %10, i32 -1)
%12 = load i32, i32* @COLOR_CYAN
%13 = call i32 @init_pair(i32 2, i32 %12, i32 -1)
%14 = load i32, i32* @COLOR_BLUE
%15 = call i32 @init_pair(i32 3, i32 %14, i32 -1)
%16 = load i32, i32* @COLOR_YELLOW
%17 = call i32 @init_pair(i32 4, i32 %16, i32 -1)
%18 = load i32, i32* @COLOR_MAGENTA
%19 = call i32 @init_pair(i32 5, i32 %18, i32 -1)
%20 = load i32, i32* @COLOR_RED
%21 = call i32 @init_pair(i32 6, i32 %20, i32 -1)
%22 = load i32, i32* @COLORS
%23 = icmp sge i32 %22, 256
br i1 %23, label %24, label %25
24: ; preds = %9
br label %27
25: ; preds = %9
%26 = load i32, i32* @COLOR_WHITE
br label %27
27: ; preds = %25, %24
%28 = phi i32 [ 231, %24 ], [ %26, %25 ]
%29 = call i32 @init_pair(i32 7, i32 %28, i32 -1)
%30 = load i32, i32* @COLORS
%31 = icmp sge i32 %30, 256
br i1 %31, label %32, label %33
32: ; preds = %27
br label %35
33: ; preds = %27
%34 = load i32, i32* @COLOR_BLUE
br label %35
35: ; preds = %33, %32
%36 = phi i32 [ 238, %32 ], [ %34, %33 ]
%37 = call i32 @init_pair(i32 8, i32 %36, i32 -1)
%38 = load i32, i32* @COLORS
%39 = icmp sge i32 %38, 256
br i1 %39, label %40, label %41
40: ; preds = %35
br label %43
41: ; preds = %35
%42 = load i32, i32* @COLOR_BLACK
br label %43
43: ; preds = %41, %40
%44 = phi i32 [ 243, %40 ], [ %42, %41 ]
%45 = call i32 @init_pair(i32 9, i32 %44, i32 -1)
%46 = load i32, i32* @COLORS
%47 = icmp sge i32 %46, 256
%48 = zext i1 %47 to i64
%49 = select i1 %47, i32 248, i32 7
%50 = call i32 @init_pair(i32 10, i32 %49, i32 -1)
store i32 0, i32* %1
br label %51
51: ; preds = %43, %8
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@ERR = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_RED = global i32 0
@COLORS = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_BLACK = global i32 0
define i32 @init_pairs() {
%1 = tail call i32 (...) @start_color()
%2 = tail call i32 @assume_default_colors(i32 -1, i32 -1)
%3 = load i32, i32* @ERR
%4 = icmp eq i32 %1, %3
br i1 %4, label %37, label %5
5: ; preds = %0
%6 = load i32, i32* @COLOR_GREEN
%7 = tail call i32 @init_pair(i32 1, i32 %6, i32 -1)
%8 = load i32, i32* @COLOR_CYAN
%9 = tail call i32 @init_pair(i32 2, i32 %8, i32 -1)
%10 = load i32, i32* @COLOR_BLUE
%11 = tail call i32 @init_pair(i32 3, i32 %10, i32 -1)
%12 = load i32, i32* @COLOR_YELLOW
%13 = tail call i32 @init_pair(i32 4, i32 %12, i32 -1)
%14 = load i32, i32* @COLOR_MAGENTA
%15 = tail call i32 @init_pair(i32 5, i32 %14, i32 -1)
%16 = load i32, i32* @COLOR_RED
%17 = tail call i32 @init_pair(i32 6, i32 %16, i32 -1)
%18 = load i32, i32* @COLORS
%19 = icmp sgt i32 %18, 255
%20 = load i32, i32* @COLOR_WHITE
%21 = select i1 %19, i32 231, i32 %20
%22 = tail call i32 @init_pair(i32 7, i32 %21, i32 -1)
%23 = load i32, i32* @COLORS
%24 = icmp sgt i32 %23, 255
%25 = load i32, i32* @COLOR_BLUE
%26 = select i1 %24, i32 238, i32 %25
%27 = tail call i32 @init_pair(i32 8, i32 %26, i32 -1)
%28 = load i32, i32* @COLORS
%29 = icmp sgt i32 %28, 255
%30 = load i32, i32* @COLOR_BLACK
%31 = select i1 %29, i32 243, i32 %30
%32 = tail call i32 @init_pair(i32 9, i32 %31, i32 -1)
%33 = load i32, i32* @COLORS
%34 = icmp sgt i32 %33, 255
%35 = select i1 %34, i32 248, i32 7
%36 = tail call i32 @init_pair(i32 10, i32 %35, i32 -1)
br label %37
37: ; preds = %0, %5
%38 = phi i32 [ 0, %5 ], [ 1, %0 ]
ret i32 %38
}