#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 sfs_fs {
  int dummy;
};
struct cache_inode {
  int dummy;
};
typedef int /*<<< orphan*/ ino_t;

/* Variables and functions */
int /*<<< orphan*/ add_entry(struct sfs_fs *, struct cache_inode *,
                             struct cache_inode *, char const *);
struct cache_inode *alloc_cache_inode(struct sfs_fs *, int /*<<< orphan*/,
                                      int /*<<< orphan*/, int);
int /*<<< orphan*/ open_link(struct sfs_fs *, struct cache_inode *,
                             char const *);
void add_link(struct sfs_fs *sfs, struct cache_inode *current,
              const char *filename, ino_t real) {
  struct cache_inode *file = alloc_cache_inode(sfs, real, 0, 3);
  open_link(sfs, file, filename);
  add_entry(sfs, current, file, filename);
}


x86 assembly (clang, -O0):
<add_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1040 <alloc_cache_inode@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <open_link@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <add_entry@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_link>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %ecx,%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1040 <alloc_cache_inode@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
call   1050 <open_link@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <add_entry@plt>

LLVM IR (-O0):
%struct.sfs_fs = type { i32 }
%struct.cache_inode = type { i32 }
define void @add_link(%struct.sfs_fs* %0, %struct.cache_inode* %1, i8* %2, i32 %3) {
%5 = alloca %struct.sfs_fs*
%6 = alloca %struct.cache_inode*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.cache_inode*
store %struct.sfs_fs* %0, %struct.sfs_fs** %5
store %struct.cache_inode* %1, %struct.cache_inode** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load %struct.sfs_fs*, %struct.sfs_fs** %5
%11 = load i32, i32* %8
%12 = call %struct.cache_inode* @alloc_cache_inode(%struct.sfs_fs* %10, i32 %11, i32 0, i32 3)
store %struct.cache_inode* %12, %struct.cache_inode** %9
%13 = load %struct.sfs_fs*, %struct.sfs_fs** %5
%14 = load %struct.cache_inode*, %struct.cache_inode** %9
%15 = load i8*, i8** %7
%16 = call i32 @open_link(%struct.sfs_fs* %13, %struct.cache_inode* %14, i8* %15)
%17 = load %struct.sfs_fs*, %struct.sfs_fs** %5
%18 = load %struct.cache_inode*, %struct.cache_inode** %6
%19 = load %struct.cache_inode*, %struct.cache_inode** %9
%20 = load i8*, i8** %7
%21 = call i32 @add_entry(%struct.sfs_fs* %17, %struct.cache_inode* %18, %struct.cache_inode* %19, i8* %20)
ret void
}

LLVM IR (-O2):
%struct.sfs_fs = type { i32 }
%struct.cache_inode = type { i32 }
define void @add_link(%struct.sfs_fs* %0, %struct.cache_inode* %1, i8* %2, i32 %3) {
%5 = tail call %struct.cache_inode* @alloc_cache_inode(%struct.sfs_fs* %0, i32 %3, i32 0, i32 3)
%6 = tail call i32 @open_link(%struct.sfs_fs* %0, %struct.cache_inode* %5, i8* %2)
%7 = tail call i32 @add_entry(%struct.sfs_fs* %0, %struct.cache_inode* %1, %struct.cache_inode* %5, i8* %2)
ret void
}