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

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
char *strchr(char *, char);
scalar_t__ strcmp(char const *, char *);
struct udev_device *udev_device_new_from_syspath(struct udev *, char *);
int /*<<< orphan*/ udev_get_sys_path(struct udev *);
size_t util_strpcpyl(char **, int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ util_strscpy(char *, int, char const *);
int /*<<< orphan*/ util_strscpyl(char *, size_t, char *, char const *, char *,
                                 ...);
__attribute__((visibility("default"))) struct udev_device *
udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem,
                                       const char *sysname) {
  char path_full[1024];
  char *path;
  size_t l;
  struct stat statbuf;
  path = path_full;
  l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL);
  if (strcmp(subsystem, "subsystem") == 0) {
    util_strscpyl(path, l, "/subsystem/", sysname, NULL);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    util_strscpyl(path, l, "/bus/", sysname, NULL);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    util_strscpyl(path, l, "/class/", sysname, NULL);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    goto out;
  }
  if (strcmp(subsystem, "module") == 0) {
    util_strscpyl(path, l, "/module/", sysname, NULL);
    if (stat(path_full, &statbuf) == 0)
      goto found;
    goto out;
  }
  if (strcmp(subsystem, "drivers") == 0) {
    char subsys[512];
    char *driver;
    util_strscpy(subsys, sizeof(subsys), sysname);
    driver = strchr(subsys, ':');
    if (driver != NULL) {
      driver[0] = '\0';
      driver = &driver[1];
      util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL);
      if (stat(path_full, &statbuf) == 0)
        goto found;
      util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL);
      if (stat(path_full, &statbuf) == 0)
        goto found;
    }
    goto out;
  }
  util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL);
  if (stat(path_full, &statbuf) == 0)
    goto found;
  util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL);
  if (stat(path_full, &statbuf) == 0)
    goto found;
  util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL);
  if (stat(path_full, &statbuf) == 0)
    goto found;
out:
  return NULL;
found:
  return udev_device_new_from_syspath(udev, path_full);
}


