#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 directory_data {
  int dummy;
};
typedef struct directory_data directory;

/* Variables and functions */
int /*<<< orphan*/ assert(struct directory_data *);
int /*<<< orphan*/ directory_insert_sort(struct directory_data *);
int /*<<< orphan*/ directory_raw_add(struct directory_data *,
                                     struct directory_data *);
void directory_add(struct directory *self, struct directory_data *data) {
  assert(self);
  assert(data);
  directory_raw_add(self, data);
  directory_insert_sort(self);
}


x86 assembly (clang, -O0):
<directory_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <directory_raw_add@plt>
mov    -0x8(%rbp),%rdi
call   1040 <directory_insert_sort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<directory_add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <assert@plt>
mov    %r14,%rdi
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <directory_raw_add@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <directory_insert_sort@plt>

LLVM IR (-O0):
%struct.directory = type opaque
%struct.directory_data = type { i32 }
define void @directory_add(%struct.directory* %0, %struct.directory_data* %1) {
%3 = alloca %struct.directory*
%4 = alloca %struct.directory_data*
store %struct.directory* %0, %struct.directory** %3
store %struct.directory_data* %1, %struct.directory_data** %4
%5 = load %struct.directory*, %struct.directory** %3
%6 = bitcast %struct.directory* %5 to %struct.directory_data*
%7 = call i32 @assert(%struct.directory_data* %6)
%8 = load %struct.directory_data*, %struct.directory_data** %4
%9 = call i32 @assert(%struct.directory_data* %8)
%10 = load %struct.directory*, %struct.directory** %3
%11 = bitcast %struct.directory* %10 to %struct.directory_data*
%12 = load %struct.directory_data*, %struct.directory_data** %4
%13 = call i32 @directory_raw_add(%struct.directory_data* %11, %struct.directory_data* %12)
%14 = load %struct.directory*, %struct.directory** %3
%15 = bitcast %struct.directory* %14 to %struct.directory_data*
%16 = call i32 @directory_insert_sort(%struct.directory_data* %15)
ret void
}

LLVM IR (-O2):
%struct.directory = type opaque
%struct.directory_data = type { i32 }
define void @directory_add(%struct.directory* %0, %struct.directory_data* %1) {
%3 = bitcast %struct.directory* %0 to %struct.directory_data*
%4 = tail call i32 @assert(%struct.directory_data* %3)
%5 = tail call i32 @assert(%struct.directory_data* %1)
%6 = tail call i32 @directory_raw_add(%struct.directory_data* %3, %struct.directory_data* %1)
%7 = tail call i32 @directory_insert_sort(%struct.directory_data* %3)
ret void
}