#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 inode {
  int dummy;
};
typedef void dentry;

/* Variables and functions */
void *d_instantiate_unique(void *, struct inode *);
int /*<<< orphan*/ d_rehash(void *);
__attribute__((always_)) struct dentry *d_add_unique(struct dentry *entry,
                                                     struct inode *inode) {
  struct dentry *res;
  res = d_instantiate_unique(entry, inode);
  d_rehash(res != ((void *)0) ? res : entry);
  return res;
}


x86 assembly (clang, -O0):
<d_add_unique>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <d_instantiate_unique@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1159 <d_add_unique+0x39>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1161 <d_add_unique+0x41>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <d_rehash@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_add_unique>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <d_instantiate_unique@plt>
mov    %rax,%r14
test   %rax,%rax
cmovne %rax,%rbx
mov    %rbx,%rdi
call   1040 <d_rehash@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dentry = type opaque
%struct.inode = type { i32 }
define %struct.dentry* @d_add_unique(%struct.dentry* %0, %struct.inode* %1) {
%3 = alloca %struct.dentry*
%4 = alloca %struct.inode*
%5 = alloca %struct.dentry*
store %struct.dentry* %0, %struct.dentry** %3
store %struct.inode* %1, %struct.inode** %4
%6 = load %struct.dentry*, %struct.dentry** %3
%7 = bitcast %struct.dentry* %6 to i8*
%8 = load %struct.inode*, %struct.inode** %4
%9 = call i8* @d_instantiate_unique(i8* %7, %struct.inode* %8)
%10 = bitcast i8* %9 to %struct.dentry*
store %struct.dentry* %10, %struct.dentry** %5
%11 = load %struct.dentry*, %struct.dentry** %5
%12 = icmp ne %struct.dentry* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load %struct.dentry*, %struct.dentry** %5
br label %17
15: ; preds = %2
%16 = load %struct.dentry*, %struct.dentry** %3
br label %17
17: ; preds = %15, %13
%18 = phi %struct.dentry* [ %14, %13 ], [ %16, %15 ]
%19 = bitcast %struct.dentry* %18 to i8*
%20 = call i32 @d_rehash(i8* %19)
%21 = load %struct.dentry*, %struct.dentry** %5
ret %struct.dentry* %21
}

LLVM IR (-O2):
%struct.dentry = type opaque
%struct.inode = type { i32 }
define %struct.dentry* @d_add_unique(%struct.dentry* %0, %struct.inode* %1) {
%3 = bitcast %struct.dentry* %0 to i8*
%4 = tail call i8* @d_instantiate_unique(i8* %3, %struct.inode* %1)
%5 = bitcast i8* %4 to %struct.dentry*
%6 = icmp eq i8* %4, null
%7 = select i1 %6, %struct.dentry* %0, %struct.dentry* %5
%8 = bitcast %struct.dentry* %7 to i8*
%9 = tail call i32 @d_rehash(i8* %8)
ret %struct.dentry* %5
}