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

/* Variables and functions */
int S_IFDIR;
int S_IFREG;
scalar_t__ S_ISDIR(int);
scalar_t__ S_ISREG(int);
scalar_t__ chmod(char *, int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, char *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int fixperms(char *path, mode_t filemode, mode_t dirmode) {
  DIR *dir;
  struct dirent *direntry;
  struct stat dirstat;
  dir = opendir(path);
  if (dir == NULL) {
    fprintf(stderr, "Failed to open directory %s\n", path);
    return -1;
  }
  while ((direntry = readdir(dir))) {
    if (!strcmp(direntry->d_name, "..") || !strcmp(direntry->d_name, "."))
      continue;
    char *epath = malloc(strlen(path) + strlen(direntry->d_name) + 2);
    strcpy(epath, path);
    strcat(epath, "/");
    strcat(epath, direntry->d_name);
    if (stat(epath, &dirstat)) {
      fprintf(stderr, "Failed to stat %s\n", epath);
      continue;
    }
    if (S_ISDIR(dirstat.st_mode)) {
      fixperms(epath, filemode, dirmode);
      if (dirstat.st_mode != (dirmode | S_IFDIR))
        if (chmod(epath, dirmode))
          fprintf(stderr, "Failed to update the permissions of directory %s\n",
                  epath);
    } else {
      if (S_ISREG(dirstat.st_mode)) {
        if (dirstat.st_mode != (filemode | S_IFREG))
          if (chmod(epath, filemode))
            fprintf(stderr, "Failed to update the permissions of file %s\n",
                    epath);
      } else
        printf("Ignored special file %s\n", epath);
    }
    free(epath);
  }
  closedir(dir);
  return 0;
}


x86 assembly (clang, -O0):
<fixperms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    124f <fixperms+0x4f>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdc2(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143d <fixperms+0x23d>
jmp    1254 <fixperms+0x54>
mov    -0x20(%rbp),%rdi
call   10e0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     142d <fixperms+0x22d>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xda4(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     12a3 <fixperms+0xa3>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xd89(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    12a8 <fixperms+0xa8>
jmp    1254 <fixperms+0x54>
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    -0x40(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    0xd33(%rip),%rsi
call   1120 <strcat@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1120 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
je     1337 <fixperms+0x137>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xcf5(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1254 <fixperms+0x54>
mov    -0x30(%rbp),%edi
call   1080 <S_ISDIR@plt>
cmp    $0x0,%rax
je     13a8 <fixperms+0x1a8>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1110 <fixperms@plt>
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    0x2c63(%rip),%rdx
or     (%rdx),%ecx
cmp    %ecx,%eax
je     13a3 <fixperms+0x1a3>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1100 <chmod@plt>
cmp    $0x0,%rax
je     139e <fixperms+0x19e>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xc9c(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    13a3 <fixperms+0x1a3>
jmp    141f <fixperms+0x21f>
mov    -0x30(%rbp),%edi
call   10d0 <S_ISREG@plt>
cmp    $0x0,%rax
je     140a <fixperms+0x20a>
mov    -0x30(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    0x2c21(%rip),%rdx
or     (%rdx),%ecx
cmp    %ecx,%eax
je     1405 <fixperms+0x205>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1100 <chmod@plt>
cmp    $0x0,%rax
je     1400 <fixperms+0x200>
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xc6c(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1405 <fixperms+0x205>
jmp    141a <fixperms+0x21a>
mov    -0x38(%rbp),%rsi
lea    0xc7f(%rip),%rdi
call   1070 <printf@plt>
jmp    141f <fixperms+0x21f>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    1254 <fixperms+0x54>
mov    -0x20(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixperms>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,0x8(%rsp)
mov    %rdi,%rbx
call   1050 <opendir@plt>
test   %rax,%rax
je     13d8 <fixperms+0x1d8>
mov    %rax,%r12
mov    %rbx,0x10(%rsp)
mov    %rax,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     13cc <fixperms+0x1cc>
mov    %rax,%r15
lea    0xdd3(%rip),%rbp
mov    0x10(%rsp),%r13
jmp    1293 <fixperms+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
mov    %r14,%rdx
call   10b0 <fprintf@plt>
lea    0xd9e(%rip),%rbp
mov    %r12,%rdi
call   10e0 <readdir@plt>
mov    %rax,%r15
test   %rax,%rax
je     13cc <fixperms+0x1cc>
mov    (%r15),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     127f <fixperms+0x7f>
mov    %rbx,%rdi
lea    0xd6f(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     127f <fixperms+0x7f>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbp,1),%rdi
add    $0x2,%rdi
call   10f0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
lea    0xd30(%rip),%rsi
call   1120 <strcat@plt>
mov    (%r15),%rsi
mov    %r14,%rdi
call   1120 <strcat@plt>
mov    %r14,%rdi
mov    %rsp,%rsi
call   10c0 <stat@plt>
test   %rax,%rax
jne    1260 <fixperms+0x60>
mov    (%rsp),%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
je     1366 <fixperms+0x166>
mov    %r14,%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   1110 <fixperms@plt>
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
or     %ebx,%eax
cmp    %eax,(%rsp)
je     13bf <fixperms+0x1bf>
mov    %r14,%rdi
mov    0xc(%rsp),%esi
call   1100 <chmod@plt>
test   %rax,%rax
je     13bf <fixperms+0x1bf>
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
jmp    13a6 <fixperms+0x1a6>
mov    (%rsp),%edi
call   10d0 <S_ISREG@plt>
test   %rax,%rax
je     13b0 <fixperms+0x1b0>
mov    0x2c6e(%rip),%rax
mov    (%rax),%eax
or     0x8(%rsp),%eax
cmp    %eax,(%rsp)
je     13bf <fixperms+0x1bf>
mov    %r14,%rdi
mov    0x8(%rsp),%esi
call   1100 <chmod@plt>
test   %rax,%rax
je     13bf <fixperms+0x1bf>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
lea    0xcc1(%rip),%rsi
mov    %r14,%rdx
call   10b0 <fprintf@plt>
jmp    13bf <fixperms+0x1bf>
lea    0xcdd(%rip),%rdi
mov    %r14,%rsi
call   1070 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1278 <fixperms+0x78>
mov    %r12,%rdi
call   1090 <closedir@plt>
xor    %eax,%eax
jmp    13f5 <fixperms+0x1f5>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
lea    0xc18(%rip),%rsi
mov    %rbx,%rdx
call   10b0 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [29 x i8] c"Failed to open directory %s\0A\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [19 x i8] c"Failed to stat %s\0A\00"
@S_IFDIR = global i32 0
@.str.5 = [50 x i8] c"Failed to update the permissions of directory %s\0A\00"
@S_IFREG = global i32 0
@.str.6 = [45 x i8] c"Failed to update the permissions of file %s\0A\00"
@.str.7 = [25 x i8] c"Ignored special file %s\0A\00"
define i32 @fixperms(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca %struct.dirent*
%10 = alloca %struct.stat
%11 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%12 = load i8*, i8** %5
%13 = call i32* @opendir(i8* %12)
store i32* %13, i32** %8
%14 = load i32*, i32** %8
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %5
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 -1, i32* %4
br label %125
20: ; preds = %3
br label %21
21: ; preds = %119, %61, %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 %122
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 i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %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 i32 @strcmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %31, %25
br label %21
38: ; preds = %31
%39 = load i8*, i8** %5
%40 = call i64 @strlen(i8* %39)
%41 = load %struct.dirent*, %struct.dirent** %9
%42 = getelementptr inbounds %struct.dirent, %struct.dirent* %41, i32 0, i32 0
%43 = load i8*, i8** %42
%44 = call i64 @strlen(i8* %43)
%45 = add nsw i64 %40, %44
%46 = add nsw i64 %45, 2
%47 = call i8* @malloc(i64 %46)
store i8* %47, i8** %11
%48 = load i8*, i8** %11
%49 = load i8*, i8** %5
%50 = call i32 @strcpy(i8* %48, i8* %49)
%51 = load i8*, i8** %11
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%53 = load i8*, i8** %11
%54 = load %struct.dirent*, %struct.dirent** %9
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %54, i32 0, i32 0
%56 = load i8*, i8** %55
%57 = call i32 @strcat(i8* %53, i8* %56)
%58 = load i8*, i8** %11
%59 = call i64 @stat(i8* %58, %struct.stat* %10)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %38
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %11
%64 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %63)
br label %21
65: ; preds = %38
%66 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%67 = load i32, i32* %66
%68 = call i64 @S_ISDIR(i32 %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %92
70: ; preds = %65
%71 = load i8*, i8** %11
%72 = load i32, i32* %6
%73 = load i32, i32* %7
%74 = call i32 @fixperms(i8* %71, i32 %72, i32 %73)
%75 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%76 = load i32, i32* %75
%77 = load i32, i32* %7
%78 = load i32, i32* @S_IFDIR
%79 = or i32 %77, %78
%80 = icmp ne i32 %76, %79
br i1 %80, label %81, label %91
81: ; preds = %70
%82 = load i8*, i8** %11
%83 = load i32, i32* %7
%84 = call i64 @chmod(i8* %82, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %81
%87 = load i32, i32* @stderr
%88 = load i8*, i8** %11
%89 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i8* %88)
br label %90
90: ; preds = %86, %81
br label %91
91: ; preds = %90, %70
br label %119
92: ; preds = %65
%93 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%94 = load i32, i32* %93
%95 = call i64 @S_ISREG(i32 %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %115
97: ; preds = %92
%98 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%99 = load i32, i32* %98
%100 = load i32, i32* %6
%101 = load i32, i32* @S_IFREG
%102 = or i32 %100, %101
%103 = icmp ne i32 %99, %102
br i1 %103, label %104, label %114
104: ; preds = %97
%105 = load i8*, i8** %11
%106 = load i32, i32* %6
%107 = call i64 @chmod(i8* %105, i32 %106)
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %113
109: ; preds = %104
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %11
%112 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %111)
br label %113
113: ; preds = %109, %104
br label %114
114: ; preds = %113, %97
br label %118
115: ; preds = %92
%116 = load i8*, i8** %11
%117 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %116)
br label %118
118: ; preds = %115, %114
br label %119
119: ; preds = %118, %91
%120 = load i8*, i8** %11
%121 = call i32 @free(i8* %120)
br label %21
122: ; preds = %21
%123 = load i32*, i32** %8
%124 = call i32 @closedir(i32* %123)
store i32 0, i32* %4
br label %125
125: ; preds = %122, %16
%126 = load i32, i32* %4
ret i32 %126
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@stderr = global i32 0
@.str = [29 x i8] c"Failed to open directory %s\0A\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [19 x i8] c"Failed to stat %s\0A\00"
@S_IFDIR = global i32 0
@.str.5 = [50 x i8] c"Failed to update the permissions of directory %s\0A\00"
@S_IFREG = global i32 0
@.str.6 = [45 x i8] c"Failed to update the permissions of file %s\0A\00"
@.str.7 = [25 x i8] c"Ignored special file %s\0A\00"
define i32 @fixperms(i8* %0, i32 %1, i32 %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = tail call i32* @opendir(i8* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = call %struct.dirent* @readdir(i32* %6)
%10 = icmp eq %struct.dirent* %9, null
br i1 %10, label %78, label %11
11: ; preds = %8
%12 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
br label %16
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %80
16: ; preds = %11, %25
%17 = phi %struct.dirent* [ %9, %11 ], [ %26, %25 ]
%18 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %40, %76, %16, %22
%26 = call %struct.dirent* @readdir(i32* %6)
%27 = icmp eq %struct.dirent* %26, null
br i1 %27, label %78, label %16
28: ; preds = %22
%29 = call i64 @strlen(i8* dereferenceable(1) %0)
%30 = call i64 @strlen(i8* dereferenceable(1) %19)
%31 = add i64 %29, 2
%32 = add i64 %31, %30
%33 = call i8* @malloc(i64 %32)
%34 = call i32 @strcpy(i8* %33, i8* %0)
%35 = call i32 @strcat(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = load i8*, i8** %18
%37 = call i32 @strcat(i8* %33, i8* %36)
%38 = call i64 @stat(i8* %33, %struct.stat* %4)
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %28
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %33)
br label %25
43: ; preds = %28
%44 = load i32, i32* %12
%45 = call i64 @S_ISDIR(i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %59, label %47
47: ; preds = %43
%48 = call i32 @fixperms(i8* %33, i32 %1, i32 %2)
%49 = load i32, i32* %12
%50 = load i32, i32* @S_IFDIR
%51 = or i32 %50, %2
%52 = icmp eq i32 %49, %51
br i1 %52, label %76, label %53
53: ; preds = %47
%54 = call i64 @chmod(i8* %33, i32 %2)
%55 = icmp eq i64 %54, 0
br i1 %55, label %76, label %56
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i8* %33)
br label %76
59: ; preds = %43
%60 = load i32, i32* %12
%61 = call i64 @S_ISREG(i32 %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %74, label %63
63: ; preds = %59
%64 = load i32, i32* %12
%65 = load i32, i32* @S_IFREG
%66 = or i32 %65, %1
%67 = icmp eq i32 %64, %66
br i1 %67, label %76, label %68
68: ; preds = %63
%69 = call i64 @chmod(i8* %33, i32 %1)
%70 = icmp eq i64 %69, 0
br i1 %70, label %76, label %71
71: ; preds = %68
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %33)
br label %76
74: ; preds = %59
%75 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %33)
br label %76
76: ; preds = %74, %68, %71, %63, %47, %56, %53
%77 = call i32 @free(i8* %33)
br label %25
78: ; preds = %25, %8
%79 = call i32 @closedir(i32* %6)
br label %80
80: ; preds = %78, %13
%81 = phi i32 [ -1, %13 ], [ 0, %78 ]
ret i32 %81
}