#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 list_simple {
  int dummy;
};
struct list_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _list_node_destroy(struct list_node **,
                                      int /*<<< orphan*/ *);
struct list_node *_list_node_new(void *);
int _list_prepend_node(struct list_simple **, struct list_node *);
int list_prepend_data(struct list_simple **list, void *data) {
  int rc;
  struct list_node *node;
  node = _list_node_new(data);
  rc = _list_prepend_node(list, node);
  if (rc)
    _list_node_destroy(&node, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<list_prepend_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_list_node_new@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <_list_prepend_node@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1174 <list_prepend_data+0x44>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <_list_node_destroy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_prepend_data>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <_list_node_new@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <_list_prepend_node@plt>
test   %eax,%eax
je     1160 <list_prepend_data+0x30>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <_list_node_destroy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.list_simple = type { i32 }
%struct.list_node = type { i32 }
define i32 @list_prepend_data(%struct.list_simple** %0, i8* %1) {
%3 = alloca %struct.list_simple**
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.list_node*
store %struct.list_simple** %0, %struct.list_simple*** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call %struct.list_node* @_list_node_new(i8* %7)
store %struct.list_node* %8, %struct.list_node** %6
%9 = load %struct.list_simple**, %struct.list_simple*** %3
%10 = load %struct.list_node*, %struct.list_node** %6
%11 = call i32 @_list_prepend_node(%struct.list_simple** %9, %struct.list_node* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @_list_node_destroy(%struct.list_node** %6, i32* null)
br label %16
16: ; preds = %14, %2
ret i32 0
}

LLVM IR (-O2):
%struct.list_simple = type { i32 }
%struct.list_node = type { i32 }
define i32 @list_prepend_data(%struct.list_simple** %0, i8* %1) {
%3 = alloca %struct.list_node*
%4 = bitcast %struct.list_node** %3 to i8*
%5 = tail call %struct.list_node* @_list_node_new(i8* %1)
store %struct.list_node* %5, %struct.list_node** %3
%6 = tail call i32 @_list_prepend_node(%struct.list_simple** %0, %struct.list_node* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @_list_node_destroy(%struct.list_node** %3, i32* null)
br label %10
10: ; preds = %8, %2
ret i32 0
}