#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 */
scalar_t__ FNM_NOMATCH;
scalar_t__ fnmatch(char *, char *, int /*<<< orphan*/);
int do_test(void) {
  if (fnmatch("[[:alpha:]'[:alpha:]\0]", "a", 0) != FNM_NOMATCH)
    return 1;
  if (fnmatch("[a[.\0.]]", "a", 0) != FNM_NOMATCH)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xefa(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
mov    0x2eb4(%rip),%rcx
cmp    (%rcx),%rax
je     1149 <do_test+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1181 <do_test+0x71>
lea    0xec7(%rip),%rdi
lea    0xec9(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
je     117a <do_test+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    1181 <do_test+0x71>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xf01(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
mov    %rax,%rcx
mov    0x2eb8(%rip),%rbx
mov    $0x1,%eax
cmp    (%rbx),%rcx
jne    115a <do_test+0x4a>
lea    0xed6(%rip),%rdi
lea    0xed8(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    (%rbx),%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"[[:alpha:]'[:alpha:]\00]\00"
@.str.1 = [2 x i8] c"a\00"
@FNM_NOMATCH = global i64 0
@.str.2 = [9 x i8] c"[a[.\00.]]\00"
define i32 @do_test() {
%1 = alloca i32
%2 = call i64 @fnmatch(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = load i64, i64* @FNM_NOMATCH
%4 = icmp ne i64 %2, %3
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %12
6: ; preds = %0
%7 = call i64 @fnmatch(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0)
%8 = load i64, i64* @FNM_NOMATCH
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 1, i32* %1
br label %12
11: ; preds = %6
store i32 0, i32* %1
br label %12
12: ; preds = %11, %10, %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [23 x i8] c"[[:alpha:]'[:alpha:]\00]\00"
@.str.1 = [2 x i8] c"a\00"
@FNM_NOMATCH = global i64 0
@.str.2 = [9 x i8] c"[a[.\00.]]\00"
define i32 @do_test() {
%1 = tail call i64 @fnmatch(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0)
%2 = load i64, i64* @FNM_NOMATCH
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = tail call i64 @fnmatch(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0)
%6 = load i64, i64* @FNM_NOMATCH
%7 = icmp ne i64 %5, %6
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %0
%10 = phi i32 [ 1, %0 ], [ %8, %4 ]
ret i32 %10
}