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

/* Variables and functions */
int PATH_MAX;
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ chmod(char const *, int);
scalar_t__ chown(char const *, int, int);
scalar_t__ closedir(int /*<<< orphan*/ *);
int errno;
scalar_t__ lstat(char const *, struct stat *);
int /*<<< orphan*/ *opendir(char const *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int dirSetHierarchyPermissions(const char *path, int uid, int gid, int dirMode,
                               int fileMode) {
  struct stat st;
  if (lstat(path, &st)) {
    return -1;
  }
  if (S_ISLNK(st.st_mode)) {
    return 0;
  }
  if (chown(path, uid, gid) ||
      chmod(path, S_ISDIR(st.st_mode) ? dirMode : fileMode)) {
    return -1;
  }
  if (S_ISDIR(st.st_mode)) {
    DIR *dir = opendir(path);
    if (dir == NULL) {
      return -1;
    }
    errno = 0;
    const struct dirent *de;
    while (errno == 0 && (de = readdir(dir)) != NULL) {
      if (!strcmp(de->d_name, "..") || !strcmp(de->d_name, ".")) {
        continue;
      }
      char dn[PATH_MAX];
      snprintf(dn, sizeof(dn), "%s/%s", path, de->d_name);
      if (!dirSetHierarchyPermissions(dn, uid, gid, dirMode, fileMode)) {
        errno = 0;
      } else if (errno == 0) {
        errno = -1;
      }
    }
    if (errno != 0) {
      int save = errno;
      closedir(dir);
      errno = save;
      return -1;
    }
    if (closedir(dir)) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<dirSetHierarchyPermissions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <lstat@plt>
cmp    $0x0,%rax
je     11ec <dirSetHierarchyPermissions+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
mov    -0x28(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     120a <dirSetHierarchyPermissions+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10c0 <chown@plt>
cmp    $0x0,%rax
jne    1264 <dirSetHierarchyPermissions+0xb4>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1248 <dirSetHierarchyPermissions+0x98>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    124e <dirSetHierarchyPermissions+0x9e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x5c(%rbp),%esi
call   10d0 <chmod@plt>
cmp    $0x0,%rax
je     1270 <dirSetHierarchyPermissions+0xc0>
movl   $0xffffffff,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
mov    -0x28(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1431 <dirSetHierarchyPermissions+0x281>
mov    -0x10(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12a6 <dirSetHierarchyPermissions+0xf6>
movl   $0xffffffff,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
mov    0x2d2b(%rip),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
mov    0x2d1c(%rip),%rcx
cmpl   $0x0,(%rcx)
mov    %al,-0x5d(%rbp)
jne    12df <dirSetHierarchyPermissions+0x12f>
mov    -0x30(%rbp),%rdi
call   10b0 <readdir@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
test   $0x1,%al
jne    12ef <dirSetHierarchyPermissions+0x13f>
jmp    13d0 <dirSetHierarchyPermissions+0x220>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
lea    0xd03(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1327 <dirSetHierarchyPermissions+0x177>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
lea    0xce8(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    132c <dirSetHierarchyPermissions+0x17c>
jmp    12b3 <dirSetHierarchyPermissions+0x103>
mov    0x2cbd(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x68(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x48(%rbp)
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
mov    -0x38(%rbp),%rax
mov    (%rax),%r8
lea    0xc97(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x68(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1050 <dirSetHierarchyPermissions@plt>
cmp    $0x0,%eax
jne    13a2 <dirSetHierarchyPermissions+0x1f2>
mov    0x2c41(%rip),%rax
movl   $0x0,(%rax)
jmp    13c4 <dirSetHierarchyPermissions+0x214>
mov    0x2c2f(%rip),%rax
cmpl   $0x0,(%rax)
jne    13bf <dirSetHierarchyPermissions+0x20f>
mov    0x2c1f(%rip),%rax
movl   $0xffffffff,(%rax)
jmp    13c4 <dirSetHierarchyPermissions+0x214>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
jmp    12b3 <dirSetHierarchyPermissions+0x103>
mov    0x2c01(%rip),%rax
cmpl   $0x0,(%rax)
je     140d <dirSetHierarchyPermissions+0x25d>
mov    0x2bf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%rdi
call   1080 <closedir@plt>
mov    -0x4c(%rbp),%ecx
mov    0x2bd9(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
mov    -0x30(%rbp),%rdi
call   1080 <closedir@plt>
cmp    $0x0,%rax
je     142c <dirSetHierarchyPermissions+0x27c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1438 <dirSetHierarchyPermissions+0x288>
jmp    1431 <dirSetHierarchyPermissions+0x281>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirSetHierarchyPermissions>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %esi,%r13d
mov    %rdi,%r14
lea    -0x40(%rbp),%rsi
call   1090 <lstat@plt>
test   %rax,%rax
je     11e5 <dirSetHierarchyPermissions+0x35>
mov    $0xffffffff,%r12d
jmp    11fe <dirSetHierarchyPermissions+0x4e>
mov    %ebx,-0x30(%rbp)
mov    %r12d,-0x2c(%rbp)
mov    -0x40(%rbp),%ebx
mov    %ebx,%edi
call   1030 <S_ISLNK@plt>
xor    %r12d,%r12d
test   %rax,%rax
je     1210 <dirSetHierarchyPermissions+0x60>
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
mov    %r13d,%esi
mov    -0x30(%rbp),%edx
call   10c0 <chown@plt>
test   %rax,%rax
jne    11dd <dirSetHierarchyPermissions+0x2d>
mov    %ebx,%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
mov    -0x2c(%rbp),%esi
cmove  %r15d,%esi
mov    %r14,%rdi
call   10d0 <chmod@plt>
test   %rax,%rax
jne    11dd <dirSetHierarchyPermissions+0x2d>
mov    %ebx,%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
je     11fe <dirSetHierarchyPermissions+0x4e>
mov    %r14,%rdi
call   1040 <opendir@plt>
mov    %rax,-0x38(%rbp)
test   %rax,%rax
je     11dd <dirSetHierarchyPermissions+0x2d>
mov    %r15d,-0x44(%rbp)
mov    0x2d6b(%rip),%rax
movl   $0x0,(%rax)
jmp    1298 <dirSetHierarchyPermissions+0xe8>
xor    %eax,%eax
mov    -0x50(%rbp),%rdx
mov    0x2d56(%rip),%rcx
mov    %eax,(%rcx)
mov    %rdx,%rsp
mov    0x2d4a(%rip),%rax
mov    (%rax),%ebx
test   %ebx,%ebx
jne    1354 <dirSetHierarchyPermissions+0x1a4>
mov    -0x38(%rbp),%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     1347 <dirSetHierarchyPermissions+0x197>
mov    %rax,%r15
mov    (%rax),%rbx
mov    %rbx,%rdi
lea    0xd46(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1287 <dirSetHierarchyPermissions+0xd7>
mov    %rbx,%rdi
lea    0xd34(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1287 <dirSetHierarchyPermissions+0xd7>
mov    %rsp,-0x50(%rbp)
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    (%r15),%r8
mov    %rbx,%rdi
lea    0xcff(%rip),%rdx
mov    %r14,%rcx
call   1070 <snprintf@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x44(%rbp),%r8d
call   1050 <dirSetHierarchyPermissions@plt>
test   %eax,%eax
je     1275 <dirSetHierarchyPermissions+0xc5>
mov    0x2ca8(%rip),%rax
cmpl   $0x0,(%rax)
mov    -0x50(%rbp),%rdx
jne    1284 <dirSetHierarchyPermissions+0xd4>
mov    $0xffffffff,%eax
jmp    127b <dirSetHierarchyPermissions+0xcb>
mov    0x2c8a(%rip),%rax
mov    (%rax),%ebx
test   %ebx,%ebx
je     136b <dirSetHierarchyPermissions+0x1bb>
mov    -0x38(%rbp),%rdi
call   1080 <closedir@plt>
mov    0x2c74(%rip),%rax
mov    %ebx,(%rax)
jmp    11dd <dirSetHierarchyPermissions+0x2d>
mov    -0x38(%rbp),%rdi
call   1080 <closedir@plt>
test   %rax,%rax
jne    11dd <dirSetHierarchyPermissions+0x2d>
jmp    11fe <dirSetHierarchyPermissions+0x4e>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@errno = global i32 0
@.str = [3 x i8] c"..\00"
@.str.1 = [2 x i8] c".\00"
@PATH_MAX = global i32 0
@.str.2 = [6 x i8] c"%s/%s\00"
define i32 @dirSetHierarchyPermissions(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.stat
%13 = alloca i32*
%14 = alloca %struct.dirent*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%18 = load i8*, i8** %7
%19 = call i64 @lstat(i8* %18, %struct.stat* %12)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %5
store i32 -1, i32* %6
br label %123
22: ; preds = %5
%23 = getelementptr inbounds %struct.stat, %struct.stat* %12, i32 0, i32 0
%24 = load i32, i32* %23
%25 = call i64 @S_ISLNK(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
store i32 0, i32* %6
br label %123
28: ; preds = %22
%29 = load i8*, i8** %7
%30 = load i32, i32* %8
%31 = load i32, i32* %9
%32 = call i64 @chown(i8* %29, i32 %30, i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %48, label %34
34: ; preds = %28
%35 = load i8*, i8** %7
%36 = getelementptr inbounds %struct.stat, %struct.stat* %12, i32 0, i32 0
%37 = load i32, i32* %36
%38 = call i64 @S_ISDIR(i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = load i32, i32* %10
br label %44
42: ; preds = %34
%43 = load i32, i32* %11
br label %44
44: ; preds = %42, %40
%45 = phi i32 [ %41, %40 ], [ %43, %42 ]
%46 = call i64 @chmod(i8* %35, i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44, %28
store i32 -1, i32* %6
br label %123
49: ; preds = %44
%50 = getelementptr inbounds %struct.stat, %struct.stat* %12, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i64 @S_ISDIR(i32 %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %122
54: ; preds = %49
%55 = load i8*, i8** %7
%56 = call i32* @opendir(i8* %55)
store i32* %56, i32** %13
%57 = load i32*, i32** %13
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %60
59: ; preds = %54
store i32 -1, i32* %6
br label %123
60: ; preds = %54
store i32 0, i32* @errno
br label %61
61: ; preds = %106, %82, %60
%62 = load i32, i32* @errno
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = load i32*, i32** %13
%66 = call %struct.dirent* @readdir(i32* %65)
store %struct.dirent* %66, %struct.dirent** %14
%67 = icmp ne %struct.dirent* %66, null
br label %68
68: ; preds = %64, %61
%69 = phi i1 [ false, %61 ], [ %67, %64 ]
br i1 %69, label %70, label %108
70: ; preds = %68
%71 = load %struct.dirent*, %struct.dirent** %14
%72 = getelementptr inbounds %struct.dirent, %struct.dirent* %71, i32 0, i32 0
%73 = load i8*, i8** %72
%74 = call i32 @strcmp(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %70
%77 = load %struct.dirent*, %struct.dirent** %14
%78 = getelementptr inbounds %struct.dirent, %struct.dirent* %77, i32 0, i32 0
%79 = load i8*, i8** %78
%80 = call i32 @strcmp(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%81 = icmp ne i32 %80, 0
br i1 %81, label %83, label %82
82: ; preds = %76, %70
br label %61
83: ; preds = %76
%84 = load i32, i32* @PATH_MAX
%85 = zext i32 %84 to i64
%86 = call i8* @llvm.stacksave()
store i8* %86, i8** %15
%87 = alloca i8, i64 %85
store i64 %85, i64* %16
%88 = trunc i64 %85 to i32
%89 = load i8*, i8** %7
%90 = load %struct.dirent*, %struct.dirent** %14
%91 = getelementptr inbounds %struct.dirent, %struct.dirent* %90, i32 0, i32 0
%92 = load i8*, i8** %91
%93 = call i32 @snprintf(i8* %87, i32 %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %89, i8* %92)
%94 = load i32, i32* %8
%95 = load i32, i32* %9
%96 = load i32, i32* %10
%97 = load i32, i32* %11
%98 = call i32 @dirSetHierarchyPermissions(i8* %87, i32 %94, i32 %95, i32 %96, i32 %97)
%99 = icmp ne i32 %98, 0
br i1 %99, label %101, label %100
100: ; preds = %83
store i32 0, i32* @errno
br label %106
101: ; preds = %83
%102 = load i32, i32* @errno
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %101
store i32 -1, i32* @errno
br label %105
105: ; preds = %104, %101
br label %106
106: ; preds = %105, %100
%107 = load i8*, i8** %15
br label %61
108: ; preds = %68
%109 = load i32, i32* @errno
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %116
111: ; preds = %108
%112 = load i32, i32* @errno
store i32 %112, i32* %17
%113 = load i32*, i32** %13
%114 = call i64 @closedir(i32* %113)
%115 = load i32, i32* %17
store i32 %115, i32* @errno
store i32 -1, i32* %6
br label %123
116: ; preds = %108
%117 = load i32*, i32** %13
%118 = call i64 @closedir(i32* %117)
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %116
store i32 -1, i32* %6
br label %123
121: ; preds = %116
br label %122
122: ; preds = %121, %49
store i32 0, i32* %6
br label %123
123: ; preds = %122, %120, %111, %59, %48, %27, %21
%124 = load i32, i32* %6
ret i32 %124
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@errno = global i32 0
@.str = [3 x i8] c"..\00"
@.str.1 = [2 x i8] c".\00"
@PATH_MAX = global i32 0
@.str.2 = [6 x i8] c"%s/%s\00"
define i32 @dirSetHierarchyPermissions(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.stat
%7 = bitcast %struct.stat* %6 to i8*
%8 = call i64 @lstat(i8* %0, %struct.stat* %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %70
10: ; preds = %5
%11 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%12 = load i32, i32* %11
%13 = tail call i64 @S_ISLNK(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %70
15: ; preds = %10
%16 = tail call i64 @chown(i8* %0, i32 %1, i32 %2)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %70
18: ; preds = %15
%19 = tail call i64 @S_ISDIR(i32 %12)
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i32 %4, i32 %3
%22 = tail call i64 @chmod(i8* %0, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %70
24: ; preds = %18
%25 = tail call i64 @S_ISDIR(i32 %12)
%26 = icmp eq i64 %25, 0
br i1 %26, label %70, label %27
27: ; preds = %24
%28 = tail call i32* @opendir(i8* %0)
%29 = icmp eq i32* %28, null
br i1 %29, label %69, label %30
30: ; preds = %27
store i32 0, i32* @errno
br label %34
31: ; preds = %37, %42, %59
%32 = load i32, i32* @errno
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %63
34: ; preds = %30, %31
%35 = call %struct.dirent* @readdir(i32* %28)
%36 = icmp eq %struct.dirent* %35, null
br i1 %36, label %60, label %37
37: ; preds = %34
%38 = getelementptr inbounds %struct.dirent, %struct.dirent* %35, i64 0, i32 0
%39 = load i8*, i8** %38
%40 = call i32 @strcmp(i8* dereferenceable(1) %39, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
br i1 %41, label %31, label %42
42: ; preds = %37
%43 = call i32 @strcmp(i8* dereferenceable(1) %39, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i32 %43, 0
br i1 %44, label %31, label %45
45: ; preds = %42
%46 = load i32, i32* @PATH_MAX
%47 = zext i32 %46 to i64
%48 = call i8* @llvm.stacksave()
%49 = alloca i8, i64 %47
%50 = load i8*, i8** %38
%51 = call i32 @snprintf(i8* %49, i32 %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %50)
%52 = call i32 @dirSetHierarchyPermissions(i8* %49, i32 %1, i32 %2, i32 %3, i32 %4)
%53 = icmp eq i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %45
%55 = load i32, i32* @errno
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54, %45
%58 = phi i32 [ 0, %45 ], [ -1, %54 ]
store i32 %58, i32* @errno
br label %59
59: ; preds = %57, %54
br label %31
60: ; preds = %34
%61 = load i32, i32* @errno
%62 = icmp eq i32 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %31, %60
%64 = phi i32 [ %61, %60 ], [ %32, %31 ]
%65 = call i64 @closedir(i32* %28)
store i32 %64, i32* @errno
br label %69
66: ; preds = %60
%67 = call i64 @closedir(i32* %28)
%68 = icmp eq i64 %67, 0
br i1 %68, label %70, label %69
69: ; preds = %27, %63, %66
br label %70
70: ; preds = %24, %66, %69, %15, %18, %10, %5
%71 = phi i32 [ -1, %5 ], [ 0, %10 ], [ -1, %18 ], [ -1, %15 ], [ -1, %69 ], [ 0, %66 ], [ 0, %24 ]
ret i32 %71
}