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

/* Variables and functions */
int EXIT_FAILURE;
int atoi(char *);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ usage(char **);
int main(int argc, char **argv) {
  int i, j, k;
  int nroot, ndirs, nfiles, ndel = 0;
  char name_buf[128];
  if (argc < 4) {
    usage(argv);
    return EXIT_FAILURE;
  }
  nroot = atoi(argv[1]);
  ndirs = atoi(argv[2]);
  nfiles = atoi(argv[3]);
  if (argc == 5)
    ndel = atoi(argv[4]);
  for (i = 0; i < nroot; ++i) {
    snprintf(name_buf, sizeof(name_buf), "rootdir%d", i);
    mkdir(name_buf, 0700);
    chdir(name_buf);
    for (j = 0; j < ndirs; ++j) {
      snprintf(name_buf, sizeof(name_buf), "dir%d", j);
      mkdir(name_buf, 0700);
      chdir(name_buf);
      for (k = 0; k < nfiles; ++k) {
        snprintf(name_buf, sizeof(name_buf), "file%d", k);
        int fd = creat(name_buf, 0600);
        if (fd != -1)
          close(fd);
        else
          perror("Error creating file");
      }
      chdir("..");
    }
    for (j = 0; j < ndel; ++j) {
      snprintf(name_buf, sizeof(name_buf), "dir%d", j);
      chdir(name_buf);
      for (k = 0; k < nfiles; ++k) {
        snprintf(name_buf, sizeof(name_buf), "file%d", k);
        remove(name_buf);
      }
      chdir("..");
      snprintf(name_buf, sizeof(name_buf), "dir%d", j);
      remove(name_buf);
    }
    chdir("..");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11d4 <main+0x44>
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1433 <main+0x2a3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    121e <main+0x8e>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    142c <main+0x29c>
lea    -0xb0(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0x80,%esi
lea    0xdb9(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <chdir@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    134f <main+0x1bf>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0x80,%esi
lea    0xd72(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <chdir@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1335 <main+0x1a5>
lea    -0xb0(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0x80,%esi
lea    0xd2d(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x180,%esi
call   10b0 <creat@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0xffffffff,-0xb4(%rbp)
je     1316 <main+0x186>
mov    -0xb4(%rbp),%edi
call   1070 <close@plt>
jmp    1322 <main+0x192>
lea    0xcf4(%rip),%rdi
call   1090 <perror@plt>
jmp    1327 <main+0x197>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12bb <main+0x12b>
lea    0xce9(%rip),%rdi
call   1050 <chdir@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1270 <main+0xe0>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1412 <main+0x282>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0x80,%esi
lea    0xc8c(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <chdir@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13d1 <main+0x241>
lea    -0xb0(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0x80,%esi
lea    0xc58(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
call   1030 <remove@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1390 <main+0x200>
lea    0xc4d(%rip),%rdi
call   1050 <chdir@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0x80,%esi
lea    0xc11(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0xb0(%rbp),%rdi
call   1030 <remove@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1356 <main+0x1c6>
lea    0xc0c(%rip),%rdi
call   1050 <chdir@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1225 <main+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jg     11c0 <main+0x30>
mov    %rbp,%rdi
call   1080 <usage@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%r14d
jmp    13c9 <main+0x239>
mov    %edi,%r15d
mov    0x8(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x10(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x8(%rsp)
mov    0x18(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebx
xor    %r14d,%r14d
movl   $0x0,(%rsp)
cmp    $0x5,%r15d
jne    1204 <main+0x74>
mov    0x20(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,(%rsp)
cmpl   $0x0,0x4(%rsp)
jle    13c9 <main+0x239>
xor    %ecx,%ecx
lea    0x10(%rsp),%r13
lea    0xde7(%rip),%r14
lea    0xde6(%rip),%r12
jmp    124d <main+0xbd>
cs nopw 0x0(%rax,%rax,1)
lea    0xdee(%rip),%rdi
call   1050 <chdir@plt>
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
cmp    0x4(%rsp),%ecx
je     13c6 <main+0x236>
mov    %r13,%rdi
mov    $0x80,%esi
lea    0xda4(%rip),%rdx
mov    %ecx,0xc(%rsp)
call   1060 <snprintf@plt>
mov    %r13,%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
mov    %r13,%rdi
call   1050 <chdir@plt>
cmpl   $0x0,0x8(%rsp)
jle    1330 <main+0x1a0>
xor    %ebp,%ebp
jmp    12a9 <main+0x119>
nopl   0x0(%rax)
lea    0xd8e(%rip),%rdi
call   1050 <chdir@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
je     1330 <main+0x1a0>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1060 <snprintf@plt>
mov    %r13,%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
mov    %r13,%rdi
call   1050 <chdir@plt>
test   %ebx,%ebx
jle    1290 <main+0x100>
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x80,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1060 <snprintf@plt>
mov    %r13,%rdi
mov    $0x180,%esi
call   10b0 <creat@plt>
cmp    $0xffffffff,%eax
je     131a <main+0x18a>
mov    %eax,%edi
call   1070 <close@plt>
add    $0x1,%r15d
cmp    %r15d,%ebx
jne    12e0 <main+0x150>
jmp    1290 <main+0x100>
lea    0xcf0(%rip),%rdi
call   1090 <perror@plt>
jmp    130c <main+0x17c>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,(%rsp)
jle    1230 <main+0xa0>
xor    %r15d,%r15d
jmp    1375 <main+0x1e5>
nop
lea    0xcde(%rip),%rdi
call   1050 <chdir@plt>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1060 <snprintf@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
add    $0x1,%r15d
cmp    (%rsp),%r15d
je     1230 <main+0xa0>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
call   1060 <snprintf@plt>
mov    %r13,%rdi
call   1050 <chdir@plt>
test   %ebx,%ebx
jle    1340 <main+0x1b0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x80,%esi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1060 <snprintf@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    13a0 <main+0x210>
jmp    1340 <main+0x1b0>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [10 x i8] c"rootdir%d\00"
@.str.1 = [6 x i8] c"dir%d\00"
@.str.2 = [7 x i8] c"file%d\00"
@.str.3 = [20 x i8] c"Error creating file\00"
@.str.4 = [3 x i8] c"..\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [128 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = call i32 @usage(i8** %18)
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %132
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %9
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %10
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %11
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 5
br i1 %35, label %36, label %41
36: ; preds = %21
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 4
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %12
br label %41
41: ; preds = %36, %21
store i32 0, i32* %6
br label %42
42: ; preds = %128, %41
%43 = load i32, i32* %6
%44 = load i32, i32* %9
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %131
46: ; preds = %42
%47 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%48 = load i32, i32* %6
%49 = call i32 @snprintf(i8* %47, i32 128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%51 = call i32 @mkdir(i8* %50, i32 448)
%52 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%53 = call i32 @chdir(i8* %52)
store i32 0, i32* %7
br label %54
54: ; preds = %89, %46
%55 = load i32, i32* %7
%56 = load i32, i32* %10
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %92
58: ; preds = %54
%59 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%60 = load i32, i32* %7
%61 = call i32 @snprintf(i8* %59, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%63 = call i32 @mkdir(i8* %62, i32 448)
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%65 = call i32 @chdir(i8* %64)
store i32 0, i32* %8
br label %66
66: ; preds = %84, %58
%67 = load i32, i32* %8
%68 = load i32, i32* %11
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %87
70: ; preds = %66
%71 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%72 = load i32, i32* %8
%73 = call i32 @snprintf(i8* %71, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %72)
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%75 = call i32 @creat(i8* %74, i32 384)
store i32 %75, i32* %14
%76 = load i32, i32* %14
%77 = icmp ne i32 %76, -1
br i1 %77, label %78, label %81
78: ; preds = %70
%79 = load i32, i32* %14
%80 = call i32 @close(i32 %79)
br label %83
81: ; preds = %70
%82 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %83
83: ; preds = %81, %78
br label %84
84: ; preds = %83
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
store i32 %86, i32* %8
br label %66
87: ; preds = %66
%88 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %89
89: ; preds = %87
%90 = load i32, i32* %7
%91 = add nsw i32 %90, 1
store i32 %91, i32* %7
br label %54
92: ; preds = %54
store i32 0, i32* %7
br label %93
93: ; preds = %123, %92
%94 = load i32, i32* %7
%95 = load i32, i32* %12
%96 = icmp slt i32 %94, %95
br i1 %96, label %97, label %126
97: ; preds = %93
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%99 = load i32, i32* %7
%100 = call i32 @snprintf(i8* %98, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %99)
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%102 = call i32 @chdir(i8* %101)
store i32 0, i32* %8
br label %103
103: ; preds = %113, %97
%104 = load i32, i32* %8
%105 = load i32, i32* %11
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %116
107: ; preds = %103
%108 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%109 = load i32, i32* %8
%110 = call i32 @snprintf(i8* %108, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%112 = call i32 @remove(i8* %111)
br label %113
113: ; preds = %107
%114 = load i32, i32* %8
%115 = add nsw i32 %114, 1
store i32 %115, i32* %8
br label %103
116: ; preds = %103
%117 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%118 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%119 = load i32, i32* %7
%120 = call i32 @snprintf(i8* %118, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %119)
%121 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%122 = call i32 @remove(i8* %121)
br label %123
123: ; preds = %116
%124 = load i32, i32* %7
%125 = add nsw i32 %124, 1
store i32 %125, i32* %7
br label %93
126: ; preds = %93
%127 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %128
128: ; preds = %126
%129 = load i32, i32* %6
%130 = add nsw i32 %129, 1
store i32 %130, i32* %6
br label %42
131: ; preds = %42
store i32 0, i32* %3
br label %132
132: ; preds = %131, %17
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [10 x i8] c"rootdir%d\00"
@.str.1 = [6 x i8] c"dir%d\00"
@.str.2 = [7 x i8] c"file%d\00"
@.str.3 = [20 x i8] c"Error creating file\00"
@.str.4 = [3 x i8] c"..\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @usage(i8** %1)
%8 = load i32, i32* @EXIT_FAILURE
br label %78
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = icmp eq i32 %0, 5
br i1 %19, label %20, label %24
20: ; preds = %9
%21 = getelementptr inbounds i8*, i8** %1, i64 4
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
br label %24
24: ; preds = %20, %9
%25 = phi i32 [ %23, %20 ], [ 0, %9 ]
%26 = icmp sgt i32 %12, 0
br i1 %26, label %27, label %78
27: ; preds = %24
%28 = icmp sgt i32 %15, 0
%29 = icmp sgt i32 %18, 0
%30 = icmp sgt i32 %25, 0
br label %31
31: ; preds = %27, %74
%32 = phi i32 [ 0, %27 ], [ %76, %74 ]
%33 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = call i32 @mkdir(i8* %4, i32 448)
%35 = call i32 @chdir(i8* %4)
br i1 %28, label %37, label %36
36: ; preds = %54, %31
br i1 %30, label %58, label %74
37: ; preds = %31, %54
%38 = phi i32 [ %56, %54 ], [ 0, %31 ]
%39 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 @mkdir(i8* %4, i32 448)
%41 = call i32 @chdir(i8* %4)
br i1 %29, label %42, label %54
42: ; preds = %37, %51
%43 = phi i32 [ %52, %51 ], [ 0, %37 ]
%44 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = call i32 @creat(i8* %4, i32 384)
%46 = icmp eq i32 %45, -1
br i1 %46, label %49, label %47
47: ; preds = %42
%48 = call i32 @close(i32 %45)
br label %51
49: ; preds = %42
%50 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %47
%52 = add nuw nsw i32 %43, 1
%53 = icmp eq i32 %52, %18
br i1 %53, label %54, label %42
54: ; preds = %51, %37
%55 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%56 = add nuw nsw i32 %38, 1
%57 = icmp eq i32 %56, %15
br i1 %57, label %36, label %37
58: ; preds = %36, %68
%59 = phi i32 [ %72, %68 ], [ 0, %36 ]
%60 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = call i32 @chdir(i8* %4)
br i1 %29, label %62, label %68
62: ; preds = %58, %62
%63 = phi i32 [ %66, %62 ], [ 0, %58 ]
%64 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = call i32 @remove(i8* %4)
%66 = add nuw nsw i32 %63, 1
%67 = icmp eq i32 %66, %18
br i1 %67, label %68, label %62
68: ; preds = %62, %58
%69 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%71 = call i32 @remove(i8* %4)
%72 = add nuw nsw i32 %59, 1
%73 = icmp eq i32 %72, %25
br i1 %73, label %74, label %58
74: ; preds = %68, %36
%75 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%76 = add nuw nsw i32 %32, 1
%77 = icmp eq i32 %76, %12
br i1 %77, label %78, label %31
78: ; preds = %74, %24, %6
%79 = phi i32 [ %8, %6 ], [ 0, %24 ], [ 0, %74 ]
ret i32 %79
}