#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 */
struct node *InsertAtEnd(struct node *, int);
struct node *InsertAtN(struct node *, int, int);
struct node *InsertInFront(struct node *, int);
int /*<<< orphan*/ PrintList(struct node *);
void test3() {
  struct node *head = NULL;
  head = InsertInFront(head, 2);
  head = InsertInFront(head, 4);
  head = InsertInFront(head, 6);
  PrintList(head);
  head = NULL;
  head = InsertAtEnd(head, 2);
  head = InsertAtEnd(head, 4);
  head = InsertAtEnd(head, 6);
  PrintList(head);
  head = NULL;
  head = InsertAtN(head, 2, 5);
  head = InsertAtN(head, 3, 0);
  head = InsertAtN(head, 4, 2);
  head = InsertAtN(head, 5, 1);
  head = InsertAtN(head, 6, 1);
  head = InsertAtN(head, 7, 3);
  head = InsertAtN(head, 8, 0);
  PrintList(head);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <InsertInFront@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1060 <InsertInFront@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1060 <InsertInFront@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <PrintList@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <PrintList@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
mov    $0x5,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1040 <InsertAtN@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <PrintList@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rax
xor    %edi,%edi
mov    $0x2,%esi
call   1060 <InsertInFront@plt>
mov    %rax,%rdi
mov    $0x4,%esi
call   1060 <InsertInFront@plt>
mov    %rax,%rdi
mov    $0x6,%esi
call   1060 <InsertInFront@plt>
mov    %rax,%rdi
call   1030 <PrintList@plt>
xor    %edi,%edi
mov    $0x2,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,%rdi
mov    $0x4,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,%rdi
mov    $0x6,%esi
call   1050 <InsertAtEnd@plt>
mov    %rax,%rdi
call   1030 <PrintList@plt>
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1040 <InsertAtN@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <PrintList@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define void @test3() {
%1 = alloca %struct.node*
store %struct.node* null, %struct.node** %1
%2 = load %struct.node*, %struct.node** %1
%3 = call %struct.node* @InsertInFront(%struct.node* %2, i32 2)
store %struct.node* %3, %struct.node** %1
%4 = load %struct.node*, %struct.node** %1
%5 = call %struct.node* @InsertInFront(%struct.node* %4, i32 4)
store %struct.node* %5, %struct.node** %1
%6 = load %struct.node*, %struct.node** %1
%7 = call %struct.node* @InsertInFront(%struct.node* %6, i32 6)
store %struct.node* %7, %struct.node** %1
%8 = load %struct.node*, %struct.node** %1
%9 = call i32 @PrintList(%struct.node* %8)
store %struct.node* null, %struct.node** %1
%10 = load %struct.node*, %struct.node** %1
%11 = call %struct.node* @InsertAtEnd(%struct.node* %10, i32 2)
store %struct.node* %11, %struct.node** %1
%12 = load %struct.node*, %struct.node** %1
%13 = call %struct.node* @InsertAtEnd(%struct.node* %12, i32 4)
store %struct.node* %13, %struct.node** %1
%14 = load %struct.node*, %struct.node** %1
%15 = call %struct.node* @InsertAtEnd(%struct.node* %14, i32 6)
store %struct.node* %15, %struct.node** %1
%16 = load %struct.node*, %struct.node** %1
%17 = call i32 @PrintList(%struct.node* %16)
store %struct.node* null, %struct.node** %1
%18 = load %struct.node*, %struct.node** %1
%19 = call %struct.node* @InsertAtN(%struct.node* %18, i32 2, i32 5)
store %struct.node* %19, %struct.node** %1
%20 = load %struct.node*, %struct.node** %1
%21 = call %struct.node* @InsertAtN(%struct.node* %20, i32 3, i32 0)
store %struct.node* %21, %struct.node** %1
%22 = load %struct.node*, %struct.node** %1
%23 = call %struct.node* @InsertAtN(%struct.node* %22, i32 4, i32 2)
store %struct.node* %23, %struct.node** %1
%24 = load %struct.node*, %struct.node** %1
%25 = call %struct.node* @InsertAtN(%struct.node* %24, i32 5, i32 1)
store %struct.node* %25, %struct.node** %1
%26 = load %struct.node*, %struct.node** %1
%27 = call %struct.node* @InsertAtN(%struct.node* %26, i32 6, i32 1)
store %struct.node* %27, %struct.node** %1
%28 = load %struct.node*, %struct.node** %1
%29 = call %struct.node* @InsertAtN(%struct.node* %28, i32 7, i32 3)
store %struct.node* %29, %struct.node** %1
%30 = load %struct.node*, %struct.node** %1
%31 = call %struct.node* @InsertAtN(%struct.node* %30, i32 8, i32 0)
store %struct.node* %31, %struct.node** %1
%32 = load %struct.node*, %struct.node** %1
%33 = call i32 @PrintList(%struct.node* %32)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @test3() {
%1 = tail call %struct.node* @InsertInFront(%struct.node* null, i32 2)
%2 = tail call %struct.node* @InsertInFront(%struct.node* %1, i32 4)
%3 = tail call %struct.node* @InsertInFront(%struct.node* %2, i32 6)
%4 = tail call i32 @PrintList(%struct.node* %3)
%5 = tail call %struct.node* @InsertAtEnd(%struct.node* null, i32 2)
%6 = tail call %struct.node* @InsertAtEnd(%struct.node* %5, i32 4)
%7 = tail call %struct.node* @InsertAtEnd(%struct.node* %6, i32 6)
%8 = tail call i32 @PrintList(%struct.node* %7)
%9 = tail call %struct.node* @InsertAtN(%struct.node* null, i32 2, i32 5)
%10 = tail call %struct.node* @InsertAtN(%struct.node* %9, i32 3, i32 0)
%11 = tail call %struct.node* @InsertAtN(%struct.node* %10, i32 4, i32 2)
%12 = tail call %struct.node* @InsertAtN(%struct.node* %11, i32 5, i32 1)
%13 = tail call %struct.node* @InsertAtN(%struct.node* %12, i32 6, i32 1)
%14 = tail call %struct.node* @InsertAtN(%struct.node* %13, i32 7, i32 3)
%15 = tail call %struct.node* @InsertAtN(%struct.node* %14, i32 8, i32 0)
%16 = tail call i32 @PrintList(%struct.node* %15)
ret void
}