#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 run {
  int dummy;
};
struct evbuffer {
  int dummy;
};
typedef int /*<<< orphan*/ ev_uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ evbuffer_free(struct evbuffer *);
struct evbuffer *evbuffer_new();
int /*<<< orphan*/ evtag_marshal_buffer(struct evbuffer *, int /*<<< orphan*/,
                                        struct evbuffer *);
int /*<<< orphan*/ run_marshal(struct evbuffer *, struct run const *);
void evtag_marshal_run(struct evbuffer *evbuf, ev_uint32_t tag,
                       const struct run *msg) {
  struct evbuffer *_buf = evbuffer_new();
  assert(_buf != NULL);
  run_marshal(_buf, msg);
  evtag_marshal_buffer(evbuf, tag, _buf);
  evbuffer_free(_buf);
}


x86 assembly (clang, -O0):
<evtag_marshal_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1070 <evbuffer_new@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <run_marshal@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <evtag_marshal_buffer@plt>
mov    -0x20(%rbp),%rdi
call   1040 <evbuffer_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evtag_marshal_run>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%r15
xor    %eax,%eax
call   1070 <evbuffer_new@plt>
mov    %rax,%rbp
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <run_marshal@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
call   1060 <evtag_marshal_buffer@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <evbuffer_free@plt>

LLVM IR (-O0):
%struct.evbuffer = type { i32 }
%struct.run = type { i32 }
define void @evtag_marshal_run(%struct.evbuffer* %0, i32 %1, %struct.run* %2) {
%4 = alloca %struct.evbuffer*
%5 = alloca i32
%6 = alloca %struct.run*
%7 = alloca %struct.evbuffer*
store %struct.evbuffer* %0, %struct.evbuffer** %4
store i32 %1, i32* %5
store %struct.run* %2, %struct.run** %6
%8 = call %struct.evbuffer* (...) @evbuffer_new()
store %struct.evbuffer* %8, %struct.evbuffer** %7
%9 = load %struct.evbuffer*, %struct.evbuffer** %7
%10 = icmp ne %struct.evbuffer* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load %struct.evbuffer*, %struct.evbuffer** %7
%14 = load %struct.run*, %struct.run** %6
%15 = call i32 @run_marshal(%struct.evbuffer* %13, %struct.run* %14)
%16 = load %struct.evbuffer*, %struct.evbuffer** %4
%17 = load i32, i32* %5
%18 = load %struct.evbuffer*, %struct.evbuffer** %7
%19 = call i32 @evtag_marshal_buffer(%struct.evbuffer* %16, i32 %17, %struct.evbuffer* %18)
%20 = load %struct.evbuffer*, %struct.evbuffer** %7
%21 = call i32 @evbuffer_free(%struct.evbuffer* %20)
ret void
}

LLVM IR (-O2):
%struct.evbuffer = type { i32 }
%struct.run = type { i32 }
define void @evtag_marshal_run(%struct.evbuffer* %0, i32 %1, %struct.run* %2) {
%4 = tail call %struct.evbuffer* (...) @evbuffer_new()
%5 = icmp ne %struct.evbuffer* %4, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @run_marshal(%struct.evbuffer* %4, %struct.run* %2)
%9 = tail call i32 @evtag_marshal_buffer(%struct.evbuffer* %0, i32 %1, %struct.evbuffer* %4)
%10 = tail call i32 @evbuffer_free(%struct.evbuffer* %4)
ret void
}