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

/* Variables and functions */
#define DT_DIR 130
#define DT_LNK 129
#define DT_REG 128
int PATH_MAX;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ *opendir(char const *);
int /*<<< orphan*/ printf(char *, char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int find_directory(const char *dirname) {
  char buffer[PATH_MAX + 2];
  char *p = buffer;
  char *end = &buffer[PATH_MAX];
  const char *src = dirname;
  while (p < end && *src != '\0') {
    *p++ = *src++;
  }
  *p = '\0';
  DIR *dir = opendir(dirname);
  if (!dir) {
    fprintf(stderr, "Cannot open %s (%s)\n", dirname, strerror(errno));
    return 0;
  }
  struct dirent *ent;
  while ((ent = readdir(dir)) != NULL) {
    char *q = p;
    char c;
    if (buffer < q)
      c = q[-1];
    else
      c = ':';
    if (c != ':' && c != '/' && c != '\\')
      *q++ = '/';
    src = ent->d_name;
    while (q < end && *src != '\0') {
      *q++ = *src++;
    }
    *q = '\0';
    switch (ent->d_type) {
    case DT_LNK:
    case DT_REG:
      printf("%s\n", buffer);
      break;
    case DT_DIR:
      if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0) {
        find_directory(buffer);
      }
      break;
    default:;
    }
  }
  closedir(dir);
  return 1;
}


