#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*/ append(struct node **, int);
int count(struct node *);
int /*<<< orphan*/ delete (struct node **, int);
int /*<<< orphan*/ display(struct node *);
int /*<<< orphan*/ insert_after(struct node *, int, int);
int /*<<< orphan*/ prepend(struct node **, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  struct node *list;
  list = NULL;
  printf("No of elements in linked list = %d\n", count(list));
  append(&list, 14);
  append(&list, 30);
  append(&list, 25);
  append(&list, 42);
  append(&list, 17);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  prepend(&list, 999);
  prepend(&list, 888);
  prepend(&list, 777);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  insert_after(list, 1, 0);
  insert_after(list, 2, 1);
  insert_after(list, 5, 99);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  insert_after(list, 99, 10);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  delete (&list, 99);
  delete (&list, 1);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  delete (&list, 10);
  printf("No of elements in linked list = %d\n", count(list));
  display(list);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xe67(%rip),%rdi
call   1070 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0xe,%esi
call   1040 <append@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1e,%esi
call   1040 <append@plt>
lea    -0x10(%rbp),%rdi
mov    $0x19,%esi
call   1040 <append@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1040 <append@plt>
lea    -0x10(%rbp),%rdi
mov    $0x11,%esi
call   1040 <append@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xe0a(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3e7,%esi
call   1050 <prepend@plt>
lea    -0x10(%rbp),%rdi
mov    $0x378,%esi
call   1050 <prepend@plt>
lea    -0x10(%rbp),%rdi
mov    $0x309,%esi
call   1050 <prepend@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xdc0(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1090 <insert_after@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1090 <insert_after@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x63,%edx
call   1090 <insert_after@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xd6a(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
mov    -0x10(%rbp),%rdi
mov    $0x63,%esi
mov    $0xa,%edx
call   1090 <insert_after@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xd37(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
lea    -0x10(%rbp),%rdi
mov    $0x63,%esi
call   1080 <delete@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1080 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xcfb(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
lea    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1080 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xccd(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <display@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
xor    %edi,%edi
call   1030 <count@plt>
lea    0xe76(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xe,%esi
call   1040 <append@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1040 <append@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1040 <append@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1040 <append@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1040 <append@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
mov    %rbx,%rdi
mov    $0x3e7,%esi
call   1050 <prepend@plt>
mov    %rbx,%rdi
mov    $0x378,%esi
call   1050 <prepend@plt>
mov    %rbx,%rdi
mov    $0x309,%esi
call   1050 <prepend@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
mov    (%rsp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1090 <insert_after@plt>
mov    (%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1090 <insert_after@plt>
mov    (%rsp),%rdi
mov    $0x5,%esi
mov    $0x63,%edx
call   1090 <insert_after@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
mov    (%rsp),%rdi
mov    $0x63,%esi
mov    $0xa,%edx
call   1090 <insert_after@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
call   1080 <delete@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <delete@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <delete@plt>
mov    (%rsp),%rdi
call   1030 <count@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    (%rsp),%rdi
call   1060 <display@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [36 x i8] c"No of elements in linked list = %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 = load %struct.node*, %struct.node** %2
%4 = call i32 @count(%struct.node* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @append(%struct.node** %2, i32 14)
%7 = call i32 @append(%struct.node** %2, i32 30)
%8 = call i32 @append(%struct.node** %2, i32 25)
%9 = call i32 @append(%struct.node** %2, i32 42)
%10 = call i32 @append(%struct.node** %2, i32 17)
%11 = load %struct.node*, %struct.node** %2
%12 = call i32 @count(%struct.node* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load %struct.node*, %struct.node** %2
%15 = call i32 @display(%struct.node* %14)
%16 = call i32 @prepend(%struct.node** %2, i32 999)
%17 = call i32 @prepend(%struct.node** %2, i32 888)
%18 = call i32 @prepend(%struct.node** %2, i32 777)
%19 = load %struct.node*, %struct.node** %2
%20 = call i32 @count(%struct.node* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load %struct.node*, %struct.node** %2
%23 = call i32 @display(%struct.node* %22)
%24 = load %struct.node*, %struct.node** %2
%25 = call i32 @insert_after(%struct.node* %24, i32 1, i32 0)
%26 = load %struct.node*, %struct.node** %2
%27 = call i32 @insert_after(%struct.node* %26, i32 2, i32 1)
%28 = load %struct.node*, %struct.node** %2
%29 = call i32 @insert_after(%struct.node* %28, i32 5, i32 99)
%30 = load %struct.node*, %struct.node** %2
%31 = call i32 @count(%struct.node* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load %struct.node*, %struct.node** %2
%34 = call i32 @display(%struct.node* %33)
%35 = load %struct.node*, %struct.node** %2
%36 = call i32 @insert_after(%struct.node* %35, i32 99, i32 10)
%37 = load %struct.node*, %struct.node** %2
%38 = call i32 @count(%struct.node* %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = load %struct.node*, %struct.node** %2
%41 = call i32 @display(%struct.node* %40)
%42 = call i32 @delete(%struct.node** %2, i32 99)
%43 = call i32 @delete(%struct.node** %2, i32 1)
%44 = load %struct.node*, %struct.node** %2
%45 = call i32 @count(%struct.node* %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = load %struct.node*, %struct.node** %2
%48 = call i32 @display(%struct.node* %47)
%49 = call i32 @delete(%struct.node** %2, i32 10)
%50 = load %struct.node*, %struct.node** %2
%51 = call i32 @count(%struct.node* %50)
%52 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = load %struct.node*, %struct.node** %2
%54 = call i32 @display(%struct.node* %53)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [36 x i8] c"No of elements in linked list = %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 = tail call i32 @count(%struct.node* null)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @append(%struct.node** %1, i32 14)
%6 = call i32 @append(%struct.node** %1, i32 30)
%7 = call i32 @append(%struct.node** %1, i32 25)
%8 = call i32 @append(%struct.node** %1, i32 42)
%9 = call i32 @append(%struct.node** %1, i32 17)
%10 = load %struct.node*, %struct.node** %1
%11 = call i32 @count(%struct.node* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load %struct.node*, %struct.node** %1
%14 = call i32 @display(%struct.node* %13)
%15 = call i32 @prepend(%struct.node** %1, i32 999)
%16 = call i32 @prepend(%struct.node** %1, i32 888)
%17 = call i32 @prepend(%struct.node** %1, i32 777)
%18 = load %struct.node*, %struct.node** %1
%19 = call i32 @count(%struct.node* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load %struct.node*, %struct.node** %1
%22 = call i32 @display(%struct.node* %21)
%23 = load %struct.node*, %struct.node** %1
%24 = call i32 @insert_after(%struct.node* %23, i32 1, i32 0)
%25 = load %struct.node*, %struct.node** %1
%26 = call i32 @insert_after(%struct.node* %25, i32 2, i32 1)
%27 = load %struct.node*, %struct.node** %1
%28 = call i32 @insert_after(%struct.node* %27, i32 5, i32 99)
%29 = load %struct.node*, %struct.node** %1
%30 = call i32 @count(%struct.node* %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load %struct.node*, %struct.node** %1
%33 = call i32 @display(%struct.node* %32)
%34 = load %struct.node*, %struct.node** %1
%35 = call i32 @insert_after(%struct.node* %34, i32 99, i32 10)
%36 = load %struct.node*, %struct.node** %1
%37 = call i32 @count(%struct.node* %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = load %struct.node*, %struct.node** %1
%40 = call i32 @display(%struct.node* %39)
%41 = call i32 @delete(%struct.node** %1, i32 99)
%42 = call i32 @delete(%struct.node** %1, i32 1)
%43 = load %struct.node*, %struct.node** %1
%44 = call i32 @count(%struct.node* %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = load %struct.node*, %struct.node** %1
%47 = call i32 @display(%struct.node* %46)
%48 = call i32 @delete(%struct.node** %1, i32 10)
%49 = load %struct.node*, %struct.node** %1
%50 = call i32 @count(%struct.node* %49)
%51 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = load %struct.node*, %struct.node** %1
%53 = call i32 @display(%struct.node* %52)
ret i32 0
}