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

/* Variables and functions */
int MAXPATHLEN;
int S_IFDIR;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
void get_names(char ***names, char *path, int count, int filelen) {
  struct dirent *dp;
  DIR *dir;
  char dirpath[MAXPATHLEN];
  char fullname[MAXPATHLEN];
  int len;
  struct stat buf;
  int i;
  if (!((*names) = (char **)malloc((count + 1) * sizeof(char *)))) {
    fprintf(stderr, "Error: Memory allocation for array\n");
    exit(-1);
  }
  (*names)[count] = NULL;
  for (i = 0; i < count; ++i)
    if (!((*names)[i] = (char *)malloc(filelen + 1))) {
      fprintf(stderr, "Error: Memory allocation for char *\n");
      exit(-1);
    }
  strcpy(dirpath, path);
  len = strlen(dirpath);
  if (dirpath[len - 1] != '/')
    strcat(dirpath, "/");
  if (!(dir = opendir(dirpath))) {
    fprintf(stderr, "Error: Cannot open directory [%s]\n", path);
    exit(-1);
  }
  i = 0;
  while ((dp = readdir(dir))) {
    if (!dp->d_ino || *dp->d_name == '.' || !strncmp(dp->d_name, "Makefile", 8))
      continue;
    sprintf(fullname, "%s%s", dirpath, dp->d_name);
    if (!stat(fullname, &buf))
      if (buf.st_mode & S_IFDIR)
        continue;
    len = strlen(dp->d_name);
    if (dp->d_name[len - 1] == '~')
      continue;
    strcpy((*names)[i++], dp->d_name);
  }
  closedir(dir);
  return;
}


