#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 */
scalar_t__ has_colors();
int /*<<< orphan*/ load_color_theme(scalar_t__, int);
scalar_t__ options_get_str(char *);
int /*<<< orphan*/ reset_colors_table();
int /*<<< orphan*/ set_bw_colors();
int /*<<< orphan*/ set_default_colors();
void theme_init(const int has_xterm) {
  reset_colors_table();
  if (has_colors()) {
    if (options_get_str("ForceTheme"))
      load_color_theme(options_get_str("ForceTheme"), 1);
    else if (has_xterm && options_get_str("XTermTheme"))
      load_color_theme(options_get_str("XTermTheme"), 1);
    else if (options_get_str("Theme"))
      load_color_theme(options_get_str("Theme"), 1);
    set_default_colors();
  } else
    set_bw_colors();
}


x86 assembly (clang, -O0):
<theme_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1070 <reset_colors_table@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
cmp    $0x0,%rax
je     123a <theme_init+0xda>
lea    0xe76(%rip),%rdi
call   1080 <options_get_str@plt>
cmp    $0x0,%rax
je     11b7 <theme_init+0x57>
lea    0xe60(%rip),%rdi
call   1080 <options_get_str@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1060 <load_color_theme@plt>
jmp    122e <theme_init+0xce>
cmpl   $0x0,-0x4(%rbp)
je     11f5 <theme_init+0x95>
lea    0xe43(%rip),%rdi
call   1080 <options_get_str@plt>
cmp    $0x0,%rax
je     11f5 <theme_init+0x95>
lea    0xe2d(%rip),%rdi
call   1080 <options_get_str@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1060 <load_color_theme@plt>
jmp    1229 <theme_init+0xc9>
lea    0xe09(%rip),%rdi
call   1080 <options_get_str@plt>
cmp    $0x0,%rax
je     1224 <theme_init+0xc4>
lea    0xdf3(%rip),%rdi
call   1080 <options_get_str@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1060 <load_color_theme@plt>
jmp    1229 <theme_init+0xc9>
jmp    122e <theme_init+0xce>
mov    $0x0,%al
call   1030 <set_default_colors@plt>
jmp    1241 <theme_init+0xe1>
mov    $0x0,%al
call   1050 <set_bw_colors@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<theme_init>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1070 <reset_colors_table@plt>
xor    %eax,%eax
call   1040 <has_colors@plt>
test   %rax,%rax
je     11ae <theme_init+0x4e>
lea    0xe81(%rip),%rbx
mov    %rbx,%rdi
call   1080 <options_get_str@plt>
test   %rax,%rax
je     11bb <theme_init+0x5b>
mov    %rbx,%rdi
call   1080 <options_get_str@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1060 <load_color_theme@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <set_default_colors@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <set_bw_colors@plt>
test   %ebp,%ebp
je     11d3 <theme_init+0x73>
lea    0xe45(%rip),%rbx
mov    %rbx,%rdi
call   1080 <options_get_str@plt>
test   %rax,%rax
jne    118c <theme_init+0x2c>
lea    0xe2b(%rip),%rbx
mov    %rbx,%rdi
call   1080 <options_get_str@plt>
test   %rax,%rax
jne    118c <theme_init+0x2c>
jmp    11a1 <theme_init+0x41>

LLVM IR (-O0):
@.str = [11 x i8] c"ForceTheme\00"
@.str.1 = [11 x i8] c"XTermTheme\00"
@.str.2 = [6 x i8] c"Theme\00"
define void @theme_init(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @reset_colors_table()
%4 = call i64 (...) @has_colors()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %31
6: ; preds = %1
%7 = call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @load_color_theme(i64 %10, i32 1)
br label %29
12: ; preds = %6
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @load_color_theme(i64 %19, i32 1)
br label %28
21: ; preds = %15, %12
%22 = call i64 @options_get_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = call i64 @options_get_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @load_color_theme(i64 %25, i32 1)
br label %27
27: ; preds = %24, %21
br label %28
28: ; preds = %27, %18
br label %29
29: ; preds = %28, %9
%30 = call i32 (...) @set_default_colors()
br label %33
31: ; preds = %1
%32 = call i32 (...) @set_bw_colors()
br label %33
33: ; preds = %31, %29
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"ForceTheme\00"
@.str.1 = [11 x i8] c"XTermTheme\00"
@.str.2 = [6 x i8] c"Theme\00"
define void @theme_init(i32 %0) {
%2 = tail call i32 (...) @reset_colors_table()
%3 = tail call i64 (...) @has_colors()
%4 = icmp eq i64 %3, 0
br i1 %4, label %22, label %5
5: ; preds = %1
%6 = tail call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = icmp eq i32 %0, 0
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = tail call i64 @options_get_str(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10, %8
%14 = tail call i64 @options_get_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13, %10, %5
%17 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %13 ]
%18 = tail call i64 @options_get_str(i8* %17)
%19 = tail call i32 @load_color_theme(i64 %18, i32 1)
br label %20
20: ; preds = %16, %13
%21 = tail call i32 (...) @set_default_colors()
br label %24
22: ; preds = %1
%23 = tail call i32 (...) @set_bw_colors()
br label %24
24: ; preds = %22, %20
ret void
}