#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*/ one_argument(char const *, char *);
char *strstr(char const *, char *);
int get_color(const char *argument) {
  char color[1024];
  const char *cptr;
  static char const *color_list =
      "_bla_red_dgr_bro_dbl_pur_cya_cha_dch_ora_gre_yel_blu_pin_lbl_whi";
  static char const *blink_list =
      "*bla*red*dgr*bro*dbl*pur*cya*cha*dch*ora*gre*yel*blu*pin*lbl*whi";
  one_argument(argument, color);
  if (color[0] != '_' && color[0] != '*')
    return 0;
  if ((cptr = strstr(color_list, color)))
    return (cptr - color_list) / 4;
  if ((cptr = strstr(blink_list, color)))
    return (cptr - blink_list) / 4 + 16;
  return 0;
}


x86 assembly (clang, -O0):
<get_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <one_argument@plt>
movsbl -0x410(%rbp),%eax
cmp    $0x5f,%eax
je     116b <get_color+0x4b>
movsbl -0x410(%rbp),%eax
cmp    $0x2a,%eax
je     116b <get_color+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1204 <get_color+0xe4>
mov    0x2ebe(%rip),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     11b2 <get_color+0x92>
mov    -0x418(%rbp),%rax
mov    0x2e93(%rip),%rcx
sub    %rcx,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
mov    %eax,-0x4(%rbp)
jmp    1204 <get_color+0xe4>
mov    0x2e7f(%rip),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     11fd <get_color+0xdd>
mov    -0x418(%rbp),%rax
mov    0x2e54(%rip),%rcx
sub    %rcx,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
add    $0x10,%rax
mov    %eax,-0x4(%rbp)
jmp    1204 <get_color+0xe4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_color>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rsi
call   1030 <one_argument@plt>
xor    %ebx,%ebx
mov    (%rsp),%al
cmp    $0x5f,%al
je     113f <get_color+0x1f>
cmp    $0x2a,%al
jne    1196 <get_color+0x76>
lea    0xeba(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     116a <get_color+0x4a>
sub    %r14,%rax
lea    0x3(%rax),%rbx
test   %rax,%rax
cmovns %rax,%rbx
shr    $0x2,%rbx
jmp    1196 <get_color+0x76>
lea    0xed0(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     1196 <get_color+0x76>
sub    %r14,%rax
lea    0x3(%rax),%rbx
test   %rax,%rax
cmovns %rax,%rbx
shr    $0x2,%rbx
add    $0x10,%ebx
mov    %ebx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@get_color.color_list = internal global i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0)
@.str = [65 x i8] c"_bla_red_dgr_bro_dbl_pur_cya_cha_dch_ora_gre_yel_blu_pin_lbl_whi\00"
@get_color.blink_list = internal global i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i32 0, i32 0)
@.str.1 = [65 x i8] c"*bla*red*dgr*bro*dbl*pur*cya*cha*dch*ora*gre*yel*blu*pin*lbl*whi\00"
define i32 @get_color(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = call i32 @one_argument(i8* %6, i8* %7)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 95
br i1 %12, label %13, label %19
13: ; preds = %1
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 42
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %2
br label %47
19: ; preds = %13, %1
%20 = load i8*, i8** @get_color.color_list
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%22 = call i8* @strstr(i8* %20, i8* %21)
store i8* %22, i8** %5
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %32
24: ; preds = %19
%25 = load i8*, i8** %5
%26 = load i8*, i8** @get_color.color_list
%27 = ptrtoint i8* %25 to i64
%28 = ptrtoint i8* %26 to i64
%29 = sub i64 %27, %28
%30 = sdiv i64 %29, 4
%31 = trunc i64 %30 to i32
store i32 %31, i32* %2
br label %47
32: ; preds = %19
%33 = load i8*, i8** @get_color.blink_list
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%35 = call i8* @strstr(i8* %33, i8* %34)
store i8* %35, i8** %5
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %46
37: ; preds = %32
%38 = load i8*, i8** %5
%39 = load i8*, i8** @get_color.blink_list
%40 = ptrtoint i8* %38 to i64
%41 = ptrtoint i8* %39 to i64
%42 = sub i64 %40, %41
%43 = sdiv i64 %42, 4
%44 = add nsw i64 %43, 16
%45 = trunc i64 %44 to i32
store i32 %45, i32* %2
br label %47
46: ; preds = %32
store i32 0, i32* %2
br label %47
47: ; preds = %46, %37, %24, %18
%48 = load i32, i32* %2
ret i32 %48
}

LLVM IR (-O2):
@.str = [65 x i8] c"_bla_red_dgr_bro_dbl_pur_cya_cha_dch_ora_gre_yel_blu_pin_lbl_whi\00"
@.str.1 = [65 x i8] c"*bla*red*dgr*bro*dbl*pur*cya*cha*dch*ora*gre*yel*blu*pin*lbl*whi\00"
define i32 @get_color(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @one_argument(i8* %0, i8* %3)
%5 = load i8, i8* %3
switch i8 %5, label %23 [
i8 95, label %6
i8 42, label %6
]
6: ; preds = %1, %1
%7 = call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = ptrtoint i8* %7 to i64
%11 = sub i64 %10, ptrtoint ([65 x i8]* @.str to i64)
%12 = sdiv i64 %11, 4
%13 = trunc i64 %12 to i32
br label %23
14: ; preds = %6
%15 = call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%16 = icmp eq i8* %15, null
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = ptrtoint i8* %15 to i64
%19 = sub i64 %18, ptrtoint ([65 x i8]* @.str.1 to i64)
%20 = sdiv i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = add i32 %21, 16
br label %23
23: ; preds = %14, %1, %17, %9
%24 = phi i32 [ %13, %9 ], [ %22, %17 ], [ 0, %1 ], [ 0, %14 ]
ret i32 %24
}