#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 */
int /*<<< orphan*/ REG_EXTENDED;
int /*<<< orphan*/ assert(char const *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
int regexec(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/,
            int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int re_strcmp(const char *s, const char *mask) {
  assert(s);
  assert(mask);
  regex_t re;
  int ret;
  if (regcomp(&re, mask, REG_EXTENDED)) {
    return (-1);
  }
  ret = regexec(&re, s, 0, NULL, 0);
  regfree(&re);
  return (ret);
}


x86 assembly (clang, -O0):
<re_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rsi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rdi
call   1040 <regcomp@plt>
cmp    $0x0,%rax
je     118e <re_strcmp+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <re_strcmp+0x77>
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1060 <regexec@plt>
mov    %eax,-0x20(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <regfree@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_strcmp>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1050 <assert@plt>
mov    %rbp,%rdi
call   1050 <assert@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rdi
mov    %rbp,%rsi
call   1040 <regcomp@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    119c <re_strcmp+0x5c>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <regexec@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <regfree@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@REG_EXTENDED = global i32 0
define i32 @re_strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i32 @assert(i8* %8)
%10 = load i8*, i8** %5
%11 = call i32 @assert(i8* %10)
%12 = load i8*, i8** %5
%13 = load i32, i32* @REG_EXTENDED
%14 = call i64 @regcomp(i32* %6, i8* %12, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %22
17: ; preds = %2
%18 = load i8*, i8** %4
%19 = call i32 @regexec(i32* %6, i8* %18, i32 0, i32* null, i32 0)
store i32 %19, i32* %7
%20 = call i32 @regfree(i32* %6)
%21 = load i32, i32* %7
store i32 %21, i32* %3
br label %22
22: ; preds = %17, %16
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@REG_EXTENDED = global i32 0
define i32 @re_strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = tail call i32 @assert(i8* %0)
%5 = tail call i32 @assert(i8* %1)
%6 = bitcast i32* %3 to i8*
%7 = load i32, i32* @REG_EXTENDED
%8 = call i64 @regcomp(i32* %3, i8* %1, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @regexec(i32* %3, i8* %0, i32 0, i32* null, i32 0)
%12 = call i32 @regfree(i32* %3)
br label %13
13: ; preds = %2, %10
%14 = phi i32 [ %11, %10 ], [ -1, %2 ]
ret i32 %14
}