#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 network_status {
  int dummy;
};
struct item {
  int dummy;
};

/* Variables and functions */
struct item *create_data_item_from_char(char);
int /*<<< orphan*/ item_free(struct item *);
struct network_status *network_connect(char *, int);
int /*<<< orphan*/ network_disconnect(struct network_status *);
int /*<<< orphan*/ network_send(struct network_status *, struct item *);
void send() {
  struct network_status *net_stat = network_connect("localhost", 121212);
  char i;
  struct item *m = create_data_item_from_char(i);
  network_send(net_stat, m);
  item_free(m);
  network_disconnect(net_stat);
}


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x1d97c,%esi
call   1060 <network_connect@plt>
mov    %rax,-0x8(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <create_data_item_from_char@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <network_send@plt>
mov    -0x18(%rbp),%rdi
call   1040 <item_free@plt>
mov    -0x8(%rbp),%rdi
call   1050 <network_disconnect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
mov    $0x1d97c,%esi
call   1060 <network_connect@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1030 <create_data_item_from_char@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1070 <network_send@plt>
mov    %rbx,%rdi
call   1040 <item_free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <network_disconnect@plt>

LLVM IR (-O0):
%struct.network_status = type { i32 }
%struct.item = type { i32 }
@.str = [10 x i8] c"localhost\00"
define void @send() {
%1 = alloca %struct.network_status*
%2 = alloca i8
%3 = alloca %struct.item*
%4 = call %struct.network_status* @network_connect(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 121212)
store %struct.network_status* %4, %struct.network_status** %1
%5 = load i8, i8* %2
%6 = call %struct.item* @create_data_item_from_char(i8 signext %5)
store %struct.item* %6, %struct.item** %3
%7 = load %struct.network_status*, %struct.network_status** %1
%8 = load %struct.item*, %struct.item** %3
%9 = call i32 @network_send(%struct.network_status* %7, %struct.item* %8)
%10 = load %struct.item*, %struct.item** %3
%11 = call i32 @item_free(%struct.item* %10)
%12 = load %struct.network_status*, %struct.network_status** %1
%13 = call i32 @network_disconnect(%struct.network_status* %12)
ret void
}

LLVM IR (-O2):
%struct.network_status = type { i32 }
%struct.item = type { i32 }
@.str = [10 x i8] c"localhost\00"
define void @send() {
%1 = tail call %struct.network_status* @network_connect(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 121212)
%2 = tail call %struct.item* @create_data_item_from_char(i8 signext undef)
%3 = tail call i32 @network_send(%struct.network_status* %1, %struct.item* %2)
%4 = tail call i32 @item_free(%struct.item* %2)
%5 = tail call i32 @network_disconnect(%struct.network_status* %1)
ret void
}