#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 message {
  int dummy;
};
struct connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ log_add(char *, char *, char *);
int /*<<< orphan*/ message_get_str(struct message *, char *, int);
int /*<<< orphan*/ send_hello(struct connection *);
void on_recv_message(void *handle, struct message *msg) {
  char buf[64];
  struct connection *conn = handle;
  message_get_str(msg, buf, 64);
  log_add("INFO", "on_recv_message: %s", buf);
  send_hello(conn);
}


x86 assembly (clang, -O0):
<on_recv_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <message_get_str@plt>
lea    -0x50(%rbp),%rdx
lea    0xe9b(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1040 <log_add@plt>
mov    -0x58(%rbp),%rdi
call   1050 <send_hello@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_recv_message>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %rsi,%rdi
mov    %r14,%rsi
mov    $0x40,%edx
call   1030 <message_get_str@plt>
lea    0xeac(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    %r14,%rdx
call   1040 <log_add@plt>
mov    %rbx,%rdi
call   1050 <send_hello@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.message = type { i32 }
%struct.connection = type { i32 }
@.str = [5 x i8] c"INFO\00"
@.str.1 = [20 x i8] c"on_recv_message: %s\00"
define void @on_recv_message(i8* %0, %struct.message* %1) {
%3 = alloca i8*
%4 = alloca %struct.message*
%5 = alloca [64 x i8]
%6 = alloca %struct.connection*
store i8* %0, i8** %3
store %struct.message* %1, %struct.message** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.connection*
store %struct.connection* %8, %struct.connection** %6
%9 = load %struct.message*, %struct.message** %4
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = call i32 @message_get_str(%struct.message* %9, i8* %10, i32 64)
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%13 = call i32 @log_add(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load %struct.connection*, %struct.connection** %6
%15 = call i32 @send_hello(%struct.connection* %14)
ret void
}

LLVM IR (-O2):
%struct.message = type { i32 }
%struct.connection = type { i32 }
@.str = [5 x i8] c"INFO\00"
@.str.1 = [20 x i8] c"on_recv_message: %s\00"
define void @on_recv_message(i8* %0, %struct.message* %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = bitcast i8* %0 to %struct.connection*
%6 = call i32 @message_get_str(%struct.message* %1, i8* %4, i32 64)
%7 = call i32 @log_add(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%8 = call i32 @send_hello(%struct.connection* %5)
ret void
}