#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*/ deleteAtBegin(struct Node **);
int /*<<< orphan*/ deleteAtEnd(struct Node **);
int /*<<< orphan*/ insertAtBegin(struct Node **, int);
int /*<<< orphan*/ insertAtEnd(struct Node **, int);
int length(struct Node *);
int /*<<< orphan*/ printList(struct Node *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct Node *head = NULL;
  insertAtBegin(&head, 1);
  insertAtBegin(&head, 0);
  insertAtEnd(&head, 2);
  insertAtEnd(&head, 3);
  insertAtEnd(&head, 4);
  deleteAtBegin(&head);
  deleteAtBegin(&head);
  deleteAtBegin(&head);
  deleteAtEnd(&head);
  printf("Length of the list is %d\n", length(head));
  printList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1080 <insertAtBegin@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1080 <insertAtBegin@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1060 <insertAtEnd@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1060 <insertAtEnd@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1060 <insertAtEnd@plt>
lea    -0x10(%rbp),%rdi
call   1040 <deleteAtBegin@plt>
lea    -0x10(%rbp),%rdi
call   1040 <deleteAtBegin@plt>
lea    -0x10(%rbp),%rdi
call   1040 <deleteAtBegin@plt>
lea    -0x10(%rbp),%rdi
call   1070 <deleteAtEnd@plt>
mov    -0x10(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,%esi
lea    0xe00(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <insertAtBegin@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <insertAtBegin@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <insertAtEnd@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <insertAtEnd@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <insertAtEnd@plt>
mov    %rbx,%rdi
call   1040 <deleteAtBegin@plt>
mov    %rbx,%rdi
call   1040 <deleteAtBegin@plt>
mov    %rbx,%rdi
call   1040 <deleteAtBegin@plt>
mov    %rbx,%rdi
call   1070 <deleteAtEnd@plt>
mov    0x8(%rsp),%rdi
call   1030 <length@plt>
lea    0xe0e(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
call   1090 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
@.str = [26 x i8] c"Length of the list is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Node*
store i32 0, i32* %1
store %struct.Node* null, %struct.Node** %2
%3 = call i32 @insertAtBegin(%struct.Node** %2, i32 1)
%4 = call i32 @insertAtBegin(%struct.Node** %2, i32 0)
%5 = call i32 @insertAtEnd(%struct.Node** %2, i32 2)
%6 = call i32 @insertAtEnd(%struct.Node** %2, i32 3)
%7 = call i32 @insertAtEnd(%struct.Node** %2, i32 4)
%8 = call i32 @deleteAtBegin(%struct.Node** %2)
%9 = call i32 @deleteAtBegin(%struct.Node** %2)
%10 = call i32 @deleteAtBegin(%struct.Node** %2)
%11 = call i32 @deleteAtEnd(%struct.Node** %2)
%12 = load %struct.Node*, %struct.Node** %2
%13 = call i32 @length(%struct.Node* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load %struct.Node*, %struct.Node** %2
%16 = call i32 @printList(%struct.Node* %15)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@.str = [26 x i8] c"Length of the list is %d\0A\00"
define i32 @main() {
%1 = alloca %struct.Node*
%2 = bitcast %struct.Node** %1 to i8*
store %struct.Node* null, %struct.Node** %1
%3 = call i32 @insertAtBegin(%struct.Node** %1, i32 1)
%4 = call i32 @insertAtBegin(%struct.Node** %1, i32 0)
%5 = call i32 @insertAtEnd(%struct.Node** %1, i32 2)
%6 = call i32 @insertAtEnd(%struct.Node** %1, i32 3)
%7 = call i32 @insertAtEnd(%struct.Node** %1, i32 4)
%8 = call i32 @deleteAtBegin(%struct.Node** %1)
%9 = call i32 @deleteAtBegin(%struct.Node** %1)
%10 = call i32 @deleteAtBegin(%struct.Node** %1)
%11 = call i32 @deleteAtEnd(%struct.Node** %1)
%12 = load %struct.Node*, %struct.Node** %1
%13 = call i32 @length(%struct.Node* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load %struct.Node*, %struct.Node** %1
%16 = call i32 @printList(%struct.Node* %15)
ret i32 0
}