#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 *);
struct node *list_append(struct node *, char *);
int /*<<< orphan*/ print_list(struct node *);
int main() {
  struct node *mylist = NULL;
  mylist = list_append(mylist, "foo");
  mylist = list_append(mylist, "bar");
  mylist = list_append(mylist, "baz");
  mylist = list_append(mylist, "one");
  mylist = list_append(mylist, "two");
  mylist = list_append(mylist, "three");
  print_list(mylist);
  free_list(mylist);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1050 <list_append@plt>
mov    %rax,-0x10(%rbp)
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
lea    0xec8(%rip),%rsi
xor    %edi,%edi
call   1050 <list_append@plt>
lea    0xebe(%rip),%rsi
mov    %rax,%rdi
call   1050 <list_append@plt>
lea    0xeb3(%rip),%rsi
mov    %rax,%rdi
call   1050 <list_append@plt>
lea    0xea8(%rip),%rsi
mov    %rax,%rdi
call   1050 <list_append@plt>
lea    0xe9d(%rip),%rsi
mov    %rax,%rdi
call   1050 <list_append@plt>
lea    0xe92(%rip),%rsi
mov    %rax,%rdi
call   1050 <list_append@plt>
mov    %rax,%rbx
mov    %rax,%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 }
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [4 x i8] c"baz\00"
@.str.3 = [4 x i8] c"one\00"
@.str.4 = [4 x i8] c"two\00"
@.str.5 = [6 x i8] c"three\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%3 = load %struct.node*, %struct.node** %2
%4 = call %struct.node* @list_append(%struct.node* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call %struct.node* @list_append(%struct.node* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
%8 = call %struct.node* @list_append(%struct.node* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store %struct.node* %8, %struct.node** %2
%9 = load %struct.node*, %struct.node** %2
%10 = call %struct.node* @list_append(%struct.node* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store %struct.node* %10, %struct.node** %2
%11 = load %struct.node*, %struct.node** %2
%12 = call %struct.node* @list_append(%struct.node* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store %struct.node* %12, %struct.node** %2
%13 = load %struct.node*, %struct.node** %2
%14 = call %struct.node* @list_append(%struct.node* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store %struct.node* %14, %struct.node** %2
%15 = load %struct.node*, %struct.node** %2
%16 = call i32 @print_list(%struct.node* %15)
%17 = load %struct.node*, %struct.node** %2
%18 = call i32 @free_list(%struct.node* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [4 x i8] c"baz\00"
@.str.3 = [4 x i8] c"one\00"
@.str.4 = [4 x i8] c"two\00"
@.str.5 = [6 x i8] c"three\00"
define i32 @main() {
%1 = tail call %struct.node* @list_append(%struct.node* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call %struct.node* @list_append(%struct.node* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call %struct.node* @list_append(%struct.node* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call %struct.node* @list_append(%struct.node* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call %struct.node* @list_append(%struct.node* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call %struct.node* @list_append(%struct.node* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @print_list(%struct.node* %6)
%8 = tail call i32 @free_list(%struct.node* %6)
ret i32 0
}