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

/* Variables and functions */
int PATH_MAX;
scalar_t__ S_ISBLK(int /*<<< orphan*/);
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
scalar_t__ dm_is_dm_kernel_name(char *);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *__lookup_dev(char *path, dev_t dev, int dir_level, const int max_level) {
  struct dirent *entry;
  struct stat st;
  char *ptr;
  char *result = NULL;
  DIR *dir;
  int space;
  if (dir_level > max_level)
    return NULL;
  path[PATH_MAX - 1] = '\0';
  ptr = path + strlen(path);
  *ptr++ = '/';
  *ptr = '\0';
  space = PATH_MAX - (ptr - path);
  dir = opendir(path);
  if (!dir)
    return NULL;
  while ((entry = readdir(dir))) {
    if (entry->d_name[0] == '.' || !strncmp(entry->d_name, "..", 2))
      continue;
    if (dir_level == 0 &&
        (!strcmp(entry->d_name, "shm") || !strcmp(entry->d_name, "fd") ||
         !strcmp(entry->d_name, "char") || !strcmp(entry->d_name, "pts")))
      continue;
    strncpy(ptr, entry->d_name, space);
    if (stat(path, &st) < 0)
      continue;
    if (S_ISDIR(st.st_mode)) {
      result = __lookup_dev(path, dev, dir_level + 1, max_level);
      if (result)
        break;
    } else if (S_ISBLK(st.st_mode)) {
      if (dir_level == 0 && dm_is_dm_kernel_name(entry->d_name))
        continue;
      if (st.st_rdev == dev) {
        result = strdup(path);
        break;
      }
    }
  }
  closedir(dir);
  return result;
}


