#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 RegexFind(char *, char *, int *, int *);
char *WildCharToRegex(char *);
int /*<<< orphan*/ free(char *);
int WildCharFind(char *string, char *find_expression, int *start, int *length) {
  char *regex_expr;
  int result;
  regex_expr = WildCharToRegex(find_expression);
  if (regex_expr == NULL)
    return 0;
  result = RegexFind(string, regex_expr, start, length);
  free(regex_expr);
  return result;
}


x86 assembly (clang, -O0):
<WildCharFind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <WildCharToRegex@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    116c <WildCharFind+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1193 <WildCharFind+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <RegexFind@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WildCharFind>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%r12
mov    %rsi,%rdi
call   1050 <WildCharToRegex@plt>
test   %rax,%rax
je     1170 <WildCharFind+0x40>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <RegexFind@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    1172 <WildCharFind+0x42>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @WildCharFind(i8* %0, i8* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%12 = load i8*, i8** %7
%13 = call i8* @WildCharToRegex(i8* %12)
store i8* %13, i8** %10
%14 = load i8*, i8** %10
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 0, i32* %5
br label %26
17: ; preds = %4
%18 = load i8*, i8** %6
%19 = load i8*, i8** %10
%20 = load i32*, i32** %8
%21 = load i32*, i32** %9
%22 = call i32 @RegexFind(i8* %18, i8* %19, i32* %20, i32* %21)
store i32 %22, i32* %11
%23 = load i8*, i8** %10
%24 = call i32 @free(i8* %23)
%25 = load i32, i32* %11
store i32 %25, i32* %5
br label %26
26: ; preds = %17, %16
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @WildCharFind(i8* %0, i8* %1, i32* %2, i32* %3) {
%5 = tail call i8* @WildCharToRegex(i8* %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @RegexFind(i8* %0, i8* %5, i32* %2, i32* %3)
%9 = tail call i32 @free(i8* %5)
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ %8, %7 ], [ 0, %4 ]
ret i32 %11
}