x86 assembly (clang, -O0):
<get_names>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2e0b(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x60(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x38(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1265 <get_names+0xa5>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12e3 <get_names+0x123>
mov    -0x18(%rbp),%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movslq -0x4c(%rbp),%rdx
mov    %rax,(%rcx,%rdx,8)
cmp    $0x0,%rax
jne    12d0 <get_names+0x110>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xd65(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
jmp    12d5 <get_names+0x115>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    127f <get_names+0xbf>
mov    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x60(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     1328 <get_names+0x168>
mov    -0x60(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   10c0 <strcat@plt>
mov    -0x60(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1364 <get_names+0x1a4>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xcf8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x28(%rbp),%rdi
call   10a0 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1474 <get_names+0x2b4>
mov    -0x20(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     13c4 <get_names+0x204>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     13c4 <get_names+0x204>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xcbd(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13c9 <get_names+0x209>
jmp    136b <get_names+0x1ab>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
lea    0xc98(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x58(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%eax
jne    1419 <get_names+0x259>
mov    -0x48(%rbp),%eax
mov    0x2bc4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1414 <get_names+0x254>
jmp    136b <get_names+0x1ab>
jmp    1419 <get_names+0x259>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jne    144a <get_names+0x28a>
jmp    136b <get_names+0x1ab>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x4c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x4c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
jmp    136b <get_names+0x1ab>
mov    -0x28(%rbp),%rdi
call   1070 <closedir@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_names>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r15d
mov    %edx,%r13d
mov    %rsi,-0x30(%rbp)
mov    %rdi,%r12
mov    0x2e03(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
lea    0x8(,%r13,8),%edi
call   10b0 <malloc@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     13a4 <get_names+0x1e4>
movslq %r13d,%rcx
movq   $0x0,(%rax,%rcx,8)
test   %r13d,%r13d
jle    1262 <get_names+0xa2>
add    $0x1,%r15d
mov    %r13d,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
call   10b0 <malloc@plt>
mov    (%r12),%rcx
mov    %rax,(%rcx,%rbx,8)
test   %rax,%rax
je     1383 <get_names+0x1c3>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1240 <get_names+0x80>
mov    %r14,%rdi
mov    -0x30(%rbp),%r13
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%r14,1)
je     1292 <get_names+0xd2>
lea    0xdbf(%rip),%rsi
mov    %r14,%rdi
call   10c0 <strcat@plt>
mov    %r14,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
mov    -0x40(%rbp),%r15
je     13b6 <get_names+0x1f6>
mov    %rax,%rbx
mov    %rax,%rdi
call   10a0 <readdir@plt>
test   %rax,%rax
je     136c <get_names+0x1ac>
mov    %rax,%r13
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
jmp    12f0 <get_names+0x130>
mov    0x0(%r13),%rdi
call   1060 <strlen@plt>
mov    0x0(%r13),%rsi
cltq
cmpb   $0x7e,-0x1(%rax,%rsi,1)
jne    134e <get_names+0x18e>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10a0 <readdir@plt>
mov    %rax,%r13
test   %rax,%rax
je     136c <get_names+0x1ac>
cmpl   $0x0,0x8(%r13)
je     12e0 <get_names+0x120>
mov    0x0(%r13),%rdi
cmpb   $0x2e,(%rdi)
je     12e0 <get_names+0x120>
lea    0xd67(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     12e0 <get_names+0x120>
mov    0x0(%r13),%rcx
mov    %r15,%rdi
lea    0xd54(%rip),%rsi
mov    %r14,%rdx
call   10d0 <sprintf@plt>
mov    %r15,%rdi
lea    -0x38(%rbp),%rsi
call   1090 <stat@plt>
test   %eax,%eax
jne    12c6 <get_names+0x106>
mov    0x2c86(%rip),%rax
mov    (%rax),%eax
test   %eax,-0x38(%rbp)
jne    12e0 <get_names+0x120>
jmp    12c6 <get_names+0x106>
mov    (%r12),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
call   1040 <strcpy@plt>
jmp    12e0 <get_names+0x120>
mov    %rbx,%rdi
call   1070 <closedir@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c4e(%rip),%rax
mov    (%rax),%edi
lea    0xc91(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
lea    0xc4c(%rip),%rsi
jmp    1393 <get_names+0x1d3>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8*, i32 }
@MAXPATHLEN = global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"Error: Memory allocation for array\0A\00"
@.str.1 = [37 x i8] c"Error: Memory allocation for char *\0A\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [35 x i8] c"Error: Cannot open directory [%s]\0A\00"
@.str.4 = [9 x i8] c"Makefile\00"
@.str.5 = [5 x i8] c"%s%s\00"
@S_IFDIR = global i32 0
define void @get_names(i8*** nocapture %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.stat
%6 = load i32, i32* @MAXPATHLEN
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = alloca i8, i64 %7
%10 = bitcast %struct.stat* %5 to i8*
%11 = shl i32 %2, 3
%12 = add i32 %11, 8
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8**
store i8** %14, i8*** %0
%15 = icmp eq i64 %13, 0
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %4
%21 = sext i32 %2 to i64
%22 = getelementptr inbounds i8*, i8** %14, i64 %21
store i8* null, i8** %22
%23 = icmp sgt i32 %2, 0
br i1 %23, label %24, label %41
24: ; preds = %20
%25 = add nsw i32 %3, 1
%26 = zext i32 %2 to i64
br label %29
27: ; preds = %29
%28 = icmp eq i64 %36, %26
br i1 %28, label %41, label %29
29: ; preds = %24, %27
%30 = phi i64 [ 0, %24 ], [ %36, %27 ]
%31 = tail call i64 @malloc(i32 %25)
%32 = inttoptr i64 %31 to i8*
%33 = load i8**, i8*** %0
%34 = getelementptr inbounds i8*, i8** %33, i64 %30
store i8* %32, i8** %34
%35 = icmp eq i64 %31, 0
%36 = add nuw nsw i64 %30, 1
br i1 %35, label %37, label %27
37: ; preds = %29
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%40 = tail call i32 @exit(i32 -1)
unreachable
41: ; preds = %27, %20
%42 = call i32 @strcpy(i8* %8, i8* %1)
%43 = call i32 @strlen(i8* %8)
%44 = add nsw i32 %43, -1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %8, i64 %45
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 47
br i1 %48, label %51, label %49
49: ; preds = %41
%50 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %41
%52 = call i32* @opendir(i8* %8)
%53 = icmp eq i32* %52, null
br i1 %53, label %59, label %54
54: ; preds = %51
%55 = call %struct.dirent* @readdir(i32* %52)
%56 = icmp eq %struct.dirent* %55, null
br i1 %56, label %109, label %57
57: ; preds = %54
%58 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
br label %106
59: ; preds = %51
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %106, %76
%64 = phi %struct.dirent* [ %108, %106 ], [ %77, %76 ]
%65 = getelementptr inbounds %struct.dirent, %struct.dirent* %64, i64 0, i32 1
%66 = load i32, i32* %65
%67 = icmp eq i32 %66, 0
br i1 %67, label %76, label %68
68: ; preds = %63
%69 = getelementptr inbounds %struct.dirent, %struct.dirent* %64, i64 0, i32 0
%70 = load i8*, i8** %69
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 46
br i1 %72, label %76, label %73
73: ; preds = %68
%74 = call i32 @strncmp(i8* %70, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 8)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %63, %68, %73, %84, %89
%77 = call %struct.dirent* @readdir(i32* %52)
%78 = icmp eq %struct.dirent* %77, null
br i1 %78, label %109, label %63
79: ; preds = %73
%80 = load i8*, i8** %69
%81 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %8, i8* %80)
%82 = call i32 @stat(i8* %9, %struct.stat* %5)
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %89
84: ; preds = %79
%85 = load i32, i32* %58
%86 = load i32, i32* @S_IFDIR
%87 = and i32 %86, %85
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %76
89: ; preds = %84, %79
%90 = load i8*, i8** %69
%91 = call i32 @strlen(i8* %90)
%92 = load i8*, i8** %69
%93 = add nsw i32 %91, -1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
%96 = load i8, i8* %95
%97 = icmp eq i8 %96, 126
br i1 %97, label %76, label %98
98: ; preds = %89
%99 = load i8**, i8*** %0
%100 = add nuw i64 %107, 1
%101 = getelementptr inbounds i8*, i8** %99, i64 %107
%102 = load i8*, i8** %101
%103 = call i32 @strcpy(i8* %102, i8* %92)
%104 = call %struct.dirent* @readdir(i32* %52)
%105 = icmp eq %struct.dirent* %104, null
br i1 %105, label %109, label %106
106: ; preds = %57, %98
%107 = phi i64 [ 0, %57 ], [ %100, %98 ]
%108 = phi %struct.dirent* [ %55, %57 ], [ %104, %98 ]
br label %63
109: ; preds = %98, %76, %54
%110 = call i32 @closedir(i32* %52)
ret void
}