x86 assembly (clang, -O0):
<__lookup_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1207 <__lookup_dev+0x37>
movq   $0x0,-0x8(%rbp)
jmp    1453 <__lookup_dev+0x283>
mov    -0x10(%rbp),%rax
mov    0x2dde(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x2f,(%rax)
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    0x2d91(%rip),%rax
movslq (%rax),%rax
mov    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1298 <__lookup_dev+0xc8>
movq   $0x0,-0x8(%rbp)
jmp    1453 <__lookup_dev+0x283>
jmp    129d <__lookup_dev+0xcd>
mov    -0x50(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1442 <__lookup_dev+0x272>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     12e8 <__lookup_dev+0x118>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xd2b(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    12ed <__lookup_dev+0x11d>
jmp    129d <__lookup_dev+0xcd>
cmpl   $0x0,-0x1c(%rbp)
jne    136c <__lookup_dev+0x19c>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xcfe(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1367 <__lookup_dev+0x197>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xce6(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1367 <__lookup_dev+0x197>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xccd(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1367 <__lookup_dev+0x197>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xcb6(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    136c <__lookup_dev+0x19c>
jmp    129d <__lookup_dev+0xcd>
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
mov    -0x54(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10b0 <stat@plt>
cmp    $0x0,%rax
jge    139b <__lookup_dev+0x1cb>
jmp    129d <__lookup_dev+0xcd>
mov    -0x30(%rbp),%edi
call   1080 <S_ISDIR@plt>
cmp    $0x0,%rax
je     13dc <__lookup_dev+0x20c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x20(%rbp),%ecx
call   10d0 <__lookup_dev@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     13d7 <__lookup_dev+0x207>
jmp    1442 <__lookup_dev+0x272>
jmp    143d <__lookup_dev+0x26d>
mov    -0x30(%rbp),%edi
call   10e0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     1438 <__lookup_dev+0x268>
cmpl   $0x0,-0x1c(%rbp)
jne    1413 <__lookup_dev+0x243>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1070 <dm_is_dm_kernel_name@plt>
cmp    $0x0,%rax
je     1413 <__lookup_dev+0x243>
jmp    129d <__lookup_dev+0xcd>
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1433 <__lookup_dev+0x263>
mov    -0x10(%rbp),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x48(%rbp)
jmp    1442 <__lookup_dev+0x272>
jmp    1438 <__lookup_dev+0x268>
jmp    143d <__lookup_dev+0x26d>
jmp    129d <__lookup_dev+0xcd>
mov    -0x50(%rbp),%rdi
call   1090 <closedir@plt>
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lookup_dev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    %ecx,%edx
jg     125b <__lookup_dev+0x8b>
mov    %ecx,%ebx
mov    %edx,%r12d
mov    %rdi,%r13
mov    %rsi,%r14
mov    0x2dfc(%rip),%rbp
movslq 0x0(%rbp),%rax
movb   $0x0,-0x1(%rax,%rdi,1)
call   1060 <strlen@plt>
cltq
lea    (%rax,%r13,1),%rcx
add    $0x1,%rcx
movw   $0x2f,0x0(%r13,%rax,1)
mov    %r13d,%eax
mov    %rcx,0x20(%rsp)
sub    %ecx,%eax
add    0x0(%rbp),%eax
mov    %eax,0xc(%rsp)
mov    %r13,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     125b <__lookup_dev+0x8b>
mov    %rax,%rbp
mov    %rax,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     1380 <__lookup_dev+0x1b0>
mov    %rax,%r15
mov    %ebx,0x8(%rsp)
lea    0x1(%r12),%eax
mov    %eax,0x4(%rsp)
mov    %r14,%rbx
jmp    1294 <__lookup_dev+0xc4>
xor    %ebx,%ebx
jmp    138a <__lookup_dev+0x1ba>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
call   10d0 <__lookup_dev@plt>
test   %rax,%rax
jne    13a4 <__lookup_dev+0x1d4>
xchg   %ax,%ax
mov    %rbp,%rdi
call   10c0 <readdir@plt>
mov    %rax,%r15
test   %rax,%rax
je     1380 <__lookup_dev+0x1b0>
mov    (%r15),%rdi
cmpb   $0x2e,(%rdi)
je     1280 <__lookup_dev+0xb0>
lea    0xd5d(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1280 <__lookup_dev+0xb0>
mov    (%r15),%r14
test   %r12d,%r12d
je     131f <__lookup_dev+0x14f>
mov    0x20(%rsp),%rdi
mov    %r14,%rsi
mov    0xc(%rsp),%edx
call   1030 <strncpy@plt>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   10b0 <stat@plt>
test   %rax,%rax
js     1280 <__lookup_dev+0xb0>
mov    0x18(%rsp),%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
jne    1262 <__lookup_dev+0x92>
mov    0x18(%rsp),%edi
call   10e0 <S_ISBLK@plt>
test   %rax,%rax
je     1280 <__lookup_dev+0xb0>
test   %r12d,%r12d
jne    1312 <__lookup_dev+0x142>
mov    (%r15),%rdi
call   1070 <dm_is_dm_kernel_name@plt>
test   %rax,%rax
jne    1280 <__lookup_dev+0xb0>
cmp    %rbx,0x10(%rsp)
jne    1280 <__lookup_dev+0xb0>
jmp    139c <__lookup_dev+0x1cc>
mov    %r14,%rdi
lea    0xcda(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1280 <__lookup_dev+0xb0>
mov    %r14,%rdi
lea    0xcc7(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1280 <__lookup_dev+0xb0>
mov    %r14,%rdi
lea    0xcb3(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     1280 <__lookup_dev+0xb0>
mov    %r14,%rdi
lea    0xca1(%rip),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
jne    12b9 <__lookup_dev+0xe9>
jmp    1280 <__lookup_dev+0xb0>
xor    %ebx,%ebx
mov    %rbp,%rdi
call   1090 <closedir@plt>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13,%rdi
call   10f0 <strdup@plt>
mov    %rax,%rbx
jmp    1382 <__lookup_dev+0x1b2>

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.stat = type { i64, i32 }
@PATH_MAX = global i32 0
@.str = [3 x i8] c"..\00"
@.str.1 = [4 x i8] c"shm\00"
@.str.2 = [3 x i8] c"fd\00"
@.str.3 = [5 x i8] c"char\00"
@.str.4 = [4 x i8] c"pts\00"
define i8* @__lookup_dev(i8* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.dirent*
%11 = alloca %struct.stat
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* null, i8** %13
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %4
store i8* null, i8** %5
br label %153
20: ; preds = %4
%21 = load i8*, i8** %6
%22 = load i32, i32* @PATH_MAX
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %6
%27 = load i8*, i8** %6
%28 = call i32 @strlen(i8* %27)
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8* %30, i8** %12
%31 = load i8*, i8** %12
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %12
store i8 47, i8* %31
%33 = load i8*, i8** %12
store i8 0, i8* %33
%34 = load i32, i32* @PATH_MAX
%35 = sext i32 %34 to i64
%36 = load i8*, i8** %12
%37 = load i8*, i8** %6
%38 = ptrtoint i8* %36 to i64
%39 = ptrtoint i8* %37 to i64
%40 = sub i64 %38, %39
%41 = sub nsw i64 %35, %40
%42 = trunc i64 %41 to i32
store i32 %42, i32* %15
%43 = load i8*, i8** %6
%44 = call i32* @opendir(i8* %43)
store i32* %44, i32** %14
%45 = load i32*, i32** %14
%46 = icmp ne i32* %45, null
br i1 %46, label %48, label %47
47: ; preds = %20
store i8* null, i8** %5
br label %153
48: ; preds = %20
br label %49
49: ; preds = %148, %137, %106, %95, %67, %48
%50 = load i32*, i32** %14
%51 = call %struct.dirent* @readdir(i32* %50)
store %struct.dirent* %51, %struct.dirent** %10
%52 = icmp ne %struct.dirent* %51, null
br i1 %52, label %53, label %149
53: ; preds = %49
%54 = load %struct.dirent*, %struct.dirent** %10
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %54, i32 0, i32 0
%56 = load i8*, i8** %55
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 46
br i1 %60, label %67, label %61
61: ; preds = %53
%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 i32 @strncmp(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%66 = icmp ne i32 %65, 0
br i1 %66, label %68, label %67
67: ; preds = %61, %53
br label %49
68: ; preds = %61
%69 = load i32, i32* %8
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %96
71: ; preds = %68
%72 = load %struct.dirent*, %struct.dirent** %10
%73 = getelementptr inbounds %struct.dirent, %struct.dirent* %72, i32 0, i32 0
%74 = load i8*, i8** %73
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %95
77: ; preds = %71
%78 = load %struct.dirent*, %struct.dirent** %10
%79 = getelementptr inbounds %struct.dirent, %struct.dirent* %78, i32 0, i32 0
%80 = load i8*, i8** %79
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %95
83: ; preds = %77
%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 @strcmp(i8* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %95
89: ; preds = %83
%90 = load %struct.dirent*, %struct.dirent** %10
%91 = getelementptr inbounds %struct.dirent, %struct.dirent* %90, i32 0, i32 0
%92 = load i8*, i8** %91
%93 = call i32 @strcmp(i8* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%94 = icmp ne i32 %93, 0
br i1 %94, label %96, label %95
95: ; preds = %89, %83, %77, %71
br label %49
96: ; preds = %89, %68
%97 = load i8*, i8** %12
%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 i32, i32* %15
%102 = call i32 @strncpy(i8* %97, i8* %100, i32 %101)
%103 = load i8*, i8** %6
%104 = call i64 @stat(i8* %103, %struct.stat* %11)
%105 = icmp slt i64 %104, 0
br i1 %105, label %106, label %107
106: ; preds = %96
br label %49
107: ; preds = %96
%108 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 1
%109 = load i32, i32* %108
%110 = call i64 @S_ISDIR(i32 %109)
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %123
112: ; preds = %107
%113 = load i8*, i8** %6
%114 = load i64, i64* %7
%115 = load i32, i32* %8
%116 = add nsw i32 %115, 1
%117 = load i32, i32* %9
%118 = call i8* @__lookup_dev(i8* %113, i64 %114, i32 %116, i32 %117)
store i8* %118, i8** %13
%119 = load i8*, i8** %13
%120 = icmp ne i8* %119, null
br i1 %120, label %121, label %122
121: ; preds = %112
br label %149
122: ; preds = %112
br label %148
123: ; preds = %107
%124 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 1
%125 = load i32, i32* %124
%126 = call i64 @S_ISBLK(i32 %125)
%127 = icmp ne i64 %126, 0
br i1 %127, label %128, label %147
128: ; preds = %123
%129 = load i32, i32* %8
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %138
131: ; preds = %128
%132 = load %struct.dirent*, %struct.dirent** %10
%133 = getelementptr inbounds %struct.dirent, %struct.dirent* %132, i32 0, i32 0
%134 = load i8*, i8** %133
%135 = call i64 @dm_is_dm_kernel_name(i8* %134)
%136 = icmp ne i64 %135, 0
br i1 %136, label %137, label %138
137: ; preds = %131
br label %49
138: ; preds = %131, %128
%139 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 0
%140 = load i64, i64* %139
%141 = load i64, i64* %7
%142 = icmp eq i64 %140, %141
br i1 %142, label %143, label %146
143: ; preds = %138
%144 = load i8*, i8** %6
%145 = call i8* @strdup(i8* %144)
store i8* %145, i8** %13
br label %149
146: ; preds = %138
br label %147
147: ; preds = %146, %123
br label %148
148: ; preds = %147, %122
br label %49
149: ; preds = %143, %121, %49
%150 = load i32*, i32** %14
%151 = call i32 @closedir(i32* %150)
%152 = load i8*, i8** %13
store i8* %152, i8** %5
br label %153
153: ; preds = %149, %47, %19
%154 = load i8*, i8** %5
ret i8* %154
}

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