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

/* Variables and functions */
int /*<<< orphan*/ free_list(struct node *);
int /*<<< orphan*/ list_append(struct node *);
struct node *list_new(int /*<<< orphan*/);
int /*<<< orphan*/ print_list(struct node *);
int main() {
  struct node *my_list = list_new(0);
  list_append(my_list);
  list_append(my_list);
  list_append(my_list);
  list_append(my_list);
  list_append(my_list);
  list_append(my_list);
  print_list(my_list);
  free_list(my_list);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <list_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1060 <list_append@plt>
mov    %rbx,%rdi
call   1030 <print_list@plt>
mov    %rbx,%rdi
call   1040 <free_list@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = tail call %struct.node* @list_new(i32 0)
%2 = tail call i32 @list_append(%struct.node* %1)
%3 = tail call i32 @list_append(%struct.node* %1)
%4 = tail call i32 @list_append(%struct.node* %1)
%5 = tail call i32 @list_append(%struct.node* %1)
%6 = tail call i32 @list_append(%struct.node* %1)
%7 = tail call i32 @list_append(%struct.node* %1)
%8 = tail call i32 @print_list(%struct.node* %1)
%9 = tail call i32 @free_list(%struct.node* %1)
ret i32 0
}