#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__ matchNumber(char const **);
scalar_t__ matchUnit(char const **);
int CSSValueIsLength(const char *str) {
  if (str == NULL)
    return 0;
  return (matchNumber(&str) && matchUnit(&str) && (*str == 0));
}


x86 assembly (clang, -O0):
<CSSValueIsLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <CSSValueIsLength+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1194 <CSSValueIsLength+0x74>
lea    -0x10(%rbp),%rdi
call   1030 <matchNumber@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     1189 <CSSValueIsLength+0x69>
lea    -0x10(%rbp),%rdi
call   1040 <matchUnit@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     1189 <CSSValueIsLength+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSSValueIsLength>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
xor    %ebx,%ebx
test   %rdi,%rdi
je     115c <CSSValueIsLength+0x3c>
lea    0x8(%rsp),%rdi
call   1030 <matchNumber@plt>
test   %rax,%rax
je     115c <CSSValueIsLength+0x3c>
lea    0x8(%rsp),%rdi
call   1040 <matchUnit@plt>
test   %rax,%rax
je     115c <CSSValueIsLength+0x3c>
mov    0x8(%rsp),%rax
xor    %ebx,%ebx
cmpb   $0x0,(%rax)
sete   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CSSValueIsLength(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %21
7: ; preds = %1
%8 = call i64 @matchNumber(i8** %3)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i64 @matchUnit(i8** %3)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br label %18
18: ; preds = %13, %10, %7
%19 = phi i1 [ false, %10 ], [ false, %7 ], [ %17, %13 ]
%20 = zext i1 %19 to i32
store i32 %20, i32* %2
br label %21
21: ; preds = %18, %6
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @CSSValueIsLength(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = icmp eq i8* %0, null
br i1 %3, label %15, label %4
4: ; preds = %1
%5 = call i64 @matchNumber(i8** %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = call i64 @matchUnit(i8** %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %4, %7, %10, %1
%16 = phi i32 [ 0, %1 ], [ 0, %7 ], [ 0, %4 ], [ %14, %10 ]
ret i32 %16
}