#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 bufferevent {
  int /*<<< orphan*/ output;
  int /*<<< orphan*/ input;
};

/* Variables and functions */
int /*<<< orphan*/ EVBUFFER_LENGTH(int /*<<< orphan*/);
int /*<<< orphan*/ evbuffer_drain(int /*<<< orphan*/, int /*<<< orphan*/);
void bev_drain(struct bufferevent *bev) {
  evbuffer_drain(bev->input, EVBUFFER_LENGTH(bev->input));
  evbuffer_drain(bev->output, EVBUFFER_LENGTH(bev->output));
}


x86 assembly (clang, -O0):
<bev_drain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <EVBUFFER_LENGTH@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1040 <evbuffer_drain@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <EVBUFFER_LENGTH@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1040 <evbuffer_drain@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bev_drain>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x4(%rdi),%ebp
mov    %ebp,%edi
call   1030 <EVBUFFER_LENGTH@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <evbuffer_drain@plt>
mov    (%rbx),%ebx
mov    %ebx,%edi
call   1030 <EVBUFFER_LENGTH@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <evbuffer_drain@plt>

LLVM IR (-O0):
%struct.bufferevent = type { i32, i32 }
define void @bev_drain(%struct.bufferevent* %0) {
%2 = alloca %struct.bufferevent*
store %struct.bufferevent* %0, %struct.bufferevent** %2
%3 = load %struct.bufferevent*, %struct.bufferevent** %2
%4 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %3, i32 0, i32 1
%5 = load i32, i32* %4
%6 = load %struct.bufferevent*, %struct.bufferevent** %2
%7 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = call i32 @EVBUFFER_LENGTH(i32 %8)
%10 = call i32 @evbuffer_drain(i32 %5, i32 %9)
%11 = load %struct.bufferevent*, %struct.bufferevent** %2
%12 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load %struct.bufferevent*, %struct.bufferevent** %2
%15 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @EVBUFFER_LENGTH(i32 %16)
%18 = call i32 @evbuffer_drain(i32 %13, i32 %17)
ret void
}

LLVM IR (-O2):
%struct.bufferevent = type { i32, i32 }
define void @bev_drain(%struct.bufferevent* nocapture %0) {
%2 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %0, i64 0, i32 1
%3 = load i32, i32* %2
%4 = tail call i32 @EVBUFFER_LENGTH(i32 %3)
%5 = tail call i32 @evbuffer_drain(i32 %3, i32 %4)
%6 = getelementptr inbounds %struct.bufferevent, %struct.bufferevent* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @EVBUFFER_LENGTH(i32 %7)
%9 = tail call i32 @evbuffer_drain(i32 %7, i32 %8)
ret void
}