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

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
scalar_t__ closedir(int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printPermission(struct stat);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int printFilesWithPermisions(char *directoryName, int indent, char *fileName) {
  DIR *directory = opendir(directoryName);
  struct dirent *currentFile;
  struct stat statp;
  char fileNameString[1024];
  if (directory == NULL) {
    perror("failed to open directory");
    return -1;
  }
  while ((currentFile = readdir(directory))) {
    if (!(strcmp(currentFile->d_name, ".") &&
          strcmp(currentFile->d_name, ".."))) {
      continue;
    }
    strcpy(fileNameString, directoryName);
    strcat(fileNameString, "/");
    strcat(fileNameString, currentFile->d_name);
    if (stat(fileNameString, &statp)) {
      perror("stat failed");
      return -1;
    }
    if (S_ISREG(statp.st_mode) &&
        (!strlen(fileName) || !strcmp(currentFile->d_name, fileName))) {
      int i;
      for (i = 0; i < indent; i++) {
        printf("    ");
      }
      printPermission(statp);
      printf("%s (%d bytes)\n", currentFile->d_name, (int)statp.st_size);
    } else if (!S_ISREG(statp.st_mode)) {
      int i;
      for (i = 0; i < indent; i++) {
        printf("    ");
      }
      printPermission(statp);
      printf("%s (sub-directory)\n", currentFile->d_name);
      printFilesWithPermisions(fileNameString, indent + 1, fileName);
    }
  }
  if (errno != 0) {
    perror("readdir failed");
    return -1;
  }
  if (closedir(directory)) {
    perror("closedir failed");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<printFilesWithPermisions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1216 <printFilesWithPermisions+0x46>
lea    0xdfb(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1467 <printFilesWithPermisions+0x297>
jmp    121b <printFilesWithPermisions+0x4b>
mov    -0x28(%rbp),%rdi
call   10b0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     140c <printFilesWithPermisions+0x23c>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xdda(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     126c <printFilesWithPermisions+0x9c>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xdbc(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <printFilesWithPermisions+0xa1>
jmp    121b <printFilesWithPermisions+0x4b>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x440(%rbp),%rdi
lea    0xd8d(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x440(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
call   10e0 <strcat@plt>
lea    -0x440(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%rax
je     12d9 <printFilesWithPermisions+0x109>
lea    0xd56(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1467 <printFilesWithPermisions+0x297>
mov    -0x40(%rbp),%edi
call   10a0 <S_ISREG@plt>
cmp    $0x0,%rax
je     137e <printFilesWithPermisions+0x1ae>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
je     1317 <printFilesWithPermisions+0x147>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    137e <printFilesWithPermisions+0x1ae>
movl   $0x0,-0x444(%rbp)
mov    -0x444(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1352 <printFilesWithPermisions+0x182>
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
jmp    1321 <printFilesWithPermisions+0x151>
mov    -0x40(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   10f0 <printPermission@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    -0x38(%rbp),%rax
mov    %eax,%edx
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1407 <printFilesWithPermisions+0x237>
mov    -0x40(%rbp),%edi
call   10a0 <S_ISREG@plt>
cmp    $0x0,%rax
jne    1402 <printFilesWithPermisions+0x232>
movl   $0x0,-0x448(%rbp)
mov    -0x448(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13cb <printFilesWithPermisions+0x1fb>
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x448(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x448(%rbp)
jmp    139a <printFilesWithPermisions+0x1ca>
mov    -0x40(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   10f0 <printPermission@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%rdx
call   10c0 <printFilesWithPermisions@plt>
jmp    1407 <printFilesWithPermisions+0x237>
jmp    121b <printFilesWithPermisions+0x4b>
mov    0x2bcd(%rip),%rax
cmpq   $0x0,(%rax)
je     1435 <printFilesWithPermisions+0x265>
lea    0xc2e(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1467 <printFilesWithPermisions+0x297>
mov    -0x28(%rbp),%rdi
call   1070 <closedir@plt>
cmp    $0x0,%rax
je     1460 <printFilesWithPermisions+0x290>
lea    0xc12(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1467 <printFilesWithPermisions+0x297>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFilesWithPermisions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,(%rsp)
mov    %rdi,0x28(%rsp)
call   1040 <opendir@plt>
test   %rax,%rax
je     13e6 <printFilesWithPermisions+0x216>
mov    %rax,%r13
mov    %rax,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     13b5 <printFilesWithPermisions+0x1e5>
mov    %rax,%r12
mov    (%rsp),%rax
add    $0x1,%eax
mov    %eax,0x24(%rsp)
lea    0xdf4(%rip),%rbp
lea    0xdec(%rip),%r14
lea    0xdf6(%rip),%r15
jmp    127c <printFilesWithPermisions+0xac>
mov    0x10(%rsp),%edi
mov    0x18(%rsp),%rsi
call   10f0 <printPermission@plt>
mov    (%r12),%rsi
mov    0x18(%rsp),%edx
lea    0xddc(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdb9(%rip),%rbp
lea    0xdb1(%rip),%r14
mov    %r13,%rdi
call   10b0 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     13b5 <printFilesWithPermisions+0x1e5>
mov    (%r12),%rdi
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1268 <printFilesWithPermisions+0x98>
mov    (%r12),%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1268 <printFilesWithPermisions+0x98>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    0x28(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
lea    0xd62(%rip),%rsi
call   10e0 <strcat@plt>
mov    (%r12),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   1090 <stat@plt>
test   %rax,%rax
jne    1401 <printFilesWithPermisions+0x231>
mov    0x10(%rsp),%edi
call   10a0 <S_ISREG@plt>
test   %rax,%rax
je     1314 <printFilesWithPermisions+0x144>
mov    0x8(%rsp),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1385 <printFilesWithPermisions+0x1b5>
mov    (%r12),%rdi
mov    0x8(%rsp),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1385 <printFilesWithPermisions+0x1b5>
mov    0x10(%rsp),%edi
call   10a0 <S_ISREG@plt>
test   %rax,%rax
jne    1268 <printFilesWithPermisions+0x98>
mov    0x8(%rsp),%r14
cmpl   $0x0,(%rsp)
jle    134f <printFilesWithPermisions+0x17f>
mov    (%rsp),%rax
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%ebp
jne    1340 <printFilesWithPermisions+0x170>
mov    0x10(%rsp),%edi
mov    0x18(%rsp),%rsi
call   10f0 <printPermission@plt>
mov    (%r12),%rsi
lea    0xcd6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x30(%rsp),%rdi
mov    0x24(%rsp),%esi
mov    %r14,%rdx
call   10c0 <printFilesWithPermisions@plt>
jmp    125a <printFilesWithPermisions+0x8a>
cmpl   $0x0,(%rsp)
jle    1236 <printFilesWithPermisions+0x66>
mov    (%rsp),%rax
mov    %eax,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xffffffff,%r14d
jne    13a0 <printFilesWithPermisions+0x1d0>
jmp    1236 <printFilesWithPermisions+0x66>
mov    0x2c24(%rip),%rax
cmpq   $0x0,(%rax)
jne    13ef <printFilesWithPermisions+0x21f>
mov    %r13,%rdi
call   1070 <closedir@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    13f8 <printFilesWithPermisions+0x228>
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc13(%rip),%rdi
jmp    1408 <printFilesWithPermisions+0x238>
lea    0xc5c(%rip),%rdi
jmp    1408 <printFilesWithPermisions+0x238>
lea    0xc62(%rip),%rdi
jmp    1408 <printFilesWithPermisions+0x238>
lea    0xc16(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%eax
jmp    13d4 <printFilesWithPermisions+0x204>

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

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