#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 const *d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
size_t PATH_MAX;
int closedir(int /*<<< orphan*/ *);
int dump_path(char *);
scalar_t__ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int /*<<< orphan*/ *opendir(char const *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char const *, char *);
size_t strlen(char const *);
int dump_dir(const char *path) {
  printf("%s: directory\n", path);
  fflush(stdout);
  size_t buf_size = PATH_MAX;
  size_t path_len = strlen(path);
  if (path_len + 1 > buf_size) {
    fprintf(stderr, "path too long: %s\n", path);
    return -1;
  }
  char *buf = malloc(buf_size);
  if (!buf) {
    fprintf(stderr, "out of memory\n");
    return -1;
  }
  memcpy(buf, path, path_len);
  buf[path_len] = '/';
  int ret, close_ret;
  DIR *dir = opendir(path);
  if (!dir) {
    perror("opendir");
    ret = -1;
    goto out;
  }
  for (;;) {
    errno = 0;
    struct dirent *dirent = readdir(dir);
    if (!dirent) {
      if (errno) {
        perror("readdir");
        ret = -1;
        goto out;
      }
      break;
    }
    if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0)
      continue;
    size_t name_len = strlen(dirent->d_name);
    if (path_len + 1 + name_len + 1 > buf_size) {
      fprintf(stderr, "path too long: %s/%s", path, dirent->d_name);
      ret = -1;
      goto out;
    }
    memcpy(&buf[path_len + 1], dirent->d_name, name_len + 1);
    ret = dump_path(buf);
    if (ret < 0)
      goto out;
  }
  ret = 0;
