#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stdout;
void so_log(char c) {
  switch (c) {
  case 'r':
    printf("%s[##############]%s\n", "\x1b[31m", "\x1b[0m");
    break;
  case 'g':
    printf("%s[##############]%s\n", "\x1b[32m", "\x1b[0m");
    break;
  case 'y':
    printf("%s[##############]%s\n", "\x1b[33m", "\x1b[0m");
    break;
  case 'b':
    printf("%s[##############]%s\n", "\x1b[34m", "\x1b[0m");
    break;
  case 'm':
    printf("%s[##############]%s\n", "\x1b[35m", "\x1b[0m");
    break;
  case 'c':
    printf("%s[##############]%s\n", "\x1b[36m", "\x1b[0m");
    break;
  default:
    printf("%s[##############]%s\n", "\x1b[31m", "\x1b[0m");
    break;
  }
  fflush(stdout);
}


x86 assembly (clang, -O0):
<so_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x17,%eax
ja     1212 <so_log+0xf2>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf01(%rip),%rdi
lea    0xf10(%rip),%rsi
lea    0xf0f(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xee2(%rip),%rdi
lea    0xefc(%rip),%rsi
lea    0xef0(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xec3(%rip),%rdi
lea    0xee3(%rip),%rsi
lea    0xed1(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xea4(%rip),%rdi
lea    0xeca(%rip),%rsi
lea    0xeb2(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xe85(%rip),%rdi
lea    0xeb1(%rip),%rsi
lea    0xe93(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xe66(%rip),%rdi
lea    0xe98(%rip),%rsi
lea    0xe74(%rip),%rdx
call   1030 <printf@plt>
jmp    122c <so_log+0x10c>
lea    0xe47(%rip),%rdi
lea    0xe56(%rip),%rsi
lea    0xe55(%rip),%rdx
call   1030 <printf@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_log>:
push   %rax
lea    0xf4e(%rip),%rsi
add    $0xffffff9e,%edi
cmp    $0x17,%edi
ja     116b <so_log+0x4b>
lea    0xec9(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf46(%rip),%rsi
jmp    116b <so_log+0x4b>
lea    0xf49(%rip),%rsi
jmp    116b <so_log+0x4b>
lea    0xf28(%rip),%rsi
jmp    116b <so_log+0x4b>
lea    0xf31(%rip),%rsi
jmp    116b <so_log+0x4b>
lea    0xf1c(%rip),%rsi
lea    0xeee(%rip),%rdi
lea    0xf03(%rip),%rdx
call   1030 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s[##############]%s\0A\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [6 x i8] c"\1B[32m\00"
@.str.4 = [6 x i8] c"\1B[33m\00"
@.str.5 = [6 x i8] c"\1B[34m\00"
@.str.6 = [6 x i8] c"\1B[35m\00"
@.str.7 = [6 x i8] c"\1B[36m\00"
@stdout = global i32 0
define void @so_log(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
switch i32 %4, label %17 [
i32 114, label %5
i32 103, label %7
i32 121, label %9
i32 98, label %11
i32 109, label %13
i32 99, label %15
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
15: ; preds = %1
%16 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
17: ; preds = %1
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7, %5
%20 = load i32, i32* @stdout
%21 = call i32 @fflush(i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s[##############]%s\0A\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [6 x i8] c"\1B[32m\00"
@.str.4 = [6 x i8] c"\1B[33m\00"
@.str.5 = [6 x i8] c"\1B[34m\00"
@.str.6 = [6 x i8] c"\1B[35m\00"
@.str.7 = [6 x i8] c"\1B[36m\00"
@stdout = global i32 0
define void @so_log(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 99, label %7
i32 103, label %3
i32 121, label %4
i32 98, label %5
i32 109, label %6
]
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3
%9 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %1 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = tail call i32 @fflush(i32 %11)
ret void
}