#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;
};

/* Variables and functions */
int /*<<< orphan*/ udev_device_read_db(struct udev_device *);
int /*<<< orphan*/ udev_device_set_info_loaded(struct udev_device *);
struct udev_device *udev_device_shallow_clone(struct udev_device *);
struct udev_device *udev_device_clone_with_db(struct udev_device *old_device) {
  struct udev_device *device;
  device = udev_device_shallow_clone(old_device);
  if (!device)
    return NULL;
  udev_device_read_db(device);
  udev_device_set_info_loaded(device);
  return device;
}


x86 assembly (clang, -O0):
<udev_device_clone_with_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <udev_device_shallow_clone@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <udev_device_clone_with_db+0x31>
movq   $0x0,-0x8(%rbp)
jmp    117b <udev_device_clone_with_db+0x4b>
mov    -0x18(%rbp),%rdi
call   1030 <udev_device_read_db@plt>
mov    -0x18(%rbp),%rdi
call   1050 <udev_device_set_info_loaded@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_device_clone_with_db>:
push   %rbx
call   1040 <udev_device_shallow_clone@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114e <udev_device_clone_with_db+0x1e>
mov    %rbx,%rdi
call   1030 <udev_device_read_db@plt>
mov    %rbx,%rdi
call   1050 <udev_device_set_info_loaded@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.udev_device = type { i32 }
define %struct.udev_device* @udev_device_clone_with_db(%struct.udev_device* %0) {
%2 = alloca %struct.udev_device*
%3 = alloca %struct.udev_device*
%4 = alloca %struct.udev_device*
store %struct.udev_device* %0, %struct.udev_device** %3
%5 = load %struct.udev_device*, %struct.udev_device** %3
%6 = call %struct.udev_device* @udev_device_shallow_clone(%struct.udev_device* %5)
store %struct.udev_device* %6, %struct.udev_device** %4
%7 = load %struct.udev_device*, %struct.udev_device** %4
%8 = icmp ne %struct.udev_device* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store %struct.udev_device* null, %struct.udev_device** %2
br label %16
10: ; preds = %1
%11 = load %struct.udev_device*, %struct.udev_device** %4
%12 = call i32 @udev_device_read_db(%struct.udev_device* %11)
%13 = load %struct.udev_device*, %struct.udev_device** %4
%14 = call i32 @udev_device_set_info_loaded(%struct.udev_device* %13)
%15 = load %struct.udev_device*, %struct.udev_device** %4
store %struct.udev_device* %15, %struct.udev_device** %2
br label %16
16: ; preds = %10, %9
%17 = load %struct.udev_device*, %struct.udev_device** %2
ret %struct.udev_device* %17
}

LLVM IR (-O2):
%struct.udev_device = type { i32 }
define %struct.udev_device* @udev_device_clone_with_db(%struct.udev_device* %0) {
%2 = tail call %struct.udev_device* @udev_device_shallow_clone(%struct.udev_device* %0)
%3 = icmp eq %struct.udev_device* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @udev_device_read_db(%struct.udev_device* %2)
%6 = tail call i32 @udev_device_set_info_loaded(%struct.udev_device* %2)
br label %7
7: ; preds = %1, %4
ret %struct.udev_device* %2
}