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

LLVM IR (-O0):
%struct.Node = type { i32 }
@.str = [14 x i8] c"Length 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 5, i32 1)
%4 = call i32 @insert(%struct.Node** %2, i32 2, i32 1)
%5 = call i32 @insert(%struct.Node** %2, i32 1, i32 1)
%6 = call i32 @insert(%struct.Node** %2, i32 3, i32 3)
%7 = call i32 @insert(%struct.Node** %2, i32 4, i32 4)
%8 = call i32 @insert(%struct.Node** %2, i32 6, i32 6)
%9 = call i32 @insert(%struct.Node** %2, i32 0, i32 1)
%10 = call i32 @insert(%struct.Node** %2, i32 7, i32 8)
%11 = call i32 @delete(%struct.Node** %2, i32 1)
%12 = call i32 @delete(%struct.Node** %2, i32 7)
%13 = call i32 @delete(%struct.Node** %2, i32 3)
%14 = call i32 @delete(%struct.Node** %2, i32 6)
%15 = call i32 @deleteList(%struct.Node** %2)
%16 = load %struct.Node*, %struct.Node** %2
%17 = call i32 @length(%struct.Node* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load %struct.Node*, %struct.Node** %2
%20 = call i32 @printList(%struct.Node* %19)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@.str = [14 x i8] c"Length 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 5, i32 1)
%4 = call i32 @insert(%struct.Node** %1, i32 2, i32 1)
%5 = call i32 @insert(%struct.Node** %1, i32 1, i32 1)
%6 = call i32 @insert(%struct.Node** %1, i32 3, i32 3)
%7 = call i32 @insert(%struct.Node** %1, i32 4, i32 4)
%8 = call i32 @insert(%struct.Node** %1, i32 6, i32 6)
%9 = call i32 @insert(%struct.Node** %1, i32 0, i32 1)
%10 = call i32 @insert(%struct.Node** %1, i32 7, i32 8)
%11 = call i32 @delete(%struct.Node** %1, i32 1)
%12 = call i32 @delete(%struct.Node** %1, i32 7)
%13 = call i32 @delete(%struct.Node** %1, i32 3)
%14 = call i32 @delete(%struct.Node** %1, i32 6)
%15 = call i32 @deleteList(%struct.Node** %1)
%16 = load %struct.Node*, %struct.Node** %1
%17 = call i32 @length(%struct.Node* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load %struct.Node*, %struct.Node** %1
%20 = call i32 @printList(%struct.Node* %19)
ret i32 0
}