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

/* Variables and functions */
int /*<<< orphan*/ evbuffer_drain(struct evbuffer *, int /*<<< orphan*/);
int /*<<< orphan*/ evbuffer_get_length(struct evbuffer *);
int /*<<< orphan*/ evbuffer_pullup(struct evbuffer *, int /*<<< orphan*/);
struct evbuffer *evhttp_request_get_input_buffer(struct evhttp_request *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fwrite(int /*<<< orphan*/, int /*<<< orphan*/, int,
                          int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void get_cb(struct evhttp_request *req, void *arg) {
  ev_ssize_t len;
  struct evbuffer *evbuf;
  do {
    if (!(req)) {
      fprintf(stderr, "[error] %s\n", "req");
    }
  } while (0);
  ;
  evbuf = evhttp_request_get_input_buffer(req);
  len = evbuffer_get_length(evbuf);
  fwrite(evbuffer_pullup(evbuf, len), len, 1, stdout);
  evbuffer_drain(evbuf, len);
}


x86 assembly (clang, -O0):
<get_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1197 <get_cb+0x37>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
lea    0xe7a(%rip),%rdx
call   1040 <fprintf@plt>
jmp    119c <get_cb+0x3c>
mov    -0x8(%rbp),%rdi
call   1060 <evhttp_request_get_input_buffer@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <evbuffer_get_length@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <evbuffer_pullup@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%esi
mov    0x2e0b(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <evbuffer_drain@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cb>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1187 <get_cb+0x27>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
lea    0xe8a(%rip),%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <evhttp_request_get_input_buffer@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <evbuffer_get_length@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <evbuffer_pullup@plt>
mov    0x2e2b(%rip),%rcx
mov    (%rcx),%ecx
mov    %eax,%edi
mov    %ebp,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <evbuffer_drain@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"[error] %s\0A\00"
@.str.1 = [4 x i8] c"req\00"
@stdout = global i32 0
define void @get_cb(%struct.evhttp_request* %0, i8* %1) {
%3 = alloca %struct.evhttp_request*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.evbuffer*
store %struct.evhttp_request* %0, %struct.evhttp_request** %3
store i8* %1, i8** %4
br label %7
7: ; preds = %2
%8 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%9 = icmp ne %struct.evhttp_request* %8, null
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %7
br label %14
14: ; preds = %13
%15 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%16 = call %struct.evbuffer* @evhttp_request_get_input_buffer(%struct.evhttp_request* %15)
store %struct.evbuffer* %16, %struct.evbuffer** %6
%17 = load %struct.evbuffer*, %struct.evbuffer** %6
%18 = call i32 @evbuffer_get_length(%struct.evbuffer* %17)
store i32 %18, i32* %5
%19 = load %struct.evbuffer*, %struct.evbuffer** %6
%20 = load i32, i32* %5
%21 = call i32 @evbuffer_pullup(%struct.evbuffer* %19, i32 %20)
%22 = load i32, i32* %5
%23 = load i32, i32* @stdout
%24 = call i32 @fwrite(i32 %21, i32 %22, i32 1, i32 %23)
%25 = load %struct.evbuffer*, %struct.evbuffer** %6
%26 = load i32, i32* %5
%27 = call i32 @evbuffer_drain(%struct.evbuffer* %25, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evbuffer = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"[error] %s\0A\00"
@.str.1 = [4 x i8] c"req\00"
@stdout = global i32 0
define void @get_cb(%struct.evhttp_request* %0, i8* nocapture readnone %1) {
%3 = icmp eq %struct.evhttp_request* %0, null
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %4, %2
%8 = tail call %struct.evbuffer* @evhttp_request_get_input_buffer(%struct.evhttp_request* %0)
%9 = tail call i32 @evbuffer_get_length(%struct.evbuffer* %8)
%10 = tail call i32 @evbuffer_pullup(%struct.evbuffer* %8, i32 %9)
%11 = load i32, i32* @stdout
%12 = tail call i32 @fwrite(i32 %10, i32 %9, i32 1, i32 %11)
%13 = tail call i32 @evbuffer_drain(%struct.evbuffer* %8, i32 %9)
ret void
}