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

/* Variables and functions */
int O_DIRECTORY;
int O_RDONLY;
int /*<<< orphan*/ SEEK_SET;
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
int close(int);
int create_file(char *, int const, int const);
int list_dir(char *, int);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int mkdir(char *, int const);
int open(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int remove_file(char *, int);
int rmdir(char *);
int main(void) {
  int ret, fd;
  const mode_t perm = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
  const int N = 5;
  ret = mkdir("root", perm);
  if (ret < 0) {
    perror("mkdir 1");
    return 1;
  }
  for (int i = 0; i < N; i++) {
    ret = create_file("root", i, perm);
    if (ret < 0)
      return 1;
  }
  printf("getdents_lseek: setup ok\n");
  fd = open("root", O_RDONLY | O_DIRECTORY);
  if (fd < 0) {
    perror("open dir");
    return 1;
  }
  ret = list_dir("getdents64 1", fd);
  if (ret < 0)
    return 1;
  printf("getdents_lseek: removing file0 and creating file%d\n", N);
  ret = remove_file("root", 0);
  if (ret < 0)
    return 1;
  ret = create_file("root", N, perm);
  if (ret < 0)
    return 1;
  printf("getdents_lseek: seeking to 0\n");
  ret = lseek(fd, 0, SEEK_SET);
  if (ret < 0) {
    perror("lseek 1");
    return 1;
  }
  ret = list_dir("getdents64 2", fd);
  if (ret < 0)
    return 1;
  ret = close(fd);
  if (ret < 0) {
    perror("close dir");
    return 1;
  }
  for (int i = 1; i < N + 1; i++) {
    ret = remove_file("root", i);
    if (ret < 0)
      return 1;
  }
  ret = rmdir("root");
  if (ret) {
    perror("rmdir");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    0x2e19(%rip),%rcx
or     (%rcx),%eax
mov    0x2de8(%rip),%rcx
or     (%rcx),%eax
mov    0x2e0f(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe19(%rip),%rdi
call   1030 <mkdir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1211 <main+0x71>
lea    0xe05(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    1260 <main+0xc0>
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xdd1(%rip),%rdi
call   10c0 <create_file@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    124d <main+0xad>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
jmp    1252 <main+0xb2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1218 <main+0x78>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%esi
mov    0x2d42(%rip),%rax
or     (%rax),%esi
lea    0xd79(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    12b1 <main+0x111>
lea    0xd87(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
mov    -0xc(%rbp),%esi
lea    0xd75(%rip),%rdi
call   1090 <list_dir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12d9 <main+0x139>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
lea    0xd5d(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd0d(%rip),%rdi
xor    %esi,%esi
call   1080 <remove_file@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1313 <main+0x173>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
mov    -0x10(%rbp),%edx
lea    0xce3(%rip),%rdi
mov    $0x5,%esi
call   10c0 <create_file@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1340 <main+0x1a0>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
mov    0x2c60(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1386 <main+0x1e6>
lea    0xd1a(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
mov    -0xc(%rbp),%esi
lea    0xd07(%rip),%rdi
call   1090 <list_dir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    13ae <main+0x20e>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    13db <main+0x23b>
lea    0xcda(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    1427 <main+0x287>
mov    -0x1c(%rbp),%esi
lea    0xc0a(%rip),%rdi
call   1080 <remove_file@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1414 <main+0x274>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
jmp    1419 <main+0x279>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13e2 <main+0x242>
lea    0xbd2(%rip),%rdi
call   1040 <rmdir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1458 <main+0x2b8>
lea    0xc67(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145f <main+0x2bf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e2d(%rip),%rax
mov    0x2e16(%rip),%rcx
mov    (%rcx),%ebp
or     (%rax),%ebp
mov    0x2de3(%rip),%rax
or     (%rax),%ebp
mov    0x2e0a(%rip),%rax
or     (%rax),%ebp
lea    0xe21(%rip),%rdi
mov    %ebp,%esi
call   1030 <mkdir@plt>
test   %eax,%eax
js     13e1 <main+0x231>
lea    0xe0b(%rip),%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13ed <main+0x23d>
lea    0xdf3(%rip),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xdd3(%rip),%rdi
mov    $0x2,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xdb8(%rip),%rdi
mov    $0x3,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xd9d(%rip),%rdi
mov    $0x4,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xdfe(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d46(%rip),%rax
mov    0x2d2f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xd64(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
js     13f9 <main+0x249>
mov    %eax,%r14d
lea    0xd63(%rip),%rdi
mov    %eax,%esi
call   10a0 <list_dir@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xd5a(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd24(%rip),%rdi
xor    %esi,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xd0e(%rip),%rdi
mov    $0x5,%esi
mov    %ebp,%edx
call   10d0 <create_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xd88(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
test   %eax,%eax
js     1402 <main+0x252>
lea    0xd2b(%rip),%rdi
mov    %r14d,%esi
call   10a0 <list_dir@plt>
test   %eax,%eax
js     13f2 <main+0x242>
mov    %r14d,%edi
call   1080 <close@plt>
test   %eax,%eax
js     140b <main+0x25b>
lea    0xca5(%rip),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xc87(%rip),%rdi
mov    $0x2,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xc72(%rip),%rdi
mov    $0x3,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xc5d(%rip),%rdi
mov    $0x4,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xc48(%rip),%rdi
mov    $0x5,%esi
call   1090 <remove_file@plt>
test   %eax,%eax
js     13f2 <main+0x242>
lea    0xc33(%rip),%rdi
call   1050 <rmdir@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     13f2 <main+0x242>
lea    0xc97(%rip),%rdi
jmp    13e8 <main+0x238>
lea    0xc1d(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xc0d(%rip),%rdi
jmp    13e8 <main+0x238>
lea    0xc4e(%rip),%rdi
jmp    13e8 <main+0x238>
lea    0xc5a(%rip),%rdi
jmp    13e8 <main+0x238>

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str = [5 x i8] c"root\00"
@.str.1 = [8 x i8] c"mkdir 1\00"
@.str.2 = [26 x i8] c"getdents_lseek: setup ok\0A\00"
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@.str.3 = [9 x i8] c"open dir\00"
@.str.4 = [13 x i8] c"getdents64 1\00"
@.str.5 = [52 x i8] c"getdents_lseek: removing file0 and creating file%d\0A\00"
@.str.6 = [30 x i8] c"getdents_lseek: seeking to 0\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [8 x i8] c"lseek 1\00"
@.str.8 = [13 x i8] c"getdents64 2\00"
@.str.9 = [10 x i8] c"close dir\00"
@.str.10 = [6 x i8] c"rmdir\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32, i32* @S_IRWXU
%9 = load i32, i32* @S_IRWXG
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IROTH
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IXOTH
%14 = or i32 %12, %13
store i32 %14, i32* %4
store i32 5, i32* %5
%15 = load i32, i32* %4
%16 = call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %107
21: ; preds = %0
store i32 0, i32* %6
br label %22
22: ; preds = %33, %21
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = load i32, i32* %6
%27 = load i32, i32* %4
%28 = call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %27)
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %25
store i32 1, i32* %1
br label %107
32: ; preds = %25
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %22
36: ; preds = %22
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @O_RDONLY
%39 = load i32, i32* @O_DIRECTORY
%40 = or i32 %38, %39
%41 = call i32 @open(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %40)
store i32 %41, i32* %3
%42 = load i32, i32* %3
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %36
%45 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %107
46: ; preds = %36
%47 = load i32, i32* %3
%48 = call i32 @list_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %47)
store i32 %48, i32* %2
%49 = load i32, i32* %2
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %46
store i32 1, i32* %1
br label %107
52: ; preds = %46
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 5)
%54 = call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %54, i32* %2
%55 = load i32, i32* %2
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %52
store i32 1, i32* %1
br label %107
58: ; preds = %52
%59 = load i32, i32* %4
%60 = call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5, i32 %59)
store i32 %60, i32* %2
%61 = load i32, i32* %2
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %58
store i32 1, i32* %1
br label %107
64: ; preds = %58
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%66 = load i32, i32* %3
%67 = load i32, i32* @SEEK_SET
%68 = call i32 @lseek(i32 %66, i32 0, i32 %67)
store i32 %68, i32* %2
%69 = load i32, i32* %2
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %64
%72 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %107
73: ; preds = %64
%74 = load i32, i32* %3
%75 = call i32 @list_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %74)
store i32 %75, i32* %2
%76 = load i32, i32* %2
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %73
store i32 1, i32* %1
br label %107
79: ; preds = %73
%80 = load i32, i32* %3
%81 = call i32 @close(i32 %80)
store i32 %81, i32* %2
%82 = load i32, i32* %2
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %79
%85 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %1
br label %107
86: ; preds = %79
store i32 1, i32* %7
br label %87
87: ; preds = %97, %86
%88 = load i32, i32* %7
%89 = icmp slt i32 %88, 6
br i1 %89, label %90, label %100
90: ; preds = %87
%91 = load i32, i32* %7
%92 = call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %91)
store i32 %92, i32* %2
%93 = load i32, i32* %2
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %96
95: ; preds = %90
store i32 1, i32* %1
br label %107
96: ; preds = %90
br label %97
97: ; preds = %96
%98 = load i32, i32* %7
%99 = add nsw i32 %98, 1
store i32 %99, i32* %7
br label %87
100: ; preds = %87
%101 = call i32 @rmdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %101, i32* %2
%102 = load i32, i32* %2
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %1
br label %107
106: ; preds = %100
store i32 0, i32* %1
br label %107
107: ; preds = %106, %104, %95, %84, %78, %71, %63, %57, %51, %44, %31, %19
%108 = load i32, i32* %1
ret i32 %108
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str = [5 x i8] c"root\00"
@.str.1 = [8 x i8] c"mkdir 1\00"
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@.str.3 = [9 x i8] c"open dir\00"
@.str.4 = [13 x i8] c"getdents64 1\00"
@.str.5 = [52 x i8] c"getdents_lseek: removing file0 and creating file%d\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [8 x i8] c"lseek 1\00"
@.str.8 = [13 x i8] c"getdents64 2\00"
@.str.9 = [10 x i8] c"close dir\00"
@.str.10 = [6 x i8] c"rmdir\00"
@str = [25 x i8] c"getdents_lseek: setup ok\00"
@str.11 = [29 x i8] c"getdents_lseek: seeking to 0\00"
define i32 @main() {
%1 = load i32, i32* @S_IRWXU
%2 = load i32, i32* @S_IRWXG
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IROTH
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IXOTH
%7 = or i32 %5, %6
%8 = tail call i32 @mkdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %71, label %10
10: ; preds = %0
%11 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0, i32 %7)
%12 = icmp slt i32 %11, 0
br i1 %12, label %74, label %13
13: ; preds = %10
%14 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1, i32 %7)
%15 = icmp slt i32 %14, 0
br i1 %15, label %74, label %16
16: ; preds = %13
%17 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2, i32 %7)
%18 = icmp slt i32 %17, 0
br i1 %18, label %74, label %19
19: ; preds = %16
%20 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3, i32 %7)
%21 = icmp slt i32 %20, 0
br i1 %21, label %74, label %22
22: ; preds = %19
%23 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4, i32 %7)
%24 = icmp slt i32 %23, 0
br i1 %24, label %74, label %25
25: ; preds = %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%27 = load i32, i32* @O_RDONLY
%28 = load i32, i32* @O_DIRECTORY
%29 = or i32 %28, %27
%30 = tail call i32 @open(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = icmp slt i32 %30, 0
br i1 %31, label %71, label %32
32: ; preds = %25
%33 = tail call i32 @list_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%34 = icmp slt i32 %33, 0
br i1 %34, label %74, label %35
35: ; preds = %32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 5)
%37 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%38 = icmp slt i32 %37, 0
br i1 %38, label %74, label %39
39: ; preds = %35
%40 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5, i32 %7)
%41 = icmp slt i32 %40, 0
br i1 %41, label %74, label %42
42: ; preds = %39
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.11, i64 0, i64 0))
%44 = load i32, i32* @SEEK_SET
%45 = tail call i32 @lseek(i32 %30, i32 0, i32 %44)
%46 = icmp slt i32 %45, 0
br i1 %46, label %71, label %47
47: ; preds = %42
%48 = tail call i32 @list_dir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%49 = icmp slt i32 %48, 0
br i1 %49, label %74, label %50
50: ; preds = %47
%51 = tail call i32 @close(i32 %30)
%52 = icmp slt i32 %51, 0
br i1 %52, label %71, label %53
53: ; preds = %50
%54 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%55 = icmp slt i32 %54, 0
br i1 %55, label %74, label %56
56: ; preds = %53
%57 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%58 = icmp slt i32 %57, 0
br i1 %58, label %74, label %59
59: ; preds = %56
%60 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
%61 = icmp slt i32 %60, 0
br i1 %61, label %74, label %62
62: ; preds = %59
%63 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%64 = icmp slt i32 %63, 0
br i1 %64, label %74, label %65
65: ; preds = %62
%66 = tail call i32 @remove_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
%67 = icmp slt i32 %66, 0
br i1 %67, label %74, label %68
68: ; preds = %65
%69 = tail call i32 @rmdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%70 = icmp eq i32 %69, 0
br i1 %70, label %74, label %71
71: ; preds = %68, %50, %42, %25, %0
%72 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %25 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %42 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), %50 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), %68 ]
%73 = tail call i32 @perror(i8* %72)
br label %74
74: ; preds = %71, %10, %13, %16, %19, %22, %53, %56, %59, %62, %65, %68, %47, %39, %35, %32
%75 = phi i32 [ 1, %32 ], [ 1, %35 ], [ 1, %39 ], [ 1, %47 ], [ 0, %68 ], [ 1, %65 ], [ 1, %62 ], [ 1, %59 ], [ 1, %56 ], [ 1, %53 ], [ 1, %22 ], [ 1, %19 ], [ 1, %16 ], [ 1, %13 ], [ 1, %10 ], [ 1, %71 ]
ret i32 %75
}