#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*/ list_add(struct node **, struct node *);
int /*<<< orphan*/ list_dispose(struct node *);
struct node *node_malloc(int);
int main() {
  struct node *l = NULL;
  struct node *n1 = node_malloc(1);
  struct node *n2 = node_malloc(2);
  struct node *n3 = node_malloc(3);
  list_add(&l, n1);
  list_add(&l, n2);
  list_add(&l, n3);
  list_dispose(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <node_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x2,%edi
call   1040 <node_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x3,%edi
call   1040 <node_malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1050 <list_add@plt>
mov    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1050 <list_add@plt>
mov    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1050 <list_add@plt>
mov    -0x10(%rbp),%rdi
call   1030 <list_dispose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    $0x1,%edi
call   1040 <node_malloc@plt>
mov    %rax,%r14
mov    $0x2,%edi
call   1040 <node_malloc@plt>
mov    %rax,%r15
mov    $0x3,%edi
call   1040 <node_malloc@plt>
mov    %rax,%r12
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <list_add@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <list_add@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <list_add@plt>
mov    (%rsp),%rdi
call   1030 <list_dispose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%6 = call %struct.node* @node_malloc(i32 1)
store %struct.node* %6, %struct.node** %3
%7 = call %struct.node* @node_malloc(i32 2)
store %struct.node* %7, %struct.node** %4
%8 = call %struct.node* @node_malloc(i32 3)
store %struct.node* %8, %struct.node** %5
%9 = load %struct.node*, %struct.node** %3
%10 = call i32 @list_add(%struct.node** %2, %struct.node* %9)
%11 = load %struct.node*, %struct.node** %4
%12 = call i32 @list_add(%struct.node** %2, %struct.node* %11)
%13 = load %struct.node*, %struct.node** %5
%14 = call i32 @list_add(%struct.node** %2, %struct.node* %13)
%15 = load %struct.node*, %struct.node** %2
%16 = call i32 @list_dispose(%struct.node* %15)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca %struct.node*
%2 = bitcast %struct.node** %1 to i8*
store %struct.node* null, %struct.node** %1
%3 = tail call %struct.node* @node_malloc(i32 1)
%4 = tail call %struct.node* @node_malloc(i32 2)
%5 = tail call %struct.node* @node_malloc(i32 3)
%6 = call i32 @list_add(%struct.node** %1, %struct.node* %3)
%7 = call i32 @list_add(%struct.node** %1, %struct.node* %4)
%8 = call i32 @list_add(%struct.node** %1, %struct.node* %5)
%9 = load %struct.node*, %struct.node** %1
%10 = call i32 @list_dispose(%struct.node* %9)
ret i32 0
}