#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;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
scalar_t__ S_ISDIR(int);
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Por favor, introduce 2 argumentos (Ruta)\n");
    exit(EXIT_FAILURE);
  }
  DIR *dirp;
  struct dirent *direntp;
  struct stat atributos;
  dirp = opendir(argv[1]);
  if (dirp == NULL) {
    printf("Error: No se puede abrir el directorio\n");
    exit(EXIT_FAILURE);
  }
  chdir(argv[1]);
  while ((direntp = readdir(dirp)) != NULL) {
    if (stat(direntp->d_name, &atributos) < 0) {
      printf("\nError al intentar acceder a los atributos de %s \n",
             direntp->d_name);
    } else {
      printf((S_ISDIR(atributos.st_mode)) ? "d" : "-");
      printf((atributos.st_mode & S_IRUSR) ? "r" : "-");
      printf((atributos.st_mode & S_IWUSR) ? "w" : "-");
      printf((atributos.st_mode & S_IXUSR) ? "x" : "-");
      printf((atributos.st_mode & S_IRGRP) ? "r" : "-");
      printf((atributos.st_mode & S_IWGRP) ? "w" : "-");
      printf((atributos.st_mode & S_IXGRP) ? "x" : "-");
      printf((atributos.st_mode & S_IROTH) ? "r" : "-");
      printf((atributos.st_mode & S_IWOTH) ? "w" : "-");
      printf((atributos.st_mode & S_IXOTH) ? "x" : "-");
      printf("\t\t %s    ", direntp->d_name);
      printf("\n");
    }
  }
  closedir(dirp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11bc <main+0x3c>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f4 <main+0x74>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <chdir@plt>
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1404 <main+0x284>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    -0x28(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0x0,%rax
jge    124c <main+0xcc>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ff <main+0x27f>
mov    -0x28(%rbp),%edi
call   1060 <S_ISDIR@plt>
mov    %rax,%rcx
lea    0xe29(%rip),%rdi
lea    0xe20(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2d22(%rip),%rax
and    (%rax),%ecx
lea    0xe00(%rip),%rdi
lea    0xdfb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2d2a(%rip),%rax
and    (%rax),%ecx
lea    0xdd8(%rip),%rdi
lea    0xdd5(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2d12(%rip),%rax
and    (%rax),%ecx
lea    0xdb0(%rip),%rdi
lea    0xdaf(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2cc2(%rip),%rax
and    (%rax),%ecx
lea    0xd88(%rip),%rdi
lea    0xd83(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2cba(%rip),%rax
and    (%rax),%ecx
lea    0xd60(%rip),%rdi
lea    0xd5d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2c82(%rip),%rax
and    (%rax),%ecx
lea    0xd38(%rip),%rdi
lea    0xd37(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2c42(%rip),%rax
and    (%rax),%ecx
lea    0xd10(%rip),%rdi
lea    0xd0b(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2bfa(%rip),%rax
and    (%rax),%ecx
lea    0xce8(%rip),%rdi
lea    0xce5(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2c2a(%rip),%rax
and    (%rax),%ecx
lea    0xcc0(%rip),%rdi
lea    0xcbf(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1201 <main+0x81>
mov    -0x18(%rbp),%rdi
call   1070 <closedir@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1382 <main+0x1e2>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     138b <main+0x1eb>
mov    %rax,%r13
mov    0x8(%rbx),%rdi
call   1060 <chdir@plt>
mov    %r13,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     1369 <main+0x1c9>
mov    %rax,%rbx
lea    0xe45(%rip),%rbp
lea    0xe40(%rip),%r15
lea    0xe3b(%rip),%r12
lea    0xe36(%rip),%r14
jmp    1342 <main+0x1a2>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
lea    0xe11(%rip),%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r15,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r12,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r14,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r15,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d3c(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r12,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r14,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r15,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r12,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%eax
and    (%rsp),%eax
mov    %r14,%rdi
cmove  %rbp,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rbx),%rsi
lea    0xd1c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   10b0 <readdir@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1369 <main+0x1c9>
mov    (%rbx),%rdi
mov    %rsp,%rsi
call   10a0 <stat@plt>
test   %rax,%rax
jns    1210 <main+0x70>
mov    (%rbx),%rsi
lea    0xca0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1332 <main+0x192>
mov    %r13,%rdi
call   1090 <closedir@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce5(%rip),%rdi
jmp    1392 <main+0x1f2>
lea    0xcb5(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.stat = type { i32 }
@.str = [42 x i8] c"Por favor, introduce 2 argumentos (Ruta)\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [40 x i8] c"Error: No se puede abrir el directorio\0A\00"
@.str.2 = [51 x i8] c"\0AError al intentar acceder a los atributos de %s \0A\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"-\00"
@S_IRUSR = global i32 0
@.str.5 = [2 x i8] c"r\00"
@S_IWUSR = global i32 0
@.str.6 = [2 x i8] c"w\00"
@S_IXUSR = global i32 0
@.str.7 = [2 x i8] c"x\00"
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@.str.8 = [10 x i8] c"\09\09 %s \00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.dirent*
%8 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @opendir(i8* %18)
store i32* %19, i32** %6
%20 = load i32*, i32** %6
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %26
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %15
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @chdir(i8* %29)
br label %31
31: ; preds = %131, %26
%32 = load i32*, i32** %6
%33 = call %struct.dirent* @readdir(i32* %32)
store %struct.dirent* %33, %struct.dirent** %7
%34 = icmp ne %struct.dirent* %33, null
br i1 %34, label %35, label %132
35: ; preds = %31
%36 = load %struct.dirent*, %struct.dirent** %7
%37 = getelementptr inbounds %struct.dirent, %struct.dirent* %36, i32 0, i32 0
%38 = load i8*, i8** %37
%39 = call i64 @stat(i8* %38, %struct.stat* %8)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %35
%42 = load %struct.dirent*, %struct.dirent** %7
%43 = getelementptr inbounds %struct.dirent, %struct.dirent* %42, i32 0, i32 0
%44 = load i8*, i8** %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %44)
br label %131
46: ; preds = %35
%47 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%48 = load i32, i32* %47
%49 = call i64 @S_ISDIR(i32 %48)
%50 = icmp ne i64 %49, 0
%51 = zext i1 %50 to i64
%52 = select i1 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%53 = call i32 (i8*, ...) @printf(i8* %52)
%54 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%55 = load i32, i32* %54
%56 = load i32, i32* @S_IRUSR
%57 = and i32 %55, %56
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%61 = call i32 (i8*, ...) @printf(i8* %60)
%62 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%63 = load i32, i32* %62
%64 = load i32, i32* @S_IWUSR
%65 = and i32 %63, %64
%66 = icmp ne i32 %65, 0
%67 = zext i1 %66 to i64
%68 = select i1 %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* %68)
%70 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%71 = load i32, i32* %70
%72 = load i32, i32* @S_IXUSR
%73 = and i32 %71, %72
%74 = icmp ne i32 %73, 0
%75 = zext i1 %74 to i64
%76 = select i1 %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%77 = call i32 (i8*, ...) @printf(i8* %76)
%78 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%79 = load i32, i32* %78
%80 = load i32, i32* @S_IRGRP
%81 = and i32 %79, %80
%82 = icmp ne i32 %81, 0
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%85 = call i32 (i8*, ...) @printf(i8* %84)
%86 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%87 = load i32, i32* %86
%88 = load i32, i32* @S_IWGRP
%89 = and i32 %87, %88
%90 = icmp ne i32 %89, 0
%91 = zext i1 %90 to i64
%92 = select i1 %90, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%93 = call i32 (i8*, ...) @printf(i8* %92)
%94 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%95 = load i32, i32* %94
%96 = load i32, i32* @S_IXGRP
%97 = and i32 %95, %96
%98 = icmp ne i32 %97, 0
%99 = zext i1 %98 to i64
%100 = select i1 %98, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%101 = call i32 (i8*, ...) @printf(i8* %100)
%102 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%103 = load i32, i32* %102
%104 = load i32, i32* @S_IROTH
%105 = and i32 %103, %104
%106 = icmp ne i32 %105, 0
%107 = zext i1 %106 to i64
%108 = select i1 %106, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%109 = call i32 (i8*, ...) @printf(i8* %108)
%110 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%111 = load i32, i32* %110
%112 = load i32, i32* @S_IWOTH
%113 = and i32 %111, %112
%114 = icmp ne i32 %113, 0
%115 = zext i1 %114 to i64
%116 = select i1 %114, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%117 = call i32 (i8*, ...) @printf(i8* %116)
%118 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%119 = load i32, i32* %118
%120 = load i32, i32* @S_IXOTH
%121 = and i32 %119, %120
%122 = icmp ne i32 %121, 0
%123 = zext i1 %122 to i64
%124 = select i1 %122, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%125 = call i32 (i8*, ...) @printf(i8* %124)
%126 = load %struct.dirent*, %struct.dirent** %7
%127 = getelementptr inbounds %struct.dirent, %struct.dirent* %126, i32 0, i32 0
%128 = load i8*, i8** %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %128)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %131
131: ; preds = %46, %41
br label %31
132: ; preds = %31
%133 = load i32*, i32** %6
%134 = call i32 @closedir(i32* %133)
%135 = load i32, i32* %3
ret i32 %135
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@EXIT_FAILURE = global i32 0
@.str.2 = [51 x i8] c"\0AError al intentar acceder a los atributos de %s \0A\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"-\00"
@S_IRUSR = global i32 0
@.str.5 = [2 x i8] c"r\00"
@S_IWUSR = global i32 0
@.str.6 = [2 x i8] c"w\00"
@S_IXUSR = global i32 0
@.str.7 = [2 x i8] c"x\00"
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@.str.8 = [10 x i8] c"\09\09 %s \00"
@str = [39 x i8] c"Error: No se puede abrir el directorio\00"
@str.10 = [41 x i8] c"Por favor, introduce 2 argumentos (Ruta)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.10, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = bitcast %struct.stat* %3 to i8*
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @opendir(i8* %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %9
%20 = load i8*, i8** %11
%21 = tail call i32 @chdir(i8* %20)
%22 = call %struct.dirent* @readdir(i32* %13)
%23 = icmp eq %struct.dirent* %22, null
br i1 %23, label %101, label %24
24: ; preds = %19
%25 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
br label %26
26: ; preds = %24, %98
%27 = phi %struct.dirent* [ %22, %24 ], [ %99, %98 ]
%28 = getelementptr inbounds %struct.dirent, %struct.dirent* %27, i64 0, i32 0
%29 = load i8*, i8** %28
%30 = call i64 @stat(i8* %29, %struct.stat* %3)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i8*, i8** %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %98
35: ; preds = %26
%36 = load i32, i32* %25
%37 = call i64 @S_ISDIR(i32 %36)
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %39)
%41 = load i32, i32* %25
%42 = load i32, i32* @S_IRUSR
%43 = and i32 %42, %41
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45)
%47 = load i32, i32* %25
%48 = load i32, i32* @S_IWUSR
%49 = and i32 %48, %47
%50 = icmp eq i32 %49, 0
%51 = select i1 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %51)
%53 = load i32, i32* %25
%54 = load i32, i32* @S_IXUSR
%55 = and i32 %54, %53
%56 = icmp eq i32 %55, 0
%57 = select i1 %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %57)
%59 = load i32, i32* %25
%60 = load i32, i32* @S_IRGRP
%61 = and i32 %60, %59
%62 = icmp eq i32 %61, 0
%63 = select i1 %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %63)
%65 = load i32, i32* %25
%66 = load i32, i32* @S_IWGRP
%67 = and i32 %66, %65
%68 = icmp eq i32 %67, 0
%69 = select i1 %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %69)
%71 = load i32, i32* %25
%72 = load i32, i32* @S_IXGRP
%73 = and i32 %72, %71
%74 = icmp eq i32 %73, 0
%75 = select i1 %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %75)
%77 = load i32, i32* %25
%78 = load i32, i32* @S_IROTH
%79 = and i32 %78, %77
%80 = icmp eq i32 %79, 0
%81 = select i1 %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %81)
%83 = load i32, i32* %25
%84 = load i32, i32* @S_IWOTH
%85 = and i32 %84, %83
%86 = icmp eq i32 %85, 0
%87 = select i1 %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %87)
%89 = load i32, i32* %25
%90 = load i32, i32* @S_IXOTH
%91 = and i32 %90, %89
%92 = icmp eq i32 %91, 0
%93 = select i1 %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %93)
%95 = load i8*, i8** %28
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = call i32 @putchar(i32 10)
br label %98
98: ; preds = %35, %32
%99 = call %struct.dirent* @readdir(i32* %13)
%100 = icmp eq %struct.dirent* %99, null
br i1 %100, label %101, label %26
101: ; preds = %98, %19
%102 = call i32 @closedir(i32* %13)
ret i32 0
}