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) + 1;
    directory_name = (char *)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 (temp_results == (char **)-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 || temp_results == (char **)-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    1610 <glob_filename+0x480>
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    1267 <glob_filename+0xd7>
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%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     14a4 <glob_filename+0x314>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    12a4 <glob_filename+0x114>
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    12c1 <glob_filename+0x131>
jmp    15bd <glob_filename+0x42d>
mov    -0x40(%rbp),%rax
cmp    $0xffffffff,%eax
jne    12de <glob_filename+0x14e>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
mov    -0x40(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1305 <glob_filename+0x175>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
jmp    130a <glob_filename+0x17a>
jmp    130f <glob_filename+0x17f>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1457 <glob_filename+0x2c7>
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    1354 <glob_filename+0x1c4>
jmp    15bd <glob_filename+0x42d>
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x50(%rbp)
jne    136a <glob_filename+0x1da>
jmp    143f <glob_filename+0x2af>
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     13ad <glob_filename+0x21d>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    138d <glob_filename+0x1fd>
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    13d8 <glob_filename+0x248>
jmp    15bd <glob_filename+0x42d>
movl   $0x0,-0x5c(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1422 <glob_filename+0x292>
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    13df <glob_filename+0x24f>
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    1444 <glob_filename+0x2b4>
jmp    1449 <glob_filename+0x2b9>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1316 <glob_filename+0x186>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     148e <glob_filename+0x2fe>
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    145e <glob_filename+0x2ce>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    153b <glob_filename+0x3ab>
mov    -0x18(%rbp),%rdi
mov    $0x10,%esi
call   1090 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14de <glob_filename+0x34e>
movq   $0x0,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
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    150a <glob_filename+0x37a>
jmp    15bd <glob_filename+0x42d>
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    1610 <glob_filename+0x480>
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    155d <glob_filename+0x3cd>
lea    0xaac(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    1565 <glob_filename+0x3d5>
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     1596 <glob_filename+0x406>
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x68(%rbp)
jne    15a3 <glob_filename+0x413>
mov    -0x68(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
mov    -0x28(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    $0x0,%al
call   1070 <glob_dir_to_array@plt>
cltq
mov    %rax,-0x8(%rbp)
jmp    1610 <glob_filename+0x480>
cmpq   $0x0,-0x18(%rbp)
je     1608 <glob_filename+0x478>
movl   $0x0,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x6c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     15ff <glob_filename+0x46f>
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    15cf <glob_filename+0x43f>
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     1213 <glob_filename+0x83>
mov    %rax,%rbx
sub    %r14d,%eax
lea    0x1(%rax),%r13d
add    $0x2,%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>
movb   $0x0,0x0(%r13,%r15,1)
add    $0x1,%rbx
mov    %rbx,%r14
jmp    121a <glob_filename+0x8a>
lea    0xde7(%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    123c <glob_filename+0xac>
movb   $0x0,(%r15,%r13,1)
mov    %r15,%rdi
call   1050 <glob_filename@plt>
test   %rax,%rax
je     139f <glob_filename+0x20f>
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    12be <glob_filename+0x12e>
cs nopw 0x0(%rax,%rax,1)
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     1422 <glob_filename+0x292>
mov    -0x38(%rbp),%rdi
xor    %eax,%eax
call   1060 <glob_vector@plt>
test   %eax,%eax
je     1417 <glob_filename+0x287>
movslq %eax,%rsi
cmp    $0xffffffffffffffff,%rsi
je     12a9 <glob_filename+0x119>
mov    (%rbx),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1070 <glob_dir_to_array@plt>
movslq %eax,%rbx
lea    -0x1(%r14),%eax
xchg   %ax,%ax
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     1290 <glob_filename+0x100>
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    1294 <glob_filename+0x104>
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
test   %r13d,%r13d
je     144b <glob_filename+0x2bb>
cmp    $0xffffffffffffffff,%r13
je     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
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     145d <glob_filename+0x2cd>
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>
test   %r13,%r13
jne    13a2 <glob_filename+0x212>
jmp    13cc <glob_filename+0x23c>
mov    (%r15),%rdi
test   %rdi,%rdi
je     1443 <glob_filename+0x2b3>
mov    $0x1,%ebx
nop
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
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 %291
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 %52
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 = add nsw i64 %35, 1
%37 = trunc i64 %36 to i32
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = add i32 %38, 1
%40 = zext i32 %39 to i64
%41 = alloca i8, i64 %40
store i8* %41, i8** %6
%42 = load i8*, i8** %3
%43 = load i8*, i8** %6
%44 = load i32, i32* %8
%45 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %42, i8* %43, i32 %44)
%46 = load i8*, i8** %6
%47 = load i32, i32* %8
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 0, i8* %49
%50 = load i8*, i8** %7
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %7
br label %52
52: ; preds = %30, %28
%53 = load i8*, i8** %6
%54 = call i32 (i8*, ...) bitcast (i32 (...)* @glob_pattern_p to i32 (i8*, ...)*)(i8* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %206
56: ; preds = %52
%57 = load i8*, i8** %6
%58 = load i32, i32* %8
%59 = sub i32 %58, 1
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %57, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 47
br i1 %64, label %65, label %71
65: ; preds = %56
%66 = load i8*, i8** %6
%67 = load i32, i32* %8
%68 = sub i32 %67, 1
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %66, i64 %69
store i8 0, i8* %70
br label %71
71: ; preds = %65, %56
%72 = load i8*, i8** %6
%73 = call i8** @glob_filename(i8* %72)
store i8** %73, i8*** %9
%74 = load i8**, i8*** %9
%75 = icmp eq i8** %74, null
br i1 %75, label %76, label %77
76: ; preds = %71
br label %267
77: ; preds = %71
%78 = load i8**, i8*** %9
%79 = ptrtoint i8** %78 to i32
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %82
81: ; preds = %77
store i8** inttoptr (i64 -1 to i8**), i8*** %2
br label %291
82: ; preds = %77
%83 = load i8**, i8*** %9
%84 = load i8*, i8** %83
%85 = icmp eq i8* %84, null
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = load i8**, i8*** %9
%88 = bitcast i8** %87 to i8*
store i8** inttoptr (i64 -1 to i8**), i8*** %2
br label %291
89: ; preds = %82
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
store i32 0, i32* %10
br label %92
92: ; preds = %182, %91
%93 = load i8**, i8*** %9
%94 = load i32, i32* %10
%95 = zext i32 %94 to i64
%96 = getelementptr inbounds i8*, i8** %93, i64 %95
%97 = load i8*, i8** %96
%98 = icmp ne i8* %97, null
br i1 %98, label %99, label %185
99: ; preds = %92
%100 = load i8*, i8** %7
%101 = load i8**, i8*** %9
%102 = load i32, i32* %10
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %101, i64 %103
%105 = load i8*, i8** %104
%106 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @glob_vector to i32 (i8*, i8*, ...)*)(i8* %100, i8* %105)
%107 = sext i32 %106 to i64
%108 = inttoptr i64 %107 to i8**
store i8** %108, i8*** %11
%109 = load i8**, i8*** %11
%110 = icmp eq i8** %109, null
br i1 %110, label %111, label %112
111: ; preds = %99
br label %267
112: ; preds = %99
%113 = load i8**, i8*** %11
%114 = icmp eq i8** %113, inttoptr (i64 -1 to i8**)
br i1 %114, label %115, label %116
115: ; preds = %112
br label %180
116: ; preds = %112
%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 %267
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 %92
185: ; preds = %92
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 %291
206: ; preds = %52
%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 %291
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 %267
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 %291
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 %259, label %256
256: ; preds = %249
%257 = load i8**, i8*** %14
%258 = icmp eq i8** %257, inttoptr (i64 -1 to i8**)
br i1 %258, label %259, label %261
259: ; preds = %256, %249
%260 = load i8**, i8*** %14
store i8** %260, i8*** %2
br label %291
261: ; preds = %256
%262 = load i8*, i8** %6
%263 = load i8**, i8*** %14
%264 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @glob_dir_to_array to i32 (i8*, i8**, ...)*)(i8* %262, i8** %263)
%265 = sext i32 %264 to i64
%266 = inttoptr i64 %265 to i8**
store i8** %266, i8*** %2
br label %291
267: ; preds = %230, %148, %111, %76
%268 = load i8**, i8*** %4
%269 = icmp ne i8** %268, null
br i1 %269, label %270, label %290
270: ; preds = %267
store i32 0, i32* %15
br label %271
271: ; preds = %284, %270
%272 = load i8**, i8*** %4
%273 = load i32, i32* %15
%274 = zext i32 %273 to i64
%275 = getelementptr inbounds i8*, i8** %272, i64 %274
%276 = load i8*, i8** %275
%277 = icmp ne i8* %276, null
br i1 %277, label %278, label %287
278: ; preds = %271
%279 = load i8**, i8*** %4
%280 = load i32, i32* %15
%281 = zext i32 %280 to i64
%282 = getelementptr inbounds i8*, i8** %279, i64 %281
%283 = load i8*, i8** %282
br label %284
284: ; preds = %278
%285 = load i32, i32* %15
%286 = add i32 %285, 1
store i32 %286, i32* %15
br label %271
287: ; preds = %271
%288 = load i8**, i8*** %4
%289 = bitcast i8** %288 to i8*
br label %290
290: ; preds = %287, %267
store i8** null, i8*** %2
br label %291
291: ; preds = %290, %261, %259, %231, %218, %202, %86, %81, %20
%292 = load i8**, i8*** %2
ret i8** %292
}

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