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


x86 assembly (clang, -O0):
<so_log_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     122e <so_log_s+0x10e>
mov    -0x18(%rbp),%rax
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdx
lea    0xef9(%rip),%rdi
lea    0xf0c(%rip),%rsi
lea    0xf0b(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xed6(%rip),%rdi
lea    0xef4(%rip),%rsi
lea    0xee8(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xeb3(%rip),%rdi
lea    0xed7(%rip),%rsi
lea    0xec5(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xe90(%rip),%rdi
lea    0xeba(%rip),%rsi
lea    0xea2(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xe6d(%rip),%rdi
lea    0xe9d(%rip),%rsi
lea    0xe7f(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xe4a(%rip),%rdi
lea    0xe80(%rip),%rsi
lea    0xe5c(%rip),%rcx
call   1030 <printf@plt>
jmp    124c <so_log_s+0x12c>
mov    -0x10(%rbp),%rdx
lea    0xe27(%rip),%rdi
lea    0xe3a(%rip),%rsi
lea    0xe39(%rip),%rcx
call   1030 <printf@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_log_s>:
push   %rax
mov    %rsi,%rdx
lea    0xf4f(%rip),%rsi
add    $0xffffff9e,%edi
cmp    $0x17,%edi
ja     116e <so_log_s+0x4e>
lea    0xec6(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf47(%rip),%rsi
jmp    116e <so_log_s+0x4e>
lea    0xf4a(%rip),%rsi
jmp    116e <so_log_s+0x4e>
lea    0xf29(%rip),%rsi
jmp    116e <so_log_s+0x4e>
lea    0xf32(%rip),%rsi
jmp    116e <so_log_s+0x4e>
lea    0xf1d(%rip),%rsi
lea    0xeeb(%rip),%rdi
lea    0xf04(%rip),%rcx
call   1030 <printf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"%s[####### %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_s(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %25 [
i32 114, label %7
i32 103, label %10
i32 121, label %13
i32 98, label %16
i32 109, label %19
i32 99, label %22
]
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
19: ; preds = %2
%20 = load i8*, i8** %4
%21 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
22: ; preds = %2
%23 = load i8*, i8** %4
%24 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
25: ; preds = %2
%26 = load i8*, i8** %4
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %7
%29 = load i32, i32* @stdout
%30 = call i32 @fflush(i32 %29)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s[####### %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_s(i8 signext %0, i8* %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %9 [
i32 99, label %8
i32 103, label %4
i32 121, label %5
i32 98, label %6
i32 109, label %7
]
4: ; preds = %2
br label %9
5: ; preds = %2
br label %9
6: ; preds = %2
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %8, %7, %6, %5, %4
%10 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %2 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = tail call i32 @fflush(i32 %12)
ret void
}