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


x86 assembly (clang, -O0):
<so_log_i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x17,%eax
ja     1227 <so_log_i+0x107>
mov    -0x10(%rbp),%rax
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edx
lea    0xefb(%rip),%rdi
lea    0xf0e(%rip),%rsi
lea    0xf0d(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xed9(%rip),%rdi
lea    0xef7(%rip),%rsi
lea    0xeeb(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xeb7(%rip),%rdi
lea    0xedb(%rip),%rsi
lea    0xec9(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xe95(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xea7(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xe73(%rip),%rdi
lea    0xea3(%rip),%rsi
lea    0xe85(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xe51(%rip),%rdi
lea    0xe87(%rip),%rsi
lea    0xe63(%rip),%rcx
call   1030 <printf@plt>
jmp    1244 <so_log_i+0x124>
mov    -0x8(%rbp),%edx
lea    0xe2f(%rip),%rdi
lea    0xe42(%rip),%rsi
lea    0xe41(%rip),%rcx
call   1030 <printf@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_log_i>:
push   %rax
mov    %esi,%edx
lea    0xf50(%rip),%rsi
add    $0xffffff9e,%edi
cmp    $0x17,%edi
ja     116d <so_log_i+0x4d>
lea    0xec7(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf48(%rip),%rsi
jmp    116d <so_log_i+0x4d>
lea    0xf4b(%rip),%rsi
jmp    116d <so_log_i+0x4d>
lea    0xf2a(%rip),%rsi
jmp    116d <so_log_i+0x4d>
lea    0xf33(%rip),%rsi
jmp    116d <so_log_i+0x4d>
lea    0xf1e(%rip),%rsi
lea    0xeec(%rip),%rdi
lea    0xf05(%rip),%rcx
call   1030 <printf@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"%s[####### %d #######]%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_i(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %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 i32, i32* %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), i32 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
10: ; preds = %2
%11 = load i32, i32* %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), i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
13: ; preds = %2
%14 = load i32, i32* %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), i32 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
16: ; preds = %2
%17 = load i32, i32* %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), i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
19: ; preds = %2
%20 = load i32, i32* %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), i32 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
22: ; preds = %2
%23 = load i32, i32* %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), i32 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
25: ; preds = %2
%26 = load i32, i32* %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), i32 %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[####### %d #######]%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_i(i8 signext %0, i32 %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, i32 %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
}