#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*/ DIR;

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
char *bc_strdup_printf(char *, char const *, char *);
scalar_t__ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *opendir(char const *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ rmdir(char const *);
scalar_t__ stat(char const *, struct stat *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
scalar_t__ unlink(char *);
void rmdir_recursive(const char *dir) {
  if (dir == NULL)
    return;
  struct stat buf;
  if (0 != stat(dir, &buf)) {
    return;
  }
  if (!S_ISDIR(buf.st_mode)) {
    fprintf(stderr, "error: trying to remove invalid directory: %s\n", dir);
    exit(2);
  }
  DIR *d = opendir(dir);
  if (d == NULL) {
    fprintf(stderr, "error: failed to open directory: %s\n", strerror(errno));
    exit(2);
  }
  struct dirent *e;
  while (NULL != (e = readdir(d))) {
    if ((0 == strcmp(e->d_name, ".")) || (0 == strcmp(e->d_name, "..")))
      continue;
    char *f = bc_strdup_printf("%s/%s", dir, e->d_name);
    if (0 != stat(f, &buf)) {
      fprintf(stderr, "error: failed to stat directory entry (%s): %s\n",
              e->d_name, strerror(errno));
      free(f);
      exit(2);
    }
    if (S_ISDIR(buf.st_mode)) {
      rmdir_recursive(f);
    } else if (0 != unlink(f)) {
      fprintf(stderr, "error: failed to remove file (%s): %s\n", f,
              strerror(errno));
      free(f);
      exit(2);
    }
    free(f);
  }
  if (0 != closedir(d)) {
    fprintf(stderr, "error: failed to close directory: %s\n", strerror(errno));
    exit(2);
  }
  if (0 != rmdir(dir)) {
    fprintf(stderr, "error: failed to remove directory: %s\n", strerror(errno));
    exit(2);
  }
}


x86 assembly (clang, -O0):
<rmdir_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11fc <rmdir_recursive+0x1c>
jmp    14c5 <rmdir_recursive+0x2e5>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     121c <rmdir_recursive+0x3c>
jmp    14c5 <rmdir_recursive+0x2e5>
mov    -0x10(%rbp),%edi
call   1080 <S_ISDIR@plt>
cmp    $0x0,%rax
jne    1253 <rmdir_recursive+0x73>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12a3 <rmdir_recursive+0xc3>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
jmp    12a8 <rmdir_recursive+0xc8>
mov    -0x18(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     1427 <rmdir_recursive+0x247>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd84(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1305 <rmdir_recursive+0x125>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd62(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    130a <rmdir_recursive+0x12a>
jmp    12a8 <rmdir_recursive+0xc8>
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    0xd3b(%rip),%rdi
call   10e0 <bc_strdup_printf@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1390 <rmdir_recursive+0x1b0>
mov    0x2c99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xce7(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%edi
call   1080 <S_ISDIR@plt>
cmp    $0x0,%rax
je     13b0 <rmdir_recursive+0x1d0>
mov    -0x28(%rbp),%rdi
call   1070 <rmdir_recursive@plt>
jmp    1419 <rmdir_recursive+0x239>
mov    -0x28(%rbp),%rdi
call   1040 <unlink@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1414 <rmdir_recursive+0x234>
mov    0x2c12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xc93(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
jmp    1419 <rmdir_recursive+0x239>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    12a8 <rmdir_recursive+0xc8>
mov    -0x18(%rbp),%rdi
call   1090 <closedir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1476 <rmdir_recursive+0x296>
mov    0x2b9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b87(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%rdx
lea    0xc4f(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
mov    -0x8(%rbp),%rdi
call   1060 <rmdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     14c5 <rmdir_recursive+0x2e5>
mov    0x2b4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    %rax,%rdx
lea    0xc26(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmdir_recursive>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     132a <rmdir_recursive+0x14a>
mov    %rdi,%r14
mov    %rsp,%rsi
call   10c0 <stat@plt>
test   %rax,%rax
jne    132a <rmdir_recursive+0x14a>
mov    (%rsp),%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
je     137c <rmdir_recursive+0x19c>
mov    %r14,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     1391 <rmdir_recursive+0x1b1>
mov    %rax,%rbx
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1308 <rmdir_recursive+0x128>
mov    %rax,%rbp
lea    0xe0d(%rip),%r15
lea    0xe05(%rip),%r12
jmp    1281 <rmdir_recursive+0xa1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1070 <rmdir_recursive@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   10d0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1308 <rmdir_recursive+0x128>
mov    0x0(%rbp),%rdi
mov    %r15,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     126d <rmdir_recursive+0x8d>
mov    0x0(%rbp),%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     126d <rmdir_recursive+0x8d>
mov    0x0(%rbp),%rdx
lea    0xda9(%rip),%rdi
mov    %r14,%rsi
call   10e0 <bc_strdup_printf@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %rsp,%rsi
call   10c0 <stat@plt>
test   %rax,%rax
jne    1339 <rmdir_recursive+0x159>
mov    (%rsp),%edi
call   1080 <S_ISDIR@plt>
mov    %r13,%rdi
test   %rax,%rax
jne    1260 <rmdir_recursive+0x80>
call   1040 <unlink@plt>
test   %rax,%rax
je     1265 <rmdir_recursive+0x85>
mov    0x2cf6(%rip),%rax
mov    (%rax),%ebx
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xd8c(%rip),%rsi
mov    %ebx,%edi
mov    %r13,%rdx
jmp    1360 <rmdir_recursive+0x180>
mov    %rbx,%rdi
call   1090 <closedir@plt>
test   %rax,%rax
jne    13b1 <rmdir_recursive+0x1d1>
mov    %r14,%rdi
call   1060 <rmdir@plt>
test   %rax,%rax
jne    13d1 <rmdir_recursive+0x1f1>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ca0(%rip),%rax
mov    (%rax),%ebx
mov    0x0(%rbp),%rbp
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xd02(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
lea    0xc74(%rip),%rsi
mov    %r14,%rdx
jmp    13f4 <rmdir_recursive+0x214>
mov    0x2c48(%rip),%rax
mov    (%rax),%ebx
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xc80(%rip),%rsi
jmp    13ef <rmdir_recursive+0x20f>
mov    0x2c28(%rip),%rax
mov    (%rax),%ebx
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xce5(%rip),%rsi
jmp    13ef <rmdir_recursive+0x20f>
mov    0x2c08(%rip),%rax
mov    (%rax),%ebx
mov    0x2bf7(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xceb(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@stderr = global i32 0
@.str = [47 x i8] c"error: trying to remove invalid directory: %s\0A\00"
@.str.1 = [37 x i8] c"error: failed to open directory: %s\0A\00"
@errno = global i32 0
@.str.2 = [2 x i8] c".\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [6 x i8] c"%s/%s\00"
@.str.5 = [48 x i8] c"error: failed to stat directory entry (%s): %s\0A\00"
@.str.6 = [39 x i8] c"error: failed to remove file (%s): %s\0A\00"
@.str.7 = [38 x i8] c"error: failed to close directory: %s\0A\00"
@.str.8 = [39 x i8] c"error: failed to remove directory: %s\0A\00"
define void @rmdir_recursive(i8* %0) {
%2 = alloca %struct.stat
%3 = icmp eq i8* %0, null
br i1 %3, label %91, label %4
4: ; preds = %1
%5 = bitcast %struct.stat* %2 to i8*
%6 = call i64 @stat(i8* %0, %struct.stat* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %90
8: ; preds = %4
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = call i64 @S_ISDIR(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %0)
%16 = call i32 @exit(i32 2)
unreachable
17: ; preds = %8
%18 = call i32* @opendir(i8* %0)
%19 = icmp eq i32* %18, null
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = call %struct.dirent* @readdir(i32* %18)
%22 = icmp eq %struct.dirent* %21, null
br i1 %22, label %72, label %29
23: ; preds = %17
%24 = load i32, i32* @stderr
%25 = load i32, i32* @errno
%26 = call i8* @strerror(i32 %25)
%27 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 2)
unreachable
29: ; preds = %20, %39
%30 = phi %struct.dirent* [ %40, %39 ], [ %21, %20 ]
%31 = getelementptr inbounds %struct.dirent, %struct.dirent* %30, i64 0, i32 0
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %29
%36 = load i8*, i8** %31
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %29, %35, %70
%40 = call %struct.dirent* @readdir(i32* %18)
%41 = icmp eq %struct.dirent* %40, null
br i1 %41, label %72, label %29
42: ; preds = %35
%43 = load i8*, i8** %31
%44 = call i8* @bc_strdup_printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %43)
%45 = call i64 @stat(i8* %44, %struct.stat* %2)
%46 = icmp eq i64 %45, 0
br i1 %46, label %55, label %47
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %31
%50 = load i32, i32* @errno
%51 = call i8* @strerror(i32 %50)
%52 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* %49, i8* %51)
%53 = call i32 @free(i8* %44)
%54 = call i32 @exit(i32 2)
unreachable
55: ; preds = %42
%56 = load i32, i32* %9
%57 = call i64 @S_ISDIR(i32 %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %60, label %59
59: ; preds = %55
br label %70
60: ; preds = %55
%61 = call i64 @unlink(i8* %44)
%62 = icmp eq i64 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %44, i8* %66)
%68 = call i32 @free(i8* %44)
%69 = call i32 @exit(i32 2)
unreachable
70: ; preds = %60, %59
%71 = call i32 @free(i8* %44)
br label %39
72: ; preds = %39, %20
%73 = call i64 @closedir(i32* %18)
%74 = icmp eq i64 %73, 0
br i1 %74, label %81, label %75
75: ; preds = %72
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i8* %78)
%80 = call i32 @exit(i32 2)
unreachable
81: ; preds = %72
%82 = call i64 @rmdir(i8* %0)
%83 = icmp eq i64 %82, 0
br i1 %83, label %90, label %84
84: ; preds = %81
%85 = load i32, i32* @stderr
%86 = load i32, i32* @errno
%87 = call i8* @strerror(i32 %86)
%88 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %87)
%89 = call i32 @exit(i32 2)
unreachable
90: ; preds = %81, %4
br label %91
91: ; preds = %1, %90
ret void
}