#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_PATHNAME;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test(char *, char const *, int /*<<< orphan*/);
int main() {
  const char path1[] = "home/viric/hola";
  const char path2[] = "home/viric/.xa/2";
  printf("nothing:\n");
  test("home/*", path1, 0);
  test("home/*", path2, 0);
  test("home/viric*", path1, 0);
  test("home/viric*", path2, 0);
  test("home/viric/*", path1, 0);
  test("home/viric/*", path2, 0);
  test("home/viric/", path1, 0);
  test("home/viric/", path2, 0);
  test("home*", path2, 0);
  test("home/", path2, 0);
  test("ho", path1, 0);
  test("home/vi", path1, 0);
  printf("FNM_PATHNAME:\n");
  test("home/*", path1, FNM_PATHNAME);
  test("home/*", path2, FNM_PATHNAME);
  test("home/viric*", path1, FNM_PATHNAME);
  test("home/viric*", path2, FNM_PATHNAME);
  test("home/viric/*", path1, FNM_PATHNAME);
  test("home/viric/*", path2, FNM_PATHNAME);
  test("home/viric/", path1, FNM_PATHNAME);
  test("home/viric/", path2, FNM_PATHNAME);
  test("home*", path2, FNM_PATHNAME);
  test("home/", path2, FNM_PATHNAME);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xebf(%rip),%al
mov    %al,-0x30(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb0(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe9e(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
lea    0xe93(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe81(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
lea    0xe7b(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe69(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
lea    0xe64(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe52(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe4c(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
lea    0xe40(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
lea    0xe34(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
lea    0xe25(%rip),%rdi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    0x2d79(%rip),%rax
mov    (%rax),%edx
lea    0xdc3(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2d60(%rip),%rax
mov    (%rax),%edx
lea    0xdaa(%rip),%rdi
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
mov    0x2d47(%rip),%rax
mov    (%rax),%edx
lea    0xd98(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
lea    0xd7f(%rip),%rdi
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
mov    0x2d15(%rip),%rax
mov    (%rax),%edx
lea    0xd72(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2cfc(%rip),%rax
mov    (%rax),%edx
lea    0xd59(%rip),%rdi
call   1040 <test@plt>
lea    -0x20(%rbp),%rsi
mov    0x2ce3(%rip),%rax
mov    (%rax),%edx
lea    0xd4d(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2cca(%rip),%rax
mov    (%rax),%edx
lea    0xd34(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2cb1(%rip),%rax
mov    (%rax),%edx
lea    0xd27(%rip),%rdi
call   1040 <test@plt>
lea    -0x40(%rbp),%rsi
mov    0x2c98(%rip),%rax
mov    (%rax),%edx
lea    0xd14(%rip),%rdi
call   1040 <test@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xf13(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%r12
lea    0x20(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
mov    %rsp,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xea2(%rip),%r13
mov    %r13,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe8d(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe79(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe64(%rip),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe59(%rip),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe4e(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe40(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <test@plt>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d9f(%rip),%r15
mov    (%r15),%edx
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
lea    0xdb9(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
lea    0xda3(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
lea    0xd8c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    (%r15),%edx
lea    0xd80(%rip),%rdi
mov    %rbx,%rsi
call   1040 <test@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.path1 = [16 x i8] c"home/viric/hola\00"
@__const.main.path2 = [17 x i8] c"home/viric/.xa/2\00"
@.str = [10 x i8] c"nothing:\0A\00"
@.str.1 = [7 x i8] c"home/*\00"
@.str.2 = [12 x i8] c"home/viric*\00"
@.str.3 = [13 x i8] c"home/viric/*\00"
@.str.4 = [12 x i8] c"home/viric/\00"
@.str.5 = [6 x i8] c"home*\00"
@.str.6 = [6 x i8] c"home/\00"
@.str.7 = [3 x i8] c"ho\00"
@.str.8 = [8 x i8] c"home/vi\00"
@.str.9 = [15 x i8] c"FNM_PATHNAME:\0A\00"
@FNM_PATHNAME = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [17 x i8]
store i32 0, i32* %1
%4 = bitcast [16 x i8]* %2 to i8*
%5 = bitcast [17 x i8]* %3 to i8*
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%8 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 0)
%9 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%10 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 0)
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %11, i32 0)
%13 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%14 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %13, i32 0)
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%16 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %15, i32 0)
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%18 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %17, i32 0)
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%20 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %19, i32 0)
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%22 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %21, i32 0)
%23 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%24 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %23, i32 0)
%25 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%26 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %25, i32 0)
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%28 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %27, i32 0)
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%30 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %29, i32 0)
%31 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%33 = load i32, i32* @FNM_PATHNAME
%34 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %32, i32 %33)
%35 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%36 = load i32, i32* @FNM_PATHNAME
%37 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %35, i32 %36)
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%39 = load i32, i32* @FNM_PATHNAME
%40 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %38, i32 %39)
%41 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%42 = load i32, i32* @FNM_PATHNAME
%43 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %41, i32 %42)
%44 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%45 = load i32, i32* @FNM_PATHNAME
%46 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %44, i32 %45)
%47 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%48 = load i32, i32* @FNM_PATHNAME
%49 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %47, i32 %48)
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%51 = load i32, i32* @FNM_PATHNAME
%52 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %50, i32 %51)
%53 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%54 = load i32, i32* @FNM_PATHNAME
%55 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %53, i32 %54)
%56 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%57 = load i32, i32* @FNM_PATHNAME
%58 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %56, i32 %57)
%59 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%60 = load i32, i32* @FNM_PATHNAME
%61 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %59, i32 %60)
ret i32 0
}

LLVM IR (-O2):
@__const.main.path1 = [16 x i8] c"home/viric/hola\00"
@__const.main.path2 = [17 x i8] c"home/viric/.xa/2\00"
@.str.1 = [7 x i8] c"home/*\00"
@.str.2 = [12 x i8] c"home/viric*\00"
@.str.3 = [13 x i8] c"home/viric/*\00"
@.str.4 = [12 x i8] c"home/viric/\00"
@.str.5 = [6 x i8] c"home*\00"
@.str.6 = [6 x i8] c"home/\00"
@.str.7 = [3 x i8] c"ho\00"
@.str.8 = [8 x i8] c"home/vi\00"
@FNM_PATHNAME = global i32 0
@str = [9 x i8] c"nothing:\00"
@str.10 = [14 x i8] c"FNM_PATHNAME:\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [17 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 0)
%7 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 0)
%8 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 0)
%9 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 0)
%10 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %3, i32 0)
%11 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 0)
%12 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %3, i32 0)
%13 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %4, i32 0)
%14 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %4, i32 0)
%15 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %4, i32 0)
%16 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %3, i32 0)
%17 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %3, i32 0)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0))
%19 = load i32, i32* @FNM_PATHNAME
%20 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %19)
%21 = load i32, i32* @FNM_PATHNAME
%22 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %21)
%23 = load i32, i32* @FNM_PATHNAME
%24 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 %23)
%25 = load i32, i32* @FNM_PATHNAME
%26 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 %25)
%27 = load i32, i32* @FNM_PATHNAME
%28 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %3, i32 %27)
%29 = load i32, i32* @FNM_PATHNAME
%30 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 %29)
%31 = load i32, i32* @FNM_PATHNAME
%32 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %3, i32 %31)
%33 = load i32, i32* @FNM_PATHNAME
%34 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %4, i32 %33)
%35 = load i32, i32* @FNM_PATHNAME
%36 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %4, i32 %35)
%37 = load i32, i32* @FNM_PATHNAME
%38 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %4, i32 %37)
ret i32 0
}