#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 ifreq {
  int ifr_ifindex;
  char *ifr_name;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ENODEV;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SIOCGIFNAME;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ makedev(int, int);
int /*<<< orphan*/ memset(struct ifreq *, int /*<<< orphan*/, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int sscanf(char const *, char *, char *, int *, int *);
char *strchr(char *, char);
int /*<<< orphan*/ strscpy(char *, int, char const *);
int strtoul(char const *, int /*<<< orphan*/ *, int);
int udev_device_get_ifindex(struct udev_device *);
struct udev_device *udev_device_new_from_devnum(struct udev *, char,
                                                int /*<<< orphan*/);
struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *,
                                                           char *, char *);
int /*<<< orphan*/ udev_device_unref(struct udev_device *);
struct udev_device *udev_device_new_from_device_id(struct udev *udev,
                                                   const char *id) {
  char type;
  int maj, min;
  char subsys[1024];
  char *sysname;
  switch (id[0]) {
  case 'b':
  case 'c':
    if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3)
      return NULL;
    return udev_device_new_from_devnum(udev, type, makedev(maj, min));
  case 'n': {
    int sk;
    struct ifreq ifr;
    struct udev_device *dev;
    int ifindex;
    ifindex = strtoul(&id[1], NULL, 10);
    if (ifindex <= 0) {
      errno = EINVAL;
      return NULL;
    }
    sk = socket(PF_INET, SOCK_DGRAM, 0);
    if (sk < 0)
      return NULL;
    (memset((&ifr), 0, (sizeof(struct ifreq))));
    ifr.ifr_ifindex = ifindex;
    if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) {
      close(sk);
      return NULL;
    }
    close(sk);
    dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name);
    if (dev == NULL)
      return NULL;
    if (udev_device_get_ifindex(dev) == ifindex)
      return dev;
    udev_device_unref(dev);
    errno = ENODEV;
    return NULL;
  }
  case '+':
    strscpy(subsys, sizeof(subsys), &id[1]);
    sysname = strchr(subsys, ':');
    if (sysname == NULL) {
      errno = EINVAL;
      return NULL;
    }
    sysname[0] = '\0';
    sysname = &sysname[1];
    return udev_device_new_from_subsystem_sysname(udev, subsys, sysname);
  default:
    errno = EINVAL;
    return NULL;
  }
}


