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

/* Variables and functions */
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewinddir(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int wait(int /*<<< orphan*/ *);
int backup(char *inpath, char *outpath) {
  pid_t pid;
  DIR *sourcedir;
  DIR *destdir;
  struct dirent *r;
  char *str[4096];
  char buf[4096];
  int i = 2, k;
  str[0] = "cp";
  str[1] = "-upr";
  sourcedir = opendir(inpath);
  if (sourcedir == NULL) {
    printf("Error: no source directory.\n");
    exit(-1);
  }
  destdir = opendir(outpath);
  if (destdir == NULL) {
    mkdir(outpath, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  }
  if (sourcedir == destdir) {
    printf("Error: backuping directory to itself.\n");
    exit(-1);
  }
  if ((r = readdir(sourcedir)) == NULL) {
    printf("Source directory is empty.\n");
    exit(-1);
  }
  rewinddir(sourcedir);
  while (r = readdir(sourcedir)) {
    if (!strcmp(r->d_name, ".") || !strcmp(r->d_name, ".."))
      continue;
    memset(buf, 0, sizeof(buf));
    strcpy(buf, inpath);
    strcat(buf, "/");
    strcat(buf, r->d_name);
    str[i] = malloc(strlen(buf) + 1);
    strcpy(str[i], buf);
    i++;
  }
  str[i] = outpath;
  closedir(sourcedir);
  closedir(destdir);
  pid = fork();
  if (pid == -1) {
    printf("Fork error.\n");
    exit(-1);
  } else if (pid == 0) {
    execvp(str[0], str);
  }
  while (wait(NULL) != -1) {
  }
  for (k = 2; k < i; k++) {
    free(str[k]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<backup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9040,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x9034(%rbp)
lea    0xdcc(%rip),%rax
mov    %rax,-0x8030(%rbp)
lea    0xdc1(%rip),%rax
mov    %rax,-0x8028(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1277 <backup+0x67>
lea    0xda0(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12bc <backup+0xac>
mov    -0x10(%rbp),%rdi
mov    0x2d4e(%rip),%rax
mov    (%rax),%esi
mov    0x2d35(%rip),%rax
or     (%rax),%esi
mov    0x2d1c(%rip),%rax
or     (%rax),%esi
mov    0x2d2b(%rip),%rax
or     (%rax),%esi
call   1050 <mkdir@plt>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    12e0 <backup+0xd0>
lea    0xd54(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    130d <backup+0xfd>
lea    0xd4e(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%rdi
call   10a0 <rewinddir@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     140c <backup+0x1fc>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xd2e(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
je     1365 <backup+0x155>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xd11(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    136a <backup+0x15a>
jmp    1316 <backup+0x106>
lea    -0x9030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1090 <memset@plt>
lea    -0x9030(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x9030(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   1100 <strcat@plt>
lea    -0x9030(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
call   1100 <strcat@plt>
lea    -0x9030(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10e0 <malloc@plt>
mov    %rax,%rcx
movslq -0x9034(%rbp),%rax
mov    %rcx,-0x8030(%rbp,%rax,8)
ff
movslq -0x9034(%rbp),%rax
mov    -0x8030(%rbp,%rax,8),%rdi
ff
lea    -0x9030(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x9034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9034(%rbp)
jmp    1316 <backup+0x106>
mov    -0x10(%rbp),%rcx
movslq -0x9034(%rbp),%rax
mov    %rcx,-0x8030(%rbp,%rax,8)
ff
mov    -0x20(%rbp),%rdi
call   10b0 <closedir@plt>
mov    -0x28(%rbp),%rdi
call   10b0 <closedir@plt>
mov    $0x0,%al
call   1130 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    145b <backup+0x24b>
lea    0xc21(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1478 <backup+0x268>
mov    -0x8030(%rbp),%rdi
lea    -0x8030(%rbp),%rsi
call   10f0 <execvp@plt>
jmp    147d <backup+0x26d>
jmp    1482 <backup+0x272>
xor    %eax,%eax
mov    %eax,%edi
call   1120 <wait@plt>
cmp    $0xffffffff,%eax
je     1499 <backup+0x289>
jmp    1482 <backup+0x272>
movl   $0x2,-0x9038(%rbp)
mov    -0x9038(%rbp),%eax
cmp    -0x9034(%rbp),%eax
jge    14dd <backup+0x2cd>
movslq -0x9038(%rbp),%rax
mov    -0x8030(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x9038(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9038(%rbp)
jmp    14a3 <backup+0x293>
xor    %eax,%eax
add    $0x9040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9028,%rsp
mov    %rsi,%r14
lea    0xdd5(%rip),%rax
mov    %rax,0x1020(%rsp)
lea    0xdc9(%rip),%rax
mov    %rax,0x1028(%rsp)
mov    %rdi,0x18(%rsp)
call   1070 <opendir@plt>
test   %rax,%rax
je     143a <backup+0x22a>
mov    %rax,%rbx
mov    %r14,%rdi
call   1070 <opendir@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1294 <backup+0x84>
mov    0x2d79(%rip),%rax
mov    0x2d62(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d47(%rip),%rax
or     (%rax),%esi
mov    0x2d56(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
call   1050 <mkdir@plt>
cmp    %rbp,%rbx
je     1443 <backup+0x233>
mov    %rbx,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     144c <backup+0x23c>
mov    %rbx,%rdi
call   10a0 <rewinddir@plt>
mov    %rbx,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     139b <backup+0x18b>
mov    %rax,%r12
mov    %rbp,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    $0x2,%r15d
lea    0xd28(%rip),%r13
lea    0xd20(%rip),%rbp
jmp    1304 <backup+0xf4>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10d0 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     138f <backup+0x17f>
mov    (%r12),%r14
mov    %r14,%rdi
mov    %r13,%rsi
call   10c0 <strcmp@plt>
test   %eax,%eax
je     12f0 <backup+0xe0>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10c0 <strcmp@plt>
test   %eax,%eax
je     12f0 <backup+0xe0>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1090 <memset@plt>
mov    %r14,%rdi
mov    0x18(%rsp),%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
lea    0xcba(%rip),%rsi
call   1100 <strcat@plt>
mov    (%r12),%rsi
mov    %r14,%rdi
call   1100 <strcat@plt>
mov    %r14,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdi
call   10e0 <malloc@plt>
mov    %rax,0x1020(%rsp,%r15,8)
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
add    $0x1,%r15
jmp    12f0 <backup+0xe0>
mov    0x10(%rsp),%r14
mov    0x8(%rsp),%rbp
jmp    13a1 <backup+0x191>
mov    $0x2,%r15d
movslq %r15d,%rax
mov    %r14,0x1020(%rsp,%rax,8)
mov    %rbx,%rdi
call   10b0 <closedir@plt>
mov    %rbp,%rdi
call   10b0 <closedir@plt>
xor    %eax,%eax
call   1130 <fork@plt>
test   %eax,%eax
je     13d8 <backup+0x1c8>
cmp    $0xffffffff,%eax
jne    13f0 <backup+0x1e0>
lea    0xc3a(%rip),%rdi
jmp    1453 <backup+0x243>
mov    0x1020(%rsp),%rdi
lea    0x1020(%rsp),%rsi
call   10f0 <execvp@plt>
nopl   (%rax)
xor    %edi,%edi
call   1120 <wait@plt>
cmp    $0xffffffff,%eax
jne    13f0 <backup+0x1e0>
cmp    $0x3,%r15d
jl     1426 <backup+0x216>
mov    %r15d,%ebx
mov    $0x2,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x1020(%rsp,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1410 <backup+0x200>
xor    %eax,%eax
add    $0x9028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc19(%rip),%rdi
jmp    1453 <backup+0x243>
lea    0xbea(%rip),%rdi
jmp    1453 <backup+0x243>
lea    0xbc6(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [3 x i8] c"cp\00"
@.str.1 = [5 x i8] c"-upr\00"
@.str.2 = [29 x i8] c"Error: no source directory.\0A\00"
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str.3 = [39 x i8] c"Error: backuping directory to itself.\0A\00"
@.str.4 = [28 x i8] c"Source directory is empty.\0A\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"..\00"
@.str.7 = [2 x i8] c"/\00"
@.str.8 = [13 x i8] c"Fork error.\0A\00"
define i32 @backup(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca %struct.dirent*
%9 = alloca [4096 x i8*]
%10 = alloca [4096 x i8]
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 2, i32* %11
%13 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %14
%15 = load i8*, i8** %3
%16 = call i32* @opendir(i8* %15)
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %2
%23 = load i8*, i8** %4
%24 = call i32* @opendir(i8* %23)
store i32* %24, i32** %7
%25 = load i32*, i32** %7
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %37
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i32, i32* @S_IRWXU
%30 = load i32, i32* @S_IRWXG
%31 = or i32 %29, %30
%32 = load i32, i32* @S_IROTH
%33 = or i32 %31, %32
%34 = load i32, i32* @S_IXOTH
%35 = or i32 %33, %34
%36 = call i32 @mkdir(i8* %28, i32 %35)
br label %37
37: ; preds = %27, %22
%38 = load i32*, i32** %6
%39 = load i32*, i32** %7
%40 = icmp eq i32* %38, %39
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %37
%45 = load i32*, i32** %6
%46 = call %struct.dirent* @readdir(i32* %45)
store %struct.dirent* %46, %struct.dirent** %8
%47 = icmp eq %struct.dirent* %46, null
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%50 = call i32 @exit(i32 -1)
unreachable
51: ; preds = %44
%52 = load i32*, i32** %6
%53 = call i32 @rewinddir(i32* %52)
br label %54
54: ; preds = %71, %70, %51
%55 = load i32*, i32** %6
%56 = call %struct.dirent* @readdir(i32* %55)
store %struct.dirent* %56, %struct.dirent** %8
%57 = icmp ne %struct.dirent* %56, null
br i1 %57, label %58, label %99
58: ; preds = %54
%59 = load %struct.dirent*, %struct.dirent** %8
%60 = getelementptr inbounds %struct.dirent, %struct.dirent* %59, i32 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 @strcmp(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %58
%65 = load %struct.dirent*, %struct.dirent** %8
%66 = getelementptr inbounds %struct.dirent, %struct.dirent* %65, i32 0, i32 0
%67 = load i8*, i8** %66
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %64, %58
br label %54
71: ; preds = %64
%72 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%73 = call i32 @memset(i8* %72, i32 0, i32 4096)
%74 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%75 = load i8*, i8** %3
%76 = call i32 @strcpy(i8* %74, i8* %75)
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%80 = load %struct.dirent*, %struct.dirent** %8
%81 = getelementptr inbounds %struct.dirent, %struct.dirent* %80, i32 0, i32 0
%82 = load i8*, i8** %81
%83 = call i32 @strcat(i8* %79, i8* %82)
%84 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%85 = call i64 @strlen(i8* %84)
%86 = add nsw i64 %85, 1
%87 = call i8* @malloc(i64 %86)
%88 = load i32, i32* %11
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 %89
store i8* %87, i8** %90
%91 = load i32, i32* %11
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 %92
%94 = load i8*, i8** %93
%95 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%96 = call i32 @strcpy(i8* %94, i8* %95)
%97 = load i32, i32* %11
%98 = add nsw i32 %97, 1
store i32 %98, i32* %11
br label %54
99: ; preds = %54
%100 = load i8*, i8** %4
%101 = load i32, i32* %11
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 %102
store i8* %100, i8** %103
%104 = load i32*, i32** %6
%105 = call i32 @closedir(i32* %104)
%106 = load i32*, i32** %7
%107 = call i32 @closedir(i32* %106)
%108 = call i32 (...) @fork()
store i32 %108, i32* %5
%109 = load i32, i32* %5
%110 = icmp eq i32 %109, -1
br i1 %110, label %111, label %114
111: ; preds = %99
%112 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%113 = call i32 @exit(i32 -1)
unreachable
114: ; preds = %99
%115 = load i32, i32* %5
%116 = icmp eq i32 %115, 0
br i1 %116, label %117, label %122
117: ; preds = %114
%118 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 0
%119 = load i8*, i8** %118
%120 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 0
%121 = call i32 @execvp(i8* %119, i8** %120)
br label %122
122: ; preds = %117, %114
br label %123
123: ; preds = %122
br label %124
124: ; preds = %127, %123
%125 = call i32 @wait(i32* null)
%126 = icmp ne i32 %125, -1
br i1 %126, label %127, label %128
127: ; preds = %124
br label %124
128: ; preds = %124
store i32 2, i32* %12
br label %129
129: ; preds = %139, %128
%130 = load i32, i32* %12
%131 = load i32, i32* %11
%132 = icmp slt i32 %130, %131
br i1 %132, label %133, label %142
133: ; preds = %129
%134 = load i32, i32* %12
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %9, i64 0, i64 %135
%137 = load i8*, i8** %136
%138 = call i32 @free(i8* %137)
br label %139
139: ; preds = %133
%140 = load i32, i32* %12
%141 = add nsw i32 %140, 1
store i32 %141, i32* %12
br label %129
142: ; preds = %129
ret i32 0
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [3 x i8] c"cp\00"
@.str.1 = [5 x i8] c"-upr\00"
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"..\00"
@.str.7 = [2 x i8] c"/\00"
@str = [12 x i8] c"Fork error.\00"
@str.9 = [27 x i8] c"Source directory is empty.\00"
@str.10 = [38 x i8] c"Error: backuping directory to itself.\00"
@str.11 = [28 x i8] c"Error: no source directory.\00"
define i32 @backup(i8* %0, i8* %1) {
%3 = alloca [4096 x i8*]
%4 = alloca [4096 x i8]
%5 = bitcast [4096 x i8*]* %3 to i8*
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %8
%9 = tail call i32* @opendir(i8* %0)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = tail call i32* @opendir(i8* %1)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* @S_IRWXU
%19 = load i32, i32* @S_IRWXG
%20 = or i32 %19, %18
%21 = load i32, i32* @S_IROTH
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IXOTH
%24 = or i32 %22, %23
%25 = tail call i32 @mkdir(i8* %1, i32 %24)
br label %26
26: ; preds = %17, %14
%27 = icmp eq i32* %9, %15
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.10, i64 0, i64 0))
%30 = tail call i32 @exit(i32 -1)
unreachable
31: ; preds = %26
%32 = tail call %struct.dirent* @readdir(i32* %9)
%33 = icmp eq %struct.dirent* %32, null
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%36 = tail call i32 @exit(i32 -1)
unreachable
37: ; preds = %31
%38 = tail call i32 @rewinddir(i32* %9)
%39 = call %struct.dirent* @readdir(i32* %9)
%40 = icmp eq %struct.dirent* %39, null
br i1 %40, label %75, label %41
41: ; preds = %37, %56
%42 = phi i64 [ %68, %56 ], [ 2, %37 ]
%43 = phi %struct.dirent* [ %69, %56 ], [ %39, %37 ]
br label %44
44: ; preds = %41, %53
%45 = phi %struct.dirent* [ %43, %41 ], [ %54, %53 ]
%46 = getelementptr inbounds %struct.dirent, %struct.dirent* %45, i64 0, i32 0
%47 = load i8*, i8** %46
%48 = call i32 @strcmp(i8* dereferenceable(1) %47, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %44
%51 = call i32 @strcmp(i8* dereferenceable(1) %47, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50, %44
%54 = call %struct.dirent* @readdir(i32* %9)
%55 = icmp eq %struct.dirent* %54, null
br i1 %55, label %71, label %44
56: ; preds = %50
%57 = getelementptr inbounds %struct.dirent, %struct.dirent* %45, i64 0, i32 0
%58 = call i32 @memset(i8* %6, i32 0, i32 4096)
%59 = call i32 @strcpy(i8* %6, i8* %0)
%60 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%61 = load i8*, i8** %57
%62 = call i32 @strcat(i8* %6, i8* %61)
%63 = call i64 @strlen(i8* %6)
%64 = add nsw i64 %63, 1
%65 = call i8* @malloc(i64 %64)
%66 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %3, i64 0, i64 %42
store i8* %65, i8** %66
%67 = call i32 @strcpy(i8* %65, i8* %6)
%68 = add nuw i64 %42, 1
%69 = call %struct.dirent* @readdir(i32* %9)
%70 = icmp eq %struct.dirent* %69, null
br i1 %70, label %73, label %41
71: ; preds = %53
%72 = trunc i64 %42 to i32
br label %75
73: ; preds = %56
%74 = trunc i64 %68 to i32
br label %75
75: ; preds = %73, %71, %37
%76 = phi i32 [ 2, %37 ], [ %72, %71 ], [ %74, %73 ]
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %3, i64 0, i64 %77
store i8* %1, i8** %78
%79 = call i32 @closedir(i32* %9)
%80 = call i32 @closedir(i32* %15)
%81 = call i32 (...) @fork()
switch i32 %81, label %88 [
i32 -1, label %82
i32 0, label %85
]
82: ; preds = %75
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%84 = call i32 @exit(i32 -1)
unreachable
85: ; preds = %75
%86 = load i8*, i8** %7
%87 = call i32 @execvp(i8* %86, i8** %7)
br label %88
88: ; preds = %75, %85
br label %89
89: ; preds = %88, %89
%90 = call i32 @wait(i32* null)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %89
92: ; preds = %89
%93 = icmp sgt i32 %76, 2
br i1 %93, label %94, label %103
94: ; preds = %92
%95 = zext i32 %76 to i64
br label %96
96: ; preds = %94, %96
%97 = phi i64 [ 2, %94 ], [ %101, %96 ]
%98 = getelementptr inbounds [4096 x i8*], [4096 x i8*]* %3, i64 0, i64 %97
%99 = load i8*, i8** %98
%100 = call i32 @free(i8* %99)
%101 = add nuw nsw i64 %97, 1
%102 = icmp eq i64 %101, %95
br i1 %102, label %103, label %96
103: ; preds = %96, %92
ret i32 0
}