char **glob_filename(pathname)
char *pathname;
{
  char **result;
  unsigned int result_size;
  char *directory_name, *filename;
  unsigned int directory_len;
  result = (char **)malloc(sizeof(char *));
  result_size = 1;
  if (result == 0)
    return 0;
  result[0] = 0;
  filename = rindex(pathname, '/');
  if (filename == 0) {
    filename = pathname;
    directory_name = "";
    directory_len = 0;
  } else {
    directory_len = filename - pathname;
    directory_name = (char *)__builtin_alloca(directory_len + 1);
    bcopy(pathname, directory_name, directory_len);
    directory_name[directory_len] = '\0';
    ++filename;
  }
  if (glob_pattern_p(directory_name)) {
    char **directories;
    register unsigned int i;
    if (directory_name[directory_len - 1] == '/')
      directory_name[directory_len - 1] = '\0';
    directories = glob_filename(directory_name);
    if (directories == 0)
      goto memory_error;
    else if ((int)directories == -1)
      return (char **)-1;
    else if (*directories == 0) {
      free((char *)directories);
      return (char **)-1;
    }
    for (i = 0; directories[i] != 0; ++i) {
      char **temp_results = glob_vector(filename, directories[i]);
      if (temp_results == 0)
        goto memory_error;
      else if ((int)temp_results == -1)
        ;
      else {
        char **array = glob_dir_to_array(directories[i], temp_results);
        register unsigned int l;
        l = 0;
        while (array[l] != 0)
          ++l;
        result = (char **)realloc(result, (result_size + l) * sizeof(char *));
        if (result == 0)
          goto memory_error;
        for (l = 0; array[l] != 0; ++l)
          result[result_size++ - 1] = array[l];
        result[result_size - 1] = 0;
        free((char *)array);
      }
    }
    for (i = 0; directories[i]; i++)
      free(directories[i]);
    free((char *)directories);
    return result;
  }
  if (*filename == '\0') {
    result = (char **)realloc((char *)result, 2 * sizeof(char *));
    if (result == 0)
      return 0;
    result[0] = (char *)malloc(directory_len + 1);
    if (result[0] == 0)
      goto memory_error;
    bcopy(directory_name, result[0], directory_len + 1);
    result[1] = 0;
    return result;
  } else {
    char **temp_results =
        glob_vector(filename, (directory_len == 0 ? "." : directory_name));
    if (temp_results == 0 || (int)temp_results == -1)
      return temp_results;
    return glob_dir_to_array(directory_name, temp_results);
  }
memory_error:;
  if (result != 0) {
    register unsigned int i;
    for (i = 0; result[i] != 0; ++i)
      free(result[i]);
    free((char *)result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<glob_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11cc <glob_filename+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   10b0 <rindex@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1213 <glob_filename+0x83>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xdfe(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
jmp    1264 <glob_filename+0xd4>
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    $0x0,%al
call   10a0 <bcopy@plt>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1040 <glob_pattern_p@plt>
cmp    $0x0,%eax
je     149d <glob_filename+0x30d>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    12a1 <glob_filename+0x111>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
call   1050 <glob_filename@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12be <glob_filename+0x12e>
jmp    15b2 <glob_filename+0x422>
mov    -0x40(%rbp),%rax
cmp    $0xffffffff,%eax
jne    12db <glob_filename+0x14b>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x40(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1302 <glob_filename+0x172>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
jmp    1307 <glob_filename+0x177>
jmp    130c <glob_filename+0x17c>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1450 <glob_filename+0x2c0>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
mov    $0x0,%al
call   1060 <glob_vector@plt>
cltq
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1351 <glob_filename+0x1c1>
jmp    15b2 <glob_filename+0x422>
mov    -0x50(%rbp),%rax
cmp    $0xffffffff,%eax
jne    1363 <glob_filename+0x1d3>
jmp    1438 <glob_filename+0x2a8>
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
mov    -0x50(%rbp),%rsi
mov    $0x0,%al
call   1070 <glob_dir_to_array@plt>
cltq
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     13a6 <glob_filename+0x216>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1386 <glob_filename+0x1f6>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%eax
add    -0x5c(%rbp),%eax
mov    %eax,%eax
mov    %eax,%esi
shl    $0x3,%rsi
call   1090 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13d1 <glob_filename+0x241>
jmp    15b2 <glob_filename+0x422>
movl   $0x0,-0x5c(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     141b <glob_filename+0x28b>
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13d8 <glob_filename+0x248>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movq   $0x0,(%rax,%rcx,8)
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
jmp    143d <glob_filename+0x2ad>
jmp    1442 <glob_filename+0x2b2>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1313 <glob_filename+0x183>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1487 <glob_filename+0x2f7>
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1457 <glob_filename+0x2c7>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1534 <glob_filename+0x3a4>
mov    -0x18(%rbp),%rdi
mov    $0x10,%esi
call   1090 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14d7 <glob_filename+0x347>
movq   $0x0,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1503 <glob_filename+0x373>
jmp    15b2 <glob_filename+0x422>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x34(%rbp),%edx
add    $0x1,%edx
mov    $0x0,%al
call   10a0 <bcopy@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1556 <glob_filename+0x3c6>
lea    0xab3(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    155e <glob_filename+0x3ce>
mov    -0x28(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1060 <glob_vector@plt>
cltq
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
je     158b <glob_filename+0x3fb>
mov    -0x68(%rbp),%rax
cmp    $0xffffffff,%eax
jne    1598 <glob_filename+0x408>
mov    -0x68(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
mov    -0x28(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    $0x0,%al
call   1070 <glob_dir_to_array@plt>
cltq
mov    %rax,-0x8(%rbp)
jmp    1605 <glob_filename+0x475>
cmpq   $0x0,-0x18(%rbp)
je     15fd <glob_filename+0x46d>
movl   $0x0,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x6c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     15f4 <glob_filename+0x464>
mov    -0x18(%rbp),%rax
mov    -0x6c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    15c4 <glob_filename+0x434>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glob_filename>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
mov    $0x8,%edi
call   1080 <malloc@plt>
xor    %r13d,%r13d
test   %rax,%rax
je     144b <glob_filename+0x2bb>
mov    %rax,%r12
movq   $0x0,(%rax)
mov    %r14,%rdi
mov    $0x2f,%esi
call   10b0 <rindex@plt>
test   %rax,%rax
je     1215 <glob_filename+0x85>
mov    %rax,%rbx
mov    %rax,%r13
sub    %r14,%r13
lea    0x1(%r13),%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <bcopy@plt>
mov    %r13d,%eax
movb   $0x0,(%rax,%r15,1)
add    $0x1,%rbx
mov    %rbx,%r14
jmp    121c <glob_filename+0x8c>
lea    0xde5(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <glob_pattern_p@plt>
test   %eax,%eax
je     1356 <glob_filename+0x1c6>
add    $0xffffffff,%r13d
cmpb   $0x2f,(%r15,%r13,1)
jne    123e <glob_filename+0xae>
movb   $0x0,(%r15,%r13,1)
mov    %r15,%rdi
call   1050 <glob_filename@plt>
test   %rax,%rax
je     1399 <glob_filename+0x209>
mov    %rax,%r15
mov    $0xffffffffffffffff,%r13
cmp    $0xffffffff,%r15d
je     144b <glob_filename+0x2bb>
mov    (%r15),%rsi
test   %rsi,%rsi
je     1443 <glob_filename+0x2b3>
mov    %r14,-0x38(%rbp)
mov    $0x1,%r14d
mov    %r15,%rbx
mov    %r12,%r13
xor    %r12d,%r12d
mov    %r15,-0x30(%rbp)
jmp    12b6 <glob_filename+0x126>
mov    -0x30(%rbp),%r15
lea    -0x1(%r14),%eax
movq   $0x0,0x0(%r13,%rax,8)
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x1,%r12d
lea    (%r15,%r12,8),%rbx
mov    (%r15,%r12,8),%rsi
test   %rsi,%rsi
je     1417 <glob_filename+0x287>
mov    -0x38(%rbp),%rdi
xor    %eax,%eax
call   1060 <glob_vector@plt>
cmp    $0xffffffff,%eax
je     12a1 <glob_filename+0x111>
test   %eax,%eax
je     145d <glob_filename+0x2cd>
movslq %eax,%rsi
mov    (%rbx),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1070 <glob_dir_to_array@plt>
movslq %eax,%rbx
lea    -0x1(%r14),%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%ecx
add    $0x1,%r15d
add    $0x1,%eax
cmpq   $0x0,(%rbx,%rcx,8)
jne    12f0 <glob_filename+0x160>
mov    %eax,%esi
shl    $0x3,%rsi
mov    %r13,%rdi
call   1090 <realloc@plt>
test   %rax,%rax
je     13cc <glob_filename+0x23c>
mov    %rax,%r13
mov    (%rbx),%rcx
test   %rcx,%rcx
je     1288 <glob_filename+0xf8>
mov    $0x1,%eax
mov    -0x30(%rbp),%r15
lea    (%r14,%rax,1),%edx
add    $0xfffffffe,%edx
mov    %rcx,0x0(%r13,%rdx,8)
mov    %eax,%ecx
mov    (%rbx,%rcx,8),%rcx
add    $0x1,%eax
test   %rcx,%rcx
jne    1330 <glob_filename+0x1a0>
add    %eax,%r14d
add    $0xffffffff,%r14d
jmp    128c <glob_filename+0xfc>
cmpb   $0x0,(%r14)
je     13d1 <glob_filename+0x241>
test   %r13d,%r13d
lea    0xc9a(%rip),%rsi
cmovne %r15,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <glob_vector@plt>
movslq %eax,%r13
lea    0x1(%r13),%eax
cmp    $0x2,%eax
jb     144b <glob_filename+0x2bb>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <glob_dir_to_array@plt>
movslq %eax,%r13
jmp    144b <glob_filename+0x2bb>
mov    %r12,%r13
mov    0x0(%r13),%rdi
test   %rdi,%rdi
je     13c4 <glob_filename+0x234>
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    %ebx,%eax
mov    0x0(%r13,%rax,8),%rdi
add    $0x1,%ebx
test   %rdi,%rdi
jne    13b0 <glob_filename+0x220>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %r13d,%r13d
jmp    144b <glob_filename+0x2bb>
mov    $0x10,%esi
mov    %r12,%rdi
call   1090 <realloc@plt>
test   %rax,%rax
je     13cc <glob_filename+0x23c>
mov    %rax,%rbx
add    $0x1,%r13d
mov    %r13,%rdi
call   1080 <malloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     146b <glob_filename+0x2db>
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <bcopy@plt>
movq   $0x0,0x8(%rbx)
mov    %rbx,%r13
jmp    144b <glob_filename+0x2bb>
mov    (%r15),%rdi
test   %rdi,%rdi
je     1443 <glob_filename+0x2b3>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <free@plt>
mov    %ebx,%eax
mov    (%r15,%rax,8),%rdi
add    $0x1,%ebx
test   %rdi,%rdi
jne    1430 <glob_filename+0x2a0>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r13,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r13,%r13
jne    139c <glob_filename+0x20c>
jmp    13cc <glob_filename+0x23c>
mov    %rbx,%r13
jmp    13c4 <glob_filename+0x234>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c".\00"
define i8** @glob_filename(i8* %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i8**
%13 = alloca i32
%14 = alloca i8**
%15 = alloca i32
store i8* %0, i8** %3
%16 = call i8* @malloc(i64 8)
%17 = bitcast i8* %16 to i8**
store i8** %17, i8*** %4
store i32 1, i32* %5
%18 = load i8**, i8*** %4
%19 = icmp eq i8** %18, null
br i1 %19, label %20, label %21
20: ; preds = %1
store i8** null, i8*** %2
br label %292
21: ; preds = %1
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i64 0
store i8* null, i8** %23
%24 = load i8*, i8** %3
%25 = call i8* @rindex(i8* %24, i32 47)
store i8* %25, i8** %7
%26 = load i8*, i8** %7
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = load i8*, i8** %3
store i8* %29, i8** %7
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %8
br label %51
30: ; preds = %21
%31 = load i8*, i8** %7
%32 = load i8*, i8** %3
%33 = ptrtoint i8* %31 to i64
%34 = ptrtoint i8* %32 to i64
%35 = sub i64 %33, %34
%36 = trunc i64 %35 to i32
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = add i32 %37, 1
%39 = zext i32 %38 to i64
%40 = alloca i8, i64 %39
store i8* %40, i8** %6
%41 = load i8*, i8** %3
%42 = load i8*, i8** %6
%43 = load i32, i32* %8
%44 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %41, i8* %42, i32 %43)
%45 = load i8*, i8** %6
%46 = load i32, i32* %8
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
store i8 0, i8* %48
%49 = load i8*, i8** %7
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %7
br label %51
51: ; preds = %30, %28
%52 = load i8*, i8** %6
%53 = call i32 (i8*, ...) bitcast (i32 (...)* @glob_pattern_p to i32 (i8*, ...)*)(i8* %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %206
55: ; preds = %51
%56 = load i8*, i8** %6
%57 = load i32, i32* %8
%58 = sub i32 %57, 1
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 47
br i1 %63, label %64, label %70
64: ; preds = %55
%65 = load i8*, i8** %6
%66 = load i32, i32* %8
%67 = sub i32 %66, 1
%68 = zext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %65, i64 %68
store i8 0, i8* %69
br label %70
70: ; preds = %64, %55
%71 = load i8*, i8** %6
%72 = call i8** @glob_filename(i8* %71)
store i8** %72, i8*** %9
%73 = load i8**, i8*** %9
%74 = icmp eq i8** %73, null
br i1 %74, label %75, label %76
75: ; preds = %70
br label %268
76: ; preds = %70
%77 = load i8**, i8*** %9
%78 = ptrtoint i8** %77 to i32
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %81
80: ; preds = %76
store i8** inttoptr (i64 -1 to i8**), i8*** %2
br label %292
81: ; preds = %76
%82 = load i8**, i8*** %9
%83 = load i8*, i8** %82
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = load i8**, i8*** %9
%87 = bitcast i8** %86 to i8*
store i8** inttoptr (i64 -1 to i8**), i8*** %2
br label %292
88: ; preds = %81
br label %89
89: ; preds = %88
br label %90
90: ; preds = %89
store i32 0, i32* %10
br label %91
91: ; preds = %182, %90
%92 = load i8**, i8*** %9
%93 = load i32, i32* %10
%94 = zext i32 %93 to i64
%95 = getelementptr inbounds i8*, i8** %92, i64 %94
%96 = load i8*, i8** %95
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %185
98: ; preds = %91
%99 = load i8*, i8** %7
%100 = load i8**, i8*** %9
%101 = load i32, i32* %10
%102 = zext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %100, i64 %102
%104 = load i8*, i8** %103
%105 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @glob_vector to i32 (i8*, i8*, ...)*)(i8* %99, i8* %104)
%106 = sext i32 %105 to i64
%107 = inttoptr i64 %106 to i8**
store i8** %107, i8*** %11
%108 = load i8**, i8*** %11
%109 = icmp eq i8** %108, null
br i1 %109, label %110, label %111
110: ; preds = %98
br label %268
111: ; preds = %98
%112 = load i8**, i8*** %11
%113 = ptrtoint i8** %112 to i32
%114 = icmp eq i32 %113, -1
br i1 %114, label %115, label %116
115: ; preds = %111
br label %180
116: ; preds = %111
%117 = load i8**, i8*** %9
%118 = load i32, i32* %10
%119 = zext i32 %118 to i64
%120 = getelementptr inbounds i8*, i8** %117, i64 %119
%121 = load i8*, i8** %120
%122 = load i8**, i8*** %11
%123 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @glob_dir_to_array to i32 (i8*, i8**, ...)*)(i8* %121, i8** %122)
%124 = sext i32 %123 to i64
%125 = inttoptr i64 %124 to i8**
store i8** %125, i8*** %12
store i32 0, i32* %13
br label %126
126: ; preds = %133, %116
%127 = load i8**, i8*** %12
%128 = load i32, i32* %13
%129 = zext i32 %128 to i64
%130 = getelementptr inbounds i8*, i8** %127, i64 %129
%131 = load i8*, i8** %130
%132 = icmp ne i8* %131, null
br i1 %132, label %133, label %136
133: ; preds = %126
%134 = load i32, i32* %13
%135 = add i32 %134, 1
store i32 %135, i32* %13
br label %126
136: ; preds = %126
%137 = load i8**, i8*** %4
%138 = bitcast i8** %137 to i8*
%139 = load i32, i32* %5
%140 = load i32, i32* %13
%141 = add i32 %139, %140
%142 = zext i32 %141 to i64
%143 = mul i64 %142, 8
%144 = call i8* @realloc(i8* %138, i64 %143)
%145 = bitcast i8* %144 to i8**
store i8** %145, i8*** %4
%146 = load i8**, i8*** %4
%147 = icmp eq i8** %146, null
br i1 %147, label %148, label %149
148: ; preds = %136
br label %268
149: ; preds = %136
store i32 0, i32* %13
br label %150
150: ; preds = %169, %149
%151 = load i8**, i8*** %12
%152 = load i32, i32* %13
%153 = zext i32 %152 to i64
%154 = getelementptr inbounds i8*, i8** %151, i64 %153
%155 = load i8*, i8** %154
%156 = icmp ne i8* %155, null
br i1 %156, label %157, label %172
157: ; preds = %150
%158 = load i8**, i8*** %12
%159 = load i32, i32* %13
%160 = zext i32 %159 to i64
%161 = getelementptr inbounds i8*, i8** %158, i64 %160
%162 = load i8*, i8** %161
%163 = load i8**, i8*** %4
%164 = load i32, i32* %5
%165 = add i32 %164, 1
store i32 %165, i32* %5
%166 = sub i32 %164, 1
%167 = zext i32 %166 to i64
%168 = getelementptr inbounds i8*, i8** %163, i64 %167
store i8* %162, i8** %168
br label %169
169: ; preds = %157
%170 = load i32, i32* %13
%171 = add i32 %170, 1
store i32 %171, i32* %13
br label %150
172: ; preds = %150
%173 = load i8**, i8*** %4
%174 = load i32, i32* %5
%175 = sub i32 %174, 1
%176 = zext i32 %175 to i64
%177 = getelementptr inbounds i8*, i8** %173, i64 %176
store i8* null, i8** %177
%178 = load i8**, i8*** %12
%179 = bitcast i8** %178 to i8*
br label %180
180: ; preds = %172, %115
br label %181
181: ; preds = %180
br label %182
182: ; preds = %181
%183 = load i32, i32* %10
%184 = add i32 %183, 1
store i32 %184, i32* %10
br label %91
185: ; preds = %91
store i32 0, i32* %10
br label %186
186: ; preds = %199, %185
%187 = load i8**, i8*** %9
%188 = load i32, i32* %10
%189 = zext i32 %188 to i64
%190 = getelementptr inbounds i8*, i8** %187, i64 %189
%191 = load i8*, i8** %190
%192 = icmp ne i8* %191, null
br i1 %192, label %193, label %202
193: ; preds = %186
%194 = load i8**, i8*** %9
%195 = load i32, i32* %10
%196 = zext i32 %195 to i64
%197 = getelementptr inbounds i8*, i8** %194, i64 %196
%198 = load i8*, i8** %197
br label %199
199: ; preds = %193
%200 = load i32, i32* %10
%201 = add i32 %200, 1
store i32 %201, i32* %10
br label %186
202: ; preds = %186
%203 = load i8**, i8*** %9
%204 = bitcast i8** %203 to i8*
%205 = load i8**, i8*** %4
store i8** %205, i8*** %2
br label %292
206: ; preds = %51
%207 = load i8*, i8** %7
%208 = load i8, i8* %207
%209 = sext i8 %208 to i32
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %242
211: ; preds = %206
%212 = load i8**, i8*** %4
%213 = bitcast i8** %212 to i8*
%214 = call i8* @realloc(i8* %213, i64 16)
%215 = bitcast i8* %214 to i8**
store i8** %215, i8*** %4
%216 = load i8**, i8*** %4
%217 = icmp eq i8** %216, null
br i1 %217, label %218, label %219
218: ; preds = %211
store i8** null, i8*** %2
br label %292
219: ; preds = %211
%220 = load i32, i32* %8
%221 = add i32 %220, 1
%222 = zext i32 %221 to i64
%223 = call i8* @malloc(i64 %222)
%224 = load i8**, i8*** %4
%225 = getelementptr inbounds i8*, i8** %224, i64 0
store i8* %223, i8** %225
%226 = load i8**, i8*** %4
%227 = getelementptr inbounds i8*, i8** %226, i64 0
%228 = load i8*, i8** %227
%229 = icmp eq i8* %228, null
br i1 %229, label %230, label %231
230: ; preds = %219
br label %268
231: ; preds = %219
%232 = load i8*, i8** %6
%233 = load i8**, i8*** %4
%234 = getelementptr inbounds i8*, i8** %233, i64 0
%235 = load i8*, i8** %234
%236 = load i32, i32* %8
%237 = add i32 %236, 1
%238 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %232, i8* %235, i32 %237)
%239 = load i8**, i8*** %4
%240 = getelementptr inbounds i8*, i8** %239, i64 1
store i8* null, i8** %240
%241 = load i8**, i8*** %4
store i8** %241, i8*** %2
br label %292
242: ; preds = %206
%243 = load i8*, i8** %7
%244 = load i32, i32* %8
%245 = icmp eq i32 %244, 0
br i1 %245, label %246, label %247
246: ; preds = %242
br label %249
247: ; preds = %242
%248 = load i8*, i8** %6
br label %249
249: ; preds = %247, %246
%250 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %246 ], [ %248, %247 ]
%251 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @glob_vector to i32 (i8*, i8*, ...)*)(i8* %243, i8* %250)
%252 = sext i32 %251 to i64
%253 = inttoptr i64 %252 to i8**
store i8** %253, i8*** %14
%254 = load i8**, i8*** %14
%255 = icmp eq i8** %254, null
br i1 %255, label %260, label %256
256: ; preds = %249
%257 = load i8**, i8*** %14
%258 = ptrtoint i8** %257 to i32
%259 = icmp eq i32 %258, -1
br i1 %259, label %260, label %262
260: ; preds = %256, %249
%261 = load i8**, i8*** %14
store i8** %261, i8*** %2
br label %292
262: ; preds = %256
%263 = load i8*, i8** %6
%264 = load i8**, i8*** %14
%265 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @glob_dir_to_array to i32 (i8*, i8**, ...)*)(i8* %263, i8** %264)
%266 = sext i32 %265 to i64
%267 = inttoptr i64 %266 to i8**
store i8** %267, i8*** %2
br label %292
268: ; preds = %230, %148, %110, %75
%269 = load i8**, i8*** %4
%270 = icmp ne i8** %269, null
br i1 %270, label %271, label %291
271: ; preds = %268
store i32 0, i32* %15
br label %272
272: ; preds = %285, %271
%273 = load i8**, i8*** %4
%274 = load i32, i32* %15
%275 = zext i32 %274 to i64
%276 = getelementptr inbounds i8*, i8** %273, i64 %275
%277 = load i8*, i8** %276
%278 = icmp ne i8* %277, null
br i1 %278, label %279, label %288
279: ; preds = %272
%280 = load i8**, i8*** %4
%281 = load i32, i32* %15
%282 = zext i32 %281 to i64
%283 = getelementptr inbounds i8*, i8** %280, i64 %282
%284 = load i8*, i8** %283
br label %285
285: ; preds = %279
%286 = load i32, i32* %15
%287 = add i32 %286, 1
store i32 %287, i32* %15
br label %272
288: ; preds = %272
%289 = load i8**, i8*** %4
%290 = bitcast i8** %289 to i8*
br label %291
291: ; preds = %288, %268
store i8** null, i8*** %2
br label %292
292: ; preds = %291, %262, %260, %231, %218, %202, %85, %80, %20
%293 = load i8**, i8*** %2
ret i8** %293
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c".\00"
define i8** @glob_filename(i8* %0) {
%2 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%3 = bitcast i8* %2 to i8**
%4 = icmp eq i8* %2, null
br i1 %4, label %159, label %5
5: ; preds = %1
store i8* null, i8** %3
%6 = tail call i8* @rindex(i8* %0, i32 47)
%7 = icmp eq i8* %6, null
br i1 %7, label %20, label %8
8: ; preds = %5
%9 = ptrtoint i8* %6 to i64
%10 = ptrtoint i8* %0 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = add i64 %11, 1
%14 = and i64 %13, 4294967295
%15 = alloca i8, i64 %14
%16 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* %15, i32 %12)
%17 = and i64 %11, 4294967295
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
%19 = getelementptr inbounds i8, i8* %6, i64 1
br label %20
20: ; preds = %5, %8
%21 = phi i8* [ %19, %8 ], [ %0, %5 ]
%22 = phi i32 [ %12, %8 ], [ 0, %5 ]
%23 = phi i8* [ %15, %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %5 ]
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @glob_pattern_p to i32 (i8*, ...)*)(i8* %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %117, label %26
26: ; preds = %20
%27 = add i32 %22, -1
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %23, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 47
br i1 %31, label %32, label %33
32: ; preds = %26
store i8 0, i8* %29
br label %33
33: ; preds = %32, %26
%34 = call i8** @glob_filename(i8* %23)
%35 = icmp eq i8** %34, null
br i1 %35, label %144, label %36
36: ; preds = %33
%37 = ptrtoint i8** %34 to i64
%38 = trunc i64 %37 to i32
%39 = icmp eq i32 %38, -1
br i1 %39, label %159, label %40
40: ; preds = %36
%41 = load i8*, i8** %34
%42 = icmp eq i8* %41, null
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = bitcast i8** %34 to i8*
br label %159
45: ; preds = %99
%46 = load i8*, i8** %34
%47 = icmp eq i8* %46, null
br i1 %47, label %115, label %107
48: ; preds = %40, %99
%49 = phi i8* [ %105, %99 ], [ %41, %40 ]
%50 = phi i8** [ %104, %99 ], [ %34, %40 ]
%51 = phi i8** [ %101, %99 ], [ %3, %40 ]
%52 = phi i32 [ %100, %99 ], [ 1, %40 ]
%53 = phi i32 [ %102, %99 ], [ 0, %40 ]
%54 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @glob_vector to i32 (i8*, i8*, ...)*)(i8* %21, i8* %49)
switch i32 %54, label %55 [
i32 0, label %142
i32 -1, label %99
]
55: ; preds = %48
%56 = sext i32 %54 to i64
%57 = inttoptr i64 %56 to i8**
%58 = load i8*, i8** %50
%59 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @glob_dir_to_array to i32 (i8*, i8**, ...)*)(i8* %58, i8** %57)
%60 = sext i32 %59 to i64
%61 = inttoptr i64 %60 to i8**
br label %62
62: ; preds = %62, %55
%63 = phi i32 [ 0, %55 ], [ %68, %62 ]
%64 = zext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %61, i64 %64
%66 = load i8*, i8** %65
%67 = icmp eq i8* %66, null
%68 = add i32 %63, 1
br i1 %67, label %69, label %62
69: ; preds = %62
%70 = bitcast i8** %51 to i8*
%71 = add i32 %63, %52
%72 = zext i32 %71 to i64
%73 = shl nuw nsw i64 %72, 3
%74 = call i8* @realloc(i8* %70, i64 %73)
%75 = bitcast i8* %74 to i8**
%76 = icmp eq i8* %74, null
br i1 %76, label %159, label %77
77: ; preds = %69
%78 = load i8*, i8** %61
%79 = icmp eq i8* %78, null
br i1 %79, label %93, label %80
80: ; preds = %77, %80
%81 = phi i8* [ %91, %80 ], [ %78, %77 ]
%82 = phi i32 [ %88, %80 ], [ 0, %77 ]
%83 = phi i32 [ %84, %80 ], [ %52, %77 ]
%84 = add i32 %83, 1
%85 = add i32 %83, -1
%86 = zext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %75, i64 %86
store i8* %81, i8** %87
%88 = add i32 %82, 1
%89 = zext i32 %88 to i64
%90 = getelementptr inbounds i8*, i8** %61, i64 %89
%91 = load i8*, i8** %90
%92 = icmp eq i8* %91, null
br i1 %92, label %93, label %80
93: ; preds = %80, %77
%94 = phi i32 [ %52, %77 ], [ %84, %80 ]
%95 = add i32 %94, -1
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds i8*, i8** %75, i64 %96
store i8* null, i8** %97
%98 = inttoptr i64 %60 to i8*
br label %99
99: ; preds = %93, %48
%100 = phi i32 [ %94, %93 ], [ %52, %48 ]
%101 = phi i8** [ %75, %93 ], [ %51, %48 ]
%102 = add i32 %53, 1
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %34, i64 %103
%105 = load i8*, i8** %104
%106 = icmp eq i8* %105, null
br i1 %106, label %45, label %48
107: ; preds = %45, %107
%108 = phi i8* [ %113, %107 ], [ %46, %45 ]
%109 = phi i32 [ %110, %107 ], [ 0, %45 ]
%110 = add i32 %109, 1
%111 = zext i32 %110 to i64
%112 = getelementptr inbounds i8*, i8** %34, i64 %111
%113 = load i8*, i8** %112
%114 = icmp eq i8* %113, null
br i1 %114, label %115, label %107
115: ; preds = %107, %45
%116 = bitcast i8** %34 to i8*
br label %159
117: ; preds = %20
%118 = load i8, i8* %21
%119 = icmp eq i8 %118, 0
br i1 %119, label %120, label %132
120: ; preds = %117
%121 = call dereferenceable_or_null(16) i8* @realloc(i8* %2, i64 16)
%122 = bitcast i8* %121 to i8**
%123 = icmp eq i8* %121, null
br i1 %123, label %159, label %124
124: ; preds = %120
%125 = add i32 %22, 1
%126 = zext i32 %125 to i64
%127 = call i8* @malloc(i64 %126)
store i8* %127, i8** %122
%128 = icmp eq i8* %127, null
br i1 %128, label %156, label %129
129: ; preds = %124
%130 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %23, i8* %127, i32 %125)
%131 = getelementptr inbounds i8*, i8** %122, i64 1
store i8* null, i8** %131
br label %159
132: ; preds = %117
%133 = icmp eq i32 %22, 0
%134 = select i1 %133, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %23
%135 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @glob_vector to i32 (i8*, i8*, ...)*)(i8* %21, i8* %134)
%136 = sext i32 %135 to i64
%137 = inttoptr i64 %136 to i8**
switch i32 %135, label %138 [
i32 0, label %159
i32 -1, label %159
]
138: ; preds = %132
%139 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @glob_dir_to_array to i32 (i8*, i8**, ...)*)(i8* %23, i8** %137)
%140 = sext i32 %139 to i64
%141 = inttoptr i64 %140 to i8**
br label %159
142: ; preds = %48
%143 = icmp eq i8** %51, null
br i1 %143, label %159, label %144
144: ; preds = %33, %142
%145 = phi i8** [ %3, %33 ], [ %51, %142 ]
%146 = load i8*, i8** %145
%147 = icmp eq i8* %146, null
br i1 %147, label %156, label %148
148: ; preds = %144, %148
%149 = phi i8* [ %154, %148 ], [ %146, %144 ]
%150 = phi i32 [ %151, %148 ], [ 0, %144 ]
%151 = add i32 %150, 1
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds i8*, i8** %145, i64 %152
%154 = load i8*, i8** %153
%155 = icmp eq i8* %154, null
br i1 %155, label %156, label %148
156: ; preds = %148, %124, %144
%157 = phi i8** [ %145, %144 ], [ %122, %124 ], [ %145, %148 ]
%158 = bitcast i8** %157 to i8*
br label %159
159: ; preds = %69, %36, %115, %43, %142, %156, %138, %132, %132, %120, %1, %129
%160 = phi i8** [ %122, %129 ], [ null, %1 ], [ null, %120 ], [ %141, %138 ], [ %137, %132 ], [ %137, %132 ], [ null, %156 ], [ null, %142 ], [ inttoptr (i64 -1 to i8**), %36 ], [ %101, %115 ], [ inttoptr (i64 -1 to i8**), %43 ], [ null, %69 ]
ret i8** %160
}