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


x86 assembly (clang, -O0):
<color_char_to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x14,%eax
ja     11a0 <color_char_to_int+0x80>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
movl   $0x2,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
movl   $0x3,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
movl   $0x4,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
movl   $0x5,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
movl   $0x6,-0x4(%rbp)
jmp    11bf <color_char_to_int+0x9f>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_char_to_int>:
push   %rax
add    $0xffffff9e,%edi
cmp    $0x14,%edi
ja     1161 <color_char_to_int+0x41>
mov    $0x1,%eax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x6,%eax
pop    %rcx
ret
mov    $0x4,%eax
pop    %rcx
ret
mov    $0x5,%eax
pop    %rcx
ret
mov    $0x3,%eax
pop    %rcx
ret
mov    $0x2,%eax
pop    %rcx
ret
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xee3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"Erreur, charactere de couleur invalide.\0A\00"
define i32 @color_char_to_int(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 98, label %12
i32 118, label %3
i32 114, label %4
i32 106, label %5
i32 109, label %6
i32 103, label %7
]
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %1, %7, %6, %5, %4, %3
%13 = phi i32 [ 6, %7 ], [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %1 ]
ret i32 %13
}