#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*/ strcmp(char *, char *);
int get_col_int(char *s) {
  int colint;
  if (!strcmp(s, "COLOR_BLACK"))
    colint = 0;
  if (!strcmp(s, "COLOR_RED"))
    colint = 1;
  if (!strcmp(s, "COLOR_GREEN"))
    colint = 2;
  if (!strcmp(s, "COLOR_YELLOW"))
    colint = 3;
  if (!strcmp(s, "COLOR_BLUE"))
    colint = 4;
  if (!strcmp(s, "COLOR_MAGENTA"))
    colint = 5;
  if (!strcmp(s, "COLOR_CYAN"))
    colint = 6;
  if (!strcmp(s, "COLOR_WHITE"))
    colint = 7;
  return colint;
}


x86 assembly (clang, -O0):
<get_col_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    113c <get_col_int+0x2c>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115c <get_col_int+0x4c>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117c <get_col_int+0x6c>
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119c <get_col_int+0x8c>
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11bc <get_col_int+0xac>
movl   $0x4,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11dc <get_col_int+0xcc>
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11fc <get_col_int+0xec>
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    121c <get_col_int+0x10c>
movl   $0x7,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_col_int>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xee2(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
lea    0xed8(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x2,%ebx
cmovne %ebp,%ebx
lea    0xecb(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x3,%ebp
cmovne %ebx,%ebp
lea    0xebf(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x4,%ebx
cmovne %ebp,%ebx
lea    0xeb1(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x5,%ebp
cmovne %ebx,%ebp
lea    0xea6(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x6,%ebx
cmovne %ebp,%ebx
lea    0xe98(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x7,%eax
cmovne %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"COLOR_BLACK\00"
@.str.1 = [10 x i8] c"COLOR_RED\00"
@.str.2 = [12 x i8] c"COLOR_GREEN\00"
@.str.3 = [13 x i8] c"COLOR_YELLOW\00"
@.str.4 = [11 x i8] c"COLOR_BLUE\00"
@.str.5 = [14 x i8] c"COLOR_MAGENTA\00"
@.str.6 = [11 x i8] c"COLOR_CYAN\00"
@.str.7 = [12 x i8] c"COLOR_WHITE\00"
define i32 @get_col_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %3
br label %8
8: ; preds = %7, %1
%9 = load i8*, i8** %2
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
store i32 1, i32* %3
br label %13
13: ; preds = %12, %8
%14 = load i8*, i8** %2
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
store i32 2, i32* %3
br label %18
18: ; preds = %17, %13
%19 = load i8*, i8** %2
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %18
store i32 3, i32* %3
br label %23
23: ; preds = %22, %18
%24 = load i8*, i8** %2
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i32 4, i32* %3
br label %28
28: ; preds = %27, %23
%29 = load i8*, i8** %2
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %28
store i32 5, i32* %3
br label %33
33: ; preds = %32, %28
%34 = load i8*, i8** %2
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %33
store i32 6, i32* %3
br label %38
38: ; preds = %37, %33
%39 = load i8*, i8** %2
%40 = call i32 @strcmp(i8* %39, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %43, label %42
42: ; preds = %38
store i32 7, i32* %3
br label %43
43: ; preds = %42, %38
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"COLOR_RED\00"
@.str.2 = [12 x i8] c"COLOR_GREEN\00"
@.str.3 = [13 x i8] c"COLOR_YELLOW\00"
@.str.4 = [11 x i8] c"COLOR_BLUE\00"
@.str.5 = [14 x i8] c"COLOR_MAGENTA\00"
@.str.6 = [11 x i8] c"COLOR_CYAN\00"
@.str.7 = [12 x i8] c"COLOR_WHITE\00"
define i32 @get_col_int(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 2, i32 %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 3, i32 %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 4, i32 %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 5, i32 %13
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 6, i32 %16
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i32 7, i32 %19
ret i32 %22
}