x86 assembly (clang, -O0):
<udev_device_new_from_subsystem_sysname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x650,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <udev_get_sys_path@plt>
mov    %eax,%edx
lea    -0x428(%rbp),%rdi
mov    $0x400,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   1080 <util_strpcpyl@plt>
mov    %rax,-0x430(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12c0 <udev_device_new_from_subsystem_sysname+0x140>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xe0b(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    122d <udev_device_new_from_subsystem_sysname+0xad>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xdd0(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    1274 <udev_device_new_from_subsystem_sysname+0xf4>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xd8f(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    12bb <udev_device_new_from_subsystem_sysname+0x13b>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
jmp    1565 <udev_device_new_from_subsystem_sysname+0x3e5>
mov    -0x18(%rbp),%rdi
lea    0xd59(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1326 <udev_device_new_from_subsystem_sysname+0x1a6>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xd38(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    1321 <udev_device_new_from_subsystem_sysname+0x1a1>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
jmp    1565 <udev_device_new_from_subsystem_sysname+0x3e5>
mov    -0x18(%rbp),%rdi
lea    0xd03(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    145b <udev_device_new_from_subsystem_sysname+0x2db>
lea    -0x640(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x200,%esi
call   1030 <util_strscpy@plt>
lea    -0x640(%rbp),%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,-0x648(%rbp)
cmpq   $0x0,-0x648(%rbp)
je     1456 <udev_device_new_from_subsystem_sysname+0x2d6>
mov    -0x648(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x648(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x648(%rbp)
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
lea    -0x640(%rbp),%rcx
mov    -0x648(%rbp),%r9
lea    0xc50(%rip),%rdx
lea    0xc7b(%rip),%r8
xor    %eax,%eax
movq   $0x0,(%rsp)
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    13f4 <udev_device_new_from_subsystem_sysname+0x274>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
lea    -0x640(%rbp),%rcx
mov    -0x648(%rbp),%r9
lea    0xbff(%rip),%rdx
lea    0xc1e(%rip),%r8
xor    %eax,%eax
movq   $0x0,(%rsp)
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    1451 <udev_device_new_from_subsystem_sysname+0x2d1>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
jmp    1456 <udev_device_new_from_subsystem_sysname+0x2d6>
jmp    1565 <udev_device_new_from_subsystem_sysname+0x3e5>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r9
lea    0xb92(%rip),%rdx
lea    0xbc7(%rip),%r8
xor    %eax,%eax
movq   $0x0,(%rsp)
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    14b2 <udev_device_new_from_subsystem_sysname+0x332>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r9
lea    0xb47(%rip),%rdx
lea    0xb70(%rip),%r8
xor    %eax,%eax
movq   $0x0,(%rsp)
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    1509 <udev_device_new_from_subsystem_sysname+0x389>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r9
lea    0xaf6(%rip),%rdx
lea    0xb05(%rip),%r8
xor    %eax,%eax
movq   $0x0,(%rsp)
mov    $0x0,%al
call   10a0 <util_strscpyl@plt>
lea    -0x420(%rbp),%rdi
lea    -0x438(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jne    1560 <udev_device_new_from_subsystem_sysname+0x3e0>
jmp    1572 <udev_device_new_from_subsystem_sysname+0x3f2>
jmp    1565 <udev_device_new_from_subsystem_sysname+0x3e5>
movq   $0x0,-0x8(%rbp)
jmp    1586 <udev_device_new_from_subsystem_sysname+0x406>
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1090 <udev_device_new_from_syspath@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x650,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_device_new_from_subsystem_sysname>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x620,%rsp
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x20(%rsp),%rax
mov    %rax,0x18(%rsp)
call   1040 <udev_get_sys_path@plt>
lea    0x18(%rsp),%rdi
mov    $0x400,%esi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <util_strpcpyl@plt>
mov    %rax,%r15
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12bf <udev_device_new_from_subsystem_sysname+0x13f>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     132d <udev_device_new_from_subsystem_sysname+0x1ad>
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1384 <udev_device_new_from_subsystem_sysname+0x204>
mov    0x18(%rsp),%rdi
movq   $0x0,(%rsp)
lea    0xdf0(%rip),%rdx
lea    0xe25(%rip),%r8
mov    %r15,%rsi
mov    %rbx,%rcx
mov    %r12,%r9
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
mov    0x18(%rsp),%rdi
movq   $0x0,(%rsp)
lea    0xdb9(%rip),%rdx
lea    0xde2(%rip),%r8
mov    %r15,%rsi
mov    %rbx,%rcx
mov    %r12,%r9
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
mov    0x18(%rsp),%rdi
movq   $0x0,(%rsp)
lea    0xd7c(%rip),%rdx
lea    0xd8b(%rip),%r8
xor    %r13d,%r13d
mov    %r15,%rsi
mov    %rbx,%rcx
mov    %r12,%r9
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
jmp    134c <udev_device_new_from_subsystem_sysname+0x1cc>
mov    0x18(%rsp),%rdi
lea    0xd3f(%rip),%rdx
mov    %r15,%rsi
mov    %r12,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
mov    0x18(%rsp),%rdi
lea    0xd1b(%rip),%rdx
mov    %r15,%rsi
mov    %r12,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
mov    0x18(%rsp),%rdi
lea    0xcf1(%rip),%rdx
jmp    1339 <udev_device_new_from_subsystem_sysname+0x1b9>
mov    0x18(%rsp),%rdi
lea    0xcf2(%rip),%rdx
xor    %r13d,%r13d
mov    %r15,%rsi
mov    %r12,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
jne    1370 <udev_device_new_from_subsystem_sysname+0x1f0>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1090 <udev_device_new_from_syspath@plt>
mov    %rax,%r13
mov    %r13,%rax
add    $0x620,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0x420(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   1030 <util_strscpy@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     144c <udev_device_new_from_subsystem_sysname+0x2cc>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbx
mov    0x18(%rsp),%rdi
movq   $0x0,(%rsp)
lea    0xc3a(%rip),%rdx
lea    0xc65(%rip),%r8
lea    0x420(%rsp),%rcx
mov    %r15,%rsi
mov    %rbx,%r9
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
mov    0x18(%rsp),%rdi
movq   $0x0,(%rsp)
lea    0xbfe(%rip),%rdx
lea    0xc1d(%rip),%r8
lea    0x420(%rsp),%rcx
mov    %r15,%rsi
mov    %rbx,%r9
xor    %eax,%eax
call   10a0 <util_strscpyl@plt>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <stat@plt>
test   %rax,%rax
je     1360 <udev_device_new_from_subsystem_sysname+0x1e0>
xor    %r13d,%r13d
jmp    1370 <udev_device_new_from_subsystem_sysname+0x1f0>

LLVM IR (-O0):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.stat = type { i32 }
@.str = [10 x i8] c"subsystem\00"
@.str.1 = [12 x i8] c"/subsystem/\00"
@.str.2 = [6 x i8] c"/bus/\00"
@.str.3 = [8 x i8] c"/class/\00"
@.str.4 = [7 x i8] c"module\00"
@.str.5 = [9 x i8] c"/module/\00"
@.str.6 = [8 x i8] c"drivers\00"
@.str.7 = [10 x i8] c"/drivers/\00"
@.str.8 = [10 x i8] c"/devices/\00"
@.str.9 = [2 x i8] c"/\00"
define %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %0, i8* %1, i8* %2) {
%4 = alloca %struct.udev_device*
%5 = alloca %struct.udev*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca i64
%11 = alloca %struct.stat
%12 = alloca [512 x i8]
%13 = alloca i8*
store %struct.udev* %0, %struct.udev** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
store i8* %14, i8** %9
%15 = load %struct.udev*, %struct.udev** %5
%16 = call i32 @udev_get_sys_path(%struct.udev* %15)
%17 = call i64 @util_strpcpyl(i8** %9, i32 1024, i32 %16, i32* null)
store i64 %17, i64* %10
%18 = load i8*, i8** %6
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %49
21: ; preds = %3
%22 = load i8*, i8** %9
%23 = load i64, i64* %10
%24 = load i8*, i8** %7
%25 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %22, i64 %23, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* null)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%27 = call i64 @stat(i8* %26, %struct.stat* %11)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %21
br label %133
30: ; preds = %21
%31 = load i8*, i8** %9
%32 = load i64, i64* %10
%33 = load i8*, i8** %7
%34 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %31, i64 %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %33, i8* null)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%36 = call i64 @stat(i8* %35, %struct.stat* %11)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %30
br label %133
39: ; preds = %30
%40 = load i8*, i8** %9
%41 = load i64, i64* %10
%42 = load i8*, i8** %7
%43 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %40, i64 %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %42, i8* null)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%45 = call i64 @stat(i8* %44, %struct.stat* %11)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %39
br label %133
48: ; preds = %39
br label %132
49: ; preds = %3
%50 = load i8*, i8** %6
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i8*, i8** %9
%55 = load i64, i64* %10
%56 = load i8*, i8** %7
%57 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %54, i64 %55, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %56, i8* null)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%59 = call i64 @stat(i8* %58, %struct.stat* %11)
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %53
br label %133
62: ; preds = %53
br label %132
63: ; preds = %49
%64 = load i8*, i8** %6
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %101
67: ; preds = %63
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%69 = load i8*, i8** %7
%70 = call i32 @util_strscpy(i8* %68, i32 512, i8* %69)
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%72 = call i8* @strchr(i8* %71, i8 signext 58)
store i8* %72, i8** %13
%73 = load i8*, i8** %13
%74 = icmp ne i8* %73, null
br i1 %74, label %75, label %100
75: ; preds = %67
%76 = load i8*, i8** %13
%77 = getelementptr inbounds i8, i8* %76, i64 0
store i8 0, i8* %77
%78 = load i8*, i8** %13
%79 = getelementptr inbounds i8, i8* %78, i64 1
store i8* %79, i8** %13
%80 = load i8*, i8** %9
%81 = load i64, i64* %10
%82 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%83 = load i8*, i8** %13
%84 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %80, i64 %81, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %82, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %83, i8* null)
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%86 = call i64 @stat(i8* %85, %struct.stat* %11)
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %75
br label %133
89: ; preds = %75
%90 = load i8*, i8** %9
%91 = load i64, i64* %10
%92 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%93 = load i8*, i8** %13
%94 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %90, i64 %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %92, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %93, i8* null)
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%96 = call i64 @stat(i8* %95, %struct.stat* %11)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %89
br label %133
99: ; preds = %89
br label %100
100: ; preds = %99, %67
br label %132
101: ; preds = %63
%102 = load i8*, i8** %9
%103 = load i64, i64* %10
%104 = load i8*, i8** %6
%105 = load i8*, i8** %7
%106 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %102, i64 %103, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %105, i8* null)
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%108 = call i64 @stat(i8* %107, %struct.stat* %11)
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %111
110: ; preds = %101
br label %133
111: ; preds = %101
%112 = load i8*, i8** %9
%113 = load i64, i64* %10
%114 = load i8*, i8** %6
%115 = load i8*, i8** %7
%116 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %112, i64 %113, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %114, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %115, i8* null)
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%118 = call i64 @stat(i8* %117, %struct.stat* %11)
%119 = icmp eq i64 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %111
br label %133
121: ; preds = %111
%122 = load i8*, i8** %9
%123 = load i64, i64* %10
%124 = load i8*, i8** %6
%125 = load i8*, i8** %7
%126 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %122, i64 %123, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %124, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* %125, i8* null)
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%128 = call i64 @stat(i8* %127, %struct.stat* %11)
%129 = icmp eq i64 %128, 0
br i1 %129, label %130, label %131
130: ; preds = %121
br label %133
131: ; preds = %121
br label %132
132: ; preds = %131, %100, %62, %48
store %struct.udev_device* null, %struct.udev_device** %4
br label %137
133: ; preds = %130, %120, %110, %98, %88, %61, %47, %38, %29
%134 = load %struct.udev*, %struct.udev** %5
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%136 = call %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %134, i8* %135)
store %struct.udev_device* %136, %struct.udev_device** %4
br label %137
137: ; preds = %133, %132
%138 = load %struct.udev_device*, %struct.udev_device** %4
ret %struct.udev_device* %138
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.stat = type { i32 }
@.str = [10 x i8] c"subsystem\00"
@.str.1 = [12 x i8] c"/subsystem/\00"
@.str.2 = [6 x i8] c"/bus/\00"
@.str.3 = [8 x i8] c"/class/\00"
@.str.4 = [7 x i8] c"module\00"
@.str.5 = [9 x i8] c"/module/\00"
@.str.6 = [8 x i8] c"drivers\00"
@.str.7 = [10 x i8] c"/drivers/\00"
@.str.8 = [10 x i8] c"/devices/\00"
@.str.9 = [2 x i8] c"/\00"
define %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = alloca i8*
%6 = alloca %struct.stat
%7 = alloca [512 x i8]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast i8** %5 to i8*
%10 = bitcast %struct.stat* %6 to i8*
store i8* %8, i8** %5
%11 = call i32 @udev_get_sys_path(%struct.udev* %0)
%12 = call i64 @util_strpcpyl(i8** %5, i32 1024, i32 %11, i32* null)
%13 = call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %30
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %16, i64 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* null)
%18 = call i64 @stat(i8* %8, %struct.stat* %6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %74, label %20
20: ; preds = %15
%21 = load i8*, i8** %5
%22 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %21, i64 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* null)
%23 = call i64 @stat(i8* %8, %struct.stat* %6)
%24 = icmp eq i64 %23, 0
br i1 %24, label %74, label %25
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %26, i64 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* null)
%28 = call i64 @stat(i8* %8, %struct.stat* %6)
%29 = icmp eq i64 %28, 0
br i1 %29, label %74, label %76
30: ; preds = %3
%31 = call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i8*, i8** %5
%35 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %34, i64 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* null)
%36 = call i64 @stat(i8* %8, %struct.stat* %6)
%37 = icmp eq i64 %36, 0
br i1 %37, label %74, label %76
38: ; preds = %30
%39 = call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %59
41: ; preds = %38
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%43 = call i32 @util_strscpy(i8* %42, i32 512, i8* %2)
%44 = call i8* @strchr(i8* %42, i8 signext 58)
%45 = icmp eq i8* %44, null
br i1 %45, label %58, label %46
46: ; preds = %41
store i8 0, i8* %44
%47 = getelementptr inbounds i8, i8* %44, i64 1
%48 = load i8*, i8** %5
%49 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %48, i64 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %42, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %47, i8* null)
%50 = call i64 @stat(i8* %8, %struct.stat* %6)
%51 = icmp eq i64 %50, 0
br i1 %51, label %57, label %52
52: ; preds = %46
%53 = load i8*, i8** %5
%54 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %53, i64 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %42, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %47, i8* null)
%55 = call i64 @stat(i8* %8, %struct.stat* %6)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %46, %52
br label %74
58: ; preds = %41, %52
br label %76
59: ; preds = %38
%60 = load i8*, i8** %5
%61 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %60, i64 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %2, i8* null)
%62 = call i64 @stat(i8* %8, %struct.stat* %6)
%63 = icmp eq i64 %62, 0
br i1 %63, label %74, label %64
64: ; preds = %59
%65 = load i8*, i8** %5
%66 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %65, i64 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %2, i8* null)
%67 = call i64 @stat(i8* %8, %struct.stat* %6)
%68 = icmp eq i64 %67, 0
br i1 %68, label %74, label %69
69: ; preds = %64
%70 = load i8*, i8** %5
%71 = call i32 (i8*, i64, i8*, i8*, i8*, ...) @util_strscpyl(i8* %70, i64 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* %2, i8* null)
%72 = call i64 @stat(i8* %8, %struct.stat* %6)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %57, %69, %64, %59, %33, %25, %20, %15
%75 = call %struct.udev_device* @udev_device_new_from_syspath(%struct.udev* %0, i8* %8)
br label %76
76: ; preds = %58, %25, %33, %69, %74
%77 = phi %struct.udev_device* [ %75, %74 ], [ null, %58 ], [ null, %69 ], [ null, %33 ], [ null, %25 ]
ret %struct.udev_device* %77
}