#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 /*<<< orphan*/ DEBUG4(char *, char *, char const *, int);
int glob_pattern(char *, char const *);
int Globmatch(char *pattern, const char *str) {
  int result;
  if (pattern == 0)
    pattern = "";
  if (str == 0)
    str = "";
  result = glob_pattern(pattern, str);
  DEBUG4("Globmatch: '%s' to '%s' result %d", pattern, str, result);
  return (result);
}


x86 assembly (clang, -O0):
<Globmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1146 <Globmatch+0x26>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <Globmatch+0x3c>
lea    0xec9(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <glob_pattern@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xe82(%rip),%rdi
call   1030 <DEBUG4@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Globmatch>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rdi,%rdi
lea    0xef0(%rip),%rbx
cmove  %rbx,%r14
test   %rsi,%rsi
cmovne %rsi,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <glob_pattern@plt>
mov    %eax,%ebp
lea    0xeb0(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1030 <DEBUG4@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [34 x i8] c"Globmatch: '%s' to '%s' result %d\00"
define i32 @Globmatch(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
9: ; preds = %8, %2
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %9
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %4
br label %13
13: ; preds = %12, %9
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @glob_pattern(i8* %14, i8* %15)
store i32 %16, i32* %5
%17 = load i8*, i8** %3
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = call i32 @DEBUG4(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18, i32 %19)
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [34 x i8] c"Globmatch: '%s' to '%s' result %d\00"
define i32 @Globmatch(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%7 = tail call i32 @glob_pattern(i8* %4, i8* %6)
%8 = tail call i32 @DEBUG4(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %6, i32 %7)
ret i32 %7
}