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

/* Variables and functions */
int /*<<< orphan*/ d_drop(struct dentry *);
int /*<<< orphan*/ fist_print_dentry(char *, struct dentry *);
int /*<<< orphan*/ lock_dentry(struct dentry *);
int /*<<< orphan*/ print_entry_location();
int /*<<< orphan*/ print_exit_status(int);
int unionfs_unlink_whiteout(struct inode *, struct dentry *);
int /*<<< orphan*/ unlock_dentry(struct dentry *);
int unionfs_unlink(struct inode *dir, struct dentry *dentry) {
  int err = 0;
  print_entry_location();
  lock_dentry(dentry);
  fist_print_dentry("IN unionfs_unlink", dentry);
  err = unionfs_unlink_whiteout(dir, dentry);
  if (!err)
    d_drop(dentry);
  unlock_dentry(dentry);
  print_exit_status(err);
  return err;
}


x86 assembly (clang, -O0):
<unionfs_unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <print_entry_location@plt>
mov    -0x10(%rbp),%rdi
call   1080 <lock_dentry@plt>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1070 <fist_print_dentry@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <unionfs_unlink_whiteout@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11ca <unionfs_unlink+0x5a>
mov    -0x10(%rbp),%rdi
call   1090 <d_drop@plt>
mov    -0x10(%rbp),%rdi
call   1030 <unlock_dentry@plt>
mov    -0x14(%rbp),%edi
call   1050 <print_exit_status@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unionfs_unlink>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %eax,%eax
call   1040 <print_entry_location@plt>
mov    %rbx,%rdi
call   1080 <lock_dentry@plt>
lea    0xe71(%rip),%rdi
mov    %rbx,%rsi
call   1070 <fist_print_dentry@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <unionfs_unlink_whiteout@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11b0 <unionfs_unlink+0x40>
mov    %rbx,%rdi
call   1090 <d_drop@plt>
mov    %rbx,%rdi
call   1030 <unlock_dentry@plt>
mov    %ebp,%edi
call   1050 <print_exit_status@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.inode = type { i32 }
%struct.dentry = type { i32 }
@.str = [18 x i8] c"IN unionfs_unlink\00"
define i32 @unionfs_unlink(%struct.inode* %0, %struct.dentry* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.dentry*
%5 = alloca i32
store %struct.inode* %0, %struct.inode** %3
store %struct.dentry* %1, %struct.dentry** %4
store i32 0, i32* %5
%6 = call i32 (...) @print_entry_location()
%7 = load %struct.dentry*, %struct.dentry** %4
%8 = call i32 @lock_dentry(%struct.dentry* %7)
%9 = load %struct.dentry*, %struct.dentry** %4
%10 = call i32 @fist_print_dentry(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.dentry* %9)
%11 = load %struct.inode*, %struct.inode** %3
%12 = load %struct.dentry*, %struct.dentry** %4
%13 = call i32 @unionfs_unlink_whiteout(%struct.inode* %11, %struct.dentry* %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load %struct.dentry*, %struct.dentry** %4
%18 = call i32 @d_drop(%struct.dentry* %17)
br label %19
19: ; preds = %16, %2
%20 = load %struct.dentry*, %struct.dentry** %4
%21 = call i32 @unlock_dentry(%struct.dentry* %20)
%22 = load i32, i32* %5
%23 = call i32 @print_exit_status(i32 %22)
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
%struct.inode = type { i32 }
%struct.dentry = type { i32 }
@.str = [18 x i8] c"IN unionfs_unlink\00"
define i32 @unionfs_unlink(%struct.inode* %0, %struct.dentry* %1) {
%3 = tail call i32 (...) @print_entry_location()
%4 = tail call i32 @lock_dentry(%struct.dentry* %1)
%5 = tail call i32 @fist_print_dentry(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.dentry* %1)
%6 = tail call i32 @unionfs_unlink_whiteout(%struct.inode* %0, %struct.dentry* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @d_drop(%struct.dentry* %1)
br label %10
10: ; preds = %8, %2
%11 = tail call i32 @unlock_dentry(%struct.dentry* %1)
%12 = tail call i32 @print_exit_status(i32 %6)
ret i32 %6
}