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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int PATH_MAX;
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ lstat(char *, struct stat *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ read(int, char *, int);
struct dirent *readdir(int /*<<< orphan*/ *);
int readlink(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
void dev_paths_get(char dev_paths[][PATH_MAX], int max_paths, char *path) {
  DIR *dp;
  struct dirent *entry;
  struct stat statbuf;
  char wd_path[PATH_MAX];
  int fd;
  char vid[8];
  bool init;
  static int count;
  char link_path[4];
  if (path == NULL) {
    init = true;
    path = wd_path;
    strcpy(path, "/sys/devices/");
  }
  if ((dp = opendir(path)) == NULL) {
    return;
  }
  chdir(path);
  while ((entry = readdir(dp)) != NULL) {
    lstat(entry->d_name, &statbuf);
    if (S_ISDIR(statbuf.st_mode)) {
      if (strcmp(".", entry->d_name) == 0 || strcmp("..", entry->d_name) == 0) {
        continue;
      }
      if (init) {
        if (strncmp(entry->d_name, "pci0000", 7) == 0) {
          strcpy(wd_path, path);
          strcat(wd_path, "/");
          strcat(wd_path, entry->d_name);
          dev_paths_get(dev_paths, max_paths, wd_path);
        }
      } else {
        strcpy(wd_path, path);
        strcat(wd_path, "/");
        strcat(wd_path, entry->d_name);
        if (readlink(wd_path, link_path, sizeof(link_path)) == -1)
          dev_paths_get(dev_paths, max_paths, wd_path);
      }
    } else {
      if (strcmp(entry->d_name, "vendor") == 0) {
        fd = open(entry->d_name, O_RDONLY);
        read(fd, vid, sizeof(vid));
        close(fd);
        if (strcmp(vid, "0x494f\n") == 0) {
          strcpy(dev_paths[count], path);
          strcat(dev_paths[count], "/");
          count++;
        }
      }
    }
  }
  closedir(dp);
}


x86 assembly (clang, -O0):
<dev_paths_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2de6(%rip),%rax
mov    (%rax),%eax
mov    %eax,%edx
mov    %rdx,-0x68(%rbp)
mov    %rdx,%rax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    125f <dev_paths_get+0x6f>
mov    -0x60(%rbp),%rax
movl   $0x1,-0x50(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1282 <dev_paths_get+0x92>
movl   $0x1,-0x58(%rbp)
jmp    14aa <dev_paths_get+0x2ba>
mov    -0x18(%rbp),%rdi
call   1080 <chdir@plt>
mov    -0x20(%rbp),%rdi
call   10f0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     149a <dev_paths_get+0x2aa>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
call   10d0 <lstat@plt>
mov    -0x30(%rbp),%edi
call   1090 <S_ISDIR@plt>
cmp    $0x0,%rax
je     13d3 <dev_paths_get+0x1e3>
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xd3d(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
je     12fe <dev_paths_get+0x10e>
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xd1f(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1303 <dev_paths_get+0x113>
jmp    128b <dev_paths_get+0x9b>
cmpl   $0x0,-0x50(%rbp)
je     1371 <dev_paths_get+0x181>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xcf6(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    136c <dev_paths_get+0x17c>
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x60(%rbp),%rdi
lea    0xcc5(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1110 <strcat@plt>
mov    -0x60(%rbp),%rdx
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <dev_paths_get@plt>
jmp    13ce <dev_paths_get+0x1de>
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x60(%rbp),%rdi
lea    0xc83(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1110 <strcat@plt>
mov    -0x60(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x4,%edx
call   1060 <readlink@plt>
cmp    $0xffffffff,%eax
jne    13c9 <dev_paths_get+0x1d9>
mov    -0x60(%rbp),%rdx
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <dev_paths_get@plt>
jmp    13ce <dev_paths_get+0x1de>
jmp    1495 <dev_paths_get+0x2a5>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    0xc38(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1490 <dev_paths_get+0x2a0>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    0x2be2(%rip),%rax
mov    (%rax),%esi
call   1100 <open@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x4c(%rbp),%rsi
mov    $0x8,%edx
call   10c0 <read@plt>
mov    -0x44(%rbp),%edi
call   10a0 <close@plt>
lea    -0x4c(%rbp),%rdi
lea    0xbf4(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    148b <dev_paths_get+0x29b>
mov    -0x68(%rbp),%rcx
mov    -0x8(%rbp),%rdi
movslq 0x2c56(%rip),%rax
imul   %rcx,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x68(%rbp),%rcx
mov    -0x8(%rbp),%rdi
movslq 0x2c37(%rip),%rax
imul   %rcx,%rax
add    %rax,%rdi
lea    0xb95(%rip),%rsi
call   1110 <strcat@plt>
mov    0x2c1e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2c15(%rip)
jmp    1490 <dev_paths_get+0x2a0>
jmp    1495 <dev_paths_get+0x2a5>
jmp    128b <dev_paths_get+0x9b>
mov    -0x20(%rbp),%rdi
call   10b0 <closedir@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_paths_get>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %esi,-0x34(%rbp)
mov    %rdi,-0x48(%rbp)
mov    %rsp,%r14
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
mov    %rax,-0x58(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
test   %rdx,%rdx
jne    1233 <dev_paths_get+0x53>
lea    0xdd8(%rip),%rsi
mov    %r13,%rdi
call   1040 <strcpy@plt>
mov    %r13,%rbx
mov    %rbx,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     13db <dev_paths_get+0x1fb>
mov    %rax,%r12
mov    %r14,-0x50(%rbp)
mov    %rbx,-0x40(%rbp)
mov    %rbx,%rdi
call   1070 <chdir@plt>
mov    %r12,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     13cf <dev_paths_get+0x1ef>
mov    %rax,%r15
lea    0xda7(%rip),%rbx
jmp    12a8 <dev_paths_get+0xc8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,%rdi
mov    %rbx,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     133c <dev_paths_get+0x15c>
mov    %r12,%rdi
call   10e0 <readdir@plt>
mov    %rax,%r15
test   %rax,%rax
je     13cf <dev_paths_get+0x1ef>
mov    (%r15),%rdi
lea    -0x30(%rbp),%rsi
call   10c0 <lstat@plt>
mov    -0x30(%rbp),%edi
call   1080 <S_ISDIR@plt>
mov    (%r15),%rsi
test   %rax,%rax
je     1280 <dev_paths_get+0xa0>
lea    0xd44(%rip),%rdi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1294 <dev_paths_get+0xb4>
mov    (%r15),%rsi
lea    0xd2f(%rip),%rdi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1294 <dev_paths_get+0xb4>
mov    (%r15),%rdi
lea    0xd1e(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1294 <dev_paths_get+0xb4>
mov    %r13,%rdi
mov    -0x40(%rbp),%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
lea    0xcf4(%rip),%rsi
call   1100 <strcat@plt>
mov    (%r15),%rsi
mov    %r13,%rdi
call   1100 <strcat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    %r13,%rdx
call   1050 <dev_paths_get@plt>
jmp    1294 <dev_paths_get+0xb4>
mov    (%r15),%rdi
mov    0x2c9a(%rip),%rax
mov    (%rax),%esi
call   10f0 <open@plt>
mov    %rbx,%r14
mov    %eax,%ebx
mov    %eax,%edi
lea    -0x60(%rbp),%r15
mov    %r15,%rsi
mov    $0x8,%edx
call   10b0 <read@plt>
mov    %ebx,%edi
mov    %r14,%rbx
call   1090 <close@plt>
mov    %r15,%rdi
lea    0xca7(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    1294 <dev_paths_get+0xb4>
movslq 0x2d0a(%rip),%rdi
mov    -0x58(%rbp),%r15
imul   %r15,%rdi
mov    -0x48(%rbp),%rbx
add    %rbx,%rdi
mov    -0x40(%rbp),%rsi
call   1040 <strcpy@plt>
movslq 0x2ceb(%rip),%rdi
imul   %r15,%rdi
add    %rbx,%rdi
mov    %r14,%rbx
lea    0xc4e(%rip),%rsi
call   1100 <strcat@plt>
addl   $0x1,0x2cce(%rip)
jmp    1294 <dev_paths_get+0xb4>
mov    %r12,%rdi
call   10a0 <closedir@plt>
mov    -0x50(%rbp),%r14
mov    %r14,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@PATH_MAX = global i32 0
@dev_paths_get.count = internal unnamed_addr global i32 0
@.str = [14 x i8] c"/sys/devices/\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"..\00"
@.str.3 = [8 x i8] c"pci0000\00"
@.str.4 = [2 x i8] c"/\00"
@.str.5 = [7 x i8] c"vendor\00"
@O_RDONLY = global i32 0
@.str.6 = [8 x i8] c"0x494f\0A\00"
define void @dev_paths_get(i8* %0, i32 %1, i8* %2) {
%4 = alloca %struct.stat
%5 = alloca [8 x i8]
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = bitcast %struct.stat* %4 to i8*
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %7
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%12 = icmp eq i8* %2, null
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
%16 = phi i8* [ %10, %13 ], [ %2, %3 ]
%17 = call i32* @opendir(i8* %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %79, label %19
19: ; preds = %15
%20 = call i32 @chdir(i8* %16)
%21 = call %struct.dirent* @readdir(i32* %17)
%22 = icmp eq %struct.dirent* %21, null
br i1 %22, label %77, label %23
23: ; preds = %19
%24 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
br label %25
25: ; preds = %23, %41
%26 = phi %struct.dirent* [ %21, %23 ], [ %42, %41 ]
%27 = getelementptr inbounds %struct.dirent, %struct.dirent* %26, i64 0, i32 0
%28 = load i8*, i8** %27
%29 = call i32 @lstat(i8* %28, %struct.stat* %4)
%30 = load i32, i32* %24
%31 = call i64 @S_ISDIR(i32 %30)
%32 = icmp eq i64 %31, 0
%33 = load i8*, i8** %27
br i1 %32, label %53, label %34
34: ; preds = %25
%35 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%36 = icmp eq i64 %35, 0
br i1 %36, label %41, label %37
37: ; preds = %34
%38 = load i8*, i8** %27
%39 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %44, %48, %56, %64, %53, %34, %37
%42 = call %struct.dirent* @readdir(i32* %17)
%43 = icmp eq %struct.dirent* %42, null
br i1 %43, label %77, label %25
44: ; preds = %37
%45 = load i8*, i8** %27
%46 = call i64 @strncmp(i8* %45, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %41
48: ; preds = %44
%49 = call i32 @strcpy(i8* %10, i8* %16)
%50 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%51 = load i8*, i8** %27
%52 = call i32 @strcat(i8* %10, i8* %51)
br label %41
53: ; preds = %25
%54 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %41
56: ; preds = %53
%57 = load i8*, i8** %27
%58 = load i32, i32* @O_RDONLY
%59 = call i32 @open(i8* %57, i32 %58)
%60 = call i32 @read(i32 %59, i8* %11, i32 8)
%61 = call i32 @close(i32 %59)
%62 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %41
64: ; preds = %56
%65 = load i32, i32* @dev_paths_get.count
%66 = sext i32 %65 to i64
%67 = mul nsw i64 %66, %7
%68 = getelementptr inbounds i8, i8* %0, i64 %67
%69 = call i32 @strcpy(i8* %68, i8* %16)
%70 = load i32, i32* @dev_paths_get.count
%71 = sext i32 %70 to i64
%72 = mul nsw i64 %71, %7
%73 = getelementptr inbounds i8, i8* %0, i64 %72
%74 = call i32 @strcat(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%75 = load i32, i32* @dev_paths_get.count
%76 = add nsw i32 %75, 1
store i32 %76, i32* @dev_paths_get.count
br label %41
77: ; preds = %41, %19
%78 = call i32 @closedir(i32* %17)
br label %79
79: ; preds = %15, %77
ret void
}