const char *format_ansi(char ch) {
  if (ch == 'k')
    return ("\033[2;30m");
  if (ch == 'K')
    return ("\033[1;30m");
  if (ch == 'l')
    return ("\033[40m");
  if (ch == 'r')
    return ("\033[2;31m");
  if (ch == 'R')
    return ("\033[1;31m");
  if (ch == 's')
    return ("\033[41m");
  if (ch == 'g')
    return ("\033[2;32m");
  if (ch == 'G')
    return ("\033[1;32m");
  if (ch == 'h')
    return ("\033[42m");
  if (ch == 'y')
    return ("\033[2;33m");
  if (ch == 'Y')
    return ("\033[1;33m");
  if (ch == 'z')
    return ("\033[43m");
  if (ch == 'b')
    return ("\033[2;34m");
  if (ch == 'B')
    return ("\033[1;34m");
  if (ch == 'e')
    return ("\033[44m");
  if (ch == 'm' || ch == 'p')
    return ("\033[2;35m");
  if (ch == 'M' || ch == 'P')
    return ("\033[1;35m");
  if (ch == 'q')
    return ("\033[45m");
  if (ch == 'c')
    return ("\033[2;36m");
  if (ch == 'C')
    return ("\033[1;36m");
  if (ch == 'd')
    return ("\033[46m");
  if (ch == 'w')
    return ("\033[2;37m");
  if (ch == 'W')
    return ("\033[1;37m");
  if (ch == 'x')
    return ("\033[47m");
  if (ch == 'n')
    return ("\033[0m");
  if (ch == 'T')
    return ("\033[1m");
  if (ch == 'N')
    return ("\033[2m");
  if (ch == 'U')
    return ("\033[4m");
  if (ch == 'i')
    return ("\033[5m");
  if (ch == 'V')
    return ("\033[7m");
  if (ch == '%')
    return "%";
  return ("");
}


