#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 */
scalar_t__ strchr(char *, char const);
bool is_color_directive(const char *p) {
  return p[0] && strchr("rgbcmykwRGBCMYKW", p[0]) && p[1] &&
         strchr("rgbcmykwRGBCMYKW", p[1]) && p[2] == '{';
}


x86 assembly (clang, -O0):
<is_color_directive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     11a3 <is_color_directive+0x93>
mov    -0x8(%rbp),%rax
lea    0xec4(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11a3 <is_color_directive+0x93>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     11a3 <is_color_directive+0x93>
mov    -0x8(%rbp),%rax
lea    0xe89(%rip),%rdi
movsbl 0x1(%rax),%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     11a3 <is_color_directive+0x93>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x7b,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_color_directive>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     1157 <is_color_directive+0x47>
mov    %rdi,%rbx
movsbl %al,%esi
lea    0xed8(%rip),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1157 <is_color_directive+0x47>
mov    0x1(%rbx),%al
test   %al,%al
je     1157 <is_color_directive+0x47>
movsbl %al,%esi
lea    0xebd(%rip),%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1157 <is_color_directive+0x47>
xor    %ebp,%ebp
cmpb   $0x7b,0x2(%rbx)
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"rgbcmykwRGBCMYKW\00"
define i32 @is_color_directive(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %32
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %32
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %14
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 123
br label %32
32: ; preds = %26, %20, %14, %8, %1
%33 = phi i1 [ false, %20 ], [ false, %14 ], [ false, %8 ], [ false, %1 ], [ %31, %26 ]
%34 = zext i1 %33 to i32
ret i32 %34
}

LLVM IR (-O2):
@.str = [17 x i8] c"rgbcmykwRGBCMYKW\00"
define i32 @is_color_directive(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = tail call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %7
%12 = tail call i64 @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = getelementptr inbounds i8, i8* %0, i64 2
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 123
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %14, %11, %7, %4, %1
%20 = phi i32 [ 0, %11 ], [ 0, %7 ], [ 0, %4 ], [ 0, %1 ], [ %18, %14 ]
ret i32 %20
}