#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 */
struct stat {
  int /*<<< orphan*/ st_mode;
};
struct dirent {
  int /*<<< orphan*/ d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ S_ISREG(int /*<<< orphan*/);
int asprintf(char **, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int stat(char *, struct stat *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int fs_list_files(char *dir_name, char *array[], int length, int index) {
  DIR *dir;
  struct stat st;
  struct dirent *ep;
  char *full_path;
  char *next_dir;
  dir = opendir(dir_name);
  if (dir == NULL) {
    return -1;
  }
  while (ep = readdir(dir)) {
    if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) {
      continue;
    }
    if (asprintf(&full_path, "%s/%s", dir_name, ep->d_name) == -1) {
      closedir(dir);
      return -1;
    }
    if (stat(full_path, &st) == -1) {
      free(full_path);
      closedir(dir);
      return -1;
    }
    if (S_ISREG(st.st_mode) != 0) {
      array[index] = malloc(strlen(full_path) + 1);
      if (array[index] == NULL) {
        free(full_path);
        closedir(dir);
        return -1;
      }
      strcpy(array[index], full_path);
      index++;
      if (length <= index) {
        free(full_path);
        closedir(dir);
        return -1;
      }
    } else if (S_ISLNK(st.st_mode) == 0) {
      next_dir = malloc(strlen(full_path) + 1);
      if (next_dir == NULL) {
        free(full_path);
        closedir(dir);
        return -1;
      }
      strcpy(next_dir, full_path);
      index = fs_list_files(next_dir, array, length, index);
      free(next_dir);
      if (index == -1) {
        free(full_path);
        closedir(dir);
        return -1;
      }
    }
    free(full_path);
  }
  closedir(dir);
  return index;
}


x86 assembly (clang, -O0):
<fs_list_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    120a <fs_list_files+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
jmp    120f <fs_list_files+0x3f>
mov    -0x28(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1443 <fs_list_files+0x273>
mov    -0x38(%rbp),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     125e <fs_list_files+0x8e>
mov    -0x38(%rbp),%rax
mov    (%rax),%edi
lea    0xdb1(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <fs_list_files+0x93>
jmp    120f <fs_list_files+0x3f>
mov    -0x10(%rbp),%rdx
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
lea    -0x40(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   10f0 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    129b <fs_list_files+0xcb>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
mov    -0x40(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10b0 <stat@plt>
cmp    $0xffffffff,%eax
jne    12cf <fs_list_files+0xff>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
mov    -0x30(%rbp),%edi
call   10c0 <S_ISREG@plt>
cmp    $0x0,%rax
je     1383 <fs_list_files+0x1b3>
mov    -0x40(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10e0 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1336 <fs_list_files+0x166>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     137e <fs_list_files+0x1ae>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
jmp    1435 <fs_list_files+0x265>
mov    -0x30(%rbp),%edi
call   1060 <S_ISLNK@plt>
cmp    $0x0,%rax
jne    1430 <fs_list_files+0x260>
mov    -0x40(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10e0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13d7 <fs_list_files+0x207>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <fs_list_files@plt>
mov    %eax,-0x20(%rbp)
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
cmpl   $0xffffffff,-0x20(%rbp)
jne    142b <fs_list_files+0x25b>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <fs_list_files+0x282>
jmp    1430 <fs_list_files+0x260>
jmp    1435 <fs_list_files+0x265>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
jmp    120f <fs_list_files+0x3f>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_list_files>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r13d
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%r12
call   1070 <opendir@plt>
test   %rax,%rax
je     1225 <fs_list_files+0x55>
mov    %rax,%rbx
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1387 <fs_list_files+0x1b7>
mov    %rax,%rbp
mov    %r12,0x20(%rsp)
mov    %r14,0x18(%rsp)
lea    0xde5(%rip),%r12
lea    0xddd(%rip),%r14
jmp    1264 <fs_list_files+0x94>
mov    $0xffffffff,%r13d
jmp    138f <fs_list_files+0x1bf>
mov    %ebp,%edi
call   1060 <S_ISLNK@plt>
test   %rax,%rax
je     1319 <fs_list_files+0x149>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10d0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1387 <fs_list_files+0x1b7>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1250 <fs_list_files+0x80>
mov    0x0(%rbp),%edi
mov    %r14,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1250 <fs_list_files+0x80>
mov    0x0(%rbp),%ecx
lea    0x8(%rsp),%rdi
lea    0xd70(%rip),%rsi
mov    0x20(%rsp),%rdx
call   10f0 <asprintf@plt>
cmp    $0xffffffff,%eax
je     1381 <fs_list_files+0x1b1>
mov    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10b0 <stat@plt>
cmp    $0xffffffff,%eax
je     1374 <fs_list_files+0x1a4>
mov    0x10(%rsp),%ebp
mov    %ebp,%edi
call   10c0 <S_ISREG@plt>
test   %rax,%rax
je     1230 <fs_list_files+0x60>
mov    %r15d,%ebp
mov    0x8(%rsp),%r15
mov    %r15,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdi
call   10e0 <malloc@plt>
movslq %r13d,%rcx
mov    0x18(%rsp),%rdx
mov    %rax,(%rdx,%rcx,8)
test   %rax,%rax
je     1379 <fs_list_files+0x1a9>
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
add    $0x1,%r13d
mov    %ebp,%r15d
cmp    %ebp,%r13d
jl     1240 <fs_list_files+0x70>
jmp    1374 <fs_list_files+0x1a4>
mov    %r15d,0x14(%rsp)
mov    0x8(%rsp),%r15
mov    %r15,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdi
call   10e0 <malloc@plt>
test   %rax,%rax
je     1379 <fs_list_files+0x1a9>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
mov    0x14(%rsp),%r15d
mov    %r15d,%edx
mov    %r13d,%ecx
call   1030 <fs_list_files@plt>
mov    %eax,%r13d
mov    %rbp,%rdi
call   1040 <free@plt>
cmp    $0xffffffff,%r13d
jne    1240 <fs_list_files+0x70>
mov    0x8(%rsp),%r15
mov    %r15,%rdi
call   1040 <free@plt>
mov    $0xffffffff,%r13d
mov    %rbx,%rdi
call   1090 <closedir@plt>
mov    %r13d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [6 x i8] c"%s/%s\00"
define i32 @fs_list_files(i8* %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca %struct.stat
%12 = alloca %struct.dirent*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%15 = load i8*, i8** %6
%16 = call i32* @opendir(i8* %15)
store i32* %16, i32** %10
%17 = load i32*, i32** %10
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %20
19: ; preds = %4
store i32 -1, i32* %5
br label %145
20: ; preds = %4
br label %21
21: ; preds = %138, %37, %20
%22 = load i32*, i32** %10
%23 = call %struct.dirent* @readdir(i32* %22)
store %struct.dirent* %23, %struct.dirent** %12
%24 = icmp ne %struct.dirent* %23, null
br i1 %24, label %25, label %141
25: ; preds = %21
%26 = load %struct.dirent*, %struct.dirent** %12
%27 = getelementptr inbounds %struct.dirent, %struct.dirent* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = call i64 @strcmp(i32 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %25
%32 = load %struct.dirent*, %struct.dirent** %12
%33 = getelementptr inbounds %struct.dirent, %struct.dirent* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = call i64 @strcmp(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31, %25
br label %21
38: ; preds = %31
%39 = load i8*, i8** %6
%40 = load %struct.dirent*, %struct.dirent** %12
%41 = getelementptr inbounds %struct.dirent, %struct.dirent* %40, i32 0, i32 0
%42 = load i32, i32* %41
%43 = call i32 @asprintf(i8** %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %39, i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %38
%46 = load i32*, i32** %10
%47 = call i32 @closedir(i32* %46)
store i32 -1, i32* %5
br label %145
48: ; preds = %38
%49 = load i8*, i8** %13
%50 = call i32 @stat(i8* %49, %struct.stat* %11)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = load i8*, i8** %13
%54 = call i32 @free(i8* %53)
%55 = load i32*, i32** %10
%56 = call i32 @closedir(i32* %55)
store i32 -1, i32* %5
br label %145
57: ; preds = %48
%58 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 0
%59 = load i32, i32* %58
%60 = call i64 @S_ISREG(i32 %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %101
62: ; preds = %57
%63 = load i8*, i8** %13
%64 = call i64 @strlen(i8* %63)
%65 = add nsw i64 %64, 1
%66 = call i8* @malloc(i64 %65)
%67 = load i8**, i8*** %7
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
store i8* %66, i8** %70
%71 = load i8**, i8*** %7
%72 = load i32, i32* %9
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
%75 = load i8*, i8** %74
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %82
77: ; preds = %62
%78 = load i8*, i8** %13
%79 = call i32 @free(i8* %78)
%80 = load i32*, i32** %10
%81 = call i32 @closedir(i32* %80)
store i32 -1, i32* %5
br label %145
82: ; preds = %62
%83 = load i8**, i8*** %7
%84 = load i32, i32* %9
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
%88 = load i8*, i8** %13
%89 = call i32 @strcpy(i8* %87, i8* %88)
%90 = load i32, i32* %9
%91 = add nsw i32 %90, 1
store i32 %91, i32* %9
%92 = load i32, i32* %8
%93 = load i32, i32* %9
%94 = icmp sle i32 %92, %93
br i1 %94, label %95, label %100
95: ; preds = %82
%96 = load i8*, i8** %13
%97 = call i32 @free(i8* %96)
%98 = load i32*, i32** %10
%99 = call i32 @closedir(i32* %98)
store i32 -1, i32* %5
br label %145
100: ; preds = %82
br label %138
101: ; preds = %57
%102 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 0
%103 = load i32, i32* %102
%104 = call i64 @S_ISLNK(i32 %103)
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %137
106: ; preds = %101
%107 = load i8*, i8** %13
%108 = call i64 @strlen(i8* %107)
%109 = add nsw i64 %108, 1
%110 = call i8* @malloc(i64 %109)
store i8* %110, i8** %14
%111 = load i8*, i8** %14
%112 = icmp eq i8* %111, null
br i1 %112, label %113, label %118
113: ; preds = %106
%114 = load i8*, i8** %13
%115 = call i32 @free(i8* %114)
%116 = load i32*, i32** %10
%117 = call i32 @closedir(i32* %116)
store i32 -1, i32* %5
br label %145
118: ; preds = %106
%119 = load i8*, i8** %14
%120 = load i8*, i8** %13
%121 = call i32 @strcpy(i8* %119, i8* %120)
%122 = load i8*, i8** %14
%123 = load i8**, i8*** %7
%124 = load i32, i32* %8
%125 = load i32, i32* %9
%126 = call i32 @fs_list_files(i8* %122, i8** %123, i32 %124, i32 %125)
store i32 %126, i32* %9
%127 = load i8*, i8** %14
%128 = call i32 @free(i8* %127)
%129 = load i32, i32* %9
%130 = icmp eq i32 %129, -1
br i1 %130, label %131, label %136
131: ; preds = %118
%132 = load i8*, i8** %13
%133 = call i32 @free(i8* %132)
%134 = load i32*, i32** %10
%135 = call i32 @closedir(i32* %134)
store i32 -1, i32* %5
br label %145
136: ; preds = %118
br label %137
137: ; preds = %136, %101
br label %138
138: ; preds = %137, %100
%139 = load i8*, i8** %13
%140 = call i32 @free(i8* %139)
br label %21
141: ; preds = %21
%142 = load i32*, i32** %10
%143 = call i32 @closedir(i32* %142)
%144 = load i32, i32* %9
store i32 %144, i32* %5
br label %145
145: ; preds = %141, %131, %113, %95, %77, %52, %45, %19
%146 = load i32, i32* %5
ret i32 %146
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [6 x i8] c"%s/%s\00"
define i32 @fs_list_files(i8* %0, i8** nocapture writeonly %1, i32 %2, i32 %3) {
%5 = alloca %struct.stat
%6 = alloca i8*
%7 = bitcast %struct.stat* %5 to i8*
%8 = bitcast i8** %6 to i8*
%9 = tail call i32* @opendir(i8* %0)
%10 = icmp eq i32* %9, null
br i1 %10, label %88, label %11
11: ; preds = %4
%12 = call %struct.dirent* @readdir(i32* %9)
%13 = icmp eq %struct.dirent* %12, null
br i1 %13, label %85, label %14
14: ; preds = %11
%15 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
br label %16
16: ; preds = %14, %76
%17 = phi %struct.dirent* [ %12, %14 ], [ %80, %76 ]
%18 = phi i32 [ %3, %14 ], [ %77, %76 ]
br label %19
19: ; preds = %16, %29
%20 = phi %struct.dirent* [ %17, %16 ], [ %30, %29 ]
%21 = getelementptr inbounds %struct.dirent, %struct.dirent* %20, i64 0, i32 0
%22 = load i32, i32* %21
%23 = call i64 @strcmp(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %19
%26 = load i32, i32* %21
%27 = call i64 @strcmp(i32 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25, %19
%30 = call %struct.dirent* @readdir(i32* %9)
%31 = icmp eq %struct.dirent* %30, null
br i1 %31, label %85, label %19
32: ; preds = %25
%33 = load i32, i32* %21
%34 = call i32 @asprintf(i8** %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %85, label %36
36: ; preds = %32
%37 = load i8*, i8** %6
%38 = call i32 @stat(i8* %37, %struct.stat* %5)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i8*, i8** %6
br label %82
42: ; preds = %36
%43 = load i32, i32* %15
%44 = call i64 @S_ISREG(i32 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %60, label %46
46: ; preds = %42
%47 = load i8*, i8** %6
%48 = call i64 @strlen(i8* dereferenceable(1) %47)
%49 = add nsw i64 %48, 1
%50 = call i8* @malloc(i64 %49)
%51 = sext i32 %18 to i64
%52 = getelementptr inbounds i8*, i8** %1, i64 %51
store i8* %50, i8** %52
%53 = icmp eq i8* %50, null
br i1 %53, label %82, label %54
54: ; preds = %46
%55 = call i32 @strcpy(i8* %50, i8* %47)
%56 = add nsw i32 %18, 1
%57 = icmp slt i32 %56, %2
br i1 %57, label %76, label %58
58: ; preds = %54
%59 = load i8*, i8** %6
br label %82
60: ; preds = %42
%61 = call i64 @S_ISLNK(i32 %43)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = load i8*, i8** %6
%65 = call i64 @strlen(i8* dereferenceable(1) %64)
%66 = add nsw i64 %65, 1
%67 = call i8* @malloc(i64 %66)
%68 = icmp eq i8* %67, null
br i1 %68, label %82, label %69
69: ; preds = %63
%70 = call i32 @strcpy(i8* %67, i8* %64)
%71 = call i32 @fs_list_files(i8* %67, i8** %1, i32 %2, i32 %18)
%72 = call i32 @free(i8* %67)
%73 = icmp eq i32 %71, -1
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = load i8*, i8** %6
br label %82
76: ; preds = %60, %69, %54
%77 = phi i32 [ %56, %54 ], [ %71, %69 ], [ %18, %60 ]
%78 = load i8*, i8** %6
%79 = call i32 @free(i8* %78)
%80 = call %struct.dirent* @readdir(i32* %9)
%81 = icmp eq %struct.dirent* %80, null
br i1 %81, label %85, label %16
82: ; preds = %63, %46, %74, %58, %40
%83 = phi i8* [ %41, %40 ], [ %59, %58 ], [ %75, %74 ], [ %47, %46 ], [ %64, %63 ]
%84 = call i32 @free(i8* %83)
br label %85
85: ; preds = %76, %32, %29, %82, %11
%86 = phi i32 [ %3, %11 ], [ -1, %82 ], [ %18, %29 ], [ -1, %32 ], [ %77, %76 ]
%87 = call i32 @closedir(i32* %9)
br label %88
88: ; preds = %85, %4
%89 = phi i32 [ -1, %4 ], [ %86, %85 ]
ret i32 %89
}