#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 */
char *colstr(char style, char color) {
  bool thick;
  if (style == 'b')
    thick = true;
  else if (style == 'n')
    thick = false;
  else
    return "";
  switch (color) {
  case 'e':
    if (thick)
      return "\e[30m";
    else
      return "\e[30;1m";
    break;
  case 'c':
    if (thick)
      return "\e[36;1m";
    else
      return "\e[36m";
    break;
  case 'r':
    if (thick)
      return "\e[31;1m";
    else
      return "\e[31m";
    break;
  case 'g':
    if (thick)
      return "\e[32;1m";
    else
      return "\e[32m";
    break;
  case 'y':
    if (thick)
      return "\e[33;1m";
    else
      return "\e[33m";
    break;
  case 'b':
    if (thick)
      return "\e[34;1m";
    else
      return "\e[34m";
    break;
  case 'm':
    if (thick)
      return "\e[35;1m";
    else
      return "\e[35m";
    break;
  case 'w':
    if (thick)
      return "\e[37;1m";
    else
      return "\e[37m";
    break;
  default:
    return "\e[0m";
    break;
  }
}


x86 assembly (clang, -O0):
<colstr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x62,%eax
jne    1129 <colstr+0x29>
movl   $0x1,-0x10(%rbp)
jmp    1157 <colstr+0x57>
movsbl -0x9(%rbp),%eax
cmp    $0x6e,%eax
jne    1142 <colstr+0x42>
movl   $0x0,-0x10(%rbp)
jmp    1152 <colstr+0x52>
lea    0xf1c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
jmp    1157 <colstr+0x57>
movsbl -0xa(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     12d1 <colstr+0x1d1>
mov    -0x18(%rbp),%rax
lea    0xe88(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x10(%rbp)
je     119b <colstr+0x9b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     11c5 <colstr+0xc5>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xeaa(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     11ef <colstr+0xef>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe8e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     1219 <colstr+0x119>
lea    0xe7a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe72(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     1243 <colstr+0x143>
lea    0xe5e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe56(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     126d <colstr+0x16d>
lea    0xe42(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe3a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     1297 <colstr+0x197>
lea    0xe26(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
cmpl   $0x0,-0x10(%rbp)
je     12c1 <colstr+0x1c1>
lea    0xe0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xe02(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12dc <colstr+0x1dc>
lea    0xdf8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<colstr>:
cmp    $0x6e,%dil
je     110c <colstr+0xc>
cmp    $0x62,%dil
jne    114a <colstr+0x4a>
movsbl %sil,%ecx
lea    0xfb9(%rip),%rax
add    $0xffffff9e,%ecx
cmp    $0x17,%ecx
ja     11e0 <colstr+0xe0>
lea    0xed6(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
cmp    $0x62,%dil
lea    0xf68(%rip),%rcx
lea    0xf69(%rip),%rax
jmp    11dc <colstr+0xdc>
lea    0xf14(%rip),%rax
ret
cmp    $0x62,%dil
lea    0xf11(%rip),%rcx
lea    0xf12(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xeef(%rip),%rcx
lea    0xeee(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xf05(%rip),%rcx
lea    0xf06(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xf1b(%rip),%rcx
lea    0xf1c(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xecf(%rip),%rcx
lea    0xed0(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xf01(%rip),%rcx
lea    0xf02(%rip),%rax
jmp    11dc <colstr+0xdc>
cmp    $0x62,%dil
lea    0xec3(%rip),%rcx
lea    0xec4(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"\1B[30m\00"
@.str.2 = [8 x i8] c"\1B[30;1m\00"
@.str.3 = [8 x i8] c"\1B[36;1m\00"
@.str.4 = [6 x i8] c"\1B[36m\00"
@.str.5 = [8 x i8] c"\1B[31;1m\00"
@.str.6 = [6 x i8] c"\1B[31m\00"
@.str.7 = [8 x i8] c"\1B[32;1m\00"
@.str.8 = [6 x i8] c"\1B[32m\00"
@.str.9 = [8 x i8] c"\1B[33;1m\00"
@.str.10 = [6 x i8] c"\1B[33m\00"
@.str.11 = [8 x i8] c"\1B[34;1m\00"
@.str.12 = [6 x i8] c"\1B[34m\00"
@.str.13 = [8 x i8] c"\1B[35;1m\00"
@.str.14 = [6 x i8] c"\1B[35m\00"
@.str.15 = [8 x i8] c"\1B[37;1m\00"
@.str.16 = [6 x i8] c"\1B[37m\00"
@.str.17 = [5 x i8] c"\1B[0m\00"
define i8* @colstr(i8 signext %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 98
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %6
br label %18
11: ; preds = %2
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 110
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %6
br label %17
16: ; preds = %11
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %62
17: ; preds = %15
br label %18
18: ; preds = %17, %10
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
switch i32 %20, label %61 [
i32 101, label %21
i32 99, label %26
i32 114, label %31
i32 103, label %36
i32 121, label %41
i32 98, label %46
i32 109, label %51
i32 119, label %56
]
21: ; preds = %18
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %62
25: ; preds = %21
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %62
26: ; preds = %18
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %62
30: ; preds = %26
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %62
31: ; preds = %18
%32 = load i32, i32* %6
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %62
35: ; preds = %31
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %62
36: ; preds = %18
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %36
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %62
40: ; preds = %36
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %62
41: ; preds = %18
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %3
br label %62
45: ; preds = %41
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8** %3
br label %62
46: ; preds = %18
%47 = load i32, i32* %6
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %46
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8** %3
br label %62
50: ; preds = %46
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8** %3
br label %62
51: ; preds = %18
%52 = load i32, i32* %6
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %51
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %3
br label %62
55: ; preds = %51
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8** %3
br label %62
56: ; preds = %18
%57 = load i32, i32* %6
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %56
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8** %3
br label %62
60: ; preds = %56
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8** %3
br label %62
61: ; preds = %18
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i8** %3
br label %62
62: ; preds = %61, %60, %59, %55, %54, %50, %49, %45, %44, %40, %39, %35, %34, %30, %29, %25, %24, %16
%63 = load i8*, i8** %3
ret i8* %63
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"\1B[30m\00"
@.str.2 = [8 x i8] c"\1B[30;1m\00"
@.str.3 = [8 x i8] c"\1B[36;1m\00"
@.str.4 = [6 x i8] c"\1B[36m\00"
@.str.5 = [8 x i8] c"\1B[31;1m\00"
@.str.6 = [6 x i8] c"\1B[31m\00"
@.str.7 = [8 x i8] c"\1B[32;1m\00"
@.str.8 = [6 x i8] c"\1B[32m\00"
@.str.9 = [8 x i8] c"\1B[33;1m\00"
@.str.10 = [6 x i8] c"\1B[33m\00"
@.str.11 = [8 x i8] c"\1B[34;1m\00"
@.str.12 = [6 x i8] c"\1B[34m\00"
@.str.13 = [8 x i8] c"\1B[35;1m\00"
@.str.14 = [6 x i8] c"\1B[35m\00"
@.str.15 = [8 x i8] c"\1B[37;1m\00"
@.str.16 = [6 x i8] c"\1B[37m\00"
@.str.17 = [5 x i8] c"\1B[0m\00"
define i8* @colstr(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, 98
switch i8 %0, label %22 [
i8 110, label %4
i8 98, label %4
]
4: ; preds = %2, %2
%5 = sext i8 %1 to i32
switch i32 %5, label %22 [
i32 101, label %6
i32 99, label %8
i32 114, label %10
i32 103, label %12
i32 121, label %14
i32 98, label %16
i32 109, label %18
i32 119, label %20
]
6: ; preds = %4
%7 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
br label %22
8: ; preds = %4
%9 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
br label %22
10: ; preds = %4
%11 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0)
br label %22
12: ; preds = %4
%13 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
br label %22
14: ; preds = %4
%15 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0)
br label %22
16: ; preds = %4
%17 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
br label %22
18: ; preds = %4
%19 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0)
br label %22
20: ; preds = %4
%21 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0)
br label %22
22: ; preds = %2, %4, %20, %18, %16, %14, %12, %10, %8, %6
%23 = phi i8* [ %7, %6 ], [ %9, %8 ], [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %17, %16 ], [ %19, %18 ], [ %21, %20 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), %4 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %23
}