#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 */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
scalar_t__ REG_NOMATCH;
int /*<<< orphan*/ REG_NOSUB;
scalar_t__ regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
scalar_t__ regexec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int is_cxl_adapter_filename(char *name) {
  int rc;
  regex_t preg;
  if (*name != 'c')
    return 0;
  if (regcomp(&preg, "^card[0-9]\\+$", REG_NOSUB))
    return 0;
  rc = (regexec(&preg, name, 0, NULL, 0) != REG_NOMATCH);
  regfree(&preg);
  return rc;
}


x86 assembly (clang, -O0):
<is_cxl_adapter_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
je     1158 <is_cxl_adapter_filename+0x28>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <is_cxl_adapter_filename+0x92>
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1040 <regcomp@plt>
cmp    $0x0,%rax
je     1187 <is_cxl_adapter_filename+0x57>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <is_cxl_adapter_filename+0x92>
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1050 <regexec@plt>
mov    0x2e43(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <regfree@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_cxl_adapter_filename>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
cmpb   $0x63,(%rdi)
jne    1190 <is_cxl_adapter_filename+0x60>
mov    %rdi,%r14
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <regcomp@plt>
test   %rax,%rax
jne    1190 <is_cxl_adapter_filename+0x60>
lea    0xc(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    0x2e68(%rip),%rcx
xor    %ebx,%ebx
cmp    (%rcx),%rax
setne  %bl
mov    %r15,%rdi
call   1030 <regfree@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"^card[0-9]\\+$\00"
@REG_NOSUB = global i32 0
@REG_NOMATCH = global i64 0
define i32 @is_cxl_adapter_filename(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 99
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %24
11: ; preds = %1
%12 = load i32, i32* @REG_NOSUB
%13 = call i64 @regcomp(i32* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %2
br label %24
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i64 @regexec(i32* %5, i8* %17, i32 0, i32* null, i32 0)
%19 = load i64, i64* @REG_NOMATCH
%20 = icmp ne i64 %18, %19
%21 = zext i1 %20 to i32
store i32 %21, i32* %4
%22 = call i32 @regfree(i32* %5)
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %24
24: ; preds = %16, %15, %10
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [14 x i8] c"^card[0-9]\\+$\00"
@REG_NOSUB = global i32 0
@REG_NOMATCH = global i64 0
define i32 @is_cxl_adapter_filename(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 99
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* @REG_NOSUB
%8 = call i64 @regcomp(i32* %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = call i64 @regexec(i32* %2, i8* %0, i32 0, i32* null, i32 0)
%12 = load i64, i64* @REG_NOMATCH
%13 = icmp ne i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @regfree(i32* %2)
br label %16
16: ; preds = %6, %1, %10
%17 = phi i32 [ %14, %10 ], [ 0, %1 ], [ 0, %6 ]
ret i32 %17
}