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

/* Variables and functions */
int /*<<< orphan*/ AT_REMOVEDIR;
int /*<<< orphan*/ AT_SYMLINK_NOFOLLOW;
scalar_t__ DT_DIR;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int dirfd(int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ *fdopendir(int);
scalar_t__ fstat(int, struct stat *);
scalar_t__ fstatat(int, int /*<<< orphan*/, struct stat *, int /*<<< orphan*/);
int openat(int, int /*<<< orphan*/, int /*<<< orphan*/);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
scalar_t__ unlinkat(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *, ...);
int recursiveRemove(int fd) {
  struct stat rb;
  DIR *dir;
  int rc = -1;
  int dfd;
  if (!(dir = fdopendir(fd))) {
    warn("failed to open directory");
    goto done;
  }
  dfd = dirfd(dir);
  if (fstat(dfd, &rb)) {
    warn("failed to stat directory");
    goto done;
  }
  while (1) {
    struct dirent *d;
    errno = 0;
    if (!(d = readdir(dir))) {
      if (errno) {
        warn("failed to read directory");
        goto done;
      }
      break;
    }
    if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
      continue;
    if (d->d_type == DT_DIR) {
      struct stat sb;
      if (fstatat(dfd, d->d_name, &sb, AT_SYMLINK_NOFOLLOW)) {
        warn("failed to stat %s", d->d_name);
        continue;
      }
      if (sb.st_dev == rb.st_dev) {
        int cfd;
        cfd = openat(dfd, d->d_name, O_RDONLY);
        if (cfd >= 0) {
          recursiveRemove(cfd);
          close(cfd);
        }
      } else
        continue;
    }
    if (unlinkat(dfd, d->d_name, d->d_type == DT_DIR ? AT_REMOVEDIR : 0))
      warn("failed to unlink %s", d->d_name);
  }
  rc = 0;
done:
  if (dir)
    closedir(dir);
  return rc;
}


x86 assembly (clang, -O0):
<recursiveRemove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
call   10c0 <fdopendir@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11fb <recursiveRemove+0x3b>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <warn@plt>
jmp    13e4 <recursiveRemove+0x224>
mov    -0x18(%rbp),%rdi
call   1090 <dirfd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10d0 <fstat@plt>
cmp    $0x0,%rax
je     1230 <recursiveRemove+0x70>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <warn@plt>
jmp    13e4 <recursiveRemove+0x224>
jmp    1235 <recursiveRemove+0x75>
mov    0x2d8c(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
call   10a0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1283 <recursiveRemove+0xc3>
mov    0x2d67(%rip),%rax
cmpq   $0x0,(%rax)
je     127e <recursiveRemove+0xbe>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <warn@plt>
jmp    13e4 <recursiveRemove+0x224>
jmp    13dd <recursiveRemove+0x21d>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edi
lea    0xdbb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     12bb <recursiveRemove+0xfb>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edi
lea    0xd9e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12c0 <recursiveRemove+0x100>
jmp    1235 <recursiveRemove+0x75>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    0x2d02(%rip),%rcx
cmp    (%rcx),%rax
jne    1369 <recursiveRemove+0x1a9>
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
mov    0x2cd8(%rip),%rax
mov    (%rax),%ecx
lea    -0x30(%rbp),%rdx
call   10e0 <fstatat@plt>
cmp    $0x0,%rax
je     1317 <recursiveRemove+0x157>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1030 <warn@plt>
jmp    1235 <recursiveRemove+0x75>
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    135f <recursiveRemove+0x19f>
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
mov    0x2cb2(%rip),%rax
mov    (%rax),%edx
call   1050 <openat@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     135a <recursiveRemove+0x19a>
mov    -0x34(%rbp),%edi
call   10b0 <recursiveRemove@plt>
mov    -0x34(%rbp),%edi
call   1060 <close@plt>
jmp    1364 <recursiveRemove+0x1a4>
jmp    1235 <recursiveRemove+0x75>
jmp    1369 <recursiveRemove+0x1a9>
mov    -0x20(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    0x2c49(%rip),%rcx
cmp    (%rcx),%rax
jne    13a1 <recursiveRemove+0x1e1>
mov    0x2c41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
jmp    13ab <recursiveRemove+0x1eb>
xor    %eax,%eax
mov    %eax,-0x40(%rbp)
jmp    13ab <recursiveRemove+0x1eb>
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%edx
call   1040 <unlinkat@plt>
cmp    $0x0,%rax
je     13d8 <recursiveRemove+0x218>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1030 <warn@plt>
jmp    1235 <recursiveRemove+0x75>
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     13f8 <recursiveRemove+0x238>
mov    -0x18(%rbp),%rdi
call   1070 <closedir@plt>
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recursiveRemove>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
call   10c0 <fdopendir@plt>
test   %rax,%rax
je     1202 <recursiveRemove+0x42>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <dirfd@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   10d0 <fstat@plt>
test   %rax,%rax
je     121a <recursiveRemove+0x5a>
lea    0xe1c(%rip),%rdi
jmp    135e <recursiveRemove+0x19e>
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1030 <warn@plt>
mov    $0xffffffff,%ebp
jmp    1372 <recursiveRemove+0x1b2>
mov    0x2da7(%rip),%r15
movq   $0x0,(%r15)
mov    %rbx,%rdi
call   10a0 <readdir@plt>
test   %rax,%rax
je     1351 <recursiveRemove+0x191>
mov    %rax,%r13
mov    0x10(%rsp),%r12
lea    0xe04(%rip),%r14
mov    %r12,(%rsp)
jmp    129d <recursiveRemove+0xdd>
mov    0x8(%r13),%esi
mov    0x2d67(%rip),%rax
mov    (%rax),%ecx
mov    %ebp,%edi
lea    0x8(%rsp),%rdx
call   10e0 <fstatat@plt>
test   %rax,%rax
je     1308 <recursiveRemove+0x148>
mov    0x8(%r13),%esi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1030 <warn@plt>
movq   $0x0,(%r15)
mov    %rbx,%rdi
call   10a0 <readdir@plt>
mov    %rax,%r13
test   %rax,%rax
je     1351 <recursiveRemove+0x191>
mov    0x8(%r13),%edi
mov    %r14,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1282 <recursiveRemove+0xc2>
mov    0x8(%r13),%edi
lea    0xd93(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1282 <recursiveRemove+0xc2>
mov    0x0(%r13),%rax
mov    0x2d04(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
je     124e <recursiveRemove+0x8e>
mov    0x8(%r13),%esi
xor    %edx,%edx
cmp    %rcx,%rax
jne    12ec <recursiveRemove+0x12c>
mov    0x2cee(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
call   1040 <unlinkat@plt>
test   %rax,%rax
je     1282 <recursiveRemove+0xc2>
mov    0x8(%r13),%esi
lea    0xd5d(%rip),%rdi
jmp    127b <recursiveRemove+0xbb>
cmp    %r12,0x8(%rsp)
jne    1282 <recursiveRemove+0xc2>
mov    0x8(%r13),%esi
mov    0x2cca(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
call   1050 <openat@plt>
test   %eax,%eax
js     133d <recursiveRemove+0x17d>
mov    %eax,%r12d
mov    %eax,%edi
call   10b0 <recursiveRemove@plt>
mov    %r12d,%edi
call   1060 <close@plt>
mov    0x0(%r13),%rax
mov    0x2c88(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rsp),%r12
jmp    12d8 <recursiveRemove+0x118>
cmpq   $0x0,(%r15)
je     1383 <recursiveRemove+0x1c3>
lea    0xcd4(%rip),%rdi
xor    %eax,%eax
call   1030 <warn@plt>
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
call   1070 <closedir@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    136a <recursiveRemove+0x1aa>

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

LLVM IR (-O2):
%struct.stat = type { i64 }
%struct.dirent = type { i64, i32 }
@.str = [25 x i8] c"failed to open directory\00"
@.str.1 = [25 x i8] c"failed to stat directory\00"
@errno = global i64 0
@.str.2 = [25 x i8] c"failed to read directory\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"..\00"
@DT_DIR = global i64 0
@AT_SYMLINK_NOFOLLOW = global i32 0
@.str.5 = [18 x i8] c"failed to stat %s\00"
@O_RDONLY = global i32 0
@AT_REMOVEDIR = global i32 0
@.str.6 = [20 x i8] c"failed to unlink %s\00"
define i32 @recursiveRemove(i32 %0) {
%2 = alloca %struct.stat
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %2 to i8*
%5 = tail call i32* @fdopendir(i32 %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %84
9: ; preds = %1
%10 = tail call i32 @dirfd(i32* %5)
%11 = call i64 @fstat(i32 %10, %struct.stat* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %9
store i64 0, i64* @errno
%14 = call %struct.dirent* @readdir(i32* %5)
%15 = icmp eq %struct.dirent* %14, null
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = bitcast %struct.stat* %3 to i8*
%18 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%19 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%20 = load i64, i64* %19
br label %28
21: ; preds = %9
%22 = tail call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %81
23: ; preds = %78, %13
%24 = load i64, i64* @errno
%25 = icmp eq i64 %24, 0
br i1 %25, label %81, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %81
28: ; preds = %16, %78
%29 = phi %struct.dirent* [ %14, %16 ], [ %79, %78 ]
%30 = getelementptr inbounds %struct.dirent, %struct.dirent* %29, i64 0, i32 1
%31 = load i32, i32* %30
%32 = call i32 @strcmp(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %78, label %34
34: ; preds = %28
%35 = load i32, i32* %30
%36 = call i32 @strcmp(i32 %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %78, label %38
38: ; preds = %34
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %29, i64 0, i32 0
%40 = load i64, i64* %39
%41 = load i64, i64* @DT_DIR
%42 = icmp eq i64 %40, %41
br i1 %42, label %43, label %66
43: ; preds = %38
%44 = load i32, i32* %30
%45 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%46 = call i64 @fstatat(i32 %10, i32 %44, %struct.stat* %3, i32 %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %43
%49 = load i32, i32* %30
%50 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %49)
br label %65
51: ; preds = %43
%52 = load i64, i64* %18
%53 = icmp eq i64 %52, %20
br i1 %53, label %54, label %65
54: ; preds = %51
%55 = load i32, i32* %30
%56 = load i32, i32* @O_RDONLY
%57 = call i32 @openat(i32 %10, i32 %55, i32 %56)
%58 = icmp sgt i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = call i32 @recursiveRemove(i32 %57)
%61 = call i32 @close(i32 %57)
br label %62
62: ; preds = %59, %54
%63 = load i64, i64* %39
%64 = load i64, i64* @DT_DIR
br label %66
65: ; preds = %51, %48
br label %78
66: ; preds = %62, %38
%67 = phi i64 [ %64, %62 ], [ %41, %38 ]
%68 = phi i64 [ %63, %62 ], [ %40, %38 ]
%69 = load i32, i32* %30
%70 = icmp eq i64 %68, %67
%71 = load i32, i32* @AT_REMOVEDIR
%72 = select i1 %70, i32 %71, i32 0
%73 = call i64 @unlinkat(i32 %10, i32 %69, i32 %72)
%74 = icmp eq i64 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %66
%76 = load i32, i32* %30
%77 = call i32 (i8*, ...) @warn(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %65, %66, %75, %28, %34
store i64 0, i64* @errno
%79 = call %struct.dirent* @readdir(i32* %5)
%80 = icmp eq %struct.dirent* %79, null
br i1 %80, label %23, label %28
81: ; preds = %26, %23, %21
%82 = phi i32 [ -1, %21 ], [ -1, %26 ], [ 0, %23 ]
%83 = call i32 @closedir(i32* %5)
br label %84
84: ; preds = %7, %81
%85 = phi i32 [ %82, %81 ], [ -1, %7 ]
ret i32 %85
}