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

/* Variables and functions */
int /*<<< orphan*/ compileRegex(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ destroyRegex(int /*<<< orphan*/ *);
int executeRegex(int /*<<< orphan*/ *, char const *, char const *,
                 int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ hasMatched(int);
bool isSatisfyingRegex(const char *restrict string,
                       const char *restrict regex) {
  regex_t regexSupport;
  regmatch_t groups[2];
  int reti;
  char *size;
  bool retVal;
  compileRegex(&regexSupport, regex);
  reti = executeRegex(&regexSupport, regex, string, NULL, 0);
  if (hasMatched(reti)) {
    retVal = true;
  } else {
    retVal = false;
  }
  destroyRegex(&regexSupport);
  return retVal;
}


x86 assembly (clang, -O0):
<isSatisfyingRegex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
call   1030 <compileRegex@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0x14(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1060 <executeRegex@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <hasMatched@plt>
cmp    $0x0,%rax
je     1196 <isSatisfyingRegex+0x56>
movl   $0x1,-0x2c(%rbp)
jmp    119d <isSatisfyingRegex+0x5d>
movl   $0x0,-0x2c(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <destroyRegex@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSatisfyingRegex>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1030 <compileRegex@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <executeRegex@plt>
mov    %eax,%edi
call   1040 <hasMatched@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %r15,%rdi
call   1050 <destroyRegex@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @isSatisfyingRegex(i8* noalias %0, i8* noalias %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @compileRegex(i32* %5, i8* %10)
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = call i32 @executeRegex(i32* %5, i8* %12, i8* %13, i32* null, i32 0)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = call i64 @hasMatched(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 1, i32* %9
br label %20
19: ; preds = %2
store i32 0, i32* %9
br label %20
20: ; preds = %19, %18
%21 = call i32 @destroyRegex(i32* %5)
%22 = load i32, i32* %9
ret i32 %22
}

LLVM IR (-O2):
define i32 @isSatisfyingRegex(i8* noalias %0, i8* noalias %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @compileRegex(i32* %3, i8* %1)
%6 = call i32 @executeRegex(i32* %3, i8* %1, i8* %0, i32* null, i32 0)
%7 = call i64 @hasMatched(i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @destroyRegex(i32* %3)
ret i32 %9
}