#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 index_node_f {
  int dummy;
};
struct index_file {
  int dummy;
};
struct buffer {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct buffer *buf_create();
int /*<<< orphan*/ buf_destroy(struct buffer *);
int /*<<< orphan*/ index_dump_node(struct index_node_f *, struct buffer *,
                                   int /*<<< orphan*/ *, char const *);
struct index_node_f *index_readroot(struct index_file *);
void index_dump(struct index_file *in, FILE *out, const char *prefix) {
  struct index_node_f *root;
  struct buffer *buf;
  buf = buf_create();
  root = index_readroot(in);
  index_dump_node(root, buf, out, prefix);
  buf_destroy(buf);
}


x86 assembly (clang, -O0):
<index_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <buf_create@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <index_readroot@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <index_dump_node@plt>
mov    -0x28(%rbp),%rdi
call   1060 <buf_destroy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %eax,%eax
call   1030 <buf_create@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1050 <index_readroot@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <index_dump_node@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <buf_destroy@plt>

LLVM IR (-O0):
%struct.index_file = type { i32 }
%struct.index_node_f = type { i32 }
%struct.buffer = type { i32 }
define void @index_dump(%struct.index_file* %0, i32* %1, i8* %2) {
%4 = alloca %struct.index_file*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca %struct.index_node_f*
%8 = alloca %struct.buffer*
store %struct.index_file* %0, %struct.index_file** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%9 = call %struct.buffer* (...) @buf_create()
store %struct.buffer* %9, %struct.buffer** %8
%10 = load %struct.index_file*, %struct.index_file** %4
%11 = call %struct.index_node_f* @index_readroot(%struct.index_file* %10)
store %struct.index_node_f* %11, %struct.index_node_f** %7
%12 = load %struct.index_node_f*, %struct.index_node_f** %7
%13 = load %struct.buffer*, %struct.buffer** %8
%14 = load i32*, i32** %5
%15 = load i8*, i8** %6
%16 = call i32 @index_dump_node(%struct.index_node_f* %12, %struct.buffer* %13, i32* %14, i8* %15)
%17 = load %struct.buffer*, %struct.buffer** %8
%18 = call i32 @buf_destroy(%struct.buffer* %17)
ret void
}

LLVM IR (-O2):
%struct.index_file = type { i32 }
%struct.buffer = type { i32 }
%struct.index_node_f = type { i32 }
define void @index_dump(%struct.index_file* %0, i32* %1, i8* %2) {
%4 = tail call %struct.buffer* (...) @buf_create()
%5 = tail call %struct.index_node_f* @index_readroot(%struct.index_file* %0)
%6 = tail call i32 @index_dump_node(%struct.index_node_f* %5, %struct.buffer* %4, i32* %1, i8* %2)
%7 = tail call i32 @buf_destroy(%struct.buffer* %4)
ret void
}