#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(struct evbuffer *, char *, int);
int strlen(char *);
void ctcp_request(struct evbuffer *out, char *dest, char *message) {
  evbuffer_add(out, "PRIVMSG ", 8);
  evbuffer_add(out, dest, strlen(dest));
  evbuffer_add(out, " :\x01", 3);
  evbuffer_add(out, message, strlen(message));
  evbuffer_add(out, "\x01\n", 2);
}


x86 assembly (clang, -O0):
<ctcp_request>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0x8,%edx
call   1040 <evbuffer_add@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1040 <evbuffer_add@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x3,%edx
call   1040 <evbuffer_add@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1040 <evbuffer_add@plt>
mov    -0x8(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x2,%edx
call   1040 <evbuffer_add@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctcp_request>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
mov    $0x8,%edx
call   1040 <evbuffer_add@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <evbuffer_add@plt>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <evbuffer_add@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <evbuffer_add@plt>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <evbuffer_add@plt>

LLVM IR (-O0):
%struct.evbuffer = type { i32 }
@.str = [9 x i8] c"PRIVMSG \00"
@.str.1 = [4 x i8] c" :\01\00"
@.str.2 = [3 x i8] c"\01\0A\00"
define void @ctcp_request(%struct.evbuffer* %0, i8* %1, i8* %2) {
%4 = alloca %struct.evbuffer*
%5 = alloca i8*
%6 = alloca i8*
store %struct.evbuffer* %0, %struct.evbuffer** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.evbuffer*, %struct.evbuffer** %4
%8 = call i32 @evbuffer_add(%struct.evbuffer* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%9 = load %struct.evbuffer*, %struct.evbuffer** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @evbuffer_add(%struct.evbuffer* %9, i8* %10, i32 %12)
%14 = load %struct.evbuffer*, %struct.evbuffer** %4
%15 = call i32 @evbuffer_add(%struct.evbuffer* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%16 = load %struct.evbuffer*, %struct.evbuffer** %4
%17 = load i8*, i8** %6
%18 = load i8*, i8** %6
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @evbuffer_add(%struct.evbuffer* %16, i8* %17, i32 %19)
%21 = load %struct.evbuffer*, %struct.evbuffer** %4
%22 = call i32 @evbuffer_add(%struct.evbuffer* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
ret void
}

LLVM IR (-O2):
%struct.evbuffer = type { i32 }
@.str = [9 x i8] c"PRIVMSG \00"
@.str.1 = [4 x i8] c" :\01\00"
@.str.2 = [3 x i8] c"\01\0A\00"
define void @ctcp_request(%struct.evbuffer* %0, i8* %1, i8* %2) {
%4 = tail call i32 @evbuffer_add(%struct.evbuffer* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @evbuffer_add(%struct.evbuffer* %0, i8* %1, i32 %5)
%7 = tail call i32 @evbuffer_add(%struct.evbuffer* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%8 = tail call i32 @strlen(i8* %2)
%9 = tail call i32 @evbuffer_add(%struct.evbuffer* %0, i8* %2, i32 %8)
%10 = tail call i32 @evbuffer_add(%struct.evbuffer* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
ret void
}