#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 listNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ deleteNodeFromDLLinkedList(struct listNode **, int);
int doublyListLength(struct listNode *);
int /*<<< orphan*/ insertInLinkedList(struct listNode **, int, int);
int /*<<< orphan*/ printDLList(struct listNode *);
int /*<<< orphan*/ printf(char *, int);
int DoublyLinkedList_test() {
  struct listNode *head;
  printf("Elements in list are :%d\n", doublyListLength(head));
  printDLList(head);
  insertInLinkedList(&head, 2, 3);
  insertInLinkedList(&head, 5, 3);
  insertInLinkedList(&head, 9, 1);
  insertInLinkedList(&head, 10, 3);
  printf("Elements in list are :%d\n", doublyListLength(head));
  printDLList(head);
  deleteNodeFromDLLinkedList(&head, 3);
  printDLList(head);
  return 0;
}


x86 assembly (clang, -O0):
<DoublyLinkedList_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rdi
call   1070 <doublyListLength@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <printDLList@plt>
lea    -0x8(%rbp),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
lea    -0x8(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
lea    -0x8(%rbp),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   1040 <insertInLinkedList@plt>
lea    -0x8(%rbp),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1070 <doublyListLength@plt>
mov    %eax,%esi
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <printDLList@plt>
lea    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1050 <deleteNodeFromDLLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1060 <printDLList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoublyLinkedList_test>:
push   %r14
push   %rbx
push   %rax
call   1070 <doublyListLength@plt>
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
call   1060 <printDLList@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   1040 <insertInLinkedList@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x3,%edx
call   1040 <insertInLinkedList@plt>
mov    (%rsp),%rdi
call   1070 <doublyListLength@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%rsp),%rdi
call   1060 <printDLList@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <deleteNodeFromDLLinkedList@plt>
mov    (%rsp),%rdi
call   1060 <printDLList@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.listNode = type { i32 }
@.str = [26 x i8] c"Elements in list are :%d\0A\00"
define i32 @DoublyLinkedList_test() {
%1 = alloca %struct.listNode*
%2 = load %struct.listNode*, %struct.listNode** %1
%3 = call i32 @doublyListLength(%struct.listNode* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load %struct.listNode*, %struct.listNode** %1
%6 = call i32 @printDLList(%struct.listNode* %5)
%7 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 2, i32 3)
%8 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 5, i32 3)
%9 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 9, i32 1)
%10 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 10, i32 3)
%11 = load %struct.listNode*, %struct.listNode** %1
%12 = call i32 @doublyListLength(%struct.listNode* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load %struct.listNode*, %struct.listNode** %1
%15 = call i32 @printDLList(%struct.listNode* %14)
%16 = call i32 @deleteNodeFromDLLinkedList(%struct.listNode** %1, i32 3)
%17 = load %struct.listNode*, %struct.listNode** %1
%18 = call i32 @printDLList(%struct.listNode* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.listNode = type { i32 }
@.str = [26 x i8] c"Elements in list are :%d\0A\00"
define i32 @DoublyLinkedList_test() {
%1 = alloca %struct.listNode*
%2 = bitcast %struct.listNode** %1 to i8*
%3 = tail call i32 @doublyListLength(%struct.listNode* undef)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @printDLList(%struct.listNode* undef)
%6 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 2, i32 3)
%7 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 5, i32 3)
%8 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 9, i32 1)
%9 = call i32 @insertInLinkedList(%struct.listNode** %1, i32 10, i32 3)
%10 = load %struct.listNode*, %struct.listNode** %1
%11 = call i32 @doublyListLength(%struct.listNode* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load %struct.listNode*, %struct.listNode** %1
%14 = call i32 @printDLList(%struct.listNode* %13)
%15 = call i32 @deleteNodeFromDLLinkedList(%struct.listNode** %1, i32 3)
%16 = load %struct.listNode*, %struct.listNode** %1
%17 = call i32 @printDLList(%struct.listNode* %16)
ret i32 0
}