out:
  free(buf);
  close_ret = closedir(dir);
  if (close_ret < 0) {
    perror("closedir");
    return -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<dump_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe19(%rip),%rdi
call   1060 <printf@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
cmp    -0x18(%rbp),%rax
jbe    124e <dump_dir+0x7e>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    144d <dump_dir+0x27d>
mov    -0x18(%rbp),%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1289 <dump_dir+0xb9>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    144d <dump_dir+0x27d>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12d6 <dump_dir+0x106>
lea    0xd6c(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1410 <dump_dir+0x240>
jmp    12db <dump_dir+0x10b>
mov    0x2cee(%rip),%rax
movq   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
call   10b0 <readdir@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    132f <dump_dir+0x15f>
mov    0x2cc8(%rip),%rax
cmpq   $0x0,(%rax)
je     132a <dump_dir+0x15a>
lea    0xd20(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1410 <dump_dir+0x240>
jmp    1409 <dump_dir+0x239>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
lea    0xd05(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1369 <dump_dir+0x199>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
lea    0xce7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    136e <dump_dir+0x19e>
jmp    12db <dump_dir+0x10b>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
add    -0x48(%rbp),%rax
add    $0x1,%rax
cmp    -0x18(%rbp),%rax
jbe    13c6 <dump_dir+0x1f6>
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x40(%rbp),%rax
mov    (%rax),%rcx
lea    0xc91(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    1410 <dump_dir+0x240>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rax
add    $0x1,%rax
add    %rax,%rdi
mov    -0x40(%rbp),%rax
mov    (%rax),%rsi
mov    -0x48(%rbp),%rdx
add    $0x1,%rdx
call   10a0 <memcpy@plt>
mov    -0x28(%rbp),%rdi
call   10e0 <dump_path@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1404 <dump_dir+0x234>
jmp    1410 <dump_dir+0x240>
jmp    12db <dump_dir+0x10b>
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1070 <closedir@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1447 <dump_dir+0x277>
lea    0xc23(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    144d <dump_dir+0x27d>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_dir>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
lea    0xe18(%rip),%rdi
mov    %r15,%rsi
call   1060 <printf@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%r12
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%r13
cmp    %r12,%r13
jbe    1238 <dump_dir+0x68>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1371 <dump_dir+0x1a1>
mov    %rax,%rbx
mov    %r12,%rdi
call   10c0 <malloc@plt>
test   %rax,%rax
je     135a <dump_dir+0x18a>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10a0 <memcpy@plt>
movb   $0x2f,0x0(%rbp,%rbx,1)
mov    %r15,%rdi
call   1040 <opendir@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13a3 <dump_dir+0x1d3>
mov    %rbp,0x8(%rsp)
mov    0x2d4e(%rip),%rax
movq   $0x0,(%rax)
mov    %rbx,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     133c <dump_dir+0x16c>
mov    %rax,%rbp
mov    0x8(%rsp),%rax
add    %r13,%rax
mov    %rax,0x10(%rsp)
jmp    12ce <dump_dir+0xfe>
nopl   0x0(%rax)
mov    0x2d19(%rip),%rax
movq   $0x0,(%rax)
mov    %rbx,%rdi
call   10b0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     133c <dump_dir+0x16c>
mov    0x0(%rbp),%rdi
lea    0xd69(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12b0 <dump_dir+0xe0>
mov    0x0(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12b0 <dump_dir+0xe0>
mov    0x0(%rbp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    (%rax,%r13,1),%rcx
add    $0x1,%rcx
cmp    %r12,%rcx
ja     1379 <dump_dir+0x1a9>
add    $0x1,%rax
mov    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   10a0 <memcpy@plt>
mov    0x8(%rsp),%rdi
call   10e0 <dump_path@plt>
test   %eax,%eax
jns    12b0 <dump_dir+0xe0>
mov    %eax,%r14d
jmp    139c <dump_dir+0x1cc>
xor    %r14d,%r14d
mov    0x2c8a(%rip),%rax
cmpq   $0x0,(%rax)
mov    0x8(%rsp),%rbp
je     13b5 <dump_dir+0x1e5>
lea    0xce1(%rip),%rdi
jmp    13aa <dump_dir+0x1da>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
lea    0xcb8(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%r14d
jmp    13c9 <dump_dir+0x1f9>
mov    0x2c58(%rip),%rax
mov    (%rax),%edi
lea    0xcbb(%rip),%rsi
mov    %r15,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%r14d
mov    0x8(%rsp),%rbp
jmp    13b5 <dump_dir+0x1e5>
lea    0xc87(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%r14d
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1070 <closedir@plt>
test   %eax,%eax
js     13db <dump_dir+0x20b>
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc77(%rip),%rdi
call   10f0 <perror@plt>
jmp    1371 <dump_dir+0x1a1>

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

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [15 x i8] c"%s: directory\0A\00"
@stdout = global i32 0
@PATH_MAX = global i64 0
@stderr = global i32 0
@.str.1 = [19 x i8] c"path too long: %s\0A\00"
@.str.2 = [15 x i8] c"out of memory\0A\00"
@.str.3 = [8 x i8] c"opendir\00"
@errno = global i64 0
@.str.4 = [8 x i8] c"readdir\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"..\00"
@.str.7 = [21 x i8] c"path too long: %s/%s\00"
@.str.8 = [9 x i8] c"closedir\00"
define i32 @dump_dir(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = load i64, i64* @PATH_MAX
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = add i64 %6, 1
%8 = icmp ugt i64 %7, %5
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %68
12: ; preds = %1
%13 = tail call i8* @malloc(i64 %5)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %68
18: ; preds = %12
%19 = tail call i32 @memcpy(i8* %13, i8* %0, i64 %6)
%20 = getelementptr inbounds i8, i8* %13, i64 %6
store i8 47, i8* %20
%21 = tail call i32* @opendir(i8* %0)
%22 = icmp eq i32* %21, null
br i1 %22, label %28, label %23
23: ; preds = %18
store i64 0, i64* @errno
%24 = tail call %struct.dirent* @readdir(i32* %21)
%25 = icmp eq %struct.dirent* %24, null
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = getelementptr inbounds i8, i8* %13, i64 %7
br label %35
28: ; preds = %18
%29 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %61
30: ; preds = %58, %23
%31 = load i64, i64* @errno
%32 = icmp eq i64 %31, 0
br i1 %32, label %61, label %33
33: ; preds = %30
%34 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %61
35: ; preds = %26, %58
%36 = phi %struct.dirent* [ %24, %26 ], [ %59, %58 ]
%37 = getelementptr inbounds %struct.dirent, %struct.dirent* %36, i64 0, i32 0
%38 = load i8*, i8** %37
%39 = tail call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %58, label %41
41: ; preds = %35
%42 = load i8*, i8** %37
%43 = tail call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %58, label %45
45: ; preds = %41
%46 = load i8*, i8** %37
%47 = tail call i64 @strlen(i8* dereferenceable(1) %46)
%48 = add i64 %47, 1
%49 = add i64 %48, %7
%50 = icmp ugt i64 %49, %5
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %0, i8* %46)
br label %61
54: ; preds = %45
%55 = tail call i32 @memcpy(i8* %27, i8* %46, i64 %48)
%56 = tail call i32 @dump_path(i8* %13)
%57 = icmp slt i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %54, %35, %41
store i64 0, i64* @errno
%59 = tail call %struct.dirent* @readdir(i32* %21)
%60 = icmp eq %struct.dirent* %59, null
br i1 %60, label %30, label %35
61: ; preds = %54, %51, %33, %30, %28
%62 = phi i32 [ -1, %28 ], [ 0, %30 ], [ -1, %51 ], [ -1, %33 ], [ %56, %54 ]
%63 = tail call i32 @free(i8* %13)
%64 = tail call i32 @closedir(i32* %21)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %61
%67 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %68
68: ; preds = %15, %61, %66, %9
%69 = phi i32 [ -1, %9 ], [ -1, %15 ], [ -1, %66 ], [ %62, %61 ]
ret i32 %69
}