#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*/ printf(char *, ...);
void log_console_color_callback(int level, const char *msg) {
  static const struct {
    int color;
    char ch;
  } log_console_color_params[] = {
      {1, '!'}, {3, '!'}, {2, '+'}, {6, '-'}, {5, '*'}};
  printf("\033[1m\033[30m[ \033[3%dm%c%c\033[0m \033[1m\033[30m]\033[0m ",
         log_console_color_params[level].color,
         log_console_color_params[level].ch,
         log_console_color_params[level].ch);
  printf("%s\n", msg);
}


x86 assembly (clang, -O0):
<log_console_color_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rcx
lea    0xed6(%rip),%rax
mov    (%rax,%rcx,8),%esi
movslq -0x4(%rbp),%rcx
lea    0xec8(%rip),%rax
movsbl 0x4(%rax,%rcx,8),%edx
movslq -0x4(%rbp),%rcx
lea    0xeb8(%rip),%rax
movsbl 0x4(%rax,%rcx,8),%ecx
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_console_color_callback>:
push   %rbx
mov    %rsi,%rbx
movslq %edi,%rax
lea    0xed2(%rip),%rcx
mov    (%rcx,%rax,8),%esi
movsbl 0x4(%rcx,%rax,8),%ecx
lea    0xeeb(%rip),%rdi
mov    %ecx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
%struct.anon = type { i32, i8 }
@log_console_color_callback.log_console_color_params = internal constant [5 x %struct.anon] [%struct.anon { i32 1, i8 33 }, %struct.anon { i32 3, i8 33 }, %struct.anon { i32 2, i8 43 }, %struct.anon { i32 6, i8 45 }, %struct.anon { i32 5, i8 42 }]
@.str = [42 x i8] c"\1B[1m\1B[30m[ \1B[3%dm%c%c\1B[0m \1B[1m\1B[30m]\1B[0m \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @log_console_color_callback(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @log_console_color_callback.log_console_color_params, i64 0, i64 %6
%8 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @log_console_color_callback.log_console_color_params, i64 0, i64 %11
%13 = getelementptr inbounds %struct.anon, %struct.anon* %12, i32 0, i32 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @log_console_color_callback.log_console_color_params, i64 0, i64 %17
%19 = getelementptr inbounds %struct.anon, %struct.anon* %18, i32 0, i32 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %15, i32 %21)
%23 = load i8*, i8** %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
ret void
}

LLVM IR (-O2):
%struct.anon = type { i32, i8 }
@log_console_color_callback.log_console_color_params = internal unnamed_addr constant [5 x %struct.anon] [%struct.anon { i32 1, i8 33 }, %struct.anon { i32 3, i8 33 }, %struct.anon { i32 2, i8 43 }, %struct.anon { i32 6, i8 45 }, %struct.anon { i32 5, i8 42 }]
@.str = [42 x i8] c"\1B[1m\1B[30m[ \1B[3%dm%c%c\1B[0m \1B[1m\1B[30m]\1B[0m \00"
define void @log_console_color_callback(i32 %0, i8* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @log_console_color_callback.log_console_color_params, i64 0, i64 %3, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @log_console_color_callback.log_console_color_params, i64 0, i64 %3, i32 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) %1)
ret void
}