x86 assembly (clang, -O0):
<udev_device_new_from_device_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x460(%rbp)
sub    $0x2b,%eax
je     140d <udev_device_new_from_device_id+0x23d>
jmp    11fe <udev_device_new_from_device_id+0x2e>
mov    -0x460(%rbp),%eax
add    $0xffffff9e,%eax
sub    $0x2,%eax
jb     1229 <udev_device_new_from_device_id+0x59>
jmp    1215 <udev_device_new_from_device_id+0x45>
mov    -0x460(%rbp),%eax
sub    $0x6e,%eax
je     129a <udev_device_new_from_device_id+0xca>
jmp    14a7 <udev_device_new_from_device_id+0x2d7>
mov    -0x18(%rbp),%rdi
lea    0xdcc(%rip),%rsi
lea    -0x19(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
je     125b <udev_device_new_from_device_id+0x8b>
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x10(%rbp),%rax
mov    %rax,-0x470(%rbp)
mov    -0x19(%rbp),%al
mov    %al,-0x461(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
call   10b0 <makedev@plt>
mov    -0x470(%rbp),%rdi
mov    %eax,%edx
mov    -0x461(%rbp),%al
movsbl %al,%esi
call   10d0 <udev_device_new_from_devnum@plt>
mov    %rax,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10c0 <strtoul@plt>
mov    %eax,-0x45c(%rbp)
cmpl   $0x0,-0x45c(%rbp)
jg     12e2 <udev_device_new_from_device_id+0x112>
mov    0x2cf6(%rip),%rax
mov    (%rax),%ecx
mov    0x2cfd(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
mov    0x2cf6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x43c(%rbp)
cmpl   $0x0,-0x43c(%rbp)
jge    131b <udev_device_new_from_device_id+0x14b>
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    -0x45c(%rbp),%eax
mov    %eax,-0x450(%rbp)
mov    -0x43c(%rbp),%edi
mov    0x2c91(%rip),%rax
mov    (%rax),%esi
lea    -0x450(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%eax
je     1376 <udev_device_new_from_device_id+0x1a6>
mov    -0x43c(%rbp),%edi
call   1080 <close@plt>
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x43c(%rbp),%edi
call   1080 <close@plt>
mov    -0x10(%rbp),%rdi
mov    -0x448(%rbp),%rdx
lea    0xc75(%rip),%rsi
call   1030 <udev_device_new_from_subsystem_sysname@plt>
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    13ba <udev_device_new_from_device_id+0x1ea>
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x458(%rbp),%rdi
call   1040 <udev_device_get_ifindex@plt>
cmp    -0x45c(%rbp),%eax
jne    13e2 <udev_device_new_from_device_id+0x212>
mov    -0x458(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x458(%rbp),%rdi
call   1090 <udev_device_unref@plt>
mov    0x2bc3(%rip),%rax
mov    (%rax),%ecx
mov    0x2bd2(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    $0x400,%esi
call   10e0 <strscpy@plt>
lea    -0x430(%rbp),%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,-0x438(%rbp)
cmpq   $0x0,-0x438(%rbp)
jne    146b <udev_device_new_from_device_id+0x29b>
mov    0x2b6d(%rip),%rax
mov    (%rax),%ecx
mov    0x2b74(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    -0x438(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x438(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x438(%rbp),%rdx
call   1030 <udev_device_new_from_subsystem_sysname@plt>
mov    %rax,-0x8(%rbp)
jmp    14c1 <udev_device_new_from_device_id+0x2f1>
mov    0x2b12(%rip),%rax
mov    (%rax),%ecx
mov    0x2b19(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_device_new_from_device_id>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%rax
mov    %rdi,%r14
movsbl (%rsi),%ecx
lea    -0x62(%rcx),%edx
cmp    $0x2,%edx
jb     12cf <udev_device_new_from_device_id+0xff>
cmp    $0x2b,%ecx
je     1315 <udev_device_new_from_device_id+0x145>
cmp    $0x6e,%ecx
jne    135c <udev_device_new_from_device_id+0x18c>
add    $0x1,%rax
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10c0 <strtoul@plt>
test   %eax,%eax
jle    135c <udev_device_new_from_device_id+0x18c>
mov    %eax,%r15d
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
js     1370 <udev_device_new_from_device_id+0x1a0>
mov    %eax,%ebp
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    %r15d,0x10(%rsp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r12,%rdx
call   1070 <ioctl@plt>
mov    %eax,%r12d
mov    %ebp,%edi
call   1080 <close@plt>
test   %r12d,%r12d
jne    1370 <udev_device_new_from_device_id+0x1a0>
mov    0x18(%rsp),%rdx
lea    0xd72(%rip),%rsi
mov    %r14,%rdi
call   1030 <udev_device_new_from_subsystem_sysname@plt>
test   %rax,%rax
je     136e <udev_device_new_from_device_id+0x19e>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <udev_device_get_ifindex@plt>
cmp    %r15d,%eax
je     1370 <udev_device_new_from_device_id+0x1a0>
mov    %rbx,%rdi
call   1090 <udev_device_unref@plt>
mov    0x2cee(%rip),%rax
jmp    1363 <udev_device_new_from_device_id+0x193>
lea    0xd2a(%rip),%rsi
lea    0xb(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rax,%rdi
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
jne    136e <udev_device_new_from_device_id+0x19e>
movsbl 0xb(%rsp),%ebx
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   10b0 <makedev@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   10d0 <udev_device_new_from_devnum@plt>
mov    %rax,%rbx
jmp    1370 <udev_device_new_from_device_id+0x1a0>
add    $0x1,%rax
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   10e0 <strscpy@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     135c <udev_device_new_from_device_id+0x18c>
movb   $0x0,(%rax)
add    $0x1,%rax
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <udev_device_new_from_subsystem_sysname@plt>
mov    %rax,%rbx
jmp    1370 <udev_device_new_from_device_id+0x1a0>
mov    0x2c5d(%rip),%rax
mov    (%rax),%eax
mov    0x2c64(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.ifreq = type { i32, i8* }
@.str = [8 x i8] c"%c%i:%i\00"
@EINVAL = global i32 0
@errno = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SIOCGIFNAME = global i32 0
@.str.1 = [4 x i8] c"net\00"
@ENODEV = global i32 0
define %struct.udev_device* @udev_device_new_from_device_id(%struct.udev* %0, i8* %1) {
%3 = alloca %struct.udev_device*
%4 = alloca %struct.udev*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca %struct.ifreq
%13 = alloca %struct.udev_device*
%14 = alloca i32
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %98 [
i32 98, label %19
i32 99, label %19
i32 110, label %31
i32 43, label %78
]
19: ; preds = %2, %2
%20 = load i8*, i8** %5
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6, i32* %7, i32* %8)
%22 = icmp ne i32 %21, 3
br i1 %22, label %23, label %24
23: ; preds = %19
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
24: ; preds = %19
%25 = load %struct.udev*, %struct.udev** %4
%26 = load i8, i8* %6
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = call i32 @makedev(i32 %27, i32 %28)
%30 = call %struct.udev_device* @udev_device_new_from_devnum(%struct.udev* %25, i8 signext %26, i32 %29)
store %struct.udev_device* %30, %struct.udev_device** %3
br label %100
31: ; preds = %2
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i32 @strtoul(i8* %33, i32* null, i32 10)
store i32 %34, i32* %14
%35 = load i32, i32* %14
%36 = icmp sle i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = load i32, i32* @EINVAL
store i32 %38, i32* @errno
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
39: ; preds = %31
%40 = load i32, i32* @PF_INET
%41 = load i32, i32* @SOCK_DGRAM
%42 = call i32 @socket(i32 %40, i32 %41, i32 0)
store i32 %42, i32* %11
%43 = load i32, i32* %11
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %39
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
46: ; preds = %39
%47 = call i32 @memset(%struct.ifreq* %12, i32 0, i32 16)
%48 = load i32, i32* %14
%49 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 0
store i32 %48, i32* %49
%50 = load i32, i32* %11
%51 = load i32, i32* @SIOCGIFNAME
%52 = call i32 @ioctl(i32 %50, i32 %51, %struct.ifreq* %12)
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %46
%55 = load i32, i32* %11
%56 = call i32 @close(i32 %55)
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
57: ; preds = %46
%58 = load i32, i32* %11
%59 = call i32 @close(i32 %58)
%60 = load %struct.udev*, %struct.udev** %4
%61 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 1
%62 = load i8*, i8** %61
%63 = call %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %62)
store %struct.udev_device* %63, %struct.udev_device** %13
%64 = load %struct.udev_device*, %struct.udev_device** %13
%65 = icmp eq %struct.udev_device* %64, null
br i1 %65, label %66, label %67
66: ; preds = %57
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
67: ; preds = %57
%68 = load %struct.udev_device*, %struct.udev_device** %13
%69 = call i32 @udev_device_get_ifindex(%struct.udev_device* %68)
%70 = load i32, i32* %14
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = load %struct.udev_device*, %struct.udev_device** %13
store %struct.udev_device* %73, %struct.udev_device** %3
br label %100
74: ; preds = %67
%75 = load %struct.udev_device*, %struct.udev_device** %13
%76 = call i32 @udev_device_unref(%struct.udev_device* %75)
%77 = load i32, i32* @ENODEV
store i32 %77, i32* @errno
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
78: ; preds = %2
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%80 = load i8*, i8** %5
%81 = getelementptr inbounds i8, i8* %80, i64 1
%82 = call i32 @strscpy(i8* %79, i32 1024, i8* %81)
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%84 = call i8* @strchr(i8* %83, i8 signext 58)
store i8* %84, i8** %10
%85 = load i8*, i8** %10
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %89
87: ; preds = %78
%88 = load i32, i32* @EINVAL
store i32 %88, i32* @errno
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
89: ; preds = %78
%90 = load i8*, i8** %10
%91 = getelementptr inbounds i8, i8* %90, i64 0
store i8 0, i8* %91
%92 = load i8*, i8** %10
%93 = getelementptr inbounds i8, i8* %92, i64 1
store i8* %93, i8** %10
%94 = load %struct.udev*, %struct.udev** %4
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%96 = load i8*, i8** %10
%97 = call %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %94, i8* %95, i8* %96)
store %struct.udev_device* %97, %struct.udev_device** %3
br label %100
98: ; preds = %2
%99 = load i32, i32* @EINVAL
store i32 %99, i32* @errno
store %struct.udev_device* null, %struct.udev_device** %3
br label %100
100: ; preds = %98, %89, %87, %74, %72, %66, %54, %45, %37, %24, %23
%101 = load %struct.udev_device*, %struct.udev_device** %3
ret %struct.udev_device* %101
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
%struct.udev = type { i32 }
%struct.ifreq = type { i32, i8* }
@.str = [8 x i8] c"%c%i:%i\00"
@EINVAL = global i32 0
@errno = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SIOCGIFNAME = global i32 0
@.str.1 = [4 x i8] c"net\00"
@ENODEV = global i32 0
define %struct.udev_device* @udev_device_new_from_device_id(%struct.udev* %0, i8* %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca %struct.ifreq
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
switch i32 %12, label %64 [
i32 98, label %13
i32 99, label %13
i32 110, label %22
i32 43, label %54
]
13: ; preds = %2, %2
%14 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3, i32* %4, i32* %5)
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %66
16: ; preds = %13
%17 = load i8, i8* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @makedev(i32 %18, i32 %19)
%21 = call %struct.udev_device* @udev_device_new_from_devnum(%struct.udev* %0, i8 signext %17, i32 %20)
br label %66
22: ; preds = %2
%23 = bitcast %struct.ifreq* %7 to i8*
%24 = getelementptr inbounds i8, i8* %1, i64 1
%25 = tail call i32 @strtoul(i8* nocapture %24, i32* null, i32 10)
%26 = icmp slt i32 %25, 1
br i1 %26, label %49, label %27
27: ; preds = %22
%28 = load i32, i32* @PF_INET
%29 = load i32, i32* @SOCK_DGRAM
%30 = tail call i32 @socket(i32 %28, i32 %29, i32 0)
%31 = icmp slt i32 %30, 0
br i1 %31, label %52, label %32
32: ; preds = %27
%33 = call i32 @memset(%struct.ifreq* %7, i32 0, i32 16)
%34 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %7, i64 0, i32 0
store i32 %25, i32* %34
%35 = load i32, i32* @SIOCGIFNAME
%36 = call i32 @ioctl(i32 %30, i32 %35, %struct.ifreq* %7)
%37 = icmp eq i32 %36, 0
%38 = call i32 @close(i32 %30)
br i1 %37, label %39, label %52
39: ; preds = %32
%40 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %7, i64 0, i32 1
%41 = load i8*, i8** %40
%42 = call %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = icmp eq %struct.udev_device* %42, null
br i1 %43, label %52, label %44
44: ; preds = %39
%45 = call i32 @udev_device_get_ifindex(%struct.udev_device* %42)
%46 = icmp eq i32 %45, %25
br i1 %46, label %52, label %47
47: ; preds = %44
%48 = call i32 @udev_device_unref(%struct.udev_device* %42)
br label %49
49: ; preds = %22, %47
%50 = phi i32* [ @ENODEV, %47 ], [ @EINVAL, %22 ]
%51 = load i32, i32* %50
store i32 %51, i32* @errno
br label %52
52: ; preds = %49, %32, %44, %39, %27
%53 = phi %struct.udev_device* [ null, %27 ], [ null, %39 ], [ %42, %44 ], [ null, %32 ], [ null, %49 ]
br label %66
54: ; preds = %2
%55 = getelementptr inbounds i8, i8* %1, i64 1
%56 = call i32 @strscpy(i8* %10, i32 1024, i8* %55)
%57 = call i8* @strchr(i8* %10, i8 signext 58)
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %61
59: ; preds = %54
%60 = load i32, i32* @EINVAL
store i32 %60, i32* @errno
br label %66
61: ; preds = %54
store i8 0, i8* %57
%62 = getelementptr inbounds i8, i8* %57, i64 1
%63 = call %struct.udev_device* @udev_device_new_from_subsystem_sysname(%struct.udev* %0, i8* %10, i8* %62)
br label %66
64: ; preds = %2
%65 = load i32, i32* @EINVAL
store i32 %65, i32* @errno
br label %66
66: ; preds = %13, %64, %61, %59, %52, %16
%67 = phi %struct.udev_device* [ null, %64 ], [ null, %59 ], [ %63, %61 ], [ %53, %52 ], [ %21, %16 ], [ null, %13 ]
ret %struct.udev_device* %67
}