#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_monitor {
  int dummy;
};
struct udev {
  int dummy;
};

/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
struct udev_monitor *udev_monitor_new_from_filesystem(struct udev *);
struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *,
                                                      char const *, int);
struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev,
                                                   const char *name) {
  if (strcmp(name, "udev") == 0) {
    return udev_monitor_new_from_filesystem(udev);
  } else {
    return udev_monitor_new_from_netlink_fd(udev, name, -1);
  }
}


x86 assembly (clang, -O0):
<udev_monitor_new_from_netlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    116c <udev_monitor_new_from_netlink+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <udev_monitor_new_from_filesystem@plt>
mov    %rax,-0x8(%rbp)
jmp    1182 <udev_monitor_new_from_netlink+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0xffffffff,%edx
call   1050 <udev_monitor_new_from_netlink_fd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_monitor_new_from_netlink>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %r14,%rdi
test   %rax,%rax
je     1165 <udev_monitor_new_from_netlink+0x35>
mov    %rbx,%rsi
mov    $0xffffffff,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <udev_monitor_new_from_netlink_fd@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <udev_monitor_new_from_filesystem@plt>

LLVM IR (-O0):
%struct.udev_monitor = type { i32 }
%struct.udev = type { i32 }
@.str = [5 x i8] c"udev\00"
define %struct.udev_monitor* @udev_monitor_new_from_netlink(%struct.udev* %0, i8* %1) {
%3 = alloca %struct.udev_monitor*
%4 = alloca %struct.udev*
%5 = alloca i8*
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load %struct.udev*, %struct.udev** %4
%11 = call %struct.udev_monitor* @udev_monitor_new_from_filesystem(%struct.udev* %10)
store %struct.udev_monitor* %11, %struct.udev_monitor** %3
br label %16
12: ; preds = %2
%13 = load %struct.udev*, %struct.udev** %4
%14 = load i8*, i8** %5
%15 = call %struct.udev_monitor* @udev_monitor_new_from_netlink_fd(%struct.udev* %13, i8* %14, i32 -1)
store %struct.udev_monitor* %15, %struct.udev_monitor** %3
br label %16
16: ; preds = %12, %9
%17 = load %struct.udev_monitor*, %struct.udev_monitor** %3
ret %struct.udev_monitor* %17
}

LLVM IR (-O2):
%struct.udev_monitor = type { i32 }
%struct.udev = type { i32 }
@.str = [5 x i8] c"udev\00"
define %struct.udev_monitor* @udev_monitor_new_from_netlink(%struct.udev* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call %struct.udev_monitor* @udev_monitor_new_from_filesystem(%struct.udev* %0)
br label %9
7: ; preds = %2
%8 = tail call %struct.udev_monitor* @udev_monitor_new_from_netlink_fd(%struct.udev* %0, i8* %1, i32 -1)
br label %9
9: ; preds = %7, %5
%10 = phi %struct.udev_monitor* [ %6, %5 ], [ %8, %7 ]
ret %struct.udev_monitor* %10
}