#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char color_int_to_char(int color_index) {
  switch (color_index) {
  case 1:
    return 'b';
    break;
  case 2:
    return 'v';
    break;
  case 3:
    return 'r';
    break;
  case 4:
    return 'j';
    break;
  case 5:
    return 'm';
    break;
  case 6:
    return 'g';
    break;
  default:
    fprintf(stderr, "Erreur, index de couleur invalide.\n");
    exit(1);
    break;
  }
}


x86 assembly (clang, -O0):
<color_int_to_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     118a <color_int_to_char+0x6a>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x62,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
movb   $0x76,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
movb   $0x72,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
movb   $0x6a,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
movb   $0x6d,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
movb   $0x67,-0x1(%rbp)
jmp    11a9 <color_int_to_char+0x89>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_int_to_char>:
add    $0xffffffff,%edi
cmp    $0x6,%edi
jae    113b <color_int_to_char+0x1b>
shl    $0x3,%edi
movabs $0x676d6a727662,%rax
mov    %edi,%ecx
shr    %cl,%rax
ret
push   %rax
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Erreur, index de couleur invalide.\0A\00"
define signext i8 @color_int_to_char(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
]
5: ; preds = %1
store i8 98, i8* %2
br label %15
6: ; preds = %1
store i8 118, i8* %2
br label %15
7: ; preds = %1
store i8 114, i8* %2
br label %15
8: ; preds = %1
store i8 106, i8* %2
br label %15
9: ; preds = %1
store i8 109, i8* %2
br label %15
10: ; preds = %1
store i8 103, i8* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %10, %9, %8, %7, %6, %5
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Erreur, index de couleur invalide.\0A\00"
define signext i8 @color_int_to_char(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 6
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
%9 = zext i32 %2 to i48
%10 = shl nuw nsw i48 %9, 3
%11 = lshr i48 113719634982498, %10
%12 = trunc i48 %11 to i8
ret i8 %12
}