#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_cursor {
  int dummy;
};
struct list {
  int dummy;
};

/* Variables and functions */
struct list_cursor *cctools_list_cursor_create(struct list *);
int /*<<< orphan*/ cctools_list_cursor_destroy(struct list_cursor *);
int /*<<< orphan*/ cctools_list_insert(struct list_cursor *, void *);
int /*<<< orphan*/ cctools_list_seek(struct list_cursor *, int /*<<< orphan*/);
int cctools_list_push_head(struct list *l, void *item) {
  struct list_cursor *cur = cctools_list_cursor_create(l);
  cctools_list_seek(cur, 0);
  cctools_list_insert(cur, item);
  cctools_list_cursor_destroy(cur);
  return 1;
}


x86 assembly (clang, -O0):
<cctools_list_push_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <cctools_list_cursor_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1050 <cctools_list_seek@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <cctools_list_insert@plt>
mov    -0x18(%rbp),%rdi
call   1040 <cctools_list_cursor_destroy@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cctools_list_push_head>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1060 <cctools_list_cursor_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1050 <cctools_list_seek@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <cctools_list_insert@plt>
mov    %rbx,%rdi
call   1040 <cctools_list_cursor_destroy@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.list = type { i32 }
%struct.list_cursor = type { i32 }
define i32 @cctools_list_push_head(%struct.list* %0, i8* %1) {
%3 = alloca %struct.list*
%4 = alloca i8*
%5 = alloca %struct.list_cursor*
store %struct.list* %0, %struct.list** %3
store i8* %1, i8** %4
%6 = load %struct.list*, %struct.list** %3
%7 = call %struct.list_cursor* @cctools_list_cursor_create(%struct.list* %6)
store %struct.list_cursor* %7, %struct.list_cursor** %5
%8 = load %struct.list_cursor*, %struct.list_cursor** %5
%9 = call i32 @cctools_list_seek(%struct.list_cursor* %8, i32 0)
%10 = load %struct.list_cursor*, %struct.list_cursor** %5
%11 = load i8*, i8** %4
%12 = call i32 @cctools_list_insert(%struct.list_cursor* %10, i8* %11)
%13 = load %struct.list_cursor*, %struct.list_cursor** %5
%14 = call i32 @cctools_list_cursor_destroy(%struct.list_cursor* %13)
ret i32 1
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.list_cursor = type { i32 }
define i32 @cctools_list_push_head(%struct.list* %0, i8* %1) {
%3 = tail call %struct.list_cursor* @cctools_list_cursor_create(%struct.list* %0)
%4 = tail call i32 @cctools_list_seek(%struct.list_cursor* %3, i32 0)
%5 = tail call i32 @cctools_list_insert(%struct.list_cursor* %3, i8* %1)
%6 = tail call i32 @cctools_list_cursor_destroy(%struct.list_cursor* %3)
ret i32 1
}