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

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ S_ISREG(int /*<<< orphan*/);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int errno;
scalar_t__ lstat(char *, struct stat *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int cm_recurse(char *path, char *arg, int (*fn)(char *, char *, int)) {
  int i;
  char buf[1024];
  struct dirent *d;
  struct stat lst, st, ist;
  DIR *dp;
  errno = 0;
  if (lstat(path, &lst) < 0 || stat(path, &st) < 0) {
    return -errno;
  }
  if (!(S_ISDIR(lst.st_mode)) ||
      (S_ISLNK(lst.st_mode) && S_ISDIR(st.st_mode))) {
    return fn(path, arg, 0);
  }
  if ((dp = opendir(path)) == NULL) {
    return -errno;
  }
  while ((d = readdir(dp)) != 0) {
    memset(buf, 0, sizeof(buf));
    if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) {
      continue;
    }
    strncpy(buf, path, strlen(path));
    strncat(buf, "/", 1);
    strncat(buf, d->d_name, strlen(d->d_name));
    if (stat(buf, &ist) < 0) {
      return -errno;
    }
    if (S_ISDIR(ist.st_mode)) {
      if ((i = fn(buf, arg, 1)) != 0) {
        return i;
      }
    }
    if (S_ISREG(ist.st_mode)) {
      if ((i = fn(buf, arg, 0)) != 0) {
        return i;
      }
    }
  }
  closedir(dp);
  return 0;
}


