#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 udev_device {
  int dummy;
};
struct udev {
  int dummy;
};
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ path;
typedef int /*<<< orphan*/ file;

/* Variables and functions */
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
size_t strlen(char *);
scalar_t__ strncmp(char const *, char *, int);
char *strrchr(char const *, char);
int /*<<< orphan*/ udev_device_get_devpath(struct udev_device *);
struct udev_device *udev_device_new(struct udev *);
int /*<<< orphan*/ udev_device_set_syspath(struct udev_device *, char *);
char *udev_get_sys_path(struct udev *);
int /*<<< orphan*/ udev_log_null(struct udev *, char *, char const *, ...);
int /*<<< orphan*/ util_resolve_sys_link(struct udev *, char *, int);
int /*<<< orphan*/ util_strscpy(char *, int, char const *);
int /*<<< orphan*/ util_strscpyl(char *, int, char *, char *,
                                 int /*<<< orphan*/ *);
__attribute__((visibility("default"))) struct udev_device *
udev_device_new_from_syspath(struct udev *udev, const char *syspath) {
  size_t len;
  const char *subdir;
  char path[1024];
  char *pos;
  struct stat statbuf;
  struct udev_device *udev_device;
  if (udev == NULL)
    return NULL;
  if (syspath == NULL)
    return NULL;
  len = strlen(udev_get_sys_path(udev));
  if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) {
    udev_log_null(udev, "not in sys :%s\n", syspath);
    return NULL;
  }
  subdir = &syspath[len + 1];
  pos = strrchr(subdir, '/');
  if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
    udev_log_null(udev, "not a subdir :%s\n", syspath);
    return NULL;
  }
  util_strscpy(path, sizeof(path), syspath);
  util_resolve_sys_link(udev, path, sizeof(path));
  if (strncmp(&path[len], "/devices/", 9) == 0) {
    char file[1024];
    util_strscpyl(file, sizeof(file), path, "/uevent", NULL);
    if (stat(file, &statbuf) != 0) {
      udev_log_null(udev, "not a device: %s\n", syspath);
      return NULL;
    }
  } else {
    if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
      udev_log_null(udev, "directory not found: %s\n", syspath);
      return NULL;
    }
  }
  udev_device = udev_device_new(udev);
  if (udev_device == NULL)
    return NULL;
  udev_device_set_syspath(udev_device, path);
  udev_log_null(udev, "device %p has devpath '%s'\n", udev_device,
                udev_device_get_devpath(udev_device));
  return udev_device;
}


