#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 /*<<< orphan*/ set_blackbg_theme();
int /*<<< orphan*/ set_bluetitle_theme();
int /*<<< orphan*/ set_classic_theme();
scalar_t__ strcmp(char const *, char *);
int set_theme(const char *theme) {
  int use_color = 1;
  if (!theme)
    set_bluetitle_theme();
  else if (strcmp(theme, "classic") == 0)
    set_classic_theme();
  else if (strcmp(theme, "bluetitle") == 0)
    set_bluetitle_theme();
  else if (strcmp(theme, "blackbg") == 0)
    set_blackbg_theme();
  else if (strcmp(theme, "mono") == 0)
    use_color = 0;
  return use_color;
}


x86 assembly (clang, -O0):
<set_theme>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116a <set_theme+0x2a>
mov    $0x0,%al
call   1050 <set_bluetitle_theme@plt>
jmp    1211 <set_theme+0xd1>
mov    -0x8(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1190 <set_theme+0x50>
mov    $0x0,%al
call   1060 <set_classic_theme@plt>
jmp    120c <set_theme+0xcc>
mov    -0x8(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <set_theme+0x76>
mov    $0x0,%al
call   1050 <set_bluetitle_theme@plt>
jmp    1207 <set_theme+0xc7>
mov    -0x8(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11dc <set_theme+0x9c>
mov    $0x0,%al
call   1040 <set_blackbg_theme@plt>
jmp    1202 <set_theme+0xc2>
mov    -0x8(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11fd <set_theme+0xbd>
movl   $0x0,-0xc(%rbp)
jmp    1202 <set_theme+0xc2>
jmp    1207 <set_theme+0xc7>
jmp    120c <set_theme+0xcc>
jmp    1211 <set_theme+0xd1>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_theme>:
push   %rbx
test   %rdi,%rdi
je     119e <set_theme+0x5e>
mov    %rdi,%rbx
lea    0xeb0(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a7 <set_theme+0x67>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119e <set_theme+0x5e>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b0 <set_theme+0x70>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
call   1050 <set_bluetitle_theme@plt>
jmp    11b7 <set_theme+0x77>
xor    %eax,%eax
call   1060 <set_classic_theme@plt>
jmp    11b7 <set_theme+0x77>
xor    %eax,%eax
call   1040 <set_blackbg_theme@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"classic\00"
@.str.1 = [10 x i8] c"bluetitle\00"
@.str.2 = [8 x i8] c"blackbg\00"
@.str.3 = [5 x i8] c"mono\00"
define i32 @set_theme(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (...) @set_bluetitle_theme()
br label %35
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (...) @set_classic_theme()
br label %34
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (...) @set_bluetitle_theme()
br label %33
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @set_blackbg_theme()
br label %32
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 0, i32* %3
br label %31
31: ; preds = %30, %26
br label %32
32: ; preds = %31, %24
br label %33
33: ; preds = %32, %18
br label %34
34: ; preds = %33, %12
br label %35
35: ; preds = %34, %6
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [8 x i8] c"classic\00"
@.str.1 = [10 x i8] c"bluetitle\00"
@.str.2 = [8 x i8] c"blackbg\00"
@.str.3 = [5 x i8] c"mono\00"
define i32 @set_theme(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @set_bluetitle_theme()
br label %24
5: ; preds = %1
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (...) @set_classic_theme()
br label %24
10: ; preds = %5
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (...) @set_bluetitle_theme()
br label %24
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 (...) @set_blackbg_theme()
br label %24
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %20, %8, %18, %13, %3
%25 = phi i32 [ 1, %8 ], [ 1, %13 ], [ 1, %18 ], [ 1, %3 ], [ %23, %20 ]
ret i32 %25
}