x86 assembly (clang, -O0):
<cm_recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2df2(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x440(%rbp),%rsi
call   10b0 <lstat@plt>
cmp    $0x0,%rax
jl     1228 <cm_recurse+0x58>
mov    -0x10(%rbp),%rdi
lea    -0x448(%rbp),%rsi
call   10d0 <stat@plt>
cmp    $0x0,%rax
jge    123b <cm_recurse+0x6b>
xor    %eax,%eax
mov    0x2daf(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
mov    -0x440(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     127a <cm_recurse+0xaa>
mov    -0x440(%rbp),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1292 <cm_recurse+0xc2>
mov    -0x448(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1292 <cm_recurse+0xc2>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
mov    -0x10(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x458(%rbp)
cmp    $0x0,%rax
jne    12bf <cm_recurse+0xef>
xor    %eax,%eax
mov    0x2d2b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
jmp    12c4 <cm_recurse+0xf4>
mov    -0x458(%rbp),%rdi
call   10f0 <readdir@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
je     148b <cm_recurse+0x2bb>
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x438(%rbp),%rax
mov    (%rax),%rdi
lea    0xcfc(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     1334 <cm_recurse+0x164>
mov    -0x438(%rbp),%rax
mov    (%rax),%rdi
lea    0xcdb(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1339 <cm_recurse+0x169>
jmp    12c4 <cm_recurse+0xf4>
lea    -0x430(%rbp),%rax
mov    %rax,-0x478(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x478(%rbp),%rdi
mov    -0x470(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
lea    -0x430(%rbp),%rdi
lea    0xc85(%rip),%rsi
mov    $0x1,%edx
call   1090 <strncat@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x468(%rbp)
mov    -0x438(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x460(%rbp)
mov    -0x438(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    -0x468(%rbp),%rdi
mov    -0x460(%rbp),%rsi
mov    %eax,%edx
call   1090 <strncat@plt>
lea    -0x430(%rbp),%rdi
lea    -0x450(%rbp),%rsi
call   10d0 <stat@plt>
cmp    $0x0,%rax
jge    13fb <cm_recurse+0x22b>
xor    %eax,%eax
mov    0x2bef(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
mov    -0x450(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1442 <cm_recurse+0x272>
mov    -0x20(%rbp),%rax
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   *%rax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
je     143d <cm_recurse+0x26d>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
jmp    1442 <cm_recurse+0x272>
mov    -0x450(%rbp),%edi
call   10e0 <S_ISREG@plt>
cmp    $0x0,%rax
je     1486 <cm_recurse+0x2b6>
mov    -0x20(%rbp),%rax
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   *%rax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
je     1481 <cm_recurse+0x2b1>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    149e <cm_recurse+0x2ce>
jmp    1486 <cm_recurse+0x2b6>
jmp    12c4 <cm_recurse+0xf4>
mov    -0x458(%rbp),%rdi
call   10a0 <closedir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cm_recurse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    0x2def(%rip),%r13
movl   $0x0,0x0(%r13)
lea    0x18(%rsp),%rsi
call   10b0 <lstat@plt>
test   %rax,%rax
js     1378 <cm_recurse+0x1a8>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <stat@plt>
test   %rax,%rax
js     1378 <cm_recurse+0x1a8>
mov    0x18(%rsp),%ebp
mov    %ebp,%edi
call   1070 <S_ISDIR@plt>
test   %rax,%rax
je     124c <cm_recurse+0x7c>
mov    %ebp,%edi
call   1040 <S_ISLNK@plt>
test   %rax,%rax
je     125c <cm_recurse+0x8c>
mov    0x10(%rsp),%edi
call   1070 <S_ISDIR@plt>
test   %rax,%rax
je     125c <cm_recurse+0x8c>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   *%r14
jmp    137e <cm_recurse+0x1ae>
mov    %rbx,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     1378 <cm_recurse+0x1a8>
mov    %rax,%r12
mov    %rax,%rdi
call   10f0 <readdir@plt>
test   %rax,%rax
je     1390 <cm_recurse+0x1c0>
mov    %rax,%rbp
lea    0x20(%rsp),%r13
jmp    12a4 <cm_recurse+0xd4>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10f0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1390 <cm_recurse+0x1c0>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    0x0(%rbp),%rdi
lea    0xd43(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1290 <cm_recurse+0xc0>
mov    0x0(%rbp),%rdi
lea    0xd2d(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1290 <cm_recurse+0xc0>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %r13,%rdi
lea    0xd07(%rip),%rsi
mov    $0x1,%edx
call   1090 <strncat@plt>
mov    0x0(%rbp),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1090 <strncat@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   10d0 <stat@plt>
test   %rax,%rax
js     139c <cm_recurse+0x1cc>
mov    0x8(%rsp),%edi
call   1070 <S_ISDIR@plt>
test   %rax,%rax
je     1351 <cm_recurse+0x181>
mov    %r13,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   *%r14
test   %eax,%eax
jne    137e <cm_recurse+0x1ae>
mov    0x8(%rsp),%edi
call   10e0 <S_ISREG@plt>
test   %rax,%rax
je     1290 <cm_recurse+0xc0>
mov    %r13,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   *%r14
test   %eax,%eax
je     1290 <cm_recurse+0xc0>
jmp    137e <cm_recurse+0x1ae>
xor    %eax,%eax
sub    0x0(%r13),%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   10a0 <closedir@plt>
xor    %eax,%eax
jmp    137e <cm_recurse+0x1ae>
xor    %eax,%eax
mov    0x2c3b(%rip),%rcx
sub    (%rcx),%eax
jmp    137e <cm_recurse+0x1ae>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@errno = global i32 0
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
@.str.2 = [2 x i8] c"/\00"
define i32 @cm_recurse(i8* %0, i8* %1, i32 (i8*, i8*, i32)* nocapture %2) {
%4 = alloca [1024 x i8]
%5 = alloca %struct.stat
%6 = alloca %struct.stat
%7 = alloca %struct.stat
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast %struct.stat* %5 to i8*
%10 = bitcast %struct.stat* %6 to i8*
%11 = bitcast %struct.stat* %7 to i8*
store i32 0, i32* @errno
%12 = call i64 @lstat(i8* %0, %struct.stat* %5)
%13 = icmp slt i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = call i64 @stat(i8* %0, %struct.stat* %6)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14, %3
%18 = load i32, i32* @errno
%19 = sub nsw i32 0, %18
br label %88
20: ; preds = %14
%21 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%22 = load i32, i32* %21
%23 = call i64 @S_ISDIR(i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %20
%26 = call i64 @S_ISLNK(i32 %22)
%27 = icmp eq i64 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %25
%29 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%30 = load i32, i32* %29
%31 = call i64 @S_ISDIR(i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %28, %20
%34 = call i32 %2(i8* %0, i8* %1, i32 0)
br label %88
35: ; preds = %28, %25
%36 = call i32* @opendir(i8* %0)
%37 = icmp eq i32* %36, null
br i1 %37, label %43, label %38
38: ; preds = %35
%39 = call %struct.dirent* @readdir(i32* %36)
%40 = icmp eq %struct.dirent* %39, null
br i1 %40, label %86, label %41
41: ; preds = %38
%42 = getelementptr inbounds %struct.stat, %struct.stat* %7, i64 0, i32 0
br label %46
43: ; preds = %35
%44 = load i32, i32* @errno
%45 = sub nsw i32 0, %44
br label %88
46: ; preds = %41, %57
%47 = phi %struct.dirent* [ %39, %41 ], [ %58, %57 ]
%48 = call i32 @memset(i8* %8, i32 0, i32 1024)
%49 = getelementptr inbounds %struct.dirent, %struct.dirent* %47, i64 0, i32 0
%50 = load i8*, i8** %49
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %46
%54 = load i8*, i8** %49
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %79, %83, %46, %53
%58 = call %struct.dirent* @readdir(i32* %36)
%59 = icmp eq %struct.dirent* %58, null
br i1 %59, label %86, label %46
60: ; preds = %53
%61 = call i32 @strlen(i8* %0)
%62 = call i32 @strncpy(i8* %8, i8* %0, i32 %61)
%63 = call i32 @strncat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%64 = load i8*, i8** %49
%65 = call i32 @strlen(i8* %64)
%66 = call i32 @strncat(i8* %8, i8* %64, i32 %65)
%67 = call i64 @stat(i8* %8, %struct.stat* %7)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %60
%70 = load i32, i32* @errno
%71 = sub nsw i32 0, %70
br label %88
72: ; preds = %60
%73 = load i32, i32* %42
%74 = call i64 @S_ISDIR(i32 %73)
%75 = icmp eq i64 %74, 0
br i1 %75, label %79, label %76
76: ; preds = %72
%77 = call i32 %2(i8* %8, i8* %1, i32 1)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %88
79: ; preds = %76, %72
%80 = load i32, i32* %42
%81 = call i64 @S_ISREG(i32 %80)
%82 = icmp eq i64 %81, 0
br i1 %82, label %57, label %83
83: ; preds = %79
%84 = call i32 %2(i8* %8, i8* %1, i32 0)
%85 = icmp eq i32 %84, 0
br i1 %85, label %57, label %88
86: ; preds = %57, %38
%87 = call i32 @closedir(i32* %36)
br label %88
88: ; preds = %83, %76, %86, %69, %43, %33, %17
%89 = phi i32 [ %19, %17 ], [ %34, %33 ], [ %45, %43 ], [ %71, %69 ], [ 0, %86 ], [ %84, %83 ], [ %77, %76 ]
ret i32 %89
}