#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*/ wd;
typedef int /*<<< orphan*/ td;
struct stat {
  int /*<<< orphan*/ st_mode;
};
struct dirent {
  unsigned char *d_name;
};
struct archive_file {
  int dummy;
};
typedef int /*<<< orphan*/ ofpath;
typedef int /*<<< orphan*/ ofbase;
typedef int /*<<< orphan*/ ifpath;
typedef int /*<<< orphan*/ ifbase;
typedef int /*<<< orphan*/ fp;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int PATH_MAX;
int R_OK;
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
int W_OK;
int X_OK;
scalar_t__ access(unsigned char *, int);
scalar_t__ check_file_name(unsigned char *, unsigned char **, unsigned char **);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
scalar_t__ create_arch_dir(unsigned char *, int, unsigned char const *,
                           unsigned char const *);
int /*<<< orphan*/ error(char *, unsigned char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *opendir(unsigned char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read_text_file(unsigned char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ remove_directory_recursively(unsigned char *,
                                                int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(unsigned char *, int, ...);
scalar_t__ stat(unsigned char *, struct stat *);
int /*<<< orphan*/ strcmp(unsigned char *, char *);
int make_report(struct archive_file *arch, const unsigned char *path,
                const unsigned char *work_dir, const unsigned char *prefix,
                const unsigned char *tests_dir,
                const unsigned char *input_file_pattern,
                const unsigned char *output_file_pattern,
                int (*unpack_func)(const unsigned char *path,
                                   const unsigned char *dir),
                int ignore_dot_files, unsigned char **forbidden_names,
                unsigned char **forbidden_suffixes) {
  unsigned char wd[PATH_MAX];
  int wd_created = 0;
  unsigned char td[PATH_MAX];
  struct stat stb;
  unsigned char fp[PATH_MAX];
  char *txt = 0;
  size_t len = 0;
  int num;
  unsigned char ifbase[PATH_MAX];
  unsigned char ofbase[PATH_MAX];
  unsigned char ifpath[PATH_MAX];
  unsigned char ofpath[PATH_MAX];
  DIR *d = 0;
  struct dirent *dd;
  if (create_arch_dir(wd, sizeof(wd), work_dir, prefix) < 0)
    goto fail;
  wd_created = 1;
  if (unpack_func(path, wd) < 0)
    goto fail;
  if (!(d = opendir(wd))) {
    error("cannot open directory %s", wd);
    goto fail;
  }
  while ((dd = readdir(d))) {
    if (check_file_name(dd->d_name, forbidden_names, forbidden_suffixes) < 0) {
      error("name '%s' is invalid", dd->d_name);
      goto fail;
    }
  }
  closedir(d);
  d = 0;
  snprintf(td, sizeof(td), "%s/%s", wd, tests_dir);
  if (stat(td, &stb) < 0) {
    error("directory %s does not exist", td);
    goto fail;
  }
  if (!S_ISDIR(stb.st_mode)) {
    error("directory %s is not a directory", td);
    goto fail;
  }
  if (access(td, R_OK | W_OK | X_OK) < 0) {
    error("directory %s has invalid permissions", td);
    goto fail;
  }
  if (!(d = opendir(td))) {
    error("cannot open directory %s", td);
    goto fail;
  }
  while ((dd = readdir(d))) {
    if (check_file_name(dd->d_name, forbidden_names, forbidden_suffixes) < 0) {
      error("name '%s' is invalid", dd->d_name);
      goto fail;
    }
  }
  closedir(d);
  d = 0;
  snprintf(fp, sizeof(fp), "%s/README", td);
  if (read_text_file(fp, "README", &txt, &len) >= 0) {
    printf("=== README ===\n%s\n", txt);
    free(txt);
    txt = 0;
    len = 0;
  }
  num = 0;
  while (1) {
    ++num;
    snprintf(ifbase, sizeof(ifbase), input_file_pattern, num);
    snprintf(ofbase, sizeof(ofbase), output_file_pattern, num);
    snprintf(ifpath, sizeof(ifpath), "%s/%s", td, ifbase);
    snprintf(ofpath, sizeof(ofpath), "%s/%s", td, ofbase);
    if (stat(ifpath, &stb) < 0)
      break;
    if (read_text_file(ifpath, ifbase, &txt, &len) < 0)
      goto fail;
    printf("=== %s ===\n%s\n", ifbase, txt);
    free(txt);
    txt = 0;
    len = 0;
    if (read_text_file(ofpath, ofbase, &txt, &len) < 0)
      goto fail;
    printf("=== %s ===\n%s\n", ofbase, txt);
    free(txt);
    txt = 0;
    len = 0;
  }
  if (ignore_dot_files) {
    if ((d = opendir(td))) {
      while ((dd = readdir(d))) {
        if (!strcmp(dd->d_name, "."))
          continue;
        if (!strcmp(dd->d_name, ".."))
          continue;
        if (dd->d_name[0] == '.') {
          printf("Ignored file: %s\n", dd->d_name);
        }
      }
      closedir(d);
      d = 0;
    }
  }
  remove_directory_recursively(wd, 0);
  return 0;
fail:
  if (d)
    closedir(d);
  if (wd_created) {
    remove_directory_recursively(wd, 0);
  }
  return -1;
}


x86 assembly (clang, -O0):
<make_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x2dc3(%rip),%rcx
mov    (%rcx),%eax
mov    %rsp,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0x120(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    (%rcx),%edx
mov    %rdx,-0x118(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0x110(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x58(%rbp)
mov    (%rcx),%edx
mov    %rdx,-0x108(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0x100(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
mov    (%rcx),%edx
mov    %rdx,-0xf8(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0xf0(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x88(%rbp)
mov    (%rcx),%edx
mov    %rdx,-0xe8(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0xe0(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x90(%rbp)
mov    (%rcx),%edx
mov    %rdx,-0xd8(%rbp)
mov    %rdx,%r8
add    $0xf,%r8
and    $0xfffffffffffffff0,%r8
mov    %rsp,%rsi
sub    %r8,%rsi
mov    %rsi,-0xd0(%rbp)
mov    %rsi,%rsp
mov    %rdx,-0x98(%rbp)
mov    (%rcx),%ecx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0xc0(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0xa0(%rbp)
movq   $0x0,-0xa8(%rbp)
mov    %eax,%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <create_arch_dir@plt>
cmp    $0x0,%rax
jge    1391 <make_report+0x1a1>
jmp    18e6 <make_report+0x6f6>
mov    -0x120(%rbp),%rsi
movl   $0x1,-0x4c(%rbp)
mov    0x18(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
cmp    $0x0,%eax
jge    13b7 <make_report+0x1c7>
jmp    18e6 <make_report+0x6f6>
mov    -0x120(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
jne    13ec <make_report+0x1fc>
mov    -0x120(%rbp),%rsi
lea    0xc1e(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
jmp    13f1 <make_report+0x201>
mov    -0xa8(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0xb0(%rbp)
cmp    $0x0,%rax
je     144f <make_report+0x25f>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rdi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   10f0 <check_file_name@plt>
cmp    $0x0,%rax
jge    144a <make_report+0x25a>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rsi
lea    0xbd9(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
jmp    13f1 <make_report+0x201>
mov    -0xa8(%rbp),%rdi
call   10a0 <closedir@plt>
mov    -0x120(%rbp),%rcx
mov    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rax
movq   $0x0,-0xa8(%rbp)
mov    %eax,%esi
mov    -0x30(%rbp),%r8
lea    0xba6(%rip),%rdx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0x110(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
jge    14c1 <make_report+0x2d1>
mov    -0x110(%rbp),%rsi
lea    0xb7d(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
mov    -0x60(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    14ea <make_report+0x2fa>
mov    -0x110(%rbp),%rsi
lea    0xb70(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
mov    -0x110(%rbp),%rdi
mov    0x2ad0(%rip),%rax
mov    (%rax),%esi
mov    0x2adf(%rip),%rax
or     (%rax),%esi
mov    0x2ace(%rip),%rax
or     (%rax),%esi
call   1110 <access@plt>
cmp    $0x0,%rax
jge    1533 <make_report+0x343>
mov    -0x110(%rbp),%rsi
lea    0xb47(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
mov    -0x110(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
jne    1568 <make_report+0x378>
mov    -0x110(%rbp),%rsi
lea    0xaa2(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
jmp    156d <make_report+0x37d>
mov    -0xa8(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0xb0(%rbp)
cmp    $0x0,%rax
je     15cb <make_report+0x3db>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rdi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   10f0 <check_file_name@plt>
cmp    $0x0,%rax
jge    15c6 <make_report+0x3d6>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rsi
lea    0xa5d(%rip),%rdi
call   1100 <error@plt>
jmp    18e6 <make_report+0x6f6>
jmp    156d <make_report+0x37d>
mov    -0xa8(%rbp),%rdi
call   10a0 <closedir@plt>
mov    -0x110(%rbp),%rcx
mov    -0x100(%rbp),%rdi
mov    -0x108(%rbp),%rax
movq   $0x0,-0xa8(%rbp)
mov    %eax,%esi
lea    0xa95(%rip),%rdx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0x100(%rbp),%rdi
lea    0xa83(%rip),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x78(%rbp),%rcx
mov    $0x0,%al
call   1090 <read_text_file@plt>
cmp    $0x0,%rax
jl     1659 <make_report+0x469>
mov    -0x70(%rbp),%rsi
lea    0xa66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
jmp    1665 <make_report+0x475>
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rax
mov    -0x7c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x7c(%rbp)
mov    %eax,%esi
mov    -0x38(%rbp),%rdx
mov    -0x7c(%rbp),%ecx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0xe0(%rbp),%rdi
mov    -0xe8(%rbp),%rax
mov    %eax,%esi
mov    0x10(%rbp),%rdx
mov    -0x7c(%rbp),%ecx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0xf0(%rbp),%r8
mov    -0x110(%rbp),%rcx
mov    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%rax
mov    %eax,%esi
lea    0x95f(%rip),%rdx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0xc0(%rbp),%rdi
mov    -0x110(%rbp),%rcx
mov    -0xe0(%rbp),%r8
mov    -0xc8(%rbp),%rax
mov    %eax,%esi
lea    0x933(%rip),%rdx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0xd0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
jge    1721 <make_report+0x531>
jmp    17e2 <make_report+0x5f2>
mov    -0xf0(%rbp),%rsi
mov    -0xd0(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0x78(%rbp),%rcx
mov    $0x0,%al
call   1090 <read_text_file@plt>
cmp    $0x0,%rax
jge    174d <make_report+0x55d>
jmp    18e6 <make_report+0x6f6>
mov    -0xf0(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0x953(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rdx
lea    -0x78(%rbp),%rcx
mov    $0x0,%al
call   1090 <read_text_file@plt>
cmp    $0x0,%rax
jge    17ab <make_report+0x5bb>
jmp    18e6 <make_report+0x6f6>
mov    -0xe0(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0x8f5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
jmp    1660 <make_report+0x470>
cmpl   $0x0,0x20(%rbp)
je     18c2 <make_report+0x6d2>
mov    -0x110(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
je     18bd <make_report+0x6cd>
jmp    180e <make_report+0x61e>
mov    -0xa8(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0xb0(%rbp)
cmp    $0x0,%rax
je     18a6 <make_report+0x6b6>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rdi
lea    0x886(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    184f <make_report+0x65f>
jmp    180e <make_report+0x61e>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rdi
lea    0x861(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    1873 <make_report+0x683>
jmp    180e <make_report+0x61e>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
cmp    $0x2e,%eax
jne    18a1 <make_report+0x6b1>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rsi
lea    0x82a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    180e <make_report+0x61e>
mov    -0xa8(%rbp),%rdi
call   10a0 <closedir@plt>
movq   $0x0,-0xa8(%rbp)
jmp    18c2 <make_report+0x6d2>
mov    -0x120(%rbp),%rdi
xor    %esi,%esi
call   10e0 <remove_directory_recursively@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xb4(%rbp)
jmp    1929 <make_report+0x739>
cmpq   $0x0,-0xa8(%rbp)
je     1900 <make_report+0x710>
mov    -0xa8(%rbp),%rdi
call   10a0 <closedir@plt>
cmpl   $0x0,-0x4c(%rbp)
je     1918 <make_report+0x728>
mov    -0x120(%rbp),%rdi
xor    %esi,%esi
call   10e0 <remove_directory_recursively@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xb4(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_report>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,%r13
mov    %r8,-0x58(%rbp)
mov    %rsi,%r14
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%r15
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,-0x88(%rbp)
mov    %rdi,%rsp
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,-0x68(%rbp)
mov    %rdi,%rsp
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,-0x80(%rbp)
mov    %rdi,%rsp
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,-0x70(%rbp)
mov    %rdi,%rsp
mov    %r15,%rdi
mov    %rsi,-0x60(%rbp)
call   1040 <create_arch_dir@plt>
test   %rax,%rax
js     1329 <make_report+0x139>
mov    %r13,-0x78(%rbp)
mov    %r14,%rdi
mov    %r15,%rsi
call   *0x18(%rbp)
mov    $0xffffffff,%r13d
test   %eax,%eax
js     142c <make_report+0x23c>
mov    %rbx,-0x50(%rbp)
mov    %r15,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     1334 <make_report+0x144>
mov    %rax,%r14
mov    %r15,-0x30(%rbp)
mov    0x30(%rbp),%r15
mov    0x28(%rbp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1348 <make_report+0x158>
mov    %rax,%rbx
mov    (%rax),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   10f0 <check_file_name@plt>
test   %rax,%rax
jns    12e0 <make_report+0xf0>
mov    -0x30(%rbp),%r15
mov    $0xffffffff,%r13d
mov    (%rbx),%rsi
lea    0xd02(%rip),%rdi
call   1100 <error@plt>
mov    %r14,%rdi
call   10a0 <closedir@plt>
jmp    142c <make_report+0x23c>
mov    $0xffffffff,%r13d
jmp    1436 <make_report+0x246>
lea    0xcc5(%rip),%rdi
mov    %r15,%rsi
call   1100 <error@plt>
jmp    142c <make_report+0x23c>
mov    %r14,%rdi
call   10a0 <closedir@plt>
lea    0xcd7(%rip),%rdx
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdi
mov    -0x60(%rbp),%rsi
mov    -0x30(%rbp),%rcx
mov    -0x58(%rbp),%r8
xor    %eax,%eax
call   1080 <snprintf@plt>
lea    -0x48(%rbp),%rsi
mov    %rbx,%rdi
call   10c0 <stat@plt>
test   %rax,%rax
js     13f8 <make_report+0x208>
mov    -0x48(%rbp),%edi
call   1070 <S_ISDIR@plt>
test   %eax,%eax
je     1401 <make_report+0x211>
mov    0x2c33(%rip),%rax
mov    0x2c44(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2c31(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
call   1110 <access@plt>
test   %rax,%rax
js     140a <make_report+0x21a>
mov    %rbx,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     1413 <make_report+0x223>
mov    %rax,%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1448 <make_report+0x258>
mov    %rax,%rbx
mov    (%rax),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   10f0 <check_file_name@plt>
test   %rax,%rax
jns    13d0 <make_report+0x1e0>
jmp    1303 <make_report+0x113>
lea    0xc35(%rip),%rdi
jmp    141a <make_report+0x22a>
lea    0xc48(%rip),%rdi
jmp    141a <make_report+0x22a>
lea    0xc5f(%rip),%rdi
jmp    141a <make_report+0x22a>
lea    0xbe6(%rip),%rdi
mov    %rbx,%rsi
call   1100 <error@plt>
mov    -0x30(%rbp),%r15
mov    $0xffffffff,%r13d
mov    %r15,%rdi
xor    %esi,%esi
call   10e0 <remove_directory_recursively@plt>
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
call   10a0 <closedir@plt>
lea    0xc3e(%rip),%rdx
mov    %r12,%rdi
mov    -0x60(%rbp),%rsi
mov    -0x50(%rbp),%rcx
xor    %eax,%eax
call   1080 <snprintf@plt>
lea    0xc28(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <read_text_file@plt>
test   %rax,%rax
js     14b2 <make_report+0x2c2>
mov    -0x38(%rbp),%rsi
lea    0xc0d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    $0x1,%ebx
mov    -0x68(%rbp),%r15
mov    -0x88(%rbp),%r13
mov    %r13,%rdi
mov    -0x60(%rbp),%r12
mov    %r12d,%esi
mov    -0x78(%rbp),%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    0x10(%rbp),%rdx
mov    %ebx,-0x58(%rbp)
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    -0x80(%rbp),%rbx
mov    %rbx,%rdi
mov    %r12d,%esi
lea    0xb2e(%rip),%rdx
mov    -0x50(%rbp),%r14
mov    %r14,%rcx
mov    %r13,%r8
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    -0x70(%rbp),%rdi
mov    %r12d,%esi
lea    0xb0f(%rip),%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    %rbx,%rdi
lea    -0x48(%rbp),%rsi
call   10c0 <stat@plt>
test   %rax,%rax
js     15ec <make_report+0x3fc>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    -0x38(%rbp),%rbx
mov    %rbx,%rdx
lea    -0x40(%rbp),%r14
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <read_text_file@plt>
test   %rax,%rax
js     1422 <make_report+0x232>
mov    -0x38(%rbp),%rdx
lea    0xb42(%rip),%r12
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%r15
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <read_text_file@plt>
test   %rax,%rax
js     1422 <make_report+0x232>
mov    -0x38(%rbp),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x58(%rbp),%ebx
add    $0x1,%ebx
jmp    14c2 <make_report+0x2d2>
xor    %r13d,%r13d
cmpl   $0x0,0x20(%rbp)
mov    -0x30(%rbp),%r15
je     142c <make_report+0x23c>
mov    -0x50(%rbp),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     142c <make_report+0x23c>
mov    %rax,%r14
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1678 <make_report+0x488>
lea    0xa9c(%rip),%r13
lea    0xa94(%rip),%r15
lea    0xa90(%rip),%r12
jmp    1643 <make_report+0x453>
mov    %r14,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1678 <make_report+0x488>
mov    (%rax),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   10b0 <strcmp@plt>
test   %eax,%eax
je     1636 <make_report+0x446>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strcmp@plt>
test   %eax,%eax
je     1636 <make_report+0x446>
cmpb   $0x2e,(%rbx)
jne    1636 <make_report+0x446>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1636 <make_report+0x446>
mov    %r14,%rdi
call   10a0 <closedir@plt>
mov    -0x30(%rbp),%r15
xor    %r13d,%r13d
jmp    142c <make_report+0x23c>

LLVM IR (-O0):
%struct.archive_file = type { i32 }
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@PATH_MAX = global i32 0
@.str = [25 x i8] c"cannot open directory %s\00"
@.str.1 = [21 x i8] c"name '%s' is invalid\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [28 x i8] c"directory %s does not exist\00"
@.str.4 = [32 x i8] c"directory %s is not a directory\00"
@R_OK = global i32 0
@W_OK = global i32 0
@X_OK = global i32 0
@.str.5 = [37 x i8] c"directory %s has invalid permissions\00"
@.str.6 = [10 x i8] c"%s/README\00"
@.str.7 = [7 x i8] c"README\00"
@.str.8 = [19 x i8] c"=== README ===\0A%s\0A\00"
@.str.9 = [15 x i8] c"=== %s ===\0A%s\0A\00"
@.str.10 = [2 x i8] c".\00"
@.str.11 = [3 x i8] c"..\00"
@.str.12 = [18 x i8] c"Ignored file: %s\0A\00"
define i32 @make_report(%struct.archive_file* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, i32 (i8*, i8*)* %7, i32 %8, i8** %9, i8** %10) {
%12 = alloca i32
%13 = alloca %struct.archive_file*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32 (i8*, i8*)*
%21 = alloca i32
%22 = alloca i8**
%23 = alloca i8**
%24 = alloca i8*
%25 = alloca i64
%26 = alloca i32
%27 = alloca i64
%28 = alloca %struct.stat
%29 = alloca i64
%30 = alloca i8*
%31 = alloca i64
%32 = alloca i32
%33 = alloca i64
%34 = alloca i64
%35 = alloca i64
%36 = alloca i64
%37 = alloca i32*
%38 = alloca %struct.dirent*
%39 = alloca i32
store %struct.archive_file* %0, %struct.archive_file** %13
store i8* %1, i8** %14
store i8* %2, i8** %15
store i8* %3, i8** %16
store i8* %4, i8** %17
store i8* %5, i8** %18
store i8* %6, i8** %19
store i32 (i8*, i8*)* %7, i32 (i8*, i8*)** %20
store i32 %8, i32* %21
store i8** %9, i8*** %22
store i8** %10, i8*** %23
%40 = load i32, i32* @PATH_MAX
%41 = zext i32 %40 to i64
%42 = call i8* @llvm.stacksave()
store i8* %42, i8** %24
%43 = alloca i8, i64 %41
store i64 %41, i64* %25
store i32 0, i32* %26
%44 = load i32, i32* @PATH_MAX
%45 = zext i32 %44 to i64
%46 = alloca i8, i64 %45
store i64 %45, i64* %27
%47 = load i32, i32* @PATH_MAX
%48 = zext i32 %47 to i64
%49 = alloca i8, i64 %48
store i64 %48, i64* %29
store i8* null, i8** %30
store i64 0, i64* %31
%50 = load i32, i32* @PATH_MAX
%51 = zext i32 %50 to i64
%52 = alloca i8, i64 %51
store i64 %51, i64* %33
%53 = load i32, i32* @PATH_MAX
%54 = zext i32 %53 to i64
%55 = alloca i8, i64 %54
store i64 %54, i64* %34
%56 = load i32, i32* @PATH_MAX
%57 = zext i32 %56 to i64
%58 = alloca i8, i64 %57
store i64 %57, i64* %35
%59 = load i32, i32* @PATH_MAX
%60 = zext i32 %59 to i64
%61 = alloca i8, i64 %60
store i64 %60, i64* %36
store i32* null, i32** %37
%62 = trunc i64 %41 to i32
%63 = load i8*, i8** %15
%64 = load i8*, i8** %16
%65 = call i64 @create_arch_dir(i8* %43, i32 %62, i8* %63, i8* %64)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %11
br label %243
68: ; preds = %11
store i32 1, i32* %26
%69 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %20
%70 = load i8*, i8** %14
%71 = call i32 %69(i8* %70, i8* %43)
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %68
br label %243
74: ; preds = %68
%75 = call i32* @opendir(i8* %43)
store i32* %75, i32** %37
%76 = icmp ne i32* %75, null
br i1 %76, label %79, label %77
77: ; preds = %74
%78 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %43)
br label %243
79: ; preds = %74
br label %80
80: ; preds = %97, %79
%81 = load i32*, i32** %37
%82 = call %struct.dirent* @readdir(i32* %81)
store %struct.dirent* %82, %struct.dirent** %38
%83 = icmp ne %struct.dirent* %82, null
br i1 %83, label %84, label %98
84: ; preds = %80
%85 = load %struct.dirent*, %struct.dirent** %38
%86 = getelementptr inbounds %struct.dirent, %struct.dirent* %85, i32 0, i32 0
%87 = load i8*, i8** %86
%88 = load i8**, i8*** %22
%89 = load i8**, i8*** %23
%90 = call i64 @check_file_name(i8* %87, i8** %88, i8** %89)
%91 = icmp slt i64 %90, 0
br i1 %91, label %92, label %97
92: ; preds = %84
%93 = load %struct.dirent*, %struct.dirent** %38
%94 = getelementptr inbounds %struct.dirent, %struct.dirent* %93, i32 0, i32 0
%95 = load i8*, i8** %94
%96 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %95)
br label %243
97: ; preds = %84
br label %80
98: ; preds = %80
%99 = load i32*, i32** %37
%100 = call i32 @closedir(i32* %99)
store i32* null, i32** %37
%101 = trunc i64 %45 to i32
%102 = load i8*, i8** %17
%103 = call i32 (i8*, i32, ...) @snprintf(i8* %46, i32 %101, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %43, i8* %102)
%104 = call i64 @stat(i8* %46, %struct.stat* %28)
%105 = icmp slt i64 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %98
%107 = call i32 @error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %46)
br label %243
108: ; preds = %98
%109 = getelementptr inbounds %struct.stat, %struct.stat* %28, i32 0, i32 0
%110 = load i32, i32* %109
%111 = call i32 @S_ISDIR(i32 %110)
%112 = icmp ne i32 %111, 0
br i1 %112, label %115, label %113
113: ; preds = %108
%114 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %46)
br label %243
115: ; preds = %108
%116 = load i32, i32* @R_OK
%117 = load i32, i32* @W_OK
%118 = or i32 %116, %117
%119 = load i32, i32* @X_OK
%120 = or i32 %118, %119
%121 = call i64 @access(i8* %46, i32 %120)
%122 = icmp slt i64 %121, 0
br i1 %122, label %123, label %125
123: ; preds = %115
%124 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %46)
br label %243
125: ; preds = %115
%126 = call i32* @opendir(i8* %46)
store i32* %126, i32** %37
%127 = icmp ne i32* %126, null
br i1 %127, label %130, label %128
128: ; preds = %125
%129 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %46)
br label %243
130: ; preds = %125
br label %131
131: ; preds = %148, %130
%132 = load i32*, i32** %37
%133 = call %struct.dirent* @readdir(i32* %132)
store %struct.dirent* %133, %struct.dirent** %38
%134 = icmp ne %struct.dirent* %133, null
br i1 %134, label %135, label %149
135: ; preds = %131
%136 = load %struct.dirent*, %struct.dirent** %38
%137 = getelementptr inbounds %struct.dirent, %struct.dirent* %136, i32 0, i32 0
%138 = load i8*, i8** %137
%139 = load i8**, i8*** %22
%140 = load i8**, i8*** %23
%141 = call i64 @check_file_name(i8* %138, i8** %139, i8** %140)
%142 = icmp slt i64 %141, 0
br i1 %142, label %143, label %148
143: ; preds = %135
%144 = load %struct.dirent*, %struct.dirent** %38
%145 = getelementptr inbounds %struct.dirent, %struct.dirent* %144, i32 0, i32 0
%146 = load i8*, i8** %145
%147 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %146)
br label %243
148: ; preds = %135
br label %131
149: ; preds = %131
%150 = load i32*, i32** %37
%151 = call i32 @closedir(i32* %150)
store i32* null, i32** %37
%152 = trunc i64 %48 to i32
%153 = call i32 (i8*, i32, ...) @snprintf(i8* %49, i32 %152, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%154 = call i64 (i8*, ...) @read_text_file(i8* %49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8** %30, i64* %31)
%155 = icmp sge i64 %154, 0
br i1 %155, label %156, label %161
156: ; preds = %149
%157 = load i8*, i8** %30
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %157)
%159 = load i8*, i8** %30
%160 = call i32 @free(i8* %159)
store i8* null, i8** %30
store i64 0, i64* %31
br label %161
161: ; preds = %156, %149
store i32 0, i32* %32
br label %162
162: ; preds = %193, %161
br label %163
163: ; preds = %162
%164 = load i32, i32* %32
%165 = add nsw i32 %164, 1
store i32 %165, i32* %32
%166 = trunc i64 %51 to i32
%167 = load i8*, i8** %18
%168 = load i32, i32* %32
%169 = call i32 (i8*, i32, ...) @snprintf(i8* %52, i32 %166, i8* %167, i32 %168)
%170 = trunc i64 %54 to i32
%171 = load i8*, i8** %19
%172 = load i32, i32* %32
%173 = call i32 (i8*, i32, ...) @snprintf(i8* %55, i32 %170, i8* %171, i32 %172)
%174 = trunc i64 %57 to i32
%175 = call i32 (i8*, i32, ...) @snprintf(i8* %58, i32 %174, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %46, i8* %52)
%176 = trunc i64 %60 to i32
%177 = call i32 (i8*, i32, ...) @snprintf(i8* %61, i32 %176, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %46, i8* %55)
%178 = call i64 @stat(i8* %58, %struct.stat* %28)
%179 = icmp slt i64 %178, 0
br i1 %179, label %180, label %181
180: ; preds = %163
br label %198
181: ; preds = %163
%182 = call i64 (i8*, ...) @read_text_file(i8* %58, i8* %52, i8** %30, i64* %31)
%183 = icmp slt i64 %182, 0
br i1 %183, label %184, label %185
184: ; preds = %181
br label %243
185: ; preds = %181
%186 = load i8*, i8** %30
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %52, i8* %186)
%188 = load i8*, i8** %30
%189 = call i32 @free(i8* %188)
store i8* null, i8** %30
store i64 0, i64* %31
%190 = call i64 (i8*, ...) @read_text_file(i8* %61, i8* %55, i8** %30, i64* %31)
%191 = icmp slt i64 %190, 0
br i1 %191, label %192, label %193
192: ; preds = %185
br label %243
193: ; preds = %185
%194 = load i8*, i8** %30
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %55, i8* %194)
%196 = load i8*, i8** %30
%197 = call i32 @free(i8* %196)
store i8* null, i8** %30
store i64 0, i64* %31
br label %162
198: ; preds = %180
%199 = load i32, i32* %21
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %241
201: ; preds = %198
%202 = call i32* @opendir(i8* %46)
store i32* %202, i32** %37
%203 = icmp ne i32* %202, null
br i1 %203, label %204, label %240
204: ; preds = %201
br label %205
205: ; preds = %236, %222, %215, %204
%206 = load i32*, i32** %37
%207 = call %struct.dirent* @readdir(i32* %206)
store %struct.dirent* %207, %struct.dirent** %38
%208 = icmp ne %struct.dirent* %207, null
br i1 %208, label %209, label %237
209: ; preds = %205
%210 = load %struct.dirent*, %struct.dirent** %38
%211 = getelementptr inbounds %struct.dirent, %struct.dirent* %210, i32 0, i32 0
%212 = load i8*, i8** %211
%213 = call i32 @strcmp(i8* %212, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%214 = icmp ne i32 %213, 0
br i1 %214, label %216, label %215
215: ; preds = %209
br label %205
216: ; preds = %209
%217 = load %struct.dirent*, %struct.dirent** %38
%218 = getelementptr inbounds %struct.dirent, %struct.dirent* %217, i32 0, i32 0
%219 = load i8*, i8** %218
%220 = call i32 @strcmp(i8* %219, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%221 = icmp ne i32 %220, 0
br i1 %221, label %223, label %222
222: ; preds = %216
br label %205
223: ; preds = %216
%224 = load %struct.dirent*, %struct.dirent** %38
%225 = getelementptr inbounds %struct.dirent, %struct.dirent* %224, i32 0, i32 0
%226 = load i8*, i8** %225
%227 = getelementptr inbounds i8, i8* %226, i64 0
%228 = load i8, i8* %227
%229 = zext i8 %228 to i32
%230 = icmp eq i32 %229, 46
br i1 %230, label %231, label %236
231: ; preds = %223
%232 = load %struct.dirent*, %struct.dirent** %38
%233 = getelementptr inbounds %struct.dirent, %struct.dirent* %232, i32 0, i32 0
%234 = load i8*, i8** %233
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i8* %234)
br label %236
236: ; preds = %231, %223
br label %205
237: ; preds = %205
%238 = load i32*, i32** %37
%239 = call i32 @closedir(i32* %238)
store i32* null, i32** %37
br label %240
240: ; preds = %237, %201
br label %241
241: ; preds = %240, %198
%242 = call i32 @remove_directory_recursively(i8* %43, i32 0)
store i32 0, i32* %12
store i32 1, i32* %39
br label %255
243: ; preds = %192, %184, %143, %128, %123, %113, %106, %92, %77, %73, %67
%244 = load i32*, i32** %37
%245 = icmp ne i32* %244, null
br i1 %245, label %246, label %249
246: ; preds = %243
%247 = load i32*, i32** %37
%248 = call i32 @closedir(i32* %247)
br label %249
249: ; preds = %246, %243
%250 = load i32, i32* %26
%251 = icmp ne i32 %250, 0
br i1 %251, label %252, label %254
252: ; preds = %249
%253 = call i32 @remove_directory_recursively(i8* %43, i32 0)
br label %254
254: ; preds = %252, %249
store i32 -1, i32* %12
store i32 1, i32* %39
br label %255
255: ; preds = %254, %241
%256 = load i8*, i8** %24
%257 = load i32, i32* %12
ret i32 %257
}

LLVM IR (-O2):
%struct.archive_file = type { i32 }
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@PATH_MAX = global i32 0
@.str = [25 x i8] c"cannot open directory %s\00"
@.str.1 = [21 x i8] c"name '%s' is invalid\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [28 x i8] c"directory %s does not exist\00"
@.str.4 = [32 x i8] c"directory %s is not a directory\00"
@R_OK = global i32 0
@W_OK = global i32 0
@X_OK = global i32 0
@.str.5 = [37 x i8] c"directory %s has invalid permissions\00"
@.str.6 = [10 x i8] c"%s/README\00"
@.str.7 = [7 x i8] c"README\00"
@.str.8 = [19 x i8] c"=== README ===\0A%s\0A\00"
@.str.9 = [15 x i8] c"=== %s ===\0A%s\0A\00"
@.str.10 = [2 x i8] c".\00"
@.str.11 = [3 x i8] c"..\00"
@.str.12 = [18 x i8] c"Ignored file: %s\0A\00"
define i32 @make_report(%struct.archive_file* nocapture readnone %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, i32 (i8*, i8*)* nocapture %7, i32 %8, i8** %9, i8** %10) {
%12 = alloca %struct.stat
%13 = alloca i8*
%14 = alloca i64
%15 = load i32, i32* @PATH_MAX
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
%18 = alloca i8, i64 %16
%19 = bitcast %struct.stat* %12 to i8*
%20 = alloca i8, i64 %16
%21 = bitcast i8** %13 to i8*
store i8* null, i8** %13
%22 = bitcast i64* %14 to i8*
store i64 0, i64* %14
%23 = alloca i8, i64 %16
%24 = alloca i8, i64 %16
%25 = alloca i8, i64 %16
%26 = alloca i8, i64 %16
%27 = call i64 @create_arch_dir(i8* %17, i32 %15, i8* %2, i8* %3)
%28 = icmp slt i64 %27, 0
br i1 %28, label %154, label %29
29: ; preds = %11
%30 = call i32 %7(i8* %1, i8* %17)
%31 = icmp slt i32 %30, 0
br i1 %31, label %151, label %32
32: ; preds = %29
%33 = call i32* @opendir(i8* %17)
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %151
37: ; preds = %32, %40
%38 = call %struct.dirent* @readdir(i32* %33)
%39 = icmp eq %struct.dirent* %38, null
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = getelementptr inbounds %struct.dirent, %struct.dirent* %38, i64 0, i32 0
%42 = load i8*, i8** %41
%43 = call i64 @check_file_name(i8* %42, i8** %9, i8** %10)
%44 = icmp slt i64 %43, 0
br i1 %44, label %144, label %37
45: ; preds = %37
%46 = call i32 @closedir(i32* %33)
%47 = call i32 (i8*, i32, ...) @snprintf(i8* %18, i32 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %4)
%48 = call i64 @stat(i8* %18, %struct.stat* %12)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 @error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %151
52: ; preds = %45
%53 = getelementptr inbounds %struct.stat, %struct.stat* %12, i64 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 @S_ISDIR(i32 %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %18)
br label %151
59: ; preds = %52
%60 = load i32, i32* @R_OK
%61 = load i32, i32* @W_OK
%62 = or i32 %61, %60
%63 = load i32, i32* @X_OK
%64 = or i32 %62, %63
%65 = call i64 @access(i8* %18, i32 %64)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %59
%68 = call i32 @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %18)
br label %151
69: ; preds = %59
%70 = call i32* @opendir(i8* %18)
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %151
74: ; preds = %69, %77
%75 = call %struct.dirent* @readdir(i32* %70)
%76 = icmp eq %struct.dirent* %75, null
br i1 %76, label %82, label %77
77: ; preds = %74
%78 = getelementptr inbounds %struct.dirent, %struct.dirent* %75, i64 0, i32 0
%79 = load i8*, i8** %78
%80 = call i64 @check_file_name(i8* %79, i8** %9, i8** %10)
%81 = icmp slt i64 %80, 0
br i1 %81, label %144, label %74
82: ; preds = %74
%83 = call i32 @closedir(i32* %70)
%84 = call i32 (i8*, i32, ...) @snprintf(i8* %20, i32 %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %18)
%85 = call i64 (i8*, ...) @read_text_file(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8** %13, i64* %14)
%86 = icmp sgt i64 %85, -1
br i1 %86, label %87, label %92
87: ; preds = %82
%88 = load i8*, i8** %13
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %88)
%90 = load i8*, i8** %13
%91 = call i32 @free(i8* %90)
store i8* null, i8** %13
store i64 0, i64* %14
br label %92
92: ; preds = %87, %82
br label %93
93: ; preds = %92, %112
%94 = phi i32 [ %95, %112 ], [ 0, %92 ]
%95 = add nuw nsw i32 %94, 1
%96 = call i32 (i8*, i32, ...) @snprintf(i8* %23, i32 %15, i8* %5, i32 %95)
%97 = call i32 (i8*, i32, ...) @snprintf(i8* %24, i32 %15, i8* %6, i32 %95)
%98 = call i32 (i8*, i32, ...) @snprintf(i8* %25, i32 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %18, i8* %23)
%99 = call i32 (i8*, i32, ...) @snprintf(i8* %26, i32 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %18, i8* %24)
%100 = call i64 @stat(i8* %25, %struct.stat* %12)
%101 = icmp slt i64 %100, 0
br i1 %101, label %117, label %102
102: ; preds = %93
%103 = call i64 (i8*, ...) @read_text_file(i8* %25, i8* %23, i8** %13, i64* %14)
%104 = icmp slt i64 %103, 0
br i1 %104, label %151, label %105
105: ; preds = %102
%106 = load i8*, i8** %13
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %23, i8* %106)
%108 = load i8*, i8** %13
%109 = call i32 @free(i8* %108)
store i8* null, i8** %13
store i64 0, i64* %14
%110 = call i64 (i8*, ...) @read_text_file(i8* %26, i8* %24, i8** %13, i64* %14)
%111 = icmp slt i64 %110, 0
br i1 %111, label %151, label %112
112: ; preds = %105
%113 = load i8*, i8** %13
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %24, i8* %113)
%115 = load i8*, i8** %13
%116 = call i32 @free(i8* %115)
store i8* null, i8** %13
store i64 0, i64* %14
br label %93
117: ; preds = %93
%118 = icmp eq i32 %8, 0
br i1 %118, label %151, label %119
119: ; preds = %117
%120 = call i32* @opendir(i8* %18)
%121 = icmp eq i32* %120, null
br i1 %121, label %151, label %122
122: ; preds = %119
%123 = call %struct.dirent* @readdir(i32* %120)
%124 = icmp eq %struct.dirent* %123, null
br i1 %124, label %142, label %125
125: ; preds = %122, %139
%126 = phi %struct.dirent* [ %140, %139 ], [ %123, %122 ]
%127 = getelementptr inbounds %struct.dirent, %struct.dirent* %126, i64 0, i32 0
%128 = load i8*, i8** %127
%129 = call i32 @strcmp(i8* dereferenceable(1) %128, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%130 = icmp eq i32 %129, 0
br i1 %130, label %139, label %131
131: ; preds = %125
%132 = call i32 @strcmp(i8* dereferenceable(1) %128, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%133 = icmp eq i32 %132, 0
br i1 %133, label %139, label %134
134: ; preds = %131
%135 = load i8, i8* %128
%136 = icmp eq i8 %135, 46
br i1 %136, label %137, label %139
137: ; preds = %134
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i8* %128)
br label %139
139: ; preds = %134, %137, %125, %131
%140 = call %struct.dirent* @readdir(i32* %120)
%141 = icmp eq %struct.dirent* %140, null
br i1 %141, label %142, label %125
142: ; preds = %139, %122
%143 = call i32 @closedir(i32* %120)
br label %151
144: ; preds = %40, %77
%145 = phi %struct.dirent* [ %75, %77 ], [ %38, %40 ]
%146 = phi i32* [ %70, %77 ], [ %33, %40 ]
%147 = getelementptr inbounds %struct.dirent, %struct.dirent* %145, i64 0, i32 0
%148 = load i8*, i8** %147
%149 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %148)
%150 = call i32 @closedir(i32* %146)
br label %151
151: ; preds = %102, %105, %144, %35, %50, %57, %67, %72, %29, %117, %142, %119
%152 = phi i32 [ 0, %119 ], [ 0, %142 ], [ 0, %117 ], [ -1, %29 ], [ -1, %72 ], [ -1, %67 ], [ -1, %57 ], [ -1, %50 ], [ -1, %35 ], [ -1, %144 ], [ -1, %105 ], [ -1, %102 ]
%153 = call i32 @remove_directory_recursively(i8* %17, i32 0)
br label %154
154: ; preds = %151, %11
%155 = phi i32 [ -1, %11 ], [ %152, %151 ]
ret i32 %155
}