#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*/ delete (struct Node **, int);
int /*<<< orphan*/ deleteList(struct Node **);
int /*<<< orphan*/ insert(struct Node **, int, int);
int length(struct Node *);
int /*<<< orphan*/ print(struct Node *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct Node *head = NULL;
  insert(&head, 1, 1);
  insert(&head, 2, 1);
  insert(&head, 3, 1);
  insert(&head, 4, 2);
  insert(&head, 5, 2);
  insert(&head, 6, 6);
  delete (&head, 1);
  delete (&head, 3);
  delete (&head, 4);
  delete (&head, 6);
  print(head);
  printf("Length of the list is %d\n", length(head));
  deleteList(&head);
  print(head);
  printf("Length of the list is %d\n", length(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,%edx
mov    %edx,%esi
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x6,%edx
mov    %edx,%esi
call   1070 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1080 <delete@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1080 <delete@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1080 <delete@plt>
lea    -0x10(%rbp),%rdi
mov    $0x6,%esi
call   1080 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1050 <print@plt>
mov    -0x10(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,%esi
lea    0xdca(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1060 <deleteList@plt>
mov    -0x10(%rbp),%rdi
call   1050 <print@plt>
mov    -0x10(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,%esi
lea    0xda1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
call   1070 <insert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <delete@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <delete@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <delete@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1080 <delete@plt>
mov    (%rsp),%rdi
call   1050 <print@plt>
mov    (%rsp),%rdi
call   1030 <length@plt>
lea    0xdd8(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <deleteList@plt>
mov    (%rsp),%rdi
call   1050 <print@plt>
mov    (%rsp),%rdi
call   1030 <length@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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 @insert(%struct.Node** %2, i32 1, i32 1)
%4 = call i32 @insert(%struct.Node** %2, i32 2, i32 1)
%5 = call i32 @insert(%struct.Node** %2, i32 3, i32 1)
%6 = call i32 @insert(%struct.Node** %2, i32 4, i32 2)
%7 = call i32 @insert(%struct.Node** %2, i32 5, i32 2)
%8 = call i32 @insert(%struct.Node** %2, i32 6, i32 6)
%9 = call i32 @delete(%struct.Node** %2, i32 1)
%10 = call i32 @delete(%struct.Node** %2, i32 3)
%11 = call i32 @delete(%struct.Node** %2, i32 4)
%12 = call i32 @delete(%struct.Node** %2, i32 6)
%13 = load %struct.Node*, %struct.Node** %2
%14 = call i32 @print(%struct.Node* %13)
%15 = load %struct.Node*, %struct.Node** %2
%16 = call i32 @length(%struct.Node* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @deleteList(%struct.Node** %2)
%19 = load %struct.Node*, %struct.Node** %2
%20 = call i32 @print(%struct.Node* %19)
%21 = load %struct.Node*, %struct.Node** %2
%22 = call i32 @length(%struct.Node* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %22)
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 @insert(%struct.Node** %1, i32 1, i32 1)
%4 = call i32 @insert(%struct.Node** %1, i32 2, i32 1)
%5 = call i32 @insert(%struct.Node** %1, i32 3, i32 1)
%6 = call i32 @insert(%struct.Node** %1, i32 4, i32 2)
%7 = call i32 @insert(%struct.Node** %1, i32 5, i32 2)
%8 = call i32 @insert(%struct.Node** %1, i32 6, i32 6)
%9 = call i32 @delete(%struct.Node** %1, i32 1)
%10 = call i32 @delete(%struct.Node** %1, i32 3)
%11 = call i32 @delete(%struct.Node** %1, i32 4)
%12 = call i32 @delete(%struct.Node** %1, i32 6)
%13 = load %struct.Node*, %struct.Node** %1
%14 = call i32 @print(%struct.Node* %13)
%15 = load %struct.Node*, %struct.Node** %1
%16 = call i32 @length(%struct.Node* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @deleteList(%struct.Node** %1)
%19 = load %struct.Node*, %struct.Node** %1
%20 = call i32 @print(%struct.Node* %19)
%21 = load %struct.Node*, %struct.Node** %1
%22 = call i32 @length(%struct.Node* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}