#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 *createNode(int);
int /*<<< orphan*/ deleteNodeAt(int, struct Node *);
int /*<<< orphan*/ deleteNodeAtTheEnd(struct Node *);
struct Node *deleteNodeAtTheHead(struct Node *);
int /*<<< orphan*/ free(struct Node *);
int /*<<< orphan*/ iterateThroughLinkedList(struct Node *);
struct Node *pushNodeAt(int, struct Node *, int);
struct Node *pushNodeAtTheEnd(struct Node *, int);
struct Node *pushNodeAtTheHead(struct Node *, int);
int main() {
  struct Node *head = createNode(1);
  struct Node *n1 = pushNodeAtTheEnd(head, 20);
  iterateThroughLinkedList(head);
  struct Node *n2 = pushNodeAtTheEnd(head, 32);
  iterateThroughLinkedList(head);
  head = pushNodeAtTheHead(head, 34);
  iterateThroughLinkedList(head);
  deleteNodeAtTheEnd(head);
  iterateThroughLinkedList(head);
  struct Node *n3 = pushNodeAtTheEnd(head, 312);
  iterateThroughLinkedList(head);
  head = deleteNodeAtTheHead(head);
  iterateThroughLinkedList(head);
  struct Node *n4 = pushNodeAt(2, head, 100);
  iterateThroughLinkedList(head);
  deleteNodeAt(2, head);
  iterateThroughLinkedList(head);
  free(head);
  free(n1);
  free(n2);
  free(n3);
  free(n4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x1,%edi
call   1040 <createNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x14,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
mov    $0x22,%esi
call   10b0 <pushNodeAtTheHead@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1060 <deleteNodeAtTheEnd@plt>
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
mov    $0x138,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1080 <deleteNodeAtTheHead@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rsi
mov    $0x2,%edi
mov    $0x64,%edx
call   1090 <pushNodeAt@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rsi
mov    $0x2,%edi
call   1070 <deleteNodeAt@plt>
mov    -0x8(%rbp),%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x1,%edi
call   1040 <createNode@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x14,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
mov    $0x22,%esi
call   10b0 <pushNodeAtTheHead@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
call   1060 <deleteNodeAtTheEnd@plt>
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
mov    $0x138,%esi
call   10a0 <pushNodeAtTheEnd@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
call   1080 <deleteNodeAtTheHead@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1090 <pushNodeAt@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1070 <deleteNodeAt@plt>
mov    %rbx,%rdi
call   1050 <iterateThroughLinkedList@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca %struct.Node*
%2 = alloca %struct.Node*
%3 = alloca %struct.Node*
%4 = alloca %struct.Node*
%5 = alloca %struct.Node*
%6 = call %struct.Node* @createNode(i32 1)
store %struct.Node* %6, %struct.Node** %1
%7 = load %struct.Node*, %struct.Node** %1
%8 = call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %7, i32 20)
store %struct.Node* %8, %struct.Node** %2
%9 = load %struct.Node*, %struct.Node** %1
%10 = call i32 @iterateThroughLinkedList(%struct.Node* %9)
%11 = load %struct.Node*, %struct.Node** %1
%12 = call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %11, i32 32)
store %struct.Node* %12, %struct.Node** %3
%13 = load %struct.Node*, %struct.Node** %1
%14 = call i32 @iterateThroughLinkedList(%struct.Node* %13)
%15 = load %struct.Node*, %struct.Node** %1
%16 = call %struct.Node* @pushNodeAtTheHead(%struct.Node* %15, i32 34)
store %struct.Node* %16, %struct.Node** %1
%17 = load %struct.Node*, %struct.Node** %1
%18 = call i32 @iterateThroughLinkedList(%struct.Node* %17)
%19 = load %struct.Node*, %struct.Node** %1
%20 = call i32 @deleteNodeAtTheEnd(%struct.Node* %19)
%21 = load %struct.Node*, %struct.Node** %1
%22 = call i32 @iterateThroughLinkedList(%struct.Node* %21)
%23 = load %struct.Node*, %struct.Node** %1
%24 = call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %23, i32 312)
store %struct.Node* %24, %struct.Node** %4
%25 = load %struct.Node*, %struct.Node** %1
%26 = call i32 @iterateThroughLinkedList(%struct.Node* %25)
%27 = load %struct.Node*, %struct.Node** %1
%28 = call %struct.Node* @deleteNodeAtTheHead(%struct.Node* %27)
store %struct.Node* %28, %struct.Node** %1
%29 = load %struct.Node*, %struct.Node** %1
%30 = call i32 @iterateThroughLinkedList(%struct.Node* %29)
%31 = load %struct.Node*, %struct.Node** %1
%32 = call %struct.Node* @pushNodeAt(i32 2, %struct.Node* %31, i32 100)
store %struct.Node* %32, %struct.Node** %5
%33 = load %struct.Node*, %struct.Node** %1
%34 = call i32 @iterateThroughLinkedList(%struct.Node* %33)
%35 = load %struct.Node*, %struct.Node** %1
%36 = call i32 @deleteNodeAt(i32 2, %struct.Node* %35)
%37 = load %struct.Node*, %struct.Node** %1
%38 = call i32 @iterateThroughLinkedList(%struct.Node* %37)
%39 = load %struct.Node*, %struct.Node** %1
%40 = call i32 @free(%struct.Node* %39)
%41 = load %struct.Node*, %struct.Node** %2
%42 = call i32 @free(%struct.Node* %41)
%43 = load %struct.Node*, %struct.Node** %3
%44 = call i32 @free(%struct.Node* %43)
%45 = load %struct.Node*, %struct.Node** %4
%46 = call i32 @free(%struct.Node* %45)
%47 = load %struct.Node*, %struct.Node** %5
%48 = call i32 @free(%struct.Node* %47)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define i32 @main() {
%1 = tail call %struct.Node* @createNode(i32 1)
%2 = tail call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %1, i32 20)
%3 = tail call i32 @iterateThroughLinkedList(%struct.Node* %1)
%4 = tail call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %1, i32 32)
%5 = tail call i32 @iterateThroughLinkedList(%struct.Node* %1)
%6 = tail call %struct.Node* @pushNodeAtTheHead(%struct.Node* %1, i32 34)
%7 = tail call i32 @iterateThroughLinkedList(%struct.Node* %6)
%8 = tail call i32 @deleteNodeAtTheEnd(%struct.Node* %6)
%9 = tail call i32 @iterateThroughLinkedList(%struct.Node* %6)
%10 = tail call %struct.Node* @pushNodeAtTheEnd(%struct.Node* %6, i32 312)
%11 = tail call i32 @iterateThroughLinkedList(%struct.Node* %6)
%12 = tail call %struct.Node* @deleteNodeAtTheHead(%struct.Node* %6)
%13 = tail call i32 @iterateThroughLinkedList(%struct.Node* %12)
%14 = tail call %struct.Node* @pushNodeAt(i32 2, %struct.Node* %12, i32 100)
%15 = tail call i32 @iterateThroughLinkedList(%struct.Node* %12)
%16 = tail call i32 @deleteNodeAt(i32 2, %struct.Node* %12)
%17 = tail call i32 @iterateThroughLinkedList(%struct.Node* %12)
%18 = tail call i32 @free(%struct.Node* %12)
%19 = tail call i32 @free(%struct.Node* %2)
%20 = tail call i32 @free(%struct.Node* %4)
%21 = tail call i32 @free(%struct.Node* %10)
%22 = tail call i32 @free(%struct.Node* %14)
ret i32 0
}