#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_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_append(struct list_head *);
int /*<<< orphan*/ list_free(struct list_head **);
struct list_head *list_new();
int /*<<< orphan*/ list_push(struct list_head *);
int /*<<< orphan*/ traverse(struct list_head *);
int main() {
  struct list_head *head = list_new();
  list_push(head);
  list_append(head);
  list_push(head);
  list_push(head);
  list_append(head);
  traverse(head);
  list_free(&head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <list_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <list_push@plt>
mov    -0x10(%rbp),%rdi
call   1070 <list_append@plt>
mov    -0x10(%rbp),%rdi
call   1050 <list_push@plt>
mov    -0x10(%rbp),%rdi
call   1050 <list_push@plt>
mov    -0x10(%rbp),%rdi
call   1070 <list_append@plt>
mov    -0x10(%rbp),%rdi
call   1030 <traverse@plt>
lea    -0x10(%rbp),%rdi
call   1040 <list_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <list_new@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1050 <list_push@plt>
mov    %rbx,%rdi
call   1070 <list_append@plt>
mov    %rbx,%rdi
call   1050 <list_push@plt>
mov    %rbx,%rdi
call   1050 <list_push@plt>
mov    %rbx,%rdi
call   1070 <list_append@plt>
mov    %rbx,%rdi
call   1030 <traverse@plt>
lea    0x8(%rsp),%rdi
call   1040 <list_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.list_head = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.list_head*
store i32 0, i32* %1
%3 = call %struct.list_head* (...) @list_new()
store %struct.list_head* %3, %struct.list_head** %2
%4 = load %struct.list_head*, %struct.list_head** %2
%5 = call i32 @list_push(%struct.list_head* %4)
%6 = load %struct.list_head*, %struct.list_head** %2
%7 = call i32 @list_append(%struct.list_head* %6)
%8 = load %struct.list_head*, %struct.list_head** %2
%9 = call i32 @list_push(%struct.list_head* %8)
%10 = load %struct.list_head*, %struct.list_head** %2
%11 = call i32 @list_push(%struct.list_head* %10)
%12 = load %struct.list_head*, %struct.list_head** %2
%13 = call i32 @list_append(%struct.list_head* %12)
%14 = load %struct.list_head*, %struct.list_head** %2
%15 = call i32 @traverse(%struct.list_head* %14)
%16 = call i32 @list_free(%struct.list_head** %2)
ret i32 0
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define i32 @main() {
%1 = alloca %struct.list_head*
%2 = bitcast %struct.list_head** %1 to i8*
%3 = tail call %struct.list_head* (...) @list_new()
store %struct.list_head* %3, %struct.list_head** %1
%4 = tail call i32 @list_push(%struct.list_head* %3)
%5 = tail call i32 @list_append(%struct.list_head* %3)
%6 = tail call i32 @list_push(%struct.list_head* %3)
%7 = tail call i32 @list_push(%struct.list_head* %3)
%8 = tail call i32 @list_append(%struct.list_head* %3)
%9 = tail call i32 @traverse(%struct.list_head* %3)
%10 = call i32 @list_free(%struct.list_head** %1)
ret i32 0
}