x86 assembly (clang, -O0):
<find_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
add    $0x2,%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x68(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    0x2e25(%rip),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp),%rcx
mov    %al,-0x69(%rbp)
jae    1200 <find_directory+0x80>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    1210 <find_directory+0x90>
jmp    1237 <find_directory+0xb7>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    11dd <find_directory+0x5d>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12a1 <find_directory+0x121>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xd77(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    143b <find_directory+0x2bb>
jmp    12a6 <find_directory+0x126>
mov    -0x40(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     1424 <find_directory+0x2a4>
mov    -0x68(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
cmp    -0x58(%rbp),%rax
jae    12e2 <find_directory+0x162>
mov    -0x58(%rbp),%rax
mov    -0x1(%rax),%al
mov    %al,-0x59(%rbp)
jmp    12e6 <find_directory+0x166>
movb   $0x3a,-0x59(%rbp)
movsbl -0x59(%rbp),%eax
cmp    $0x3a,%eax
je     131f <find_directory+0x19f>
movsbl -0x59(%rbp),%eax
cmp    $0x2f,%eax
je     131f <find_directory+0x19f>
movsbl -0x59(%rbp),%eax
cmp    $0x5c,%eax
je     131f <find_directory+0x19f>
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x2f,(%rax)
mov    -0x50(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x58(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp),%rcx
mov    %al,-0x7d(%rbp)
jae    134d <find_directory+0x1cd>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x7d(%rbp)
mov    -0x7d(%rbp),%al
test   $0x1,%al
jne    135d <find_directory+0x1dd>
jmp    1384 <find_directory+0x204>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    %cl,(%rax)
jmp    132a <find_directory+0x1aa>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x84(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     13bf <find_directory+0x23f>
jmp    13a9 <find_directory+0x229>
mov    -0x84(%rbp),%eax
sub    $0x82,%eax
je     13d4 <find_directory+0x254>
jmp    141a <find_directory+0x29a>
mov    -0x68(%rbp),%rsi
lea    0xc4b(%rip),%rdi
call   1040 <printf@plt>
jmp    141f <find_directory+0x29f>
mov    -0x50(%rbp),%rax
mov    (%rax),%rdi
lea    0xc38(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1415 <find_directory+0x295>
mov    -0x50(%rbp),%rax
mov    (%rax),%rdi
lea    0xc1b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1415 <find_directory+0x295>
mov    -0x68(%rbp),%rdi
call   1080 <find_directory@plt>
jmp    141f <find_directory+0x29f>
jmp    141f <find_directory+0x29f>
jmp    12a6 <find_directory+0x126>
mov    -0x40(%rbp),%rdi
call   1050 <closedir@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_directory>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r13
mov    0x2e55(%rip),%rax
movslq (%rax),%rax
lea    0x2(%rax),%ecx
mov    %rsp,%r14
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r14
mov    %r14,%rsp
lea    (%r14,%rax,1),%r12
mov    %r14,%r15
test   %rax,%rax
jle    11e7 <find_directory+0x67>
mov    %r14,%r15
mov    %r13,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rax),%ecx
test   %cl,%cl
je     11e7 <find_directory+0x67>
add    $0x1,%rax
mov    %cl,(%r15)
add    $0x1,%r15
cmp    %r12,%r15
jb     11d0 <find_directory+0x50>
movb   $0x0,(%r15)
mov    %r13,%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     1318 <find_directory+0x198>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <readdir@plt>
test   %rax,%rax
je     1309 <find_directory+0x189>
lea    0x1(%r15),%rcx
mov    %rcx,-0x38(%rbp)
mov    %rbx,-0x30(%rbp)
jmp    1244 <find_directory+0xc4>
xchg   %ax,%ax
lea    0xdee(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
call   1090 <readdir@plt>
test   %rax,%rax
je     1309 <find_directory+0x189>
mov    %r15,%rcx
cmp    %r15,%r14
jae    1276 <find_directory+0xf6>
mov    -0x1(%r15),%cl
add    $0xd1,%cl
cmp    $0x2d,%cl
ja     12f6 <find_directory+0x176>
movzbl %cl,%ecx
movabs $0x200000000801,%rdx
bt     %rcx,%rdx
mov    %r15,%rcx
jae    12f6 <find_directory+0x176>
cmp    %r12,%rcx
jae    1296 <find_directory+0x116>
mov    (%rax),%rdx
xchg   %ax,%ax
movzbl (%rdx),%ebx
test   %bl,%bl
je     1296 <find_directory+0x116>
add    $0x1,%rdx
mov    %bl,(%rcx)
add    $0x1,%rcx
cmp    %r12,%rcx
jb     1280 <find_directory+0x100>
movb   $0x0,(%rcx)
mov    0x8(%rax),%ecx
lea    -0x80(%rcx),%edx
cmp    $0x2,%edx
jb     1220 <find_directory+0xa0>
cmp    $0x82,%ecx
mov    -0x30(%rbp),%rbx
jne    1233 <find_directory+0xb3>
mov    (%rax),%r13
mov    %r13,%rdi
lea    0xd55(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1233 <find_directory+0xb3>
mov    %r13,%rdi
lea    0xd3d(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1233 <find_directory+0xb3>
mov    %r14,%rdi
call   1080 <find_directory@plt>
jmp    1233 <find_directory+0xb3>
movb   $0x2f,(%r15)
mov    -0x38(%rbp),%rcx
cmp    %r12,%rcx
jb     127b <find_directory+0xfb>
jmp    1296 <find_directory+0x116>
mov    %rbx,%rdi
call   1050 <closedir@plt>
mov    $0x1,%eax
jmp    1345 <find_directory+0x1c5>
mov    0x2cb9(%rip),%rax
mov    (%rax),%ebx
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xcca(%rip),%rsi
mov    %ebx,%edi
mov    %r13,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.dirent = type { i8*, i32 }
@PATH_MAX = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"Cannot open %s (%s)\0A\00"
@errno = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [3 x i8] c"..\00"
define i32 @find_directory(i8* %0) {
%2 = load i32, i32* @PATH_MAX
%3 = add nsw i32 %2, 2
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %5, i64 %6
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %18
9: ; preds = %1, %14
%10 = phi i8* [ %16, %14 ], [ %5, %1 ]
%11 = phi i8* [ %15, %14 ], [ %0, %1 ]
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%17 = icmp ult i8* %16, %7
br i1 %17, label %9, label %18
18: ; preds = %9, %14, %1
%19 = phi i8* [ %5, %1 ], [ %16, %14 ], [ %10, %9 ]
store i8 0, i8* %19
%20 = call i32* @opendir(i8* %0)
%21 = icmp eq i32* %20, null
br i1 %21, label %29, label %22
22: ; preds = %18
%23 = call %struct.dirent* @readdir(i32* %20)
%24 = icmp eq %struct.dirent* %23, null
br i1 %24, label %72, label %25
25: ; preds = %22
%26 = icmp ult i8* %5, %19
%27 = getelementptr inbounds i8, i8* %19, i64 -1
%28 = getelementptr inbounds i8, i8* %19, i64 1
br label %34
29: ; preds = %18
%30 = load i32, i32* @stderr
%31 = load i32, i32* @errno
%32 = call i8* @strerror(i32 %31)
%33 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %32)
br label %74
34: ; preds = %25, %69
%35 = phi %struct.dirent* [ %23, %25 ], [ %70, %69 ]
br i1 %26, label %36, label %39
36: ; preds = %34
%37 = load i8, i8* %27
switch i8 %37, label %38 [
i8 92, label %39
i8 58, label %39
i8 47, label %39
]
38: ; preds = %36
store i8 47, i8* %19
br label %39
39: ; preds = %34, %36, %36, %36, %38
%40 = phi i8* [ %28, %38 ], [ %19, %36 ], [ %19, %36 ], [ %19, %36 ], [ %19, %34 ]
%41 = getelementptr inbounds %struct.dirent, %struct.dirent* %35, i64 0, i32 0
%42 = icmp ult i8* %40, %7
br i1 %42, label %43, label %54
43: ; preds = %39
%44 = load i8*, i8** %41
br label %45
45: ; preds = %43, %50
%46 = phi i8* [ %52, %50 ], [ %40, %43 ]
%47 = phi i8* [ %51, %50 ], [ %44, %43 ]
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %45
%51 = getelementptr inbounds i8, i8* %47, i64 1
%52 = getelementptr inbounds i8, i8* %46, i64 1
store i8 %48, i8* %46
%53 = icmp ult i8* %52, %7
br i1 %53, label %45, label %54
54: ; preds = %45, %50, %39
%55 = phi i8* [ %40, %39 ], [ %52, %50 ], [ %46, %45 ]
store i8 0, i8* %55
%56 = getelementptr inbounds %struct.dirent, %struct.dirent* %35, i64 0, i32 1
%57 = load i32, i32* %56
switch i32 %57, label %69 [
i32 129, label %58
i32 128, label %58
i32 130, label %60
]
58: ; preds = %54, %54
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
br label %69
60: ; preds = %54
%61 = load i8*, i8** %41
%62 = call i32 @strcmp(i8* dereferenceable(1) %61, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%63 = icmp eq i32 %62, 0
br i1 %63, label %69, label %64
64: ; preds = %60
%65 = call i32 @strcmp(i8* dereferenceable(1) %61, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%66 = icmp eq i32 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %64
%68 = call i32 @find_directory(i8* %5)
br label %69
69: ; preds = %54, %60, %64, %67, %58
%70 = call %struct.dirent* @readdir(i32* %20)
%71 = icmp eq %struct.dirent* %70, null
br i1 %71, label %72, label %34
72: ; preds = %69, %22
%73 = call i32 @closedir(i32* %20)
br label %74
74: ; preds = %72, %29
%75 = phi i32 [ 1, %72 ], [ 0, %29 ]
ret i32 %75
}