#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*/ matchDigitPlus(char const **);
int /*<<< orphan*/ matchString(char const **, char *);
int matchRgbColor(const char **strptr) {
  const char *str = *strptr;
  if (!matchString(&str, "rgb("))
    return 0;
  if (!matchDigitPlus(&str))
    return 0;
  if (!matchString(&str, ","))
    return 0;
  if (!matchDigitPlus(&str))
    return 0;
  if (!matchString(&str, ","))
    return 0;
  if (!matchDigitPlus(&str))
    return 0;
  if (!matchString(&str, ")"))
    return 0;
  *strptr = str;
  return 1;
}


x86 assembly (clang, -O0):
<matchRgbColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1040 <matchString@plt>
cmp    $0x0,%eax
jne    115c <matchRgbColor+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
call   1030 <matchDigitPlus@plt>
cmp    $0x0,%eax
jne    117a <matchRgbColor+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1040 <matchString@plt>
cmp    $0x0,%eax
jne    119f <matchRgbColor+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
call   1030 <matchDigitPlus@plt>
cmp    $0x0,%eax
jne    11bd <matchRgbColor+0x9d>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1040 <matchString@plt>
cmp    $0x0,%eax
jne    11e2 <matchRgbColor+0xc2>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
call   1030 <matchDigitPlus@plt>
cmp    $0x0,%eax
jne    1200 <matchRgbColor+0xe0>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
lea    -0x18(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   1040 <matchString@plt>
cmp    $0x0,%eax
jne    1225 <matchRgbColor+0x105>
movl   $0x0,-0x4(%rbp)
jmp    1237 <matchRgbColor+0x117>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchRgbColor>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    %rax,(%rsp)
lea    0xecc(%rip),%rsi
mov    %rsp,%rdi
call   1040 <matchString@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
mov    %rsp,%rdi
call   1030 <matchDigitPlus@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
lea    0xeb0(%rip),%rsi
mov    %rsp,%rdi
call   1040 <matchString@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
mov    %rsp,%rdi
call   1030 <matchDigitPlus@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
lea    0xe91(%rip),%rsi
mov    %rsp,%rdi
call   1040 <matchString@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
mov    %rsp,%rdi
call   1030 <matchDigitPlus@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
lea    0xe74(%rip),%rsi
mov    %rsp,%rdi
call   1040 <matchString@plt>
test   %eax,%eax
je     11ab <matchRgbColor+0x8b>
mov    (%rsp),%rax
mov    %rax,(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"rgb(\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [2 x i8] c")\00"
define i32 @matchRgbColor(i8** nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = load i8*, i8** %0
store i8* %4, i8** %2
%5 = call i32 @matchString(i8** %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %27, label %7
7: ; preds = %1
%8 = call i32 @matchDigitPlus(i8** %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %27, label %10
10: ; preds = %7
%11 = call i32 @matchString(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %27, label %13
13: ; preds = %10
%14 = call i32 @matchDigitPlus(i8** %2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %13
%17 = call i32 @matchString(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %16
%20 = call i32 @matchDigitPlus(i8** %2)
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %19
%23 = call i32 @matchString(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = load i8*, i8** %2
store i8* %26, i8** %0
br label %27
27: ; preds = %22, %19, %16, %13, %10, %7, %1, %25
%28 = phi i32 [ 1, %25 ], [ 0, %1 ], [ 0, %7 ], [ 0, %10 ], [ 0, %13 ], [ 0, %16 ], [ 0, %19 ], [ 0, %22 ]
ret i32 %28
}