x86 assembly (clang, -O0):
<format_ansi>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x6b,%eax
jne    1127 <format_ansi+0x27>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x4b,%eax
jne    1144 <format_ansi+0x44>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x6c,%eax
jne    1161 <format_ansi+0x61>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x72,%eax
jne    117e <format_ansi+0x7e>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x52,%eax
jne    119b <format_ansi+0x9b>
lea    0xe8c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x73,%eax
jne    11b8 <format_ansi+0xb8>
lea    0xe77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x67,%eax
jne    11d5 <format_ansi+0xd5>
lea    0xe60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x47,%eax
jne    11f2 <format_ansi+0xf2>
lea    0xe4b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x68,%eax
jne    120f <format_ansi+0x10f>
lea    0xe36(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
jne    122c <format_ansi+0x12c>
lea    0xe1f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x59,%eax
jne    1249 <format_ansi+0x149>
lea    0xe0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x7a,%eax
jne    1266 <format_ansi+0x166>
lea    0xdf5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x62,%eax
jne    1283 <format_ansi+0x183>
lea    0xdde(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x42,%eax
jne    12a0 <format_ansi+0x1a0>
lea    0xdc9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x65,%eax
jne    12bd <format_ansi+0x1bd>
lea    0xdb4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x6d,%eax
je     12d7 <format_ansi+0x1d7>
movsbl -0x9(%rbp),%eax
cmp    $0x70,%eax
jne    12e7 <format_ansi+0x1e7>
lea    0xd90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x4d,%eax
je     1301 <format_ansi+0x201>
movsbl -0x9(%rbp),%eax
cmp    $0x50,%eax
jne    1311 <format_ansi+0x211>
lea    0xd6e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x71,%eax
jne    132e <format_ansi+0x22e>
lea    0xd59(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x63,%eax
jne    134b <format_ansi+0x24b>
lea    0xd42(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
jne    1368 <format_ansi+0x268>
lea    0xd2d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x64,%eax
jne    1385 <format_ansi+0x285>
lea    0xd18(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x77,%eax
jne    13a2 <format_ansi+0x2a2>
lea    0xd01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x57,%eax
jne    13bf <format_ansi+0x2bf>
lea    0xcec(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x78,%eax
jne    13dc <format_ansi+0x2dc>
lea    0xcd7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x6e,%eax
jne    13f9 <format_ansi+0x2f9>
lea    0xcc0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x54,%eax
jne    1416 <format_ansi+0x316>
lea    0xca8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x4e,%eax
jne    1433 <format_ansi+0x333>
lea    0xc90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x55,%eax
jne    1450 <format_ansi+0x350>
lea    0xc78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x69,%eax
jne    146d <format_ansi+0x36d>
lea    0xc60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x56,%eax
jne    148a <format_ansi+0x38a>
lea    0xc48(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
movsbl -0x9(%rbp),%eax
cmp    $0x25,%eax
jne    14a7 <format_ansi+0x3a7>
lea    0xc30(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14b2 <format_ansi+0x3b2>
lea    0xc21(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_ansi>:
add    $0xdb,%dil
cmp    $0x55,%dil
ja     113d <format_ansi+0x3d>
lea    0x1047(%rip),%rax
movzbl %dil,%ecx
lea    0xee4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x10a2(%rip),%rax
ret
lea    0x1092(%rip),%rax
ret
lea    0x10ea(%rip),%rax
ret
lea    0x10e3(%rip),%rax
ret
lea    0x106c(%rip),%rax
ret
lea    0x1090(%rip),%rax
ret
lea    0x1030(%rip),%rax
ret
lea    0xffc(%rip),%rax
ret
lea    0x10a6(%rip),%rax
ret
lea    0x1002(%rip),%rax
ret
lea    0x1091(%rip),%rax
ret
lea    0x1093(%rip),%rax
ret
lea    0x1095(%rip),%rax
ret
lea    0x1066(%rip),%rax
ret
lea    0x1006(%rip),%rax
ret
lea    0x100c(%rip),%rax
ret
lea    0x1030(%rip),%rax
ret
lea    0x1038(%rip),%rax
ret
lea    0x1004(%rip),%rax
ret
lea    0xfc0(%rip),%rax
ret
lea    0xfc8(%rip),%rax
ret
lea    0x1048(%rip),%rax
ret
lea    0xf8c(%rip),%rax
ret
lea    0x1024(%rip),%rax
ret
lea    0xfea(%rip),%rax
ret
lea    0xf7a(%rip),%rax
ret
lea    0xf82(%rip),%rax
ret
lea    0xfee(%rip),%rax
ret
lea    0xff6(%rip),%rax
ret
lea    0xf86(%rip),%rax
ret
lea    0xf8e(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[2;30m\00"
@.str.1 = [8 x i8] c"\1B[1;30m\00"
@.str.2 = [6 x i8] c"\1B[40m\00"
@.str.3 = [8 x i8] c"\1B[2;31m\00"
@.str.4 = [8 x i8] c"\1B[1;31m\00"
@.str.5 = [6 x i8] c"\1B[41m\00"
@.str.6 = [8 x i8] c"\1B[2;32m\00"
@.str.7 = [8 x i8] c"\1B[1;32m\00"
@.str.8 = [6 x i8] c"\1B[42m\00"
@.str.9 = [8 x i8] c"\1B[2;33m\00"
@.str.10 = [8 x i8] c"\1B[1;33m\00"
@.str.11 = [6 x i8] c"\1B[43m\00"
@.str.12 = [8 x i8] c"\1B[2;34m\00"
@.str.13 = [8 x i8] c"\1B[1;34m\00"
@.str.14 = [6 x i8] c"\1B[44m\00"
@.str.15 = [8 x i8] c"\1B[2;35m\00"
@.str.16 = [8 x i8] c"\1B[1;35m\00"
@.str.17 = [6 x i8] c"\1B[45m\00"
@.str.18 = [8 x i8] c"\1B[2;36m\00"
@.str.19 = [8 x i8] c"\1B[1;36m\00"
@.str.20 = [6 x i8] c"\1B[46m\00"
@.str.21 = [8 x i8] c"\1B[2;37m\00"
@.str.22 = [8 x i8] c"\1B[1;37m\00"
@.str.23 = [6 x i8] c"\1B[47m\00"
@.str.24 = [5 x i8] c"\1B[0m\00"
@.str.25 = [5 x i8] c"\1B[1m\00"
@.str.26 = [5 x i8] c"\1B[2m\00"
@.str.27 = [5 x i8] c"\1B[4m\00"
@.str.28 = [5 x i8] c"\1B[5m\00"
@.str.29 = [5 x i8] c"\1B[7m\00"
@.str.30 = [2 x i8] c"%\00"
@.str.31 = [1 x i8] zeroinitializer
define i8* @format_ansi(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 107
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %167
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 75
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %167
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 108
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %167
18: ; preds = %13
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 114
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %167
23: ; preds = %18
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 82
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %167
28: ; preds = %23
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 115
br i1 %31, label %32, label %33
32: ; preds = %28
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %167
33: ; preds = %28
%34 = load i8, i8* %3
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 103
br i1 %36, label %37, label %38
37: ; preds = %33
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %167
38: ; preds = %33
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 71
br i1 %41, label %42, label %43
42: ; preds = %38
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %167
43: ; preds = %38
%44 = load i8, i8* %3
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 104
br i1 %46, label %47, label %48
47: ; preds = %43
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %167
48: ; preds = %43
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 121
br i1 %51, label %52, label %53
52: ; preds = %48
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %167
53: ; preds = %48
%54 = load i8, i8* %3
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 89
br i1 %56, label %57, label %58
57: ; preds = %53
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %167
58: ; preds = %53
%59 = load i8, i8* %3
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 122
br i1 %61, label %62, label %63
62: ; preds = %58
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %167
63: ; preds = %58
%64 = load i8, i8* %3
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 98
br i1 %66, label %67, label %68
67: ; preds = %63
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %167
68: ; preds = %63
%69 = load i8, i8* %3
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 66
br i1 %71, label %72, label %73
72: ; preds = %68
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %167
73: ; preds = %68
%74 = load i8, i8* %3
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 101
br i1 %76, label %77, label %78
77: ; preds = %73
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %167
78: ; preds = %73
%79 = load i8, i8* %3
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 109
br i1 %81, label %86, label %82
82: ; preds = %78
%83 = load i8, i8* %3
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 112
br i1 %85, label %86, label %87
86: ; preds = %82, %78
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %167
87: ; preds = %82
%88 = load i8, i8* %3
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 77
br i1 %90, label %95, label %91
91: ; preds = %87
%92 = load i8, i8* %3
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 80
br i1 %94, label %95, label %96
95: ; preds = %91, %87
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %167
96: ; preds = %91
%97 = load i8, i8* %3
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 113
br i1 %99, label %100, label %101
100: ; preds = %96
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %167
101: ; preds = %96
%102 = load i8, i8* %3
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 99
br i1 %104, label %105, label %106
105: ; preds = %101
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %167
106: ; preds = %101
%107 = load i8, i8* %3
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 67
br i1 %109, label %110, label %111
110: ; preds = %106
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %167
111: ; preds = %106
%112 = load i8, i8* %3
%113 = sext i8 %112 to i32
%114 = icmp eq i32 %113, 100
br i1 %114, label %115, label %116
115: ; preds = %111
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %167
116: ; preds = %111
%117 = load i8, i8* %3
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 119
br i1 %119, label %120, label %121
120: ; preds = %116
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %167
121: ; preds = %116
%122 = load i8, i8* %3
%123 = sext i8 %122 to i32
%124 = icmp eq i32 %123, 87
br i1 %124, label %125, label %126
125: ; preds = %121
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %167
126: ; preds = %121
%127 = load i8, i8* %3
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 120
br i1 %129, label %130, label %131
130: ; preds = %126
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %167
131: ; preds = %126
%132 = load i8, i8* %3
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 110
br i1 %134, label %135, label %136
135: ; preds = %131
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %167
136: ; preds = %131
%137 = load i8, i8* %3
%138 = sext i8 %137 to i32
%139 = icmp eq i32 %138, 84
br i1 %139, label %140, label %141
140: ; preds = %136
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), i8** %2
br label %167
141: ; preds = %136
%142 = load i8, i8* %3
%143 = sext i8 %142 to i32
%144 = icmp eq i32 %143, 78
br i1 %144, label %145, label %146
145: ; preds = %141
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), i8** %2
br label %167
146: ; preds = %141
%147 = load i8, i8* %3
%148 = sext i8 %147 to i32
%149 = icmp eq i32 %148, 85
br i1 %149, label %150, label %151
150: ; preds = %146
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i8** %2
br label %167
151: ; preds = %146
%152 = load i8, i8* %3
%153 = sext i8 %152 to i32
%154 = icmp eq i32 %153, 105
br i1 %154, label %155, label %156
155: ; preds = %151
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i64 0, i64 0), i8** %2
br label %167
156: ; preds = %151
%157 = load i8, i8* %3
%158 = sext i8 %157 to i32
%159 = icmp eq i32 %158, 86
br i1 %159, label %160, label %161
160: ; preds = %156
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i64 0, i64 0), i8** %2
br label %167
161: ; preds = %156
%162 = load i8, i8* %3
%163 = sext i8 %162 to i32
%164 = icmp eq i32 %163, 37
br i1 %164, label %165, label %166
165: ; preds = %161
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.30, i64 0, i64 0), i8** %2
br label %167
166: ; preds = %161
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.31, i64 0, i64 0), i8** %2
br label %167
167: ; preds = %166, %165, %160, %155, %150, %145, %140, %135, %130, %125, %120, %115, %110, %105, %100, %95, %86, %77, %72, %67, %62, %57, %52, %47, %42, %37, %32, %27, %22, %17, %12, %7
%168 = load i8*, i8** %2
ret i8* %168
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[2;30m\00"
@.str.1 = [8 x i8] c"\1B[1;30m\00"
@.str.2 = [6 x i8] c"\1B[40m\00"
@.str.3 = [8 x i8] c"\1B[2;31m\00"
@.str.4 = [8 x i8] c"\1B[1;31m\00"
@.str.5 = [6 x i8] c"\1B[41m\00"
@.str.6 = [8 x i8] c"\1B[2;32m\00"
@.str.7 = [8 x i8] c"\1B[1;32m\00"
@.str.8 = [6 x i8] c"\1B[42m\00"
@.str.9 = [8 x i8] c"\1B[2;33m\00"
@.str.10 = [8 x i8] c"\1B[1;33m\00"
@.str.11 = [6 x i8] c"\1B[43m\00"
@.str.12 = [8 x i8] c"\1B[2;34m\00"
@.str.13 = [8 x i8] c"\1B[1;34m\00"
@.str.14 = [6 x i8] c"\1B[44m\00"
@.str.15 = [8 x i8] c"\1B[2;35m\00"
@.str.16 = [8 x i8] c"\1B[1;35m\00"
@.str.17 = [6 x i8] c"\1B[45m\00"
@.str.18 = [8 x i8] c"\1B[2;36m\00"
@.str.19 = [8 x i8] c"\1B[1;36m\00"
@.str.20 = [6 x i8] c"\1B[46m\00"
@.str.21 = [8 x i8] c"\1B[2;37m\00"
@.str.22 = [8 x i8] c"\1B[1;37m\00"
@.str.23 = [6 x i8] c"\1B[47m\00"
@.str.24 = [5 x i8] c"\1B[0m\00"
@.str.25 = [5 x i8] c"\1B[1m\00"
@.str.26 = [5 x i8] c"\1B[2m\00"
@.str.27 = [5 x i8] c"\1B[4m\00"
@.str.28 = [5 x i8] c"\1B[5m\00"
@.str.29 = [5 x i8] c"\1B[7m\00"
@.str.30 = [2 x i8] c"%\00"
@.str.31 = [1 x i8] zeroinitializer
define i8* @format_ansi(i8 signext %0) {
switch i8 %0, label %30 [
i8 107, label %33
i8 75, label %2
i8 108, label %3
i8 114, label %4
i8 82, label %5
i8 115, label %6
i8 103, label %7
i8 71, label %8
i8 104, label %9
i8 121, label %10
i8 89, label %11
i8 122, label %12
i8 98, label %13
i8 66, label %14
i8 101, label %15
i8 112, label %31
i8 109, label %31
i8 80, label %32
i8 77, label %32
i8 113, label %16
i8 99, label %17
i8 67, label %18
i8 100, label %19
i8 119, label %20
i8 87, label %21
i8 120, label %22
i8 110, label %23
i8 84, label %24
i8 78, label %25
i8 85, label %26
i8 105, label %27
i8 86, label %28
i8 37, label %29
]
2: ; preds = %1
br label %33
3: ; preds = %1
br label %33
4: ; preds = %1
br label %33
5: ; preds = %1
br label %33
6: ; preds = %1
br label %33
7: ; preds = %1
br label %33
8: ; preds = %1
br label %33
9: ; preds = %1
br label %33
10: ; preds = %1
br label %33
11: ; preds = %1
br label %33
12: ; preds = %1
br label %33
13: ; preds = %1
br label %33
14: ; preds = %1
br label %33
15: ; preds = %1
br label %33
16: ; preds = %1
br label %33
17: ; preds = %1
br label %33
18: ; preds = %1
br label %33
19: ; preds = %1
br label %33
20: ; preds = %1
br label %33
21: ; preds = %1
br label %33
22: ; preds = %1
br label %33
23: ; preds = %1
br label %33
24: ; preds = %1
br label %33
25: ; preds = %1
br label %33
26: ; preds = %1
br label %33
27: ; preds = %1
br label %33
28: ; preds = %1
br label %33
29: ; preds = %1
br label %33
30: ; preds = %1
br label %33
31: ; preds = %1, %1
br label %33
32: ; preds = %1, %1
br label %33
33: ; preds = %1, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%34 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), %16 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), %18 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), %19 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0), %20 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i64 0, i64 0), %21 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), %22 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), %23 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), %24 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), %25 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), %26 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i64 0, i64 0), %27 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.29, i64 0, i64 0), %28 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.30, i64 0, i64 0), %29 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.31, i64 0, i64 0), %30 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), %31 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), %32 ]
ret i8* %34
}