#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*/ additionOfNodeAtBeginning(int);
int /*<<< orphan*/ additionOfNodeAtEnding(int);
int /*<<< orphan*/ additionOfNodeAtRandomeIndex(int, int);
struct node *createNode(int);
int /*<<< orphan*/ deletingFromBeginning();
int /*<<< orphan*/ deletingFromEnding();
int /*<<< orphan*/ deletingFromRandomIndex(int);
int /*<<< orphan*/ display();
int /*<<< orphan*/ displayInReverse();
int /*<<< orphan*/ printf(char *);
int main() {
  struct node *root = NULL;
  root = createNode(4);
  additionOfNodeAtBeginning(6);
  additionOfNodeAtEnding(90);
  printf("After adding 90 at last ,");
  display();
  additionOfNodeAtRandomeIndex(12, 1);
  printf("After adding 12 at index 1 ,");
  display();
  additionOfNodeAtBeginning(1);
  additionOfNodeAtEnding(2);
  additionOfNodeAtBeginning(5);
  additionOfNodeAtEnding(98);
  additionOfNodeAtRandomeIndex(122, 2);
  display();
  deletingFromBeginning();
  printf("After Deletion from beginning, ");
  display();
  deletingFromEnding();
  printf("After deleting from end, ");
  display();
  deletingFromRandomIndex(3);
  printf("After deleting from index 3 ,");
  display();
  displayInReverse();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x4,%edi
call   1060 <createNode@plt>
mov    %rax,-0x8(%rbp)
mov    $0x6,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x5a,%edi
call   1070 <additionOfNodeAtEnding@plt>
lea    0xe27(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0xc,%edi
mov    $0x1,%esi
call   10a0 <additionOfNodeAtRandomeIndex@plt>
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x1,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x2,%edi
call   1070 <additionOfNodeAtEnding@plt>
mov    $0x5,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x62,%edi
call   1070 <additionOfNodeAtEnding@plt>
mov    $0x7a,%edi
mov    $0x2,%esi
call   10a0 <additionOfNodeAtRandomeIndex@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x0,%al
call   10b0 <deletingFromBeginning@plt>
lea    0xde4(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x0,%al
call   1080 <deletingFromEnding@plt>
lea    0xdea(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x3,%edi
call   10c0 <deletingFromRandomIndex@plt>
lea    0xde7(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x0,%al
call   1090 <displayInReverse@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1060 <createNode@plt>
mov    $0x6,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x5a,%edi
call   1070 <additionOfNodeAtEnding@plt>
lea    0xe3a(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <display@plt>
mov    $0xc,%edi
mov    $0x1,%esi
call   10a0 <additionOfNodeAtRandomeIndex@plt>
lea    0xe32(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <display@plt>
mov    $0x1,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x2,%edi
call   1070 <additionOfNodeAtEnding@plt>
mov    $0x5,%edi
call   1040 <additionOfNodeAtBeginning@plt>
mov    $0x62,%edi
call   1070 <additionOfNodeAtEnding@plt>
mov    $0x7a,%edi
mov    $0x2,%esi
call   10a0 <additionOfNodeAtRandomeIndex@plt>
xor    %eax,%eax
call   1030 <display@plt>
xor    %eax,%eax
call   10b0 <deletingFromBeginning@plt>
lea    0xdf7(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <display@plt>
xor    %eax,%eax
call   1080 <deletingFromEnding@plt>
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <display@plt>
mov    $0x3,%edi
call   10c0 <deletingFromRandomIndex@plt>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <display@plt>
xor    %eax,%eax
call   1090 <displayInReverse@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [26 x i8] c"After adding 90 at last ,\00"
@.str.1 = [29 x i8] c"After adding 12 at index 1 ,\00"
@.str.2 = [32 x i8] c"After Deletion from beginning, \00"
@.str.3 = [26 x i8] c"After deleting from end, \00"
@.str.4 = [30 x i8] c"After deleting from index 3 ,\00"
define i32 @main() {
%1 = alloca %struct.node*
store %struct.node* null, %struct.node** %1
%2 = call %struct.node* @createNode(i32 4)
store %struct.node* %2, %struct.node** %1
%3 = call i32 @additionOfNodeAtBeginning(i32 6)
%4 = call i32 @additionOfNodeAtEnding(i32 90)
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @display()
%7 = call i32 @additionOfNodeAtRandomeIndex(i32 12, i32 1)
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (...) @display()
%10 = call i32 @additionOfNodeAtBeginning(i32 1)
%11 = call i32 @additionOfNodeAtEnding(i32 2)
%12 = call i32 @additionOfNodeAtBeginning(i32 5)
%13 = call i32 @additionOfNodeAtEnding(i32 98)
%14 = call i32 @additionOfNodeAtRandomeIndex(i32 122, i32 2)
%15 = call i32 (...) @display()
%16 = call i32 (...) @deletingFromBeginning()
%17 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (...) @display()
%19 = call i32 (...) @deletingFromEnding()
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (...) @display()
%22 = call i32 @deletingFromRandomIndex(i32 3)
%23 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 (...) @display()
%25 = call i32 (...) @displayInReverse()
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [26 x i8] c"After adding 90 at last ,\00"
@.str.1 = [29 x i8] c"After adding 12 at index 1 ,\00"
@.str.2 = [32 x i8] c"After Deletion from beginning, \00"
@.str.3 = [26 x i8] c"After deleting from end, \00"
@.str.4 = [30 x i8] c"After deleting from index 3 ,\00"
define i32 @main() {
%1 = tail call %struct.node* @createNode(i32 4)
%2 = tail call i32 @additionOfNodeAtBeginning(i32 6)
%3 = tail call i32 @additionOfNodeAtEnding(i32 90)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @display()
%6 = tail call i32 @additionOfNodeAtRandomeIndex(i32 12, i32 1)
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @display()
%9 = tail call i32 @additionOfNodeAtBeginning(i32 1)
%10 = tail call i32 @additionOfNodeAtEnding(i32 2)
%11 = tail call i32 @additionOfNodeAtBeginning(i32 5)
%12 = tail call i32 @additionOfNodeAtEnding(i32 98)
%13 = tail call i32 @additionOfNodeAtRandomeIndex(i32 122, i32 2)
%14 = tail call i32 (...) @display()
%15 = tail call i32 (...) @deletingFromBeginning()
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 (...) @display()
%18 = tail call i32 (...) @deletingFromEnding()
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 (...) @display()
%21 = tail call i32 @deletingFromRandomIndex(i32 3)
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 (...) @display()
%24 = tail call i32 (...) @displayInReverse()
ret i32 0
}