x86 assembly (clang, -O0):
<udev_device_new_from_syspath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11fb <udev_device_new_from_syspath+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
cmpq   $0x0,-0x18(%rbp)
jne    1213 <udev_device_new_from_syspath+0x43>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
mov    -0x10(%rbp),%rdi
call   1060 <udev_get_sys_path@plt>
mov    %rax,%rdi
call   1080 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x858(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <udev_get_sys_path@plt>
mov    -0x858(%rbp),%rdi
mov    %rax,%rsi
mov    -0x20(%rbp),%rax
mov    %eax,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     127e <udev_device_new_from_syspath+0xae>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd96(%rip),%rsi
mov    $0x0,%al
call   1070 <udev_log_null@plt>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
call   10b0 <strrchr@plt>
mov    %rax,-0x438(%rbp)
cmpq   $0x0,-0x438(%rbp)
je     12e0 <udev_device_new_from_syspath+0x110>
mov    -0x438(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     12e0 <udev_device_new_from_syspath+0x110>
mov    -0x438(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
jae    1303 <udev_device_new_from_syspath+0x133>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd21(%rip),%rsi
mov    $0x0,%al
call   1070 <udev_log_null@plt>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1040 <util_strscpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   10c0 <util_resolve_sys_link@plt>
lea    -0x430(%rbp),%rdi
add    -0x20(%rbp),%rdi
lea    0xce3(%rip),%rsi
mov    $0x9,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    13bc <udev_device_new_from_syspath+0x1ec>
lea    -0x850(%rbp),%rdi
lea    -0x430(%rbp),%rdx
mov    $0x400,%esi
lea    0xcbf(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   10e0 <util_strscpyl@plt>
lea    -0x850(%rbp),%rdi
lea    -0x440(%rbp),%rsi
call   10d0 <stat@plt>
cmp    $0x0,%rax
je     13b7 <udev_device_new_from_syspath+0x1e7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xc91(%rip),%rsi
mov    $0x0,%al
call   1070 <udev_log_null@plt>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
jmp    1415 <udev_device_new_from_syspath+0x245>
lea    -0x430(%rbp),%rdi
lea    -0x440(%rbp),%rsi
call   10d0 <stat@plt>
cmp    $0x0,%rax
jne    13ed <udev_device_new_from_syspath+0x21d>
mov    -0x440(%rbp),%edi
call   10a0 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1410 <udev_device_new_from_syspath+0x240>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   1070 <udev_log_null@plt>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
jmp    1415 <udev_device_new_from_syspath+0x245>
mov    -0x10(%rbp),%rdi
call   1030 <udev_device_new@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
jne    1440 <udev_device_new_from_syspath+0x270>
movq   $0x0,-0x8(%rbp)
jmp    14a1 <udev_device_new_from_syspath+0x2d1>
mov    -0x448(%rbp),%rdi
lea    -0x430(%rbp),%rsi
call   1090 <udev_device_set_syspath@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x868(%rbp)
mov    -0x448(%rbp),%rax
mov    %rax,-0x860(%rbp)
mov    -0x448(%rbp),%rdi
call   10f0 <udev_device_get_devpath@plt>
mov    -0x868(%rbp),%rdi
mov    -0x860(%rbp),%rdx
mov    %eax,%ecx
lea    0xbd0(%rip),%rsi
mov    $0x0,%al
call   1070 <udev_log_null@plt>
mov    -0x448(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_device_new_from_syspath>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x818,%rsp
xor    %ebx,%ebx
test   %rdi,%rdi
je     12cd <udev_device_new_from_syspath+0xfd>
mov    %rsi,%r14
test   %rsi,%rsi
je     12cd <udev_device_new_from_syspath+0xfd>
mov    %rdi,%r15
call   1060 <udev_get_sys_path@plt>
mov    %rax,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1060 <udev_get_sys_path@plt>
mov    %r14,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     122e <udev_device_new_from_syspath+0x5e>
lea    0xdd7(%rip),%rsi
jmp    12be <udev_device_new_from_syspath+0xee>
lea    (%rbx,%r14,1),%r12
add    $0x1,%r12
mov    %r12,%rdi
mov    $0x2f,%esi
call   10b0 <strrchr@plt>
test   %rax,%rax
je     12b7 <udev_device_new_from_syspath+0xe7>
cmpb   $0x0,0x1(%rax)
je     12b7 <udev_device_new_from_syspath+0xe7>
add    $0x2,%r12
cmp    %r12,%rax
jb     12b7 <udev_device_new_from_syspath+0xe7>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1040 <util_strscpy@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
call   10c0 <util_resolve_sys_link@plt>
lea    (%rsp,%rbx,1),%rdi
add    $0x10,%rdi
lea    0xd97(%rip),%rsi
mov    $0x9,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
je     12df <udev_device_new_from_syspath+0x10f>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10d0 <stat@plt>
test   %rax,%rax
je     131e <udev_device_new_from_syspath+0x14e>
lea    0xd91(%rip),%rsi
jmp    12be <udev_device_new_from_syspath+0xee>
lea    0xd52(%rip),%rsi
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <udev_log_null@plt>
mov    %rbx,%rax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd46(%rip),%rcx
lea    0x410(%rsp),%rbx
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
xor    %r8d,%r8d
call   10e0 <util_strscpyl@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <stat@plt>
test   %rax,%rax
je     132b <udev_device_new_from_syspath+0x15b>
lea    0xd18(%rip),%rsi
jmp    12be <udev_device_new_from_syspath+0xee>
mov    0x8(%rsp),%edi
call   10a0 <S_ISDIR@plt>
test   %eax,%eax
je     12ae <udev_device_new_from_syspath+0xde>
mov    %r15,%rdi
call   1030 <udev_device_new@plt>
test   %rax,%rax
je     136b <udev_device_new_from_syspath+0x19b>
mov    %rax,%rbx
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
call   1090 <udev_device_set_syspath@plt>
mov    %rbx,%rdi
call   10f0 <udev_device_get_devpath@plt>
lea    0xd08(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1070 <udev_log_null@plt>
jmp    12cd <udev_device_new_from_syspath+0xfd>
xor    %ebx,%ebx
jmp    12cd <udev_device_new_from_syspath+0xfd>

LLVM IR (-O0):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.stat = type { i32 }
@.str = [16 x i8] c"not in sys :%s\0A\00"
@.str.1 = [18 x i8] c"not a subdir :%s\0A\00"
@.str.2 = [10 x i8] c"/devices/\00"
@.str.3 = [8 x i8] c"/uevent\00"
@.str.4 = [18 x i8] c"not a device: %s\0A\00"
@.str.5 = [25 x i8] c"directory not found: %s\0A\00"
@.str.6 = [28 x i8] c"device %p has devpath '%s'\0A\00"
define %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %0, i8* %1) {
%3 = alloca %struct.udev_device*
%4 = alloca %struct.udev*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca %struct.stat
%11 = alloca %struct.udev_device*
%12 = alloca [1024 x i8]
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
%13 = load %struct.udev*, %struct.udev** %4
%14 = icmp eq %struct.udev* %13, null
br i1 %14, label %15, label %16
15: ; preds = %2
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
16: ; preds = %2
%17 = load i8*, i8** %5
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %16
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
20: ; preds = %16
%21 = load %struct.udev*, %struct.udev** %4
%22 = call i8* @udev_get_sys_path(%struct.udev* %21)
%23 = call i64 @strlen(i8* %22)
store i64 %23, i64* %6
%24 = load i8*, i8** %5
%25 = load %struct.udev*, %struct.udev** %4
%26 = call i8* @udev_get_sys_path(%struct.udev* %25)
%27 = load i64, i64* %6
%28 = trunc i64 %27 to i32
%29 = call i64 @strncmp(i8* %24, i8* %26, i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %20
%32 = load %struct.udev*, %struct.udev** %4
%33 = load i8*, i8** %5
%34 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %33)
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
35: ; preds = %20
%36 = load i8*, i8** %5
%37 = load i64, i64* %6
%38 = add i64 %37, 1
%39 = getelementptr inbounds i8, i8* %36, i64 %38
store i8* %39, i8** %7
%40 = load i8*, i8** %7
%41 = call i8* @strrchr(i8* %40, i8 signext 47)
store i8* %41, i8** %9
%42 = load i8*, i8** %9
%43 = icmp eq i8* %42, null
br i1 %43, label %55, label %44
44: ; preds = %35
%45 = load i8*, i8** %9
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 0
br i1 %49, label %55, label %50
50: ; preds = %44
%51 = load i8*, i8** %9
%52 = load i8*, i8** %7
%53 = getelementptr inbounds i8, i8* %52, i64 2
%54 = icmp ult i8* %51, %53
br i1 %54, label %55, label %59
55: ; preds = %50, %44, %35
%56 = load %struct.udev*, %struct.udev** %4
%57 = load i8*, i8** %5
%58 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %56, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %57)
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
59: ; preds = %50
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%61 = load i8*, i8** %5
%62 = call i32 @util_strscpy(i8* %60, i32 1024, i8* %61)
%63 = load %struct.udev*, %struct.udev** %4
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%65 = call i32 @util_resolve_sys_link(%struct.udev* %63, i8* %64, i32 1024)
%66 = load i64, i64* %6
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %66
%68 = call i64 @strncmp(i8* %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 9)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %82
70: ; preds = %59
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%73 = call i32 @util_strscpyl(i8* %71, i32 1024, i8* %72, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* null)
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%75 = call i64 @stat(i8* %74, %struct.stat* %10)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %70
%78 = load %struct.udev*, %struct.udev** %4
%79 = load i8*, i8** %5
%80 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %78, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %79)
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
81: ; preds = %70
br label %96
82: ; preds = %59
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%84 = call i64 @stat(i8* %83, %struct.stat* %10)
%85 = icmp ne i64 %84, 0
br i1 %85, label %91, label %86
86: ; preds = %82
%87 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%88 = load i32, i32* %87
%89 = call i32 @S_ISDIR(i32 %88)
%90 = icmp ne i32 %89, 0
br i1 %90, label %95, label %91
91: ; preds = %86, %82
%92 = load %struct.udev*, %struct.udev** %4
%93 = load i8*, i8** %5
%94 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %92, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %93)
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
95: ; preds = %86
br label %96
96: ; preds = %95, %81
%97 = load %struct.udev*, %struct.udev** %4
%98 = call %struct.udev_device* @udev_device_new(%struct.udev* %97)
store %struct.udev_device* %98, %struct.udev_device** %11
%99 = load %struct.udev_device*, %struct.udev_device** %11
%100 = icmp eq %struct.udev_device* %99, null
br i1 %100, label %101, label %102
101: ; preds = %96
store %struct.udev_device* null, %struct.udev_device** %3
br label %113
102: ; preds = %96
%103 = load %struct.udev_device*, %struct.udev_device** %11
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%105 = call i32 @udev_device_set_syspath(%struct.udev_device* %103, i8* %104)
%106 = load %struct.udev*, %struct.udev** %4
%107 = load %struct.udev_device*, %struct.udev_device** %11
%108 = bitcast %struct.udev_device* %107 to i8*
%109 = load %struct.udev_device*, %struct.udev_device** %11
%110 = call i32 @udev_device_get_devpath(%struct.udev_device* %109)
%111 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %106, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %108, i32 %110)
%112 = load %struct.udev_device*, %struct.udev_device** %11
store %struct.udev_device* %112, %struct.udev_device** %3
br label %113
113: ; preds = %102, %101, %91, %77, %55, %31, %19, %15
%114 = load %struct.udev_device*, %struct.udev_device** %3
ret %struct.udev_device* %114
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.stat = type { i32 }
@.str = [16 x i8] c"not in sys :%s\0A\00"
@.str.1 = [18 x i8] c"not a subdir :%s\0A\00"
@.str.2 = [10 x i8] c"/devices/\00"
@.str.3 = [8 x i8] c"/uevent\00"
@.str.4 = [18 x i8] c"not a device: %s\0A\00"
@.str.5 = [25 x i8] c"directory not found: %s\0A\00"
@.str.6 = [28 x i8] c"device %p has devpath '%s'\0A\00"
define %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.stat
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.stat* %4 to i8*
%8 = icmp eq %struct.udev* %0, null
%9 = icmp eq i8* %1, null
%10 = or i1 %8, %9
br i1 %10, label %66, label %11
11: ; preds = %2
%12 = tail call i8* @udev_get_sys_path(%struct.udev* %0)
%13 = tail call i64 @strlen(i8* dereferenceable(1) %12)
%14 = tail call i8* @udev_get_sys_path(%struct.udev* %0)
%15 = trunc i64 %13 to i32
%16 = tail call i64 @strncmp(i8* %1, i8* %14, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %11
%19 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %66
20: ; preds = %11
%21 = add i64 %13, 1
%22 = getelementptr inbounds i8, i8* %1, i64 %21
%23 = tail call i8* @strrchr(i8* %22, i8 signext 47)
%24 = icmp eq i8* %23, null
br i1 %24, label %32, label %25
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %23, i64 1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
%29 = getelementptr inbounds i8, i8* %22, i64 2
%30 = icmp ult i8* %23, %29
%31 = select i1 %28, i1 true, i1 %30
br i1 %31, label %32, label %34
32: ; preds = %25, %20
%33 = tail call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %66
34: ; preds = %25
%35 = call i32 @util_strscpy(i8* %6, i32 1024, i8* %1)
%36 = call i32 @util_resolve_sys_link(%struct.udev* %0, i8* %6, i32 1024)
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %13
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 9)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %34
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%42 = call i32 @util_strscpyl(i8* %41, i32 1024, i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* null)
%43 = call i64 @stat(i8* %41, %struct.stat* %4)
%44 = icmp eq i64 %43, 0
br i1 %44, label %57, label %45
45: ; preds = %40
%46 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %66
47: ; preds = %34
%48 = call i64 @stat(i8* %6, %struct.stat* %4)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%52 = load i32, i32* %51
%53 = call i32 @S_ISDIR(i32 %52)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50, %47
%56 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %1)
br label %66
57: ; preds = %40
br label %58
58: ; preds = %57, %50
%59 = call %struct.udev_device* @udev_device_new(%struct.udev* %0)
%60 = icmp eq %struct.udev_device* %59, null
br i1 %60, label %66, label %61
61: ; preds = %58
%62 = call i32 @udev_device_set_syspath(%struct.udev_device* %59, i8* %6)
%63 = bitcast %struct.udev_device* %59 to i8*
%64 = call i32 @udev_device_get_devpath(%struct.udev_device* %59)
%65 = call i32 (%struct.udev*, i8*, i8*, ...) @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %63, i32 %64)
br label %66
66: ; preds = %45, %58, %2, %61, %55, %32, %18
%67 = phi %struct.udev_device* [ null, %18 ], [ null, %32 ], [ %59, %61 ], [ null, %45 ], [ null, %55 ], [ null, %2 ], [ null, %58 ]
ret %struct.udev_device* %67
}