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

/* Variables and functions */
int /*<<< orphan*/ evbuffer_add_buffer(struct evbuffer *, struct evbuffer *);
scalar_t__ evbuffer_get_length(struct evbuffer *);
int /*<<< orphan*/ evtag_encode_int(struct evbuffer *, unsigned long);
int /*<<< orphan*/ evtag_encode_tag(struct evbuffer *, unsigned long);
void evtag_marshal_buffer(struct evbuffer *evbuf, unsigned long tag,
                          struct evbuffer *data) {
  evtag_encode_tag(evbuf, tag);
  evtag_encode_int(evbuf, (unsigned long)evbuffer_get_length(data));
  evbuffer_add_buffer(evbuf, data);
}


x86 assembly (clang, -O0):
<evtag_marshal_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <evtag_encode_tag@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <evbuffer_get_length@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1030 <evtag_encode_int@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <evbuffer_add_buffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evtag_marshal_buffer>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1050 <evtag_encode_tag@plt>
mov    %r14,%rdi
call   1060 <evbuffer_get_length@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <evtag_encode_int@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <evbuffer_add_buffer@plt>

LLVM IR (-O0):
%struct.evbuffer = type { i32 }
define void @evtag_marshal_buffer(%struct.evbuffer* %0, i64 %1, %struct.evbuffer* %2) {
%4 = alloca %struct.evbuffer*
%5 = alloca i64
%6 = alloca %struct.evbuffer*
store %struct.evbuffer* %0, %struct.evbuffer** %4
store i64 %1, i64* %5
store %struct.evbuffer* %2, %struct.evbuffer** %6
%7 = load %struct.evbuffer*, %struct.evbuffer** %4
%8 = load i64, i64* %5
%9 = call i32 @evtag_encode_tag(%struct.evbuffer* %7, i64 %8)
%10 = load %struct.evbuffer*, %struct.evbuffer** %4
%11 = load %struct.evbuffer*, %struct.evbuffer** %6
%12 = call i64 @evbuffer_get_length(%struct.evbuffer* %11)
%13 = call i32 @evtag_encode_int(%struct.evbuffer* %10, i64 %12)
%14 = load %struct.evbuffer*, %struct.evbuffer** %4
%15 = load %struct.evbuffer*, %struct.evbuffer** %6
%16 = call i32 @evbuffer_add_buffer(%struct.evbuffer* %14, %struct.evbuffer* %15)
ret void
}

LLVM IR (-O2):
%struct.evbuffer = type { i32 }
define void @evtag_marshal_buffer(%struct.evbuffer* %0, i64 %1, %struct.evbuffer* %2) {
%4 = tail call i32 @evtag_encode_tag(%struct.evbuffer* %0, i64 %1)
%5 = tail call i64 @evbuffer_get_length(%struct.evbuffer* %2)
%6 = tail call i32 @evtag_encode_int(%struct.evbuffer* %0, i64 %5)
%7 = tail call i32 @evbuffer_add_buffer(%struct.evbuffer* %0, %struct.evbuffer* %2)
ret void
}