#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*/ addNewNode(struct node *, int);
int /*<<< orphan*/ deleteList(struct node *);
int /*<<< orphan*/ deleteNode(struct node *, struct node *);
struct node *initNode(int /*<<< orphan*/);
int /*<<< orphan*/ printList(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ removeDuplicates(struct node *);
int main() {
  struct node *ptr = initNode(0);
  for (int i = 1; i < 10; i++) {
    addNewNode(ptr, 2);
    addNewNode(ptr, i);
  }
  addNewNode(ptr, 3);
  printList(ptr);
  printf("Remove 0 node from linked list:\n");
  deleteNode(ptr, ptr);
  printList(ptr);
  printf("remove duplicates from linked lists:\n");
  removeDuplicates(ptr);
  printList(ptr);
  deleteList(ptr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <initNode@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11c3 <main+0x53>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <addNewNode@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <addNewNode@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <main+0x21>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <addNewNode@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <deleteNode@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
lea    0xe1e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <removeDuplicates@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
mov    -0x10(%rbp),%rdi
call   1070 <deleteList@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <initNode@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <addNewNode@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
lea    0xd7f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1080 <deleteNode@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
lea    0xd80(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <removeDuplicates@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
mov    %rbx,%rdi
call   1070 <deleteList@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [33 x i8] c"Remove 0 node from linked list:\0A\00"
@.str.1 = [38 x i8] c"remove duplicates from linked lists:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca i32
store i32 0, i32* %1
%4 = call %struct.node* @initNode(i32 0)
store %struct.node* %4, %struct.node** %2
store i32 1, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load %struct.node*, %struct.node** %2
%10 = call i32 @addNewNode(%struct.node* %9, i32 2)
%11 = load %struct.node*, %struct.node** %2
%12 = load i32, i32* %3
%13 = call i32 @addNewNode(%struct.node* %11, i32 %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = load %struct.node*, %struct.node** %2
%19 = call i32 @addNewNode(%struct.node* %18, i32 3)
%20 = load %struct.node*, %struct.node** %2
%21 = call i32 @printList(%struct.node* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%23 = load %struct.node*, %struct.node** %2
%24 = load %struct.node*, %struct.node** %2
%25 = call i32 @deleteNode(%struct.node* %23, %struct.node* %24)
%26 = load %struct.node*, %struct.node** %2
%27 = call i32 @printList(%struct.node* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%29 = load %struct.node*, %struct.node** %2
%30 = call i32 @removeDuplicates(%struct.node* %29)
%31 = load %struct.node*, %struct.node** %2
%32 = call i32 @printList(%struct.node* %31)
%33 = load %struct.node*, %struct.node** %2
%34 = call i32 @deleteList(%struct.node* %33)
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
%struct.node = type { i32 }
@str = [32 x i8] c"Remove 0 node from linked list:\00"
@str.2 = [37 x i8] c"remove duplicates from linked lists:\00"
define i32 @main() {
%1 = tail call %struct.node* @initNode(i32 0)
%2 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%3 = tail call i32 @addNewNode(%struct.node* %1, i32 1)
%4 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%5 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%6 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%7 = tail call i32 @addNewNode(%struct.node* %1, i32 3)
%8 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%9 = tail call i32 @addNewNode(%struct.node* %1, i32 4)
%10 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%11 = tail call i32 @addNewNode(%struct.node* %1, i32 5)
%12 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%13 = tail call i32 @addNewNode(%struct.node* %1, i32 6)
%14 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%15 = tail call i32 @addNewNode(%struct.node* %1, i32 7)
%16 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%17 = tail call i32 @addNewNode(%struct.node* %1, i32 8)
%18 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%19 = tail call i32 @addNewNode(%struct.node* %1, i32 9)
%20 = tail call i32 @addNewNode(%struct.node* %1, i32 3)
%21 = tail call i32 @printList(%struct.node* %1)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @deleteNode(%struct.node* %1, %struct.node* %1)
%24 = tail call i32 @printList(%struct.node* %1)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.2, i64 0, i64 0))
%26 = tail call i32 @removeDuplicates(%struct.node* %1)
%27 = tail call i32 @printList(%struct.node* %1)
%28 = tail call i32 @deleteList(%struct.node* %1)
ret i32 0
}