#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*/ FNM_NOESCAPE;
scalar_t__ FNM_NOMATCH;
int /*<<< orphan*/ FNM_PATHNAME;
int /*<<< orphan*/ FNM_PERIOD;
scalar_t__ fnmatch(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int const);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  const int t1 = (fnmatch("a*", "abc", 0) == 0);
  const int t2 = (fnmatch("d*/*1", "d/s/1", FNM_PATHNAME) == FNM_NOMATCH);
  const int t3 = (fnmatch("a\\bc", "abc", 0) == 0);
  const int t4 = (fnmatch("a\\bc", "abc", FNM_NOESCAPE) == FNM_NOMATCH);
  const int t5 = (fnmatch("*x", ".x", 0) == 0);
  const int t6 = (fnmatch("*x", ".x", FNM_PERIOD) == FNM_NOMATCH);
  fprintf(stderr, "t1=%i\n", t1);
  fprintf(stderr, "t2=%i\n", t2);
  fprintf(stderr, "t3=%i\n", t3);
  fprintf(stderr, "t4=%i\n", t4);
  fprintf(stderr, "t5=%i\n", t5);
  fprintf(stderr, "t6=%i\n", t6);
  return !(t1 && t2 && t3 && t4 && t5 && t6);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    0xebf(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%edx
lea    0xe9d(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <fnmatch@plt>
mov    0x2e63(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
lea    0xe81(%rip),%rdi
lea    0xe6a(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e42(%rip),%rax
mov    (%rax),%edx
lea    0xe54(%rip),%rdi
lea    0xe3d(%rip),%rsi
call   1030 <fnmatch@plt>
mov    0x2e0e(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
lea    0xe31(%rip),%rdi
lea    0xe2d(%rip),%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    0x2dc5(%rip),%rax
mov    (%rax),%edx
lea    0xe04(%rip),%rdi
lea    0xe00(%rip),%rsi
call   1030 <fnmatch@plt>
mov    0x2db9(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xdd6(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xdc5(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xdb4(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xda3(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%edx
lea    0xd92(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xd81(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x29(%rbp)
je     131a <main+0x1fa>
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x29(%rbp)
je     131a <main+0x1fa>
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x29(%rbp)
je     131a <main+0x1fa>
xor    %eax,%eax
cmpl   $0x0,-0x20(%rbp)
mov    %al,-0x29(%rbp)
je     131a <main+0x1fa>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x29(%rbp)
je     131a <main+0x1fa>
cmpl   $0x0,-0x28(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0xeca(%rip),%r14
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,0x4(%rsp)
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
lea    0xea8(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1030 <fnmatch@plt>
mov    0x2e6e(%rip),%rcx
xor    %r12d,%r12d
cmp    (%rcx),%rax
mov    %rcx,%rbx
sete   %r12b
lea    0xe8d(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
xor    %r13d,%r13d
test   %rax,%rax
sete   %r13b
mov    0x2e54(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <fnmatch@plt>
xor    %r15d,%r15d
cmp    (%rbx),%rax
sete   %r15b
lea    0xe56(%rip),%rbx
lea    0xe52(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    0x2dea(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fnmatch@plt>
xor    %ebx,%ebx
mov    0x2de4(%rip),%rcx
cmp    (%rcx),%rax
sete   %bl
mov    0x2dbf(%rip),%r14
mov    (%r14),%edi
lea    0xe0b(%rip),%rsi
mov    0x4(%rsp),%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xdff(%rip),%rsi
mov    %r12d,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xdf4(%rip),%rsi
mov    %r13d,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xde9(%rip),%rsi
mov    %r15d,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xdde(%rip),%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xdd4(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
and    0x4(%rsp),%r13b
and    %r13b,%r12b
and    %r15b,%bpl
and    %r12b,%bpl
and    %bpl,%bl
xor    $0x1,%bl
movzbl %bl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"a*\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [6 x i8] c"d*/*1\00"
@.str.3 = [6 x i8] c"d/s/1\00"
@FNM_PATHNAME = global i32 0
@FNM_NOMATCH = global i64 0
@.str.4 = [5 x i8] c"a\\bc\00"
@FNM_NOESCAPE = global i32 0
@.str.5 = [3 x i8] c"*x\00"
@.str.6 = [3 x i8] c".x\00"
@FNM_PERIOD = global i32 0
@stderr = global i32 0
@.str.7 = [7 x i8] c"t1=%i\0A\00"
@.str.8 = [7 x i8] c"t2=%i\0A\00"
@.str.9 = [7 x i8] c"t3=%i\0A\00"
@.str.10 = [7 x i8] c"t4=%i\0A\00"
@.str.11 = [7 x i8] c"t5=%i\0A\00"
@.str.12 = [7 x i8] c"t6=%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* @FNM_PATHNAME
%16 = call i64 @fnmatch(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = load i64, i64* @FNM_NOMATCH
%18 = icmp eq i64 %16, %17
%19 = zext i1 %18 to i32
store i32 %19, i32* %7
%20 = call i64 @fnmatch(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
store i32 %22, i32* %8
%23 = load i32, i32* @FNM_NOESCAPE
%24 = call i64 @fnmatch(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i64, i64* @FNM_NOMATCH
%26 = icmp eq i64 %24, %25
%27 = zext i1 %26 to i32
store i32 %27, i32* %9
%28 = call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 0)
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
store i32 %30, i32* %10
%31 = load i32, i32* @FNM_PERIOD
%32 = call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = load i64, i64* @FNM_NOMATCH
%34 = icmp eq i64 %32, %33
%35 = zext i1 %34 to i32
store i32 %35, i32* %11
%36 = load i32, i32* @stderr
%37 = load i32, i32* %6
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = load i32, i32* @stderr
%40 = load i32, i32* %7
%41 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @stderr
%43 = load i32, i32* %8
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %43)
%45 = load i32, i32* @stderr
%46 = load i32, i32* %9
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @stderr
%49 = load i32, i32* %10
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %49)
%51 = load i32, i32* @stderr
%52 = load i32, i32* %11
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %6
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %71
56: ; preds = %2
%57 = load i32, i32* %7
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %71
59: ; preds = %56
%60 = load i32, i32* %8
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %71
62: ; preds = %59
%63 = load i32, i32* %9
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load i32, i32* %10
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i32, i32* %11
%70 = icmp ne i32 %69, 0
br label %71
71: ; preds = %68, %65, %62, %59, %56, %2
%72 = phi i1 [ false, %65 ], [ false, %62 ], [ false, %59 ], [ false, %56 ], [ false, %2 ], [ %70, %68 ]
%73 = xor i1 %72, true
%74 = zext i1 %73 to i32
ret i32 %74
}

LLVM IR (-O2):
@.str = [3 x i8] c"a*\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [6 x i8] c"d*/*1\00"
@.str.3 = [6 x i8] c"d/s/1\00"
@FNM_PATHNAME = global i32 0
@FNM_NOMATCH = global i64 0
@.str.4 = [5 x i8] c"a\\bc\00"
@FNM_NOESCAPE = global i32 0
@.str.5 = [3 x i8] c"*x\00"
@.str.6 = [3 x i8] c".x\00"
@FNM_PERIOD = global i32 0
@stderr = global i32 0
@.str.7 = [7 x i8] c"t1=%i\0A\00"
@.str.8 = [7 x i8] c"t2=%i\0A\00"
@.str.9 = [7 x i8] c"t3=%i\0A\00"
@.str.10 = [7 x i8] c"t4=%i\0A\00"
@.str.11 = [7 x i8] c"t5=%i\0A\00"
@.str.12 = [7 x i8] c"t6=%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = load i32, i32* @FNM_PATHNAME
%7 = tail call i64 @fnmatch(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = load i64, i64* @FNM_NOMATCH
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i64 @fnmatch(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = load i32, i32* @FNM_NOESCAPE
%15 = tail call i64 @fnmatch(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i64, i64* @FNM_NOMATCH
%17 = icmp eq i64 %15, %16
%18 = zext i1 %17 to i32
%19 = tail call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 0)
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = load i32, i32* @FNM_PERIOD
%23 = tail call i64 @fnmatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %22)
%24 = load i64, i64* @FNM_NOMATCH
%25 = icmp eq i64 %23, %24
%26 = zext i1 %25 to i32
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %5)
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %10)
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %13)
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 %18)
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %21)
%37 = load i32, i32* @stderr
%38 = tail call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %26)
%39 = select i1 %4, i1 %9, i1 false
%40 = select i1 %39, i1 %12, i1 false
%41 = select i1 %40, i1 %17, i1 false
%42 = select i1 %41, i1 %20, i1 false
%43 = select i1 %42, i1 %25, i1 false
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
